public class StatusBarListener extends java.lang.Object implements PointListener
Listener that displays at the status bar of the application's main frame, the value of the point coordinates of the mouse's
cursor on the associated MapControl, just as is received a PointEvent event.
Calculates the coordinates equivalent to the point according this rules:
formatDegrees(p.get{X or Y}() if the associated MapControl object isn't projected.formatDegrees({MapControl's projection}.toGeo(p.get{X or Y}()) if the associated
MapControl object is projected and its ViewPort's distance units are in degrees.{NumberFormat according to #setFractionDigits(Point2D)}.format((p.get{X or Y}()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])
otherwise.The prefix of the coordinate expressions will be:
MapControl's view port is in degrees.And the sufix value:
MapControl's view port is in degrees(expected latitude or longitude), according this pattern:S?Gš M' S'', having:| Constructor and Description |
|---|
StatusBarListener(MapControl mc)
Creates a new
StatusBarListener object. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancelDrawing()
Determines if the drawing process that this tool executes on the
MapControl
instance could be canceled or not. |
java.lang.String[] |
getCoords(java.awt.geom.Point2D p)
Returns the coordinates equivalent to
p:
Uses formatDegrees(p.get{X or Y}() if the associated MapControl object isn't projected. |
java.awt.Image |
getImageCursor()
Gets the
Cursor associated to this tool. |
void |
point(PointEvent event)
Called when one click is pressed on the associated
MapControl, or the location of the cursor
of the mouse has changed on it. |
void |
pointDoubleClick(PointEvent event)
Called when a double click is pressed on the associated
MapControl. |
java.lang.String[] |
setCoorDisplayText(java.lang.String[] axisText)
Gets the name of the coordinates:
Longitude and Latitude, if the associated MapControl object isn't projected, or the current distance unit
of the
MapControl's view port is in degrees. |
void |
setFractionDigits(java.awt.geom.Point2D p)
Sets the number of decimals of the coordinates that will be displayed, according the current projection
of the associated
MapControl:
8 decimals, if is using geographical coordinates:
EPSG:4230 (known as ED50). |
public StatusBarListener(MapControl mc)
Creates a new StatusBarListener object.
mc - the MapControl where will be applied the changespublic java.awt.Image getImageCursor()
ToolListenerGets the Cursor associated to this tool.
getImageCursor in interface ToolListenerpublic boolean cancelDrawing()
ToolListenerDetermines if the drawing process that this tool executes on the MapControl
instance could be canceled or not.
cancelDrawing in interface ToolListenertrue if is cancellable; otherwise returns falsepublic void point(PointEvent event) throws BehaviorException
PointListenerCalled when one click is pressed on the associated MapControl, or the location of the cursor
of the mouse has changed on it.
point in interface PointListenerevent - mouse event with the coordinates of the point selected on the associated MapControlBehaviorException - will be thrown when fails the process of this toolpublic void setFractionDigits(java.awt.geom.Point2D p)
Sets the number of decimals of the coordinates that will be displayed, according the current projection
of the associated MapControl:
p - unused parameterpublic java.lang.String[] setCoorDisplayText(java.lang.String[] axisText)
Gets the name of the coordinates:
MapControl's view port is in degrees.p - array of at least two String, where text will be stored and returnedString[0] : "Long = "String[1] : "Lat = "String[0] : "X = "String[1] : "Y = "public java.lang.String[] getCoords(java.awt.geom.Point2D p)
Returns the coordinates equivalent to p:
formatDegrees(p.get{X or Y}() if the associated MapControl object isn't projected.formatDegrees({MapControl's projection}.toGeo(p.get{X or Y}()) if the associated
MapControl object is projected and its ViewPort's distance units are in degrees.{NumberFormat according to #setFractionDigits(Point2D)}.format((p.get{X or Y}()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])
otherwise.p - point 2D to convert in text coordinates according the projection of the associated MapControl and the
distance units of its ViewPort.p, according to the algorithm explained uppublic void pointDoubleClick(PointEvent event) throws BehaviorException
PointListenerCalled when a double click is pressed on the associated MapControl.
pointDoubleClick in interface PointListenerevent - mouse event and the coordinates of the point selected on the associated MapControlBehaviorException - will be thrown when fails the process of this tool