Beispiel #1
0
  /**
   * Create a set of UPS coordinates for the given <code>Globe</code>.
   *
   * @param hemisphere the hemisphere, either {@link gov.nasa.worldwind.avlist.AVKey#NORTH} or
   *     {@link gov.nasa.worldwind.avlist.AVKey#SOUTH}.
   * @param easting the easting distance in meters
   * @param northing the northing distance in meters.
   * @param globe the <code>Globe</code> - can be null (will use WGS84).
   * @return the corresponding <code>UPSCoord</code>.
   * @throws IllegalArgumentException if the conversion to UPS coordinates fails.
   */
  public static UPSCoord fromUPS(String hemisphere, double easting, double northing, Globe globe) {
    final UPSCoordConverter converter = new UPSCoordConverter(globe);
    long err = converter.convertUPSToGeodetic(hemisphere, easting, northing);

    if (err != UTMCoordConverter.UTM_NO_ERROR) {
      String message = Logging.getMessage("Coord.UTMConversionError");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    return new UPSCoord(
        Angle.fromRadians(converter.getLatitude()),
        Angle.fromRadians(converter.getLongitude()),
        hemisphere,
        easting,
        northing);
  }