Package com.luciad.view.map
Class TLcdUPSUtil
java.lang.Object
com.luciad.view.map.TLcdUPSUtil
A utility class that can be used to format and parse lon lat points to/from a UPS string.
An example of a UPS string is "Z 2181646 1704304"
. This String has the following
components :
- The UPS zone. In the example string this is
"Z"
. - The easting, in meters.
- The northing, in meters.
Note : The UPS strings formatted and parsed by this class are no UPS Mgrs
Strings. To format or parse UPS Mgrs strings, see TLcdUpsMgrsUtil
.
- Since:
- 2012.1
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdUPSUtil
instance that uses the WGS_84 ellipsoid for its calculations.TLcdUPSUtil
(ILcdEllipsoid aEllipsoid) Creates a newTLcdUPSUtil
instance that uses the given ellipsoid for its calculations. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of digits used to format a UPS String.char
Returns the character to separate the zone/grid letters and the coordinates.lonLat2Ups
(ILcdPoint aLonLatPoint) This method converts the given lon lat point to a UPS String.void
setNumberOfDigits
(int aNumberOfDigits) Sets the number of digits used to format a UPS String.void
setUPSCoordinateSeparator
(char aUPSCoordinateSeparator) Set the character to separate the zone/grid letters and the coordinates and between the coordinates.void
ups2LonLat
(String aUpsString, ILcd2DEditablePoint a2DPointSFCT) Finds the geodetic coordinate associated with the given UPS formatted string.upsXY2Ups
(double aEasting, double aNorthing, boolean aNorthPole) Returns the formatted notation for a given coordinate within the Universal Polar Stereographic grid system.
-
Constructor Details
-
TLcdUPSUtil
public TLcdUPSUtil()Creates a newTLcdUPSUtil
instance that uses the WGS_84 ellipsoid for its calculations. -
TLcdUPSUtil
Creates a newTLcdUPSUtil
instance that uses the given ellipsoid for its calculations.- Parameters:
aEllipsoid
- a given ellipsoid.
-
-
Method Details
-
getUPSCoordinateSeparator
public char getUPSCoordinateSeparator()Returns the character to separate the zone/grid letters and the coordinates.- Returns:
- the character to separate the zone/grid letters and the coordinates.
- See Also:
-
setUPSCoordinateSeparator
public void setUPSCoordinateSeparator(char aUPSCoordinateSeparator) Set the character to separate the zone/grid letters and the coordinates and between the coordinates. Set the value 0 (not the character '0') to have no spaces between the zone and the coordinates. By default, the coordinate separator is' '
(a space).- Parameters:
aUPSCoordinateSeparator
- the character to separate the zone/grid letters and the coordinates and between the coordinates.- See Also:
-
getNumberOfDigits
public int getNumberOfDigits()Returns the number of digits used to format a UPS String.- Returns:
- the number of digits used to format a UPS String.
- See Also:
-
setNumberOfDigits
public void setNumberOfDigits(int aNumberOfDigits) Sets the number of digits used to format a UPS String. When the number of digits used is 7, the String has a precision of 1m. When the number of digits used is 6, the precision is 10m, etc...By default, no fixed number of digits is used. E.g.
- When not calling this method, a point will be formatted as
"Z 2181646 1704304"
- When calling this method with a number of digits
7
, the same point will be formatted as"Z 2181646 1704304"
- When calling this method with a number of digits
4
, the same point will be formatted as"Z 2181 1704"
- Parameters:
aNumberOfDigits
- the number of digits used to format a String.
- When not calling this method, a point will be formatted as
-
lonLat2Ups
This method converts the given lon lat point to a UPS String.- Parameters:
aLonLatPoint
- a lon lat point.- Returns:
- an UPS String.
- Throws:
TLcdOutOfBoundsException
- when the given point is outside the UPS bounds.
-
ups2LonLat
Finds the geodetic coordinate associated with the given UPS formatted string.- Parameters:
aUpsString
- a UPS formatted string.a2DPointSFCT
- a geodetic point that will be set to the coordinates of the given String- Throws:
ParseException
- if aUpsString is not a valid UPS String.
-
upsXY2Ups
public String upsXY2Ups(double aEasting, double aNorthing, boolean aNorthPole) throws TLcdOutOfBoundsException Returns the formatted notation for a given coordinate within the Universal Polar Stereographic grid system. A flag indicates whether the coordinate is within the northern or the southern UPS grid system.- Parameters:
aEasting
- the easting of the coordinate.aNorthing
- the northing of the coordinate.aNorthPole
- if true, the coordinate is specified within the northern UPS grid system, and within the southern UPS grid system otherwise.- Returns:
- the formatted notation for a given coordinate within the UPS grid system.
- Throws:
TLcdOutOfBoundsException
- if the coordinate is out of bounds.
-