Class UnitsFormat
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.util.UnitsFormat
-
- All Implemented Interfaces:
AVList
- Direct Known Subclasses:
MilStd2525UnitsFormat,WWOUnitsFormat
public class UnitsFormat extends AVListImpl
Consolidates the conversion, display and formatting of geographic units such as lengths in miles and areas in hectares. Applications configure a class instance to the desired units, labels and display formats, then simply retrieve display strings from the instance via one standard interface. All input values are in meters; the class performs the necessary conversions to the selected display units.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACREprotected java.lang.StringaltitudeUnitsprotected doublealtitudeUnitsMultiplierprotected java.lang.StringaltitudeUnitsSymbolprotected java.lang.StringareaUnitsprotected doubleareaUnitsMultiplierprotected java.lang.StringareaUnitsSymbolstatic java.lang.StringFEETstatic java.lang.StringFORMAT_AREAstatic java.lang.StringFORMAT_DECIMAL_DEGREESstatic java.lang.StringFORMAT_EYE_ALTITUDEstatic java.lang.StringFORMAT_HEADINGstatic java.lang.StringFORMAT_LENGTHstatic java.lang.StringFORMAT_PITCHstatic java.lang.StringFORMAT_TERRAIN_HEIGHTstatic java.lang.StringFORMAT_UTM_EASTINGstatic java.lang.StringFORMAT_UTM_NORTHINGstatic java.lang.StringHECTAREstatic java.lang.StringIMPERIAL_SYSTEMstatic java.lang.StringKILOMETERSstatic java.lang.StringLABEL_DATUMstatic java.lang.StringLABEL_EYE_ALTITUDEstatic java.lang.StringLABEL_HEADINGstatic java.lang.StringLABEL_LATITUDEstatic java.lang.StringLABEL_LATLON_LATstatic java.lang.StringLABEL_LATLON_LONstatic java.lang.StringLABEL_LONGITUDEstatic java.lang.StringLABEL_PITCHstatic java.lang.StringLABEL_TERRAIN_HEIGHTstatic java.lang.StringLABEL_UTM_EASTINGstatic java.lang.StringLABEL_UTM_NORTHINGstatic java.lang.StringLABEL_UTM_ZONEprotected java.lang.StringlengthUnitsprotected doublelengthUnitsMultiplierprotected java.lang.StringlengthUnitsSymbolstatic java.lang.StringMETERSstatic java.lang.StringMETRIC_SYSTEMstatic java.lang.StringMILESstatic java.lang.StringNAUTICAL_MILESprotected static java.lang.StringNLprotected booleanshowDMSstatic java.lang.StringSQUARE_FEETstatic java.lang.StringSQUARE_KILOMETERSstatic java.lang.StringSQUARE_METERSstatic java.lang.StringSQUARE_MILESstatic java.lang.StringSQUARE_YARDSstatic java.lang.StringSYMBOL_ACREstatic java.lang.StringSYMBOL_FEETstatic java.lang.StringSYMBOL_HECTAREstatic java.lang.StringSYMBOL_KILOMETERSstatic java.lang.StringSYMBOL_METERSstatic java.lang.StringSYMBOL_MILESstatic java.lang.StringSYMBOL_NAUTICAL_MILESstatic java.lang.StringSYMBOL_SQUARE_FEETstatic java.lang.StringSYMBOL_SQUARE_KILOMETERSstatic java.lang.StringSYMBOL_SQUARE_METERSstatic java.lang.StringSYMBOL_SQUARE_MILESstatic java.lang.StringSYMBOL_SQUARE_YARDSstatic java.lang.StringSYMBOL_YARDSstatic java.lang.StringYARDS
-
Constructor Summary
Constructors Constructor Description UnitsFormat()Construct an instance that displays length in kilometers, area in square kilometers and angles in decimal degrees.UnitsFormat(java.lang.String lengthUnits, java.lang.String areaUnits)Constructs an instance that display length and area in specified units, and angles in decimal degrees.UnitsFormat(java.lang.String lengthUnits, java.lang.String areaUnits, boolean showDMS)Constructs an instance that display length and area in specified units, and angles in a specified format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringangle(java.lang.String label, Angle angle)Format an angle according to the current angle format.java.lang.StringangleNL(java.lang.String label, Angle angle)Format an angle according to the current angle format.java.lang.Stringarea(java.lang.String label, double squareMeters)Format an area value according to the current length configuration and prepend a specified label.java.lang.StringareaNL(java.lang.String label, double squareMeters)Format an area value according to the current length configuration.java.lang.StringeyeAltitude(double metersAltitude)Format an eye altitude according to the current eye altitude format.java.lang.StringeyeAltitudeNL(double metersAltitude)Format an eye altitude according to the current eye altitude format, and append a new-line character.java.lang.StringgetAltitudeUnits()Returns the current altitude units.doublegetAltitudeUnitsMultiplier()Indicates the multiplier used to convert from meters to the current altitude units.java.lang.StringgetAltitudeUnitsSymbol()Returns the units symbol for the current altitude units.java.lang.StringgetAreaUnits()Returns the current area units.doublegetAreaUnitsMultiplier()Indicates the multiplier used to convert from square meters to the current area units.java.lang.StringgetAreaUnitsSymbol()Returns the units symbol for the current area units.java.lang.StringgetAreaUnitsSystem()Indicates the unit system of the current area units.java.lang.StringgetFormat(java.lang.String formatName)Returns the format for a specified value type.java.lang.StringgetLabel(java.lang.String labelName)Returns the label for a specified label name.java.lang.StringgetLengthUnits()Returns the current length units.doublegetLengthUnitsMultiplier()Indicates the multiplier used to convert from meters to the current length units.java.lang.StringgetLengthUnitsSymbol()Returns the units symbol for the current length units.java.lang.StringgetLengthUnitsSystem()Indicates the unit system of the current length units.java.lang.Stringheading(double heading)Format an angle of heading in degrees according to the current angle format.java.lang.Stringheading(Angle angle)Format an angle of heading according to the current angle format.java.lang.StringheadingNL(double heading)Format an angle of heading in degrees according to the current angle format, and append a new-line character.java.lang.StringheadingNL(Angle angle)Format an angle of heading according to the current angle format, and append a new-line character.booleanisShowDMS()Indicates whether angles are displayed in degrees-minutes-seconds.java.lang.Stringlatitude(Angle angle)Format an angle of latitude.java.lang.StringlatitudeNL(Angle angle)Format an angle of latitude and append a new-line character.java.lang.StringlatLon(LatLon latlon)Format angles of latitude and longitude according to the current angle format.java.lang.StringlatLon2(LatLon latlon)Format angles of latitude and longitude according to the current angle format and in the form "20°N 85°S".java.lang.StringlatLon2NL(LatLon latlon)Format angles withlatLon2(gov.nasa.worldwind.geom.LatLon)and append a new-line character.java.lang.StringlatLonNL(LatLon latlon)Format angles of latitude and longitude according to the current angle format, and append a new-line character.java.lang.Stringlength(java.lang.String label, double meters)Format a length according to the current length configuration.java.lang.StringlengthNL(java.lang.String label, double meters)Format a length according to the current length configuration.java.lang.Stringlongitude(Angle angle)Format an angle of longitude.java.lang.StringlongitudeNL(Angle angle)Format an angle of longitude and append a new-line character.java.lang.Stringpitch(double pitch)Format an angle of pitch according to the current angle format.java.lang.StringpitchNL(double pitch)Format an angle of pitch according to the current angle format, and append a new-line character.voidsetAltitudeUnits(java.lang.String altitudeUnits)Specifies the units in which to display altitude values.voidsetAreaUnits(java.lang.String areaUnits)Specifies the units in which to display area values.protected voidsetDefaultFormats()Establishes the format declarations to use for certain values.protected voidsetDefaultLabels()Establishes the labels to use when displaying values other than length and area.voidsetFormat(java.lang.String formatName, java.lang.String format)Set the format of a specified value type.voidsetLabel(java.lang.String labelName, java.lang.String label)Set the label of a specified value type.voidsetLengthUnits(java.lang.String lengthUnits)Specifies the units in which to display length values.voidsetShowDMS(boolean showDMS)Specifies whether angles are displayed in degrees-minutes-seconds.voidsetUnitsSystem(java.lang.String unitsSystem)Sets the length and area units to those common for a given units system.java.lang.StringterrainHeight(double metersElevation, double verticalExaggeration)Format a terrain height value according to the current configuration and append a new-line character.java.lang.StringterrainHeightNL(double metersElevation, double verticalExaggeration)Format a terrain height value according to the current configuration and append a new-line character.java.lang.StringutmEasting(double easting)Format a UTM easting value according to the current UTM easting format.java.lang.StringutmEastingNL(double easting)Format a UTM easting value according to the current UTM easting format and append a new-line character.java.lang.StringutmNorthing(double northing)Format a UTM northing value according to the current UTM northing format.java.lang.StringutmNorthingNL(double northing)Format a UTM northing value according to the current UTM northing format and append a new-line character.java.lang.StringutmZone(int zone)Format a UTM zone according to the current UTM zone format.java.lang.StringutmZoneNL(int zone)Format a UTM zone according to the current UTM zone format and append a new-line character.-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
-
-
-
Field Detail
-
IMPERIAL_SYSTEM
public static final java.lang.String IMPERIAL_SYSTEM
- See Also:
- Constant Field Values
-
METRIC_SYSTEM
public static final java.lang.String METRIC_SYSTEM
- See Also:
- Constant Field Values
-
METERS
public static final java.lang.String METERS
- See Also:
- Constant Field Values
-
KILOMETERS
public static final java.lang.String KILOMETERS
- See Also:
- Constant Field Values
-
MILES
public static final java.lang.String MILES
- See Also:
- Constant Field Values
-
NAUTICAL_MILES
public static final java.lang.String NAUTICAL_MILES
- See Also:
- Constant Field Values
-
YARDS
public static final java.lang.String YARDS
- See Also:
- Constant Field Values
-
FEET
public static final java.lang.String FEET
- See Also:
- Constant Field Values
-
SQUARE_METERS
public static final java.lang.String SQUARE_METERS
- See Also:
- Constant Field Values
-
SQUARE_KILOMETERS
public static final java.lang.String SQUARE_KILOMETERS
- See Also:
- Constant Field Values
-
SQUARE_MILES
public static final java.lang.String SQUARE_MILES
- See Also:
- Constant Field Values
-
HECTARE
public static final java.lang.String HECTARE
- See Also:
- Constant Field Values
-
ACRE
public static final java.lang.String ACRE
- See Also:
- Constant Field Values
-
SQUARE_YARDS
public static final java.lang.String SQUARE_YARDS
- See Also:
- Constant Field Values
-
SQUARE_FEET
public static final java.lang.String SQUARE_FEET
- See Also:
- Constant Field Values
-
SYMBOL_METERS
public static final java.lang.String SYMBOL_METERS
- See Also:
- Constant Field Values
-
SYMBOL_KILOMETERS
public static final java.lang.String SYMBOL_KILOMETERS
- See Also:
- Constant Field Values
-
SYMBOL_MILES
public static final java.lang.String SYMBOL_MILES
- See Also:
- Constant Field Values
-
SYMBOL_NAUTICAL_MILES
public static final java.lang.String SYMBOL_NAUTICAL_MILES
- See Also:
- Constant Field Values
-
SYMBOL_YARDS
public static final java.lang.String SYMBOL_YARDS
- See Also:
- Constant Field Values
-
SYMBOL_FEET
public static final java.lang.String SYMBOL_FEET
- See Also:
- Constant Field Values
-
SYMBOL_SQUARE_METERS
public static final java.lang.String SYMBOL_SQUARE_METERS
- See Also:
- Constant Field Values
-
SYMBOL_SQUARE_KILOMETERS
public static final java.lang.String SYMBOL_SQUARE_KILOMETERS
- See Also:
- Constant Field Values
-
SYMBOL_SQUARE_MILES
public static final java.lang.String SYMBOL_SQUARE_MILES
- See Also:
- Constant Field Values
-
SYMBOL_HECTARE
public static final java.lang.String SYMBOL_HECTARE
- See Also:
- Constant Field Values
-
SYMBOL_ACRE
public static final java.lang.String SYMBOL_ACRE
- See Also:
- Constant Field Values
-
SYMBOL_SQUARE_YARDS
public static final java.lang.String SYMBOL_SQUARE_YARDS
- See Also:
- Constant Field Values
-
SYMBOL_SQUARE_FEET
public static final java.lang.String SYMBOL_SQUARE_FEET
- See Also:
- Constant Field Values
-
LABEL_LATITUDE
public static final java.lang.String LABEL_LATITUDE
- See Also:
- Constant Field Values
-
LABEL_LONGITUDE
public static final java.lang.String LABEL_LONGITUDE
- See Also:
- Constant Field Values
-
LABEL_LATLON_LAT
public static final java.lang.String LABEL_LATLON_LAT
- See Also:
- Constant Field Values
-
LABEL_LATLON_LON
public static final java.lang.String LABEL_LATLON_LON
- See Also:
- Constant Field Values
-
LABEL_HEADING
public static final java.lang.String LABEL_HEADING
- See Also:
- Constant Field Values
-
LABEL_EYE_ALTITUDE
public static final java.lang.String LABEL_EYE_ALTITUDE
- See Also:
- Constant Field Values
-
LABEL_PITCH
public static final java.lang.String LABEL_PITCH
- See Also:
- Constant Field Values
-
LABEL_UTM_ZONE
public static final java.lang.String LABEL_UTM_ZONE
- See Also:
- Constant Field Values
-
LABEL_UTM_EASTING
public static final java.lang.String LABEL_UTM_EASTING
- See Also:
- Constant Field Values
-
LABEL_UTM_NORTHING
public static final java.lang.String LABEL_UTM_NORTHING
- See Also:
- Constant Field Values
-
LABEL_TERRAIN_HEIGHT
public static final java.lang.String LABEL_TERRAIN_HEIGHT
- See Also:
- Constant Field Values
-
LABEL_DATUM
public static final java.lang.String LABEL_DATUM
- See Also:
- Constant Field Values
-
FORMAT_LENGTH
public static final java.lang.String FORMAT_LENGTH
- See Also:
- Constant Field Values
-
FORMAT_AREA
public static final java.lang.String FORMAT_AREA
- See Also:
- Constant Field Values
-
FORMAT_PITCH
public static final java.lang.String FORMAT_PITCH
- See Also:
- Constant Field Values
-
FORMAT_HEADING
public static final java.lang.String FORMAT_HEADING
- See Also:
- Constant Field Values
-
FORMAT_UTM_NORTHING
public static final java.lang.String FORMAT_UTM_NORTHING
- See Also:
- Constant Field Values
-
FORMAT_UTM_EASTING
public static final java.lang.String FORMAT_UTM_EASTING
- See Also:
- Constant Field Values
-
FORMAT_EYE_ALTITUDE
public static final java.lang.String FORMAT_EYE_ALTITUDE
- See Also:
- Constant Field Values
-
FORMAT_DECIMAL_DEGREES
public static final java.lang.String FORMAT_DECIMAL_DEGREES
- See Also:
- Constant Field Values
-
FORMAT_TERRAIN_HEIGHT
public static final java.lang.String FORMAT_TERRAIN_HEIGHT
- See Also:
- Constant Field Values
-
NL
protected static final java.lang.String NL
- See Also:
- Constant Field Values
-
showDMS
protected boolean showDMS
-
lengthUnits
protected java.lang.String lengthUnits
-
lengthUnitsSymbol
protected java.lang.String lengthUnitsSymbol
-
lengthUnitsMultiplier
protected double lengthUnitsMultiplier
-
areaUnits
protected java.lang.String areaUnits
-
areaUnitsSymbol
protected java.lang.String areaUnitsSymbol
-
areaUnitsMultiplier
protected double areaUnitsMultiplier
-
altitudeUnits
protected java.lang.String altitudeUnits
-
altitudeUnitsSymbol
protected java.lang.String altitudeUnitsSymbol
-
altitudeUnitsMultiplier
protected double altitudeUnitsMultiplier
-
-
Constructor Detail
-
UnitsFormat
public UnitsFormat()
Construct an instance that displays length in kilometers, area in square kilometers and angles in decimal degrees.
-
UnitsFormat
public UnitsFormat(java.lang.String lengthUnits, java.lang.String areaUnits)Constructs an instance that display length and area in specified units, and angles in decimal degrees.- Parameters:
lengthUnits- the desired length units. Available length units areMETERS, KILOMETERS, MILES, NAUTICAL_MILES, YARDSandFEET.areaUnits- the desired area units. Available area units areSQUARE_METERS, SQUARE_KILOMETERS, HECTARE, ACRE, SQUARE_YARDandSQUARE_FEET.- Throws:
java.lang.IllegalArgumentException- if eitherlengthUnitsorareaUnitsis null.
-
UnitsFormat
public UnitsFormat(java.lang.String lengthUnits, java.lang.String areaUnits, boolean showDMS)Constructs an instance that display length and area in specified units, and angles in a specified format.- Parameters:
lengthUnits- the desired length units. Available length units areMETERS, KILOMETERS, MILES, NAUTICAL_MILES, YARDSandFEET.areaUnits- the desired area units. Available area units areSQUARE_METERS, SQUARE_KILOMETERS, HECTARE, ACRE, SQUARE_YARDandSQUARE_FEET.showDMS- true if the desired angle format is degrees-minutes-seconds, false if the format is decimal degrees.- Throws:
java.lang.IllegalArgumentException- if eitherlengthUnitsorareaUnitsis null.
-
-
Method Detail
-
setDefaultLabels
protected void setDefaultLabels()
Establishes the labels to use when displaying values other than length and area. A label is a string placed before the value and its units. Examples are Latitude 24.36, UTM Zone: 12, and Eye Altitude: 500 km, where the emphasized terms are the labels. Subclasses can override this method to establish labels other than the defaults. The default labels are drawn from the current message properties. The recognized labels are those indicated by the "LABEL_" constants defined by this class or by its subclasses.
-
setDefaultFormats
protected void setDefaultFormats()
Establishes the format declarations to use for certain values. Examples are " %,12.1f %s" for lengths and " %,11.1f" for UTM northings. Subclasses can override this method to establish formats other than the defaults. The value types that have associated formats are indicated by the "FORMAT_" constants defined by this class or by its subclasses.
-
setLabel
public void setLabel(java.lang.String labelName, java.lang.String label)Set the label of a specified value type. SeesetDefaultLabels()for a description and examples of labels.- Parameters:
labelName- a key identifying the label type. Available names are those indicated by the "LABEL_" constants defined by this class or by its subclasseslabel- the label to use for the specified value type.- Throws:
java.lang.IllegalArgumentException- if either the label or label name is null.
-
getLabel
public java.lang.String getLabel(java.lang.String labelName)
Returns the label for a specified label name.- Parameters:
labelName- the name of the label to return.- Returns:
- the label, or null if the label does not exist.
- Throws:
java.lang.IllegalArgumentException- if the label name is null.
-
setFormat
public void setFormat(java.lang.String formatName, java.lang.String format)Set the format of a specified value type. SeesetDefaultFormats()for a description and examples of formats.- Parameters:
formatName- a key identifying the value type that is to have the specified format. Available types are those indicated by the "FORMAT_" constants defined by this class or by its subclassesformat- the label to use for the specified value type.- Throws:
java.lang.IllegalArgumentException- if either the format or format name are null.
-
getFormat
public java.lang.String getFormat(java.lang.String formatName)
Returns the format for a specified value type.- Parameters:
formatName- the name of the value type whose format is desired.- Returns:
- the format, or null if the format does not exist.
- Throws:
java.lang.IllegalArgumentException- if the format name is null.
-
isShowDMS
public boolean isShowDMS()
Indicates whether angles are displayed in degrees-minutes-seconds.- Returns:
- true if angles are displayed in degrees-minutes seconds, false if they're displayed in decimal degrees.
-
setShowDMS
public void setShowDMS(boolean showDMS)
Specifies whether angles are displayed in degrees-minutes-seconds.- Parameters:
showDMS- true to display angles in degrees-minutes seconds, false to display them in decimal degrees.
-
getLengthUnitsSymbol
public java.lang.String getLengthUnitsSymbol()
Returns the units symbol for the current length units. Examples are "m" for meters and "Nm" for nautical miles.- Returns:
- the units symbol for the current length units.
-
getLengthUnits
public java.lang.String getLengthUnits()
Returns the current length units.- Returns:
- the current length units. See
UnitsFormat(String, String, boolean)for the list of those available.
-
setLengthUnits
public void setLengthUnits(java.lang.String lengthUnits)
Specifies the units in which to display length values. Units subsequently formatted by the instance are converted from meters to the desired units prior to formatting.- Parameters:
lengthUnits- the desired length units. SeeUnitsFormat(String, String, boolean)for the list of those available.- Throws:
java.lang.IllegalArgumentException- iflengthUnitsis null.
-
getLengthUnitsMultiplier
public double getLengthUnitsMultiplier()
Indicates the multiplier used to convert from meters to the current length units.- Returns:
- the conversion multiplier to convert meters to the current length units.
-
getAltitudeUnitsSymbol
public java.lang.String getAltitudeUnitsSymbol()
Returns the units symbol for the current altitude units. Examples are "m" for meters and "Nm" for nautical miles.- Returns:
- the units symbol for the current altitude units.
-
getAltitudeUnits
public java.lang.String getAltitudeUnits()
Returns the current altitude units.- Returns:
- the current altitude units. See
UnitsFormat(String, String, boolean)for the list of those available.
-
setAltitudeUnits
public void setAltitudeUnits(java.lang.String altitudeUnits)
Specifies the units in which to display altitude values. Units subsequently formatted by the instance are converted from meters to the desired units prior to formatting.- Parameters:
altitudeUnits- the desired altitude units. SeeUnitsFormat(String, String, boolean)for the list of those available.- Throws:
java.lang.IllegalArgumentException- iflengthUnitsis null.
-
getAltitudeUnitsMultiplier
public double getAltitudeUnitsMultiplier()
Indicates the multiplier used to convert from meters to the current altitude units.- Returns:
- the conversion multiplier to convert meters to the current altitude units.
-
getAreaUnits
public java.lang.String getAreaUnits()
Returns the current area units.- Returns:
- the current area units. See
UnitsFormat(String, String, boolean)for the list of those available.
-
setAreaUnits
public void setAreaUnits(java.lang.String areaUnits)
Specifies the units in which to display area values. Units subsequently formatted by the instance are converted from square meters to the desired units prior to formatting.- Parameters:
areaUnits- the desired length units. SeeUnitsFormat(String, String, boolean)for the list of those available.- Throws:
java.lang.IllegalArgumentException- ifareaUnitsis null.
-
getAreaUnitsMultiplier
public double getAreaUnitsMultiplier()
Indicates the multiplier used to convert from square meters to the current area units.- Returns:
- the conversion multiplier to convert square meters to the current area units.
-
getAreaUnitsSymbol
public java.lang.String getAreaUnitsSymbol()
Returns the units symbol for the current area units. Examples are "m²" for square meters and "miles²" for square miles.- Returns:
- the units symbol for the current area units.
-
setUnitsSystem
public void setUnitsSystem(java.lang.String unitsSystem)
Sets the length and area units to those common for a given units system. Recognized systems areMETRIC_SYSTEM, which uses kilometers and square kilometers, andIMPERIAL_SYSTEM, which uses miles and square miles.- Parameters:
unitsSystem- the desired units system, eitherMETRIC_SYSTEMorIMPERIAL_SYSTEM.- Throws:
java.lang.IllegalArgumentException- ifunitsSystemis null.
-
getLengthUnitsSystem
public java.lang.String getLengthUnitsSystem()
Indicates the unit system of the current length units. The available systems areMETRIC_SYSTEMandIMPERIAL_SYSTEM.- Returns:
- the current units system for lengths.
-
getAreaUnitsSystem
public java.lang.String getAreaUnitsSystem()
Indicates the unit system of the current area units. The available systems areMETRIC_SYSTEMandIMPERIAL_SYSTEM.- Returns:
- the current units system for areas.
-
latitudeNL
public java.lang.String latitudeNL(Angle angle)
Format an angle of latitude and append a new-line character.The value is formatted using the current
LABEL_LATITUDEand angle format.- Parameters:
angle- the angle to format.- Returns:
- a string containing the formatted angle and ending with the new-line character.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
latitude
public java.lang.String latitude(Angle angle)
Format an angle of latitude.The value is formatted using the current
LABEL_LATITUDEand angle format.- Parameters:
angle- the angle to format.- Returns:
- a string containing the formatted angle.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
longitudeNL
public java.lang.String longitudeNL(Angle angle)
Format an angle of longitude and append a new-line character.The value is formatted using the current
LABEL_LONGITUDEand angle format.- Parameters:
angle- the angle to format.- Returns:
- a string containing the formatted angle and ending with the new-line character.
-
longitude
public java.lang.String longitude(Angle angle)
Format an angle of longitude.The value is formatted using the current
LABEL_LONGITUDEand angle format.- Parameters:
angle- the angle to format.- Returns:
- a string containing the formatted angle.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
headingNL
public java.lang.String headingNL(Angle angle)
Format an angle of heading according to the current angle format, and append a new-line character.The value is formatted using the current
LABEL_HEADINGand angle format.- Parameters:
angle- the heading angle to format.- Returns:
- a string containing the formatted angle and ending with the new-line character.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
heading
public java.lang.String heading(Angle angle)
Format an angle of heading according to the current angle format.The value is formatted using the current
LABEL_HEADINGand angle format.- Parameters:
angle- the heading angle to format.- Returns:
- a string containing the formatted angle.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
headingNL
public java.lang.String headingNL(double heading)
Format an angle of heading in degrees according to the current angle format, and append a new-line character.The value is formatted using the current
LABEL_HEADINGandFORMAT_HEADING. The defaultFORMAT_HEADINGis " %9.2f°".- Parameters:
heading- the angle to format.- Returns:
- a string containing the formatted angle and ending with the new-line character.
-
heading
public java.lang.String heading(double heading)
Format an angle of heading in degrees according to the current angle format.The value is formatted using the current
LABEL_HEADINGandFORMAT_HEADING. The defaultFORMAT_HEADINGis " %9.2f°".- Parameters:
heading- the angle to format.- Returns:
- a string containing the formatted angle.
-
latLonNL
public java.lang.String latLonNL(LatLon latlon)
Format angles of latitude and longitude according to the current angle format, and append a new-line character.The values are formatted using the current
LABEL_LATLON_LAT,LABEL_LATLON_LONand angle format.- Parameters:
latlon- the angles to format.- Returns:
- a string containing the formatted angles and ending with the new-line character.
- Throws:
java.lang.IllegalArgumentException- iflatlonis null.
-
latLon
public java.lang.String latLon(LatLon latlon)
Format angles of latitude and longitude according to the current angle format.The values are formatted using the current
LABEL_LATLON_LAT,LABEL_LATLON_LONand angle format.- Parameters:
latlon- the angles to format.- Returns:
- a string containing the formatted angles.
- Throws:
java.lang.IllegalArgumentException- iflatlonis null.
-
latLon2NL
public java.lang.String latLon2NL(LatLon latlon)
Format angles withlatLon2(gov.nasa.worldwind.geom.LatLon)and append a new-line character.- Parameters:
latlon- the angles to format.- Returns:
- a string containing the formatted angles and ending with the new-line character.
- Throws:
java.lang.IllegalArgumentException- iflatlonis null.
-
latLon2
public java.lang.String latLon2(LatLon latlon)
Format angles of latitude and longitude according to the current angle format and in the form "20°N 85°S".- Parameters:
latlon- the angles to format.- Returns:
- a string containing the formatted angles.
- Throws:
java.lang.IllegalArgumentException- iflatlonis null.
-
angleNL
public java.lang.String angleNL(java.lang.String label, Angle angle)Format an angle according to the current angle format. Prepend a specified label and append a new-line character.- Parameters:
label- a label to prepend to the formatted angle. May be null to indicate no label.angle- the angle to format.- Returns:
- a string containing the formatted angle prepended with the specified label and ending with the new-line character.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
angle
public java.lang.String angle(java.lang.String label, Angle angle)Format an angle according to the current angle format. Prepend a specified label.- Parameters:
label- a label to prepend to the formatted angle. May be null to indicate no label.angle- the angle to format.- Returns:
- a string containing the formatted angle prepended with the specified label.
- Throws:
java.lang.IllegalArgumentException- if the angle is null.
-
eyeAltitudeNL
public java.lang.String eyeAltitudeNL(double metersAltitude)
Format an eye altitude according to the current eye altitude format, and append a new-line character.The value is formatted using the current
LABEL_EYE_ALTITUDE,FORMAT_EYE_ALTITUDEand length format.- Parameters:
metersAltitude- the eye altitude to format, in meters.- Returns:
- a string containing the formatted eye altitude and ending with the new-line character.
-
eyeAltitude
public java.lang.String eyeAltitude(double metersAltitude)
Format an eye altitude according to the current eye altitude format.The value is formatted using the current
LABEL_EYE_ALTITUDE,FORMAT_EYE_ALTITUDEand length format.- Parameters:
metersAltitude- the eye altitude to format, in meters.- Returns:
- a string containing the formatted eye altitude.
-
pitchNL
public java.lang.String pitchNL(double pitch)
Format an angle of pitch according to the current angle format, and append a new-line character.The value is formatted using the current
LABEL_PITCHandFORMAT_PITCH. The defaultFORMAT_PITCHis " %9.2f°".- Parameters:
pitch- the angle to format.- Returns:
- a string containing the formatted angle and ending with the new-line character.
-
pitch
public java.lang.String pitch(double pitch)
Format an angle of pitch according to the current angle format.The value is formatted using the current
LABEL_PITCHandFORMAT_PITCH. The defaultFORMAT_PITCHis " %9.2f°".- Parameters:
pitch- the angle to format.- Returns:
- a string containing the formatted angle.
-
utmZoneNL
public java.lang.String utmZoneNL(int zone)
Format a UTM zone according to the current UTM zone format and append a new-line character.The value is formatted using the current
LABEL_UTM_ZONE.- Parameters:
zone- the UTM zone to format.- Returns:
- the formatted UTM zone ending with a new-line character.
-
utmZone
public java.lang.String utmZone(int zone)
Format a UTM zone according to the current UTM zone format.The value is formatted using the current
LABEL_UTM_ZONE.- Parameters:
zone- the UTM zone to format.- Returns:
- the formatted UTM zone.
-
utmNorthingNL
public java.lang.String utmNorthingNL(double northing)
Format a UTM northing value according to the current UTM northing format and append a new-line character.The value is formatted using the current
LABEL_UTM_NORTHINGand currentFORMAT_UTM_NORTHING. The default UTM northing format is " %,11.1f". No units symbol is included in the formatted string because UTM northing units are always meters.- Parameters:
northing- the UTM northing to format.- Returns:
- the formatted UTM northing ending with a new-line character.
-
utmNorthing
public java.lang.String utmNorthing(double northing)
Format a UTM northing value according to the current UTM northing format.The value is formatted using the current
LABEL_UTM_NORTHINGand currentFORMAT_UTM_NORTHING. The default UTM northing format is " %,11.1f". No units symbol is included in the formatted string because UTM northing units are always meters.- Parameters:
northing- the UTM northing to format.- Returns:
- the formatted UTM northing.
-
utmEastingNL
public java.lang.String utmEastingNL(double easting)
Format a UTM easting value according to the current UTM easting format and append a new-line character.The value is formatted using the current
LABEL_UTM_EASTINGand currentFORMAT_UTM_EASTING. The default UTM easting format is " %,11.1f". No units symbol is included in the formatted string because UTM easting units are always meters.- Parameters:
easting- the UTM northing to format.- Returns:
- the formatted UTM easting ending with a new-line character.
-
utmEasting
public java.lang.String utmEasting(double easting)
Format a UTM easting value according to the current UTM easting format.The value is formatted using the current
LABEL_UTM_EASTINGand currentFORMAT_UTM_EASTING. The default UTM easting format is " %,11.1f". No units symbol is included in the formatted string because UTM easting units are always meters.- Parameters:
easting- the UTM northing to format.- Returns:
- the formatted UTM easting.
-
terrainHeightNL
public java.lang.String terrainHeightNL(double metersElevation, double verticalExaggeration)Format a terrain height value according to the current configuration and append a new-line character. SeeterrainHeight(double, double)for a description of the formatting.- Parameters:
metersElevation- the terrain height in meters.verticalExaggeration- the vertical exaggeration to apply to the terrain height.- Returns:
- the formatted terrain height ending with a new-line character.
-
terrainHeight
public java.lang.String terrainHeight(double metersElevation, double verticalExaggeration)Format a terrain height value according to the current configuration and append a new-line character.The value is formatted using the current
LABEL_TERRAIN_HEIGHT,FORMAT_TERRAIN_HEIGHTand length units symbol. The default terrain height format is " (ve %3.1f): %,6d %s", where the %3.1f specifier stands for the vertical exaggeration, the %,6d specifier stands for the terrain height, and the %s specifier stands for the units symbol.Note: While the
FORMAT_TERRAIN_HEIGHTstring may be specified by the application, the terrain height components are always passed to the internal formatter in the order: vertical exaggeration, terrain height, units symbol.- Parameters:
metersElevation- the terrain height in meters.verticalExaggeration- the vertical exaggeration to apply to the terrain height.- Returns:
- the formatted terrain height ending with a new-line character.
-
lengthNL
public java.lang.String lengthNL(java.lang.String label, double meters)Format a length according to the current length configuration. Prepend a specified label and append a new-line character.The value is formatted using the current
FORMAT_LENGTHand length units symbol, and is converted to the current length units prior to formatting. The default length format is " %,12.1f %s", where the %s specifier stands for the units symbol.- Parameters:
label- the label to prepend to the formatted length. May be null to indicate no label.meters- the length to format, in meters.- Returns:
- the formatted length with the specified label prepended and a new-line character appended.
-
length
public java.lang.String length(java.lang.String label, double meters)Format a length according to the current length configuration. Prepend a specified label.The value is formatted using the current
FORMAT_LENGTHand length units symbol, and is converted to the current length units prior to formatting. The default length format is " %,12.1f %s", where the %s specifier stands for the units symbol.- Parameters:
label- the label to prepend to the formatted length. May be null to indicate no label.meters- the length to format, in meters.- Returns:
- the formatted length with the specified label prepended.
-
areaNL
public java.lang.String areaNL(java.lang.String label, double squareMeters)Format an area value according to the current length configuration. Prepend a specified label and append a new-line character.The value is formatted using the current
FORMAT_AREAand area units symbol, and is converted to the current area units prior to formatting. The default area format is " %,12.1f %s", where the %s specifier stands for the units symbol.- Parameters:
label- the label to prepend to the formatted length. May be null to indicate no label.squareMeters- the area value to format, in square meters.- Returns:
- the formatted area with the specified label prepended and a new-line character appended.
-
area
public java.lang.String area(java.lang.String label, double squareMeters)Format an area value according to the current length configuration and prepend a specified label.The value is formatted using the current
FORMAT_AREAand area units symbol, and is converted to the current area units prior to formatting. The default area format is " %,12.1f %s", where the %s specifier stands for the units symbol.- Parameters:
label- the label to prepend to the formatted length. May be null to indicate no label.squareMeters- the area value to format, in square meters.- Returns:
- the formatted area with the specified label prepended.
-
-