Package org.ka2ddo.yaac.util
Class LatLonFormatter
java.lang.Object
org.ka2ddo.yaac.util.LatLonFormatter
Provide a formatter for a latitude or longitude value in degrees/minutes/fractional minutes
and direction (or some other format style for GUI display).
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Define the supported different formats for latitude and longitude display. -
Field Summary
-
Constructor Summary
ConstructorDescriptionLatLonFormatter
(boolean isLat, boolean forDisplay) Create a LatLonFormatter.LatLonFormatter
(boolean isLat, boolean forDisplay, LatLonFormatter.Format latLonFormat) Create a LatLonFormatter. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Register a PropertyChangeListener to be informed of changes to the global format value.format
(double value) Format the specified latitude or longitude value into a String.static String
format
(double latValue, double lonValue) Format the specified latitude and longitude pair according to the current global format.static LatLonFormatter.Format
Get the current default format to use for formatting latitudes and longitudes.static void
Unregister a PropertyChangeListener so it will no longer be informed of changes to the global format value.static void
setGlobalLatLonFormat
(LatLonFormatter.Format globalLatLonFormat) Set the default format to use for formatting latitudes and longitudes.
-
Field Details
-
LAT
-
LON
-
-
Constructor Details
-
LatLonFormatter
public LatLonFormatter(boolean isLat, boolean forDisplay) Create a LatLonFormatter.- Parameters:
isLat
- boolean true if for formatting latitudes, false for formatting longitudes.forDisplay
- boolean true if for formatting human-readable displays, false for formatting for machine-to-machine transfers
-
LatLonFormatter
Create a LatLonFormatter.- Parameters:
isLat
- boolean true if for formatting latitudes, false for formatting longitudes.forDisplay
- boolean true if for formatting human-readable displays, false for formatting for machine-to-machine transferslatLonFormat
- Format for this formatter, ignoring the global format value- See Also:
-
-
Method Details
-
getGlobalLatLonFormat
Get the current default format to use for formatting latitudes and longitudes.- Returns:
- Format enum
-
setGlobalLatLonFormat
Set the default format to use for formatting latitudes and longitudes.- Parameters:
globalLatLonFormat
- Format enum identifying the desired format
-
addPropertyChangeListener
Register a PropertyChangeListener to be informed of changes to the global format value.- Parameters:
l
- PropertyChangeListener to register
-
removePropertyChangeListener
Unregister a PropertyChangeListener so it will no longer be informed of changes to the global format value.- Parameters:
l
- PropertyChangeListener to unregister
-
format
Format the specified latitude or longitude value into a String.- Parameters:
value
- double latitude or longitude in fractional degrees North or East- Returns:
- String formatted according to the format, isLat, and forDisplay properties of this LatLonFormatter
-
format
Format the specified latitude and longitude pair according to the current global format. This allows formatting in UTM format (which implicitly merges latitude and longitude together).- Parameters:
latValue
- latitude in fractional degrees NorthlonValue
- longitude in fractional degrees East- Returns:
- formatted String
-