public class TLcdMapRulerController extends ALcdGXYSmartController implements MouseListener, MouseMotionListener
ILcdGXYController
interprets mouse events for displaying a
distance between points on the screen and the circle spanning the given distance.
Another, more advanced, ruler controller is available as well. Please refer to
TLcdAdvancedMapRulerController
.
Using this ILcdGXYController
method makes sense only when the
ILcdGXYView
it interacts with has a ILcdXYWorldReference
that is an instance of ILcdGridReference
.
If the property popupDialog is true, it pops up a Dialog in which the distance and azimuth of the last geodesic segment drawn, as well as the total distance of all segments are displayed.
Redefines formatDistance and formatAzimuth if you need to display these values with a specific unit of measure.
Redefine displayLastSegmentDistance, displayLastSegmentAzimuth and displayTotalDistance if you need to display all or some of these values differently.
Constructor and Description |
---|
TLcdMapRulerController()
Deprecated.
Default constructor for a
TLcdMapRulerController . |
TLcdMapRulerController(boolean aRegisterFlag)
Deprecated.
use the constructor without parameters.
|
Modifier and Type | Method and Description |
---|---|
protected double |
calculateAzimuth(int aFromX,
int aFromY,
int aToX,
int aToY)
Deprecated.
Calculates the azimuth between the model locations that are on screen
at[aFromX,aFromY] and [aTox,aToY].
|
protected double |
calculateDistance(int aFromX,
int aFromY,
int aToX,
int aToY)
Deprecated.
Calculates the model distance in meters between the model locations that
are on screen at[aFromX,aFromY] and [aTox,aToY].
|
protected void |
displayLastSegmentAzimuth(double aAzimuth,
MouseEvent me)
Deprecated.
|
protected void |
displayLastSegmentDistance(double aDistance,
MouseEvent me)
Deprecated.
|
protected void |
displayTotalDistance(double aDistance,
MouseEvent me)
Deprecated.
|
protected void |
doPanGXYView(int aDeltaX,
int aDeltaY)
Deprecated.
Performs the pan of this
ILcdGXYController
ILcdGXYView |
protected void |
doZoomGXYView(double aDoubleFactor)
Deprecated.
Performs the zoom of this
ILcdGXYController
ILcdGXYView |
protected String |
formatAzimuth(double aAzimuth,
MouseEvent me)
Deprecated.
Format the model azimuth aAzimuth in radians as a String.
|
protected String |
formatDistance(double aDistance,
MouseEvent me)
Deprecated.
Format the model distance aDistance in meters as a String.
|
ActionListener |
getActionListenerOnDoubleClick()
Deprecated.
|
Color |
getGhostColor()
Deprecated.
Returns the color of the lines and circles that will be rendered to graphically display the distances
on the map.
|
int |
getGhostLineWidth()
Deprecated.
GhostLineWidth is the property that holds the width of the lines and circle that
are drawn.
|
double |
getLastSegmentAzimuth()
Deprecated.
|
double |
getLastSegmentDistance()
Deprecated.
|
double |
getTotalDistance()
Deprecated.
|
boolean |
isDrawEqualDistanceCurve()
Deprecated.
The property drawEqualDistanceCurve determines whether to draw the circle.
|
boolean |
isDrawGeodesicLine()
Deprecated.
The property drawGeodesicLine determines whether to draw the lines.
|
boolean |
isPopupDialog()
Deprecated.
Returns whether a dialog should be shown displaying the values available in this controller.
|
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
mouseMoved(MouseEvent me)
Deprecated.
The mouse movement calculates and displays the new distances and calls a
repaint on the view, forcing a paint of this controller.
|
void |
mousePressed(MouseEvent me)
Deprecated.
|
void |
mouseReleased(MouseEvent me)
Deprecated.
A mouse release causes the last location to be added to the list of points
that are going to be linked.
|
void |
paint(Graphics aGraphics)
Deprecated.
Draws of a line between the mouse click points on the screen
and the drawing of the circle spanning the distance between
the last mouse clicking point and the current position
( if
isDrawEqualDistanceCurve() is true ). |
void |
setActionListenerOnDoubleClick(ActionListener aActionListener)
Deprecated.
|
void |
setDrawEqualDistanceCurve(boolean aDrawEqualDistanceCurve)
Deprecated.
Sets whether to render a curve representing points at an equal distance of the last point.
|
void |
setDrawGeodesicLine(boolean aDrawGeodesicLine)
Deprecated.
Sets whether to render lines of shortest distance between the points.
|
void |
setGhostColor(Color aGhostColor)
Deprecated.
Sets the color of the lines and circles that will be rendered to graphically display the distances
on the map.
|
void |
setGhostLineWidth(int aGhostLineWidth)
Deprecated.
GhostLineWidth is the property that holds the width of the lines and circle that
are drawn.
|
void |
setPopupDialog(boolean aPopupDialog)
Deprecated.
Sets whether a dialog should be shown displaying the values available in this controller.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
startInteraction(ILcdGXYView aGXYView)
Deprecated.
This method calls super.startInteraction( aGXYView ).
|
void |
terminateInteraction(ILcdGXYView aGXYView)
Deprecated.
Releases a few items.
|
void |
undo()
Deprecated.
Performs no action.
|
addUndoableListener, fireUndoableEvent, getDownPanChars, getDownPanCodes, getLeftPanChars, getLeftPanCodes, getPanAbsDelta, getPanAbsDelta, getRightPanChars, getRightPanCodes, getUndoableListenerCount, getUpPanChars, getUpPanCodes, getZoomInChars, getZoomInCodes, getZoomOutChars, getZoomOutCodes, isDragging, isPanOnMouseDragExit, isPanOnMouseMoveExit, isPanUndoable, isRequestFocusOnMouseEntered, isRequestFocusOnMousePressed, isZoomUndoable, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, removeUndoableListener, setDownPanChars, setDownPanCodes, setIsDragging, setLeftPanChars, setLeftPanCodes, setPanAbsDelta, setPanOnMouseDragExit, setPanOnMouseMoveExit, setPanUndoable, setRequestFocusOnMouseEntered, setRequestFocusOnMousePressed, setRightPanChars, setRightPanCodes, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCT
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription, viewRepaint
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseClicked, mouseEntered, mouseExited
mouseDragged
getLayered
public TLcdMapRulerController()
TLcdMapRulerController
.public TLcdMapRulerController(boolean aRegisterFlag)
aRegisterFlag
- whether to register this class as a bean or not.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.setTraceOn
in class ALcdGXYSmartController
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.public boolean isTraceOn()
true
if tracing is enabled for this class.isTraceOn
in class ALcdGXYSmartController
public void startInteraction(ILcdGXYView aGXYView)
Redefines formatDistance and formatAzimuth if you need to display these values with a specific unit of measure.
Redefine displayLastSegmentDistance, displayLastSegmentAzimuth and displayTotalDistance if you need to display all or some of these values differently.
startInteraction
in interface ILcdGXYController
startInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
will interact with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
public void terminateInteraction(ILcdGXYView aGXYView)
ALcdGXYController
terminateInteraction
in interface ILcdGXYController
terminateInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
interacted with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void mousePressed(MouseEvent me)
mousePressed
in interface MouseListener
mousePressed
in class ALcdGXYSmartController
public void mouseMoved(MouseEvent me)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class ALcdGXYSmartController
public void paint(Graphics aGraphics)
isDrawEqualDistanceCurve()
is true ).paint
in interface ILcdGXYController
paint
in class ALcdGXYController
aGraphics
- the Graphics on which the view was rendered.protected void displayLastSegmentDistance(double aDistance, MouseEvent me)
protected void displayLastSegmentAzimuth(double aAzimuth, MouseEvent me)
protected void displayTotalDistance(double aDistance, MouseEvent me)
public void mouseReleased(MouseEvent me)
mouseReleased
in interface MouseListener
mouseReleased
in class ALcdGXYSmartController
protected double calculateDistance(int aFromX, int aFromY, int aToX, int aToY)
Using this method only makes sense when the ILcdGXYView
this
ILcdGXYController
interacts with has a
ILcdGridReference
as a ILcdXYWorldReference
.
aFromX
- the first coordinate of the first pointaFromY
- the second coordinate of the first pointaToX
- the first coordinate of the second pointaToY
- the second coordinate of the second pointprotected double calculateAzimuth(int aFromX, int aFromY, int aToX, int aToY)
Using this method makes sense only when the ILcdGXYView
this
ILcdGXYController
interacts with has a
ILcdGridReference
as a ILcdXYWorldReference
.
aFromX
- the first coordinate of the first pointaFromY
- the second coordinate of the first pointaToX
- the first coordinate of the second pointaToY
- the second coordinate of the second pointprotected String formatDistance(double aDistance, MouseEvent me)
aDistance
- the distance to format, expressed in meters.me
- the mouse event that could have caused the distance to change. Note that this may be null.
This argument is not used in this implementation.distance < 100000
, in Km otherwiseprotected String formatAzimuth(double aAzimuth, MouseEvent me)
me
- the mouse event that could have caused the distance to change. Note that this may be null.
This argument is not used in this implementation.aAzimuth
- the azimuth between two points, expressed in radians !protected void doPanGXYView(int aDeltaX, int aDeltaY)
ALcdGXYSmartController
ILcdGXYController
ILcdGXYView
doPanGXYView
in class ALcdGXYSmartController
aDeltaX
- delta along the X axis, in AWT pixelsaDeltaY
- delta along the Y axis, in AWT pixelsprotected void doZoomGXYView(double aDoubleFactor)
ALcdGXYSmartController
ILcdGXYController
ILcdGXYView
doZoomGXYView
in class ALcdGXYSmartController
aDoubleFactor
- zoom factor with which to multiply the view's scalepublic double getLastSegmentDistance()
public double getLastSegmentAzimuth()
public double getTotalDistance()
public void undo()
public void setGhostColor(Color aGhostColor)
aGhostColor
- the color of the lines and circles that will be renderedsetGhostColor(java.awt.Color)
public Color getGhostColor()
getGhostColor()
public void setGhostLineWidth(int aGhostLineWidth)
aGhostLineWidth
- the line width to set.public int getGhostLineWidth()
public boolean isDrawEqualDistanceCurve()
true
if drawEqualDistanceCurve is true
, else false
is returned.public void setDrawEqualDistanceCurve(boolean aDrawEqualDistanceCurve)
aDrawEqualDistanceCurve
- true to have a curve rendered that shows points at equal distance of the last point.public boolean isPopupDialog()
startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void setPopupDialog(boolean aPopupDialog)
aPopupDialog
- true to have a dialog displaying the values available in this controller.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void setDrawGeodesicLine(boolean aDrawGeodesicLine)
aDrawGeodesicLine
- true to render lines of shortest distance between the points.public boolean isDrawGeodesicLine()
true
if drawGeodesicLine is true
, else false
is returned.public void setActionListenerOnDoubleClick(ActionListener aActionListener)
public ActionListener getActionListenerOnDoubleClick()