Class StatusBarListener
java.lang.Object
org.gvsig.app.project.documents.view.toolListeners.StatusBarListener
- All Implemented Interfaces:
org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener,org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener
public class StatusBarListener
extends Object
implements org.gvsig.fmap.mapcontrol.tools.Listeners.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:
- uses
formatDegrees(p.get{X or Y}()if the associatedMapControlobject isn't projected. - uses
formatDegrees({MapControl's projection}.toGeo(p.get{X or Y}())if the associatedMapControlobject is projected and itsViewPort's distance units are in degrees. - uses
{NumberFormat according tootherwise.#setFractionDigits(Point2D)}.format((p.get{X or Y}()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])
The prefix of the coordinate expressions will be:
- Longitude "Long =" and latitude "Lat =", if the associated MapControl object isn't projected, or the current distance unit
of the
MapControl's view port is in degrees. - X "X =" and Y "Y =", otherwise.
And the sufix value:
- If the associated MapControl object isn't projected, or the current distance unit
of the
MapControl's view port is in degrees(expected latitude or longitude), according this pattern:
S?GÂș M' S'', having:
- S? : optionally, if the value is negative, sets a "-" symbol.
- G : equivalent grades.
- M : equivalent minutes.
- S : equivalent seconds.
- Otherwise a decimal number according this rules:
- Author:
- Vicente Caballero Navarro
-
Constructor Summary
ConstructorsConstructorDescriptionStatusBarListener(org.gvsig.fmap.mapcontrol.MapControl mc) Creates a newStatusBarListenerobject. -
Method Summary
Modifier and TypeMethodDescriptionbooleanString[]Returns the coordinates equivalent top: UsesformatDegrees(p.get{X or Y}()if the associatedMapControlobject isn't projected. UsesformatDegrees({MapControl's projection}.toGeo(p.get{X or Y}())if the associatedMapControlobject is projected and itsViewPort's distance units are in degrees. Uses{NumberFormat according tootherwise.#setFractionDigits(Point2D)}.format((p.get{X or Y}()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])voidpoint(org.gvsig.fmap.mapcontrol.tools.Events.PointEvent event) voidpointDoubleClick(org.gvsig.fmap.mapcontrol.tools.Events.PointEvent event) String[]setCoorDisplayText(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 theMapControl's view port is in degrees. X and Y, otherwise.void
-
Constructor Details
-
StatusBarListener
public StatusBarListener(org.gvsig.fmap.mapcontrol.MapControl mc) Creates a new
StatusBarListenerobject.- Parameters:
mc- theMapControlwhere will be applied the changes
-
-
Method Details
-
getImageCursor
- Specified by:
getImageCursorin interfaceorg.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener
-
cancelDrawing
public boolean cancelDrawing()- Specified by:
cancelDrawingin interfaceorg.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener
-
point
public void point(org.gvsig.fmap.mapcontrol.tools.Events.PointEvent event) throws org.gvsig.fmap.mapcontrol.tools.BehaviorException - Specified by:
pointin interfaceorg.gvsig.fmap.mapcontrol.tools.Listeners.PointListener- Throws:
org.gvsig.fmap.mapcontrol.tools.BehaviorException
-
setFractionDigits
Sets the number of decimals of the coordinates that will be displayed, according the current projection of the associated
MapControl:- Parameters:
p- unused parameter
-
setCoorDisplayText
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. - X and Y, otherwise.
- Parameters:
p- array of at least twoString, where text will be stored and returned- Returns:
- text describing the coordinate value:
- If isn't projected:
String[0]: "Long = "String[1]: "Lat = "
- Otherwise:
String[0]: "X = "String[1]: "Y = "
- If isn't projected:
- Longitude and Latitude, if the associated MapControl object isn't projected, or the current distance unit
of the
-
getCoords
Returns the coordinates equivalent to
p:- Uses
formatDegrees(p.get{X or Y}()if the associatedMapControlobject isn't projected. - Uses
formatDegrees({MapControl's projection}.toGeo(p.get{X or Y}())if the associatedMapControlobject is projected and itsViewPort's distance units are in degrees. - Uses
{NumberFormat according tootherwise.#setFractionDigits(Point2D)}.format((p.get{X or Y}()/MapContext.CHANGEM[mapControl.getViewPort().getDistanceUnits()])*MapContext.CHANGEM[mapControl.getViewPort().getMapUnits()])
- Parameters:
p- point 2D to convert in text coordinates according the projection of the associatedMapControland the distance units of itsViewPort.- Returns:
- coordinates equivalent to
p, according to the algorithm explained up
- Uses
-
pointDoubleClick
public void pointDoubleClick(org.gvsig.fmap.mapcontrol.tools.Events.PointEvent event) throws org.gvsig.fmap.mapcontrol.tools.BehaviorException - Specified by:
pointDoubleClickin interfaceorg.gvsig.fmap.mapcontrol.tools.Listeners.PointListener- Throws:
org.gvsig.fmap.mapcontrol.tools.BehaviorException
-