Package com.luciad.view.map
Class TLcdMapLocation
java.lang.Object
com.luciad.view.map.TLcdMapLocation
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener
A utility to retrieve and display the geographical location of a mouse position on an ILcdGXYView.
Configuring a view will add this TLcdMapLocation as a mouseMotionListener.
The mouse location can be retrieved as lon - lat values (WGS84 by default),
or as a formatted String.
The format can be changed. In addition,
convenience formatting modes are available.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for center alignment.static final intMode for a custom Format.static final StringConstant for 'GXYView' property.static final intConstant for left alignment.static final intMode for the location in latitude-longitude (dd°mm'ss",ddd°mm'ss").static final intMode for the location in latitude-longitude (xx.xxxx°,xxx.xxxx°).static final intMode for the location in latitude-longitude (xx°xx',xxx°xx).static final intMode for the location in latitude-longitude (xx°xx.xx',xxx°xx.xx').static final intMode for the location in Georef coordinates.static final intMode for the location in latitude-longitude (ddmmssNdddmmssW).static final intMode for the location in UTM-MGRS coordinates, with 10 meter precision.static final intMode for the location in UTM-MGRS coordinates, with 100 meter precision.static final intMode for the location in UTM-MGRS coordinates, with km precision.static final intMode for the location in UTM-MGRS coordinates, with meter precision.static final intMode for the location in longitude-latitude (dddmmssWddmmssN).static final StringConstant for mode property.static final intConstant for right alignment.static final intMode for the scale as meter/pixel.static final intMode for the scale as km/pixel.static final intMode for the scale as miles/pixel.static final intMode for the window width in meters.static final intMode for the window width in kilometers.static final intMode for the window width in miles. -
Constructor Summary
ConstructorsConstructorDescriptionExpresses the coordinate of the mouse location in longitude, latitude coordinates on the WGS84 geodetic datum.TLcdMapLocation(ILcdGeodeticDatum aGeodeticDatum) Expresses the coordinate of the mouse location in longitude, latitude coordinates on the given geodetic datum. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Adds a property change listener.intReturns how the location information will be aligned.Returns the format to format the location as a string.Returns the view in which the location is computed.doublegetLat()Returns the latitude of the current (computed) location.doublegetLon()Returns the longitude of the current (computed) location.intgetMode()Returns the format in which the coordinates of the (computed) location will be expressed.charReturns the character to separate the zone and the coordinates.charReturns the character to separate the UTM grid zone and the 100km squares.booleanDeprecated.This method has been deprecated.voidThis implementation is empty.voidThis implementation is empty.voidThis implementation is empty.voidThis implementation is empty.voidmouseMoved(MouseEvent me) TheMouseEventme causes the properties of importance to the current mode to be updated.voidTheMouseEventme causes the properties of importance to the current mode to be updated.voidThis implementation is empty.voidThis method draws the information pertaining to the current mode as a string centered vertically in theRectangleaRectangle, havinggetAlignment()as alignment.protected voidprocessMouseEvent(MouseEvent aMouseEvent) TheMouseEventaMouseEvent causes the properties of importance to the current mode to be updated.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Removes a property change listener.voidsetAlignment(int aAlignment) The property of alignment determines whether to center, left or right align the location information.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidSets a custom format to format the location as a string.voidsetGXYView(ILcdGXYView aGXYView) Sets the view for which the location will be determined.voidsetMode(int aMode) Sets the format in which the coordinates of the (computed) location will be expressed.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidsetUTMCoordinateSeparator(char aUTMCoordinateSeparator) Set the character to separate the zone and the coordinates and between the coordinates.voidsetZoneSeparator(char aZoneSeparator) Sets the character to use as separator between the UTM grid zone and the 100km squares.protected voidUpdates the properties of this class using the current lon,lat position in accordance with the property of mode.protected voidupdateWithLocation(int aX, int aY) Updates the properties of this class by retrieving the location of theILcdGXYViewpoint (aX,aY) in a format in accordance with the property of mode.Returns the information using the current mode and (computed) location as a String.
-
Field Details
-
LOCATION_DDMMSS
public static final int LOCATION_DDMMSSMode for the location in latitude-longitude (dd°mm'ss",ddd°mm'ss").- See Also:
-
LOCATION_NSWE
public static final int LOCATION_NSWEMode for the location in latitude-longitude (ddmmssNdddmmssW).- See Also:
-
LOCATION_WENS
public static final int LOCATION_WENSMode for the location in longitude-latitude (dddmmssWddmmssN).- See Also:
-
LOCATION_DEC_DEG
public static final int LOCATION_DEC_DEGMode for the location in latitude-longitude (xx.xxxx°,xxx.xxxx°).- See Also:
-
LOCATION_DEC_MIN
public static final int LOCATION_DEC_MINMode for the location in latitude-longitude (xx°xx',xxx°xx).- See Also:
-
LOCATION_DEC_MIN_2
public static final int LOCATION_DEC_MIN_2Mode for the location in latitude-longitude (xx°xx.xx',xxx°xx.xx').- See Also:
-
LOCATION_UTM_M
public static final int LOCATION_UTM_MMode for the location in UTM-MGRS coordinates, with meter precision.- See Also:
-
LOCATION_UTM_DM
public static final int LOCATION_UTM_DMMode for the location in UTM-MGRS coordinates, with 10 meter precision.- See Also:
-
LOCATION_UTM_HM
public static final int LOCATION_UTM_HMMode for the location in UTM-MGRS coordinates, with 100 meter precision.- See Also:
-
LOCATION_UTM_KM
public static final int LOCATION_UTM_KMMode for the location in UTM-MGRS coordinates, with km precision.- See Also:
-
LOCATION_GEOREF_0
public static final int LOCATION_GEOREF_0Mode for the location in Georef coordinates.- See Also:
-
SCALE
public static final int SCALEMode for the scale as meter/pixel.- See Also:
-
SCALE_MILES
public static final int SCALE_MILESMode for the scale as miles/pixel.- See Also:
-
SCALE_KM
public static final int SCALE_KMMode for the scale as km/pixel.- See Also:
-
WINDOW_WIDTH
public static final int WINDOW_WIDTHMode for the window width in meters.- See Also:
-
WINDOW_WIDTH_KM
public static final int WINDOW_WIDTH_KMMode for the window width in kilometers.- See Also:
-
WINDOW_WIDTH_MILES
public static final int WINDOW_WIDTH_MILESMode for the window width in miles.- See Also:
-
CUSTOM_FORMAT
public static final int CUSTOM_FORMATMode for a custom Format.- See Also:
-
LEFT
public static final int LEFTConstant for left alignment.- See Also:
-
CENTER
public static final int CENTERConstant for center alignment.- See Also:
-
RIGHT
public static final int RIGHTConstant for right alignment.- See Also:
-
MODE
Constant for mode property.- See Also:
-
GXYVIEW
Constant for 'GXYView' property.- See Also:
-
-
Constructor Details
-
TLcdMapLocation
public TLcdMapLocation()Expresses the coordinate of the mouse location in longitude, latitude coordinates on the WGS84 geodetic datum. After construction, a view should be configured.- See Also:
-
TLcdMapLocation
Expresses the coordinate of the mouse location in longitude, latitude coordinates on the given geodetic datum.- Parameters:
aGeodeticDatum- the datum to express the coordinates in. After construction, a view should be configured.- See Also:
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istruethen all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrueif tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
valueAsString
Returns the information using the current mode and (computed) location as a String.- Returns:
- the information using the current mode and (computed) location as a String.
-
addPropertyChangeListener
Adds a property change listener. Possible values for property IDs are MODE and GXYVIEW.- Parameters:
aPropertyChangeListener- listens to mode and view property changes.- See Also:
-
removePropertyChangeListener
Removes a property change listener.- Parameters:
aPropertyChangeListener- listened to mode and view property changes.- See Also:
-
setMode
public void setMode(int aMode) Sets the format in which the coordinates of the (computed) location will be expressed. 3 types of modes are possible:- geographical location (constants starting with LOCATION)
- the scale (unit of length / pixel) of the
ILcdGXYView(constants starting with SCALE) - the width of the current view (constants starting with WINDOW_WIDTH)
setFormat. This will change the mode toCUSTOM_FORMAT.- Parameters:
aMode- the format in which the coordinates of the (computed) location will be expressed.- See Also:
-
getMode
public int getMode()Returns the format in which the coordinates of the (computed) location will be expressed.- Returns:
- the format in which the coordinates of the (computed) location will be expressed.
- See Also:
-
setFormat
Sets a custom format to format the location as a string. The format is passed anILcdPointobject. This will change themodetoCUSTOM_FORMAT.- Parameters:
aFormat- a format to be used
-
getFormat
Returns the format to format the location as a string. This is used if themodeis set toCUSTOM_FORMAT.- Returns:
- the used format
-
getLon
public double getLon()Returns the longitude of the current (computed) location.- Returns:
- the longitude of the current (computed) location.
-
getLat
public double getLat()Returns the latitude of the current (computed) location.- Returns:
- the latitude of the current (computed) location.
-
setAlignment
public void setAlignment(int aAlignment) The property of alignment determines whether to center, left or right align the location information. This can be RIGHT, LEFT or CENTER. Sets the property of alignment to aAlignment.- Parameters:
aAlignment- the new alignment, can be RIGHT, LEFT or CENTER.- See Also:
-
getAlignment
public int getAlignment()Returns how the location information will be aligned. The property of alignment determines whether to center, left or right align the location information.- Returns:
- RIGHT, LEFT or CENTER.
- See Also:
-
setGXYView
Sets the view for which the location will be determined. TheILcdGXYViewmust have aILcdGridReferenceas XYWorldReference property. The map location is added as a mouse motion listener to the view.- Parameters:
aGXYView- the view to determine the location in.- See Also:
-
getGXYView
Returns the view in which the location is computed.- Returns:
- the view in which the location is computed.
- See Also:
-
setUTMCoordinateSeparator
public void setUTMCoordinateSeparator(char aUTMCoordinateSeparator) Set the character to separate the zone 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. This setting only applies to the UTM modes.- Parameters:
aUTMCoordinateSeparator- the character to separate the zone and the coordinates and between the coordinates.- See Also:
-
getUTMCoordinateSeparator
public char getUTMCoordinateSeparator()Returns the character to separate the zone and the coordinates.- Returns:
- the character to separate the zone and the coordinates.
- See Also:
-
setZoneSeparator
public void setZoneSeparator(char aZoneSeparator) Sets the character to use as separator between the UTM grid zone and the 100km squares. Set the value to
0(not the character'0') to have no separator between the UTM grid zone and the 100km squares.The default is
0.This setting only applies to the UTM modes.
- Parameters:
aZoneSeparator- the character to separate the UTM grid zone and the 100km squares.- See Also:
-
getZoneSeparator
public char getZoneSeparator()Returns the character to separate the UTM grid zone and the 100km squares.
This setting only applies to the UTM modes.
- Returns:
- the character to separate the UTM grid zone and the 100km squares.
- See Also:
-
updateWithLocation
protected void updateWithLocation(int aX, int aY) Updates the properties of this class by retrieving the location of theILcdGXYViewpoint (aX,aY) in a format in accordance with the property of mode. This method is called byprocessMouseEvent(java.awt.event.MouseEvent).- Parameters:
aX- the first coordinate of the location in view (AWT) coordinates.aY- the second coordinate of the location in view (AWT) coordinates.
-
updateWithCurrentLocation
protected void updateWithCurrentLocation()Updates the properties of this class using the current lon,lat position in accordance with the property of mode. Useful when changing of mode. -
paint
This method draws the information pertaining to the current mode as a string centered vertically in theRectangleaRectangle, havinggetAlignment()as alignment.- Parameters:
aGraphics- the graphics to paint on.aRectangle- the rectangle to fit the information in. If the information does not fit into the box, it is abbreviated.
-
processMouseEvent
TheMouseEventaMouseEvent causes the properties of importance to the current mode to be updated. This method is called bymouseMoved(java.awt.event.MouseEvent)andmousePressed(java.awt.event.MouseEvent).- Parameters:
aMouseEvent- the mouse event based on which the properties will be updated.
-
mouseMoved
TheMouseEventme causes the properties of importance to the current mode to be updated.- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseDragged
This implementation is empty.MouseEventme is ignored.- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mousePressed
TheMouseEventme causes the properties of importance to the current mode to be updated.- Specified by:
mousePressedin interfaceMouseListener
-
mouseClicked
This implementation is empty.MouseEventme is ignored.- Specified by:
mouseClickedin interfaceMouseListener
-
mouseReleased
This implementation is empty.MouseEventme is ignored.- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseEntered
This implementation is empty.MouseEventme is ignored.- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
This implementation is empty.MouseEventme is ignored.- Specified by:
mouseExitedin interfaceMouseListener
-