예제 #1
0
  /**
   * Called when some fundamental parameters change.
   *
   * <p>Each projection will decide how to respond to this change. For instance, they may need to
   * recalculate "constant" parameters used in the forward() and inverse() calls.
   *
   * <p>
   */
  protected void computeParameters() {
    Debug.message("proj", "Gnomonic.computeParameters()");
    super.computeParameters();

    // maxscale = scale at which a world hemisphere fits in the
    // window
    maxscale =
        (width < height)
            ? (float) (planetPixelRadius * 2 * hPrime) / (float) width
            : (float) (planetPixelRadius * 2 * hPrime) / (float) height;
    if (maxscale < minscale) {
      maxscale = minscale;
    }

    if (scale > maxscale) {
      scale = maxscale;
    }

    scaled_radius = planetPixelRadius / scale;

    // width of the world in pixels at current scale. We see only
    // one hemisphere.
    world.x = (int) ((planetPixelRadius * 2 * hPrime) / scale);

    // do some precomputation of stuff
    cosCtrLat = Math.cos(centerY);
    sinCtrLat = Math.sin(centerY);

    // compute the offsets
    hy = height / 2;
    wx = width / 2;
  }
예제 #2
0
  protected void init() {
    super.init();

    // minscale is the minimum scale allowable (before integer
    // wrapping can occur)
    minscale = (float) Math.ceil((2 * hPrime * planetPixelRadius) / (int) Integer.MAX_VALUE);
    if (minscale < 1) minscale = 1;

    // calculate cutoff scale for XWindows workaround
    XSCALE_THRESHOLD = (int) ((planetPixelRadius * 2 * hPrime) / 64000); // fudge
  }