Esempio n. 1
0
  /**
   * Constructs an instance of a UTM coordinate transform with the supplied Ellipsoid, zone and
   * hemisphere. The ellipsoid should be the one used as a basis for the UTM coordinates. The zone
   * is the UTM zone which has positions to be converted; hemiflag is a boolean, true if points are
   * northern hemisphere. You can convert points from more than one zone and hemisphere by using the
   * method ConvertUtmToLatLon.
   *
   * <p>The reference coordinate system is RealTupleType.LatitudeLongitudeTuple; the incoming units
   * are assumed to be UTM coords based on the input ellipsoid.
   *
   * <p>Most USGS topographic maps use the 1927 North American Datum (NAD 27); new maps are being
   * slowly revised to NAD 83. To construct Ellipsoids for the first argument, import
   * geotransform.jar, and do new CC_Ellipsoid() for NAD 27 (Clark 1866 ellipsoid), or new
   * RF_Ellipsoid() for NAD 83 (GRS 80 ellipsoid), or new WE_Ellipsoid() for WSG 84. See
   * http://www.ai.sri.com/geotransform/api.html for more details about 239 supported datums.
   *
   * @param ellipsoid the basis for some UTM coordinate system; many choices possible
   * @param zone the UTM zone which has positions to be converted
   * @param bounds Linear2DSet describing the bounds of this MapProjection
   * @param hemiflag a boolean, true if points are in the northern hemisphere
   * @throws VisADException
   */
  public UTMCoordinateSystem(Ellipsoid ellipsoid, int zone, boolean hemiflag, Rectangle2D bounds)
      throws VisADException {

    super(RealTupleType.LatitudeLongitudeTuple, new Unit[] {CommonUnit.meter, CommonUnit.meter});

    if (ellipsoid == null) {
      throw new NullPointerException();
    }

    if ((zone < 1) || (zone > 60)) {
      throw new IllegalArgumentException("UTM zone number not in range 1-60");
    }

    if (bounds != null) {
      startX = bounds.getX();
      startY = bounds.getY();
      width = bounds.getWidth();
      height = bounds.getHeight();
    }

    this.ellipsoid = ellipsoid;
    this.onezone = zone;
    this.onehemiflag = hemiflag;

    // initialize the converters
    Utm_To_Gdc_Converter.Init(ellipsoid);
    Gdc_To_Utm_Converter.Init(ellipsoid);
  }