public class TLcdAdvancedMapRulerController extends ALcdGXYSmartController implements ILcdGXYChainableController
ILcdGXYController
serves the purpose of performing
measurements on an ILcdGXYView
. A measurement is defined by succeeding clicks on the map. The measurement can be ended with a right click or a double click. The measurement is displayed as a polyline having a distance label on every segment and a total distance label. Optionally, the azimuth of every segment can be displayed as well.
All style related settings can be changed using simple set methods. If more advanced customization of the visualization is required, the painters, editors and label painters can be replaced by overriding the factory methods that create them. Formatting of distance and azimuth can be modified by setting a different distance or azimuth format.
Several measure modes are available: geodetic, rhumbline and projection plane. Please refer
to setMeasureMode
for more details.
Events can be received whenever the measurement is changed. This can be used
to display the measurement values in a panel for instance. Please refer to
addMeasurementChangeListener
for more details.
Modifier and Type | Class and Description |
---|---|
static interface |
TLcdAdvancedMapRulerController.MeasurementChangeListener
Interface for listeners that want to be informed when the measurement
changes.
|
Modifier and Type | Field and Description |
---|---|
static int |
MEASURE_GEODETIC
Geodetic measure mode.
|
static int |
MEASURE_PROJECTION_PLANE
Projection plane measure mode.
|
static int |
MEASURE_RHUMBLINE
Rhumbline measure mode.
|
static String |
RULER_MODEL_TYPE_NAME
Returns the type name of the ruler model created by this controller.
|
Constructor and Description |
---|
TLcdAdvancedMapRulerController()
Creates a new
TLcdAdvancedMapRulerController , ready to be used. |
Modifier and Type | Method and Description |
---|---|
void |
addMeasurementChangeListener(TLcdAdvancedMapRulerController.MeasurementChangeListener aListener)
Adds the given
MeasurementChangeListener . |
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Add the given
PropertyChangeListener . |
void |
appendGXYController(ILcdGXYChainableController aEnd)
This method will append the passed controller to the end of the chain.
|
protected double |
calculateAzimuth(ILcdPoint aPoint1,
ILcdPoint aPoint2,
ILcdGeoReference aGeoReference,
int aMeasureMode,
ILcdGXYContext aGXYContext)
Calculates the azimuth in degrees between the two given points.
|
protected double |
calculateDistance(ILcdPoint aPoint1,
ILcdPoint aPoint2,
ILcdGeoReference aGeoReference,
int aMeasureMode,
ILcdGXYContext aGXYContext)
Calculates the distance in meters between the two given points.
|
protected ILcdGXYPainter |
createGXYEqualDistanceCurvePainter()
Creates the painter of the equal distance curve for the polylines used to measure the distances.
|
protected ILcdGXYLabelPainter |
createGXYLabelPainter()
Creates the label painter for the distance labels (or maybe angle labels,
etc).
|
protected TLcdGXYLayer |
createGXYLayer()
Create a new layer used for storing the measurements.
|
protected ILcdGXYLayerLabelPainter |
createGXYLayerLabelPainter()
Creates the
ILcdGXYLayerLabelPainter for the ruler controller. |
protected ILcdGXYEditor |
createGXYPolylineEditor()
Creates the editor for the polylines used to measure the distances.
|
protected ILcdGXYPainter |
createGXYPolylinePainter()
Creates the painter for the polylines used to measure the distances.
|
protected void |
firePropertyChangeEvent(PropertyChangeEvent aEvent) |
Format |
getAzimuthFormat()
Returns the format used to format azimuths and display them to the user.
|
Cursor |
getCursor()
Returns the cursor that will be displayed on a view when this controller is active for that view.
|
Format |
getDistanceFormat()
Returns the distance format used to format distances and display them to the user.
|
ILcdGXYController |
getGXYEditController()
Returns the edit controller that is currently used.
|
ILcdGXYLayer |
getGXYLayer()
Returns the ILcdGXYLayer containing the measurements.
|
ILcdGXYController |
getGXYNewController()
Returns the new controller that is currently used.
|
Color |
getHaloColor()
Returns the color of the halo to be added around measurement lines.
|
int |
getHaloThickness()
Returns the thickness (in pixels) of the halo to be added around measurement lines.
|
ILcdIcon |
getHotPointIcon()
Returns the hot point icon, it can be
null . |
int |
getLabelAlignment()
Returns the label alignment.
|
Color |
getLabelBackground()
Returns the background color of the labels.
|
Color |
getLabelForeground()
Returns the foreground color of the labels.
|
Color |
getLabelSelectionColor()
Returns the selection color of the labels.
|
int |
getLabelVGap()
Returns the orthogonal distance (in pixels) between the label and the line segment.
|
ILcdLayered |
getLayered()
Returns the layers associated with this controller.
|
ILcdGXYPainterStyle |
getLineStyle()
Returns the style to paint lines.
|
ILcdGeoReference |
getMeasurementGeoReference()
Returns the geo reference of the measurement points.
|
ILcdPoint |
getMeasurementPoint(int aIndex)
The measurement point at the given index.
|
int |
getMeasurementPointCount()
Returns the point count of the current measurement.
|
double |
getMeasurementSegmentAzimuth(int aIndex)
Returns the azimuth in degrees of the segment at the given index.
|
int |
getMeasurementSegmentCount()
Returns the amount of segments of the current measurement.
|
double |
getMeasurementSegmentDistance(int aIndex)
Returns the distance in meters of the segment at the given index.
|
double |
getMeasurementTotalDistance()
Returns the total distance in meters of the current measurement, the sum of
all the segment distances.
|
int |
getMeasureMode()
Returns the current measuring mode.
|
ILcdGXYChainableController |
getNextGXYController()
Returns a reference to the controller that is located after this one in a chain, or null
if this controller is the last element of the chain.
|
Font |
getSegmentLabelFont()
Returns the font of the segment distance labels (and possibly azimuth, if
isDisplayAzimuth() is true). |
ILcdGXYLayerSubsetList |
getSnappables()
Returns the snappables used by this controller.
|
Font |
getTotalDistanceLabelFont()
Returns the font of the total distance label.
|
void |
handleAWTEvent(AWTEvent aEvent)
This is method is called when the target of the listener has a new AWTEvent available.
|
boolean |
isAddGXYLayerToGXYView()
Checks if the layer containing measurements should be added to the view.
|
boolean |
isAllowMultipleMeasurements()
Checks if multiple measurements are allowed at the same time.
|
boolean |
isAlwaysCreate()
Returns whether or not you can only create new measurements, not change existing ones.
|
boolean |
isDisplayAzimuth()
Returns true if the azimuth is displayed on the map.
|
boolean |
isDrawEqualDistanceCurve()
Returns true if the equal distance curve(s) are drawn, false otherwise.
|
boolean |
isHaloEnabled()
Returns if the halo effect on the measurement lines is enabled.
|
boolean |
isLabelFilled()
Returns true if a filled rectangle should be painted behind the labels.
|
boolean |
isLabelFontBorder()
Returns true if a border is painted around the label text in the background color.
|
boolean |
isLabelFrame()
Returns true if the labels are surrounded by a frame, false otherwise.
|
boolean |
isLabelRotationAllowed()
Returns true if the labels can be rotated along the polyline, false otherwise.
|
boolean |
isPreserveMeasurement()
Returns true if the measurement is preserved when the controller is terminated and
started again.
|
boolean |
isRemoveGXYLayerFromGXYView()
Checks if the layer containing measurements should be removed from the view after terminating
the controller interaction.
|
void |
keyPressed(KeyEvent event)
No action performed.
|
void |
keyReleased(KeyEvent event)
Calls doPanGXYView or doZoomGXYView depending on
the value of e.getKeyChar().
|
void |
keyTyped(KeyEvent event)
No action performed.
|
void |
mouseClicked(MouseEvent event) |
void |
mouseDragged(MouseEvent event) |
void |
mouseEntered(MouseEvent event) |
void |
mouseExited(MouseEvent event)
Will perform a pan depending on the values of isDragging,
isPanOnMouseDragExit and isPanOnMouseMoveExit properties
|
void |
mouseMoved(MouseEvent event) |
void |
mousePressed(MouseEvent event) |
void |
mouseReleased(MouseEvent event) |
void |
paint(Graphics aGraphics)
Enables the controller to give visual feedback on the current user interactions.
|
protected void |
recalculateMeasureMents()
Invalidates the calculations.
|
void |
removeMeasurementChangeListener(TLcdAdvancedMapRulerController.MeasurementChangeListener aListener)
Removes the given
MeasurementChangeListener . |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Removes the given
PropertyChangeListener . |
void |
setAddGXYLayerToGXYView(boolean aAddGXYLayerToGXYView)
When set to true, the layer containing measurements is added to the view.
|
void |
setAllowMultipleMeasurements(boolean aAllowMultipleMeasurements)
When set to true, multiple measurements are allowed at the same time.
|
void |
setAlwaysCreate(boolean aAlwaysCreate)
Determines whether or not you can only create new measurements, not change existing ones.
|
void |
setAzimuthFormat(Format aAzimuthFormat)
Sets the azimuth format to be used to format azimuths and display them to the user.
|
void |
setDisplayAzimuth(boolean aDisplayAzimuth)
Set to true if the azimuth must be displayed as a label on the map.
|
void |
setDistanceFormat(Format aDistanceFormat)
Sets the distance format to use to format distances to be displayed to the user.
|
void |
setDrawEqualDistanceCurve(boolean aDrawEqualDistanceCurve)
Sets if the equal distance curve(s) are drawn or not.
|
void |
setGXYEditController(ILcdGXYController aGXYEditController)
Sets the edit controller that is used to modify the measurement after it has
been created.
|
void |
setGXYNewController(ILcdGXYController aGXYNewController)
Sets the new controller that is used to create a new measurement on the
map.
|
void |
setHaloColor(Color aHaloColor)
Sets the color of the halo to be added around measurement lines.
|
void |
setHaloEnabled(boolean aHaloEnabled)
Enables or disables the halo effect on the measurement lines.
|
void |
setHaloThickness(int aHaloThickness)
Sets the thickness (in pixels) of the halo to be added around measurement lines.
|
void |
setHotPointIcon(ILcdIcon aHotPointIcon)
Sets the hot point icon, used to paint the handles on the measurement line.
|
void |
setLabelAlignment(int aLabelAlignment)
Sets the label alignment.
|
void |
setLabelBackground(Color aLabelBackground)
Sets the background color of the labels.
|
void |
setLabelFilled(boolean aLabelFilled)
Sets if a filled rectangle should be painted behind the labels.
|
void |
setLabelFontBorder(boolean aLabelFontBorder)
Sets if the painted text should be bordered with the background color.
|
void |
setLabelForeground(Color aLabelForeground)
Sets the foreground color of the labels.
|
void |
setLabelFrame(boolean aLabelFrame)
Labels can be drawn surrounded by a frame, the frame property determines
whether to frame the labels or not.
|
void |
setLabelRotationAllowed(boolean aLabelRotationAllowed)
Labels can be rotated so that they have the same angle as the polyline.
|
void |
setLabelSelectionColor(Color aLabelSelectionColor)
Sets the selection color of the labels.
|
void |
setLabelVGap(int aVerticalGap)
Sets the orthogonal distance (in pixels) between the label and the line segment.
|
void |
setLineStyle(ILcdGXYPainterStyle aLineStyle)
Sets the style to use to paint lines.
|
void |
setMeasureMode(int aMeasureMode)
Sets the current measuring mode.
|
void |
setNextGXYController(ILcdGXYChainableController aNext)
This method sets the next controller in the chain for this controller.
|
void |
setPreserveMeasurement(boolean aPreserveMeasurement)
Set to true to preserve the measurement between succeeding calls to
startInteraction(com.luciad.view.gxy.ILcdGXYView)
and terminateInteraction(com.luciad.view.gxy.ILcdGXYView) . |
void |
setRemoveGXYLayerFromGXYView(boolean aRemoveGXYLayerFromGXYView)
When set to true, the layer containing measurements is removed from the view after terminating
the controller interaction.
|
void |
setSegmentLabelFont(Font aSegmentLabelFont)
Sets the font of the segment distance labels (and possibly azimuth, if
isDisplayAzimuth() is true) to the given font. |
void |
setSnappables(ILcdGXYLayerSubsetList aSnappables)
Sets the new snappables for this controller, default is null.
|
void |
setTotalDistanceLabelFont(Font aTotalDistanceLabelFont)
Sets the font of the total distance label.
|
void |
startInteraction(ILcdGXYView aGXYView)
Sets up the controller to receive input through the view passed.
|
void |
terminateInteraction(ILcdGXYView aGXYView)
Releases a few items.
|
void |
viewRepaint(ILcdGXYView aILcdGXYView)
Empty implementation.
|
addUndoableListener, doPanGXYView, doZoomGXYView, fireUndoableEvent, getDownPanChars, getDownPanCodes, getLeftPanChars, getLeftPanCodes, getPanAbsDelta, getPanAbsDelta, getRightPanChars, getRightPanCodes, getUndoableListenerCount, getUpPanChars, getUpPanCodes, getZoomInChars, getZoomInCodes, getZoomOutChars, getZoomOutCodes, isDragging, isPanOnMouseDragExit, isPanOnMouseMoveExit, isPanUndoable, isRequestFocusOnMouseEntered, isRequestFocusOnMousePressed, isTraceOn, isZoomUndoable, removeUndoableListener, setDownPanChars, setDownPanCodes, setIsDragging, setLeftPanChars, setLeftPanCodes, setPanAbsDelta, setPanOnMouseDragExit, setPanOnMouseMoveExit, setPanUndoable, setRequestFocusOnMouseEntered, setRequestFocusOnMousePressed, setRightPanChars, setRightPanCodes, setTraceOn, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCT
addStatusListener, asGXYController, fireStatusEvent, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIcon, getName, getShortDescription
public static final int MEASURE_GEODETIC
setMeasureMode(int)
,
Constant Field Valuespublic static final int MEASURE_RHUMBLINE
setMeasureMode(int)
,
Constant Field Valuespublic static final int MEASURE_PROJECTION_PLANE
setMeasureMode(int)
,
Constant Field Valuespublic static final String RULER_MODEL_TYPE_NAME
public TLcdAdvancedMapRulerController()
TLcdAdvancedMapRulerController
, ready to be used.public void startInteraction(ILcdGXYView aGXYView)
ALcdGXYController
All ILcdGXYView
implementations that support interaction call this method when the controller
has been made active with setGXYController
on the view,
so this method shouldn't normally be called directly.
Note that most view implementations add the controller as listener if appropriate before calling
this method.
Sets the cursor on the view and sets the view for which this controller is now active.
Sends out a status event based on the short description
.
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 viewRepaint(ILcdGXYView aILcdGXYView)
ALcdGXYController
viewRepaint
in interface ILcdGXYController
viewRepaint
in class ALcdGXYController
aILcdGXYView
- the ILcdGXYView
to draw on.protected void firePropertyChangeEvent(PropertyChangeEvent aEvent)
public void paint(Graphics aGraphics)
ALcdGXYController
Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
paint
in interface ILcdGXYController
paint
in class ALcdGXYController
aGraphics
- the Graphics on which the view was rendered.public ILcdLayered getLayered()
ILcdGXYController
Custom implementations of this method should take care to return the same ILcdLayered
instance every time this method is called to guarantee correct working of the ILcdLayered
interface.
getLayered
in interface ILcdGXYController
public Cursor getCursor()
ILcdGXYController
getCursor
in interface ILcdGXYController
getCursor
in class ALcdGXYController
Cursor
set by setCursor, or Cursor.getDefaultCursor()
if no Cursor
has been set yet.public void keyTyped(KeyEvent event)
ALcdGXYSmartController
keyTyped
in interface KeyListener
keyTyped
in class ALcdGXYSmartController
public void keyPressed(KeyEvent event)
ALcdGXYSmartController
keyPressed
in interface KeyListener
keyPressed
in class ALcdGXYSmartController
public void keyReleased(KeyEvent event)
ALcdGXYSmartController
keyReleased
in interface KeyListener
keyReleased
in class ALcdGXYSmartController
public void mousePressed(MouseEvent event)
mousePressed
in interface MouseListener
mousePressed
in class ALcdGXYSmartController
public void mouseReleased(MouseEvent event)
mouseReleased
in interface MouseListener
mouseReleased
in class ALcdGXYSmartController
public void mouseClicked(MouseEvent event)
mouseClicked
in interface MouseListener
mouseClicked
in class ALcdGXYSmartController
public void mouseEntered(MouseEvent event)
mouseEntered
in interface MouseListener
mouseEntered
in class ALcdGXYSmartController
public void mouseExited(MouseEvent event)
ALcdGXYSmartController
mouseExited
in interface MouseListener
mouseExited
in class ALcdGXYSmartController
public void mouseMoved(MouseEvent event)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class ALcdGXYSmartController
public void mouseDragged(MouseEvent event)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class ALcdGXYSmartController
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
.aPropertyChangeListener
- The listener to be added.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
. Does nothing if the
listener was never added (or already removed).aPropertyChangeListener
- The listener to remove.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void addMeasurementChangeListener(TLcdAdvancedMapRulerController.MeasurementChangeListener aListener)
MeasurementChangeListener
. This allows to receive updates
whenever the measurement is changed.aListener
- The listener to add.removeMeasurementChangeListener(com.luciad.view.map.TLcdAdvancedMapRulerController.MeasurementChangeListener)
public void removeMeasurementChangeListener(TLcdAdvancedMapRulerController.MeasurementChangeListener aListener)
MeasurementChangeListener
. Does nothing if the
listener was never added or already removed.aListener
- The listener to remove.addMeasurementChangeListener(com.luciad.view.map.TLcdAdvancedMapRulerController.MeasurementChangeListener)
public int getMeasureMode()
public void setMeasureMode(int aMeasureMode)
aMeasureMode
- The measuring mode. One of
protected void recalculateMeasureMents()
public Format getDistanceFormat()
setDistanceFormat(java.text.Format)
public void setDistanceFormat(Format aDistanceFormat)
aDistanceFormat
- The new distance formatgetDistanceFormat()
public Format getAzimuthFormat()
setAzimuthFormat(java.text.Format)
public void setAzimuthFormat(Format aAzimuthFormat)
aAzimuthFormat
- The new azimuth format.getAzimuthFormat()
public boolean isDrawEqualDistanceCurve()
setDrawEqualDistanceCurve(boolean)
public void setDrawEqualDistanceCurve(boolean aDrawEqualDistanceCurve)
aDrawEqualDistanceCurve
- True to draw the curves, false otherwise.public ILcdGXYLayerSubsetList getSnappables()
getSnappables()
public void setSnappables(ILcdGXYLayerSubsetList aSnappables)
aSnappables
- The new list of snappables for this controllergetSnappables()
public ILcdGXYController getGXYEditController()
setGXYEditController(com.luciad.view.gxy.ILcdGXYController)
public void setGXYEditController(ILcdGXYController aGXYEditController)
getSnappables()
is automatically
passed to the given aGXYEditController.
Note that the edit controller will only be activated when a measurement
already exists and when the mouse touches it (ILcdGXYPainter.isTouched).
The list of snappables (getSnappables()
) is also automatically set
to the given controller, provided the controller is of type
TLcdGXYEditController
or TLcdGXYEditController2
.
For other types, the snappables should be passed to the controller manually.
The edit controller must not be set while this controller is active.aGXYEditController
- The edit controller. Preferably an instance of
TLcdGXYEditController
or TLcdGXYEditController2
.getGXYEditController()
,
setAlwaysCreate(boolean)
public ILcdGXYController getGXYNewController()
setGXYNewController(com.luciad.view.gxy.ILcdGXYController)
public void setGXYNewController(ILcdGXYController aGXYNewController)
ILcdGXYNewControllerModel
or ALcdGXYNewControllerModel2
is automatically set to the given aGXYNewController so that it creates the correct object
type, provided the controller is of type TLcdGXYNewController
or
TLcdGXYNewController2
, respectively.
If the controller is of an other type, the user should make sure it creates
the correct type of objects.
The list of snappables (getSnappables()
) is also automatically set
to the given controller, provided the controller is of type
TLcdGXYNewController
or TLcdGXYNewController2
.
For other types, the snappables should
be passed to the controller manually.
The new controller must not be set while this controller is active.aGXYNewController
- The new controller. Preferably an instance of
TLcdGXYNewController
or TLcdGXYNewController2
.getGXYNewController()
public void setLineStyle(ILcdGXYPainterStyle aLineStyle)
aLineStyle
- the new line style to set.getLineStyle()
public ILcdGXYPainterStyle getLineStyle()
setLineStyle(com.luciad.view.gxy.ILcdGXYPainterStyle)
public boolean isDisplayAzimuth()
setDisplayAzimuth(boolean)
public void setDisplayAzimuth(boolean aDisplayAzimuth)
Set to true if the azimuth must be displayed as a label on the map. Default is false.
When set to true
, an arrow is also added to the middle of every line segment.
aDisplayAzimuth
- True to display azimuth on the map, false
otherwise.isDisplayAzimuth()
public void setHaloEnabled(boolean aHaloEnabled)
aHaloEnabled
- true if halos should be added, false otherwiseisHaloEnabled()
public boolean isHaloEnabled()
setHaloEnabled(boolean)
public void setHaloThickness(int aHaloThickness)
aHaloThickness
- the thickness (in pixels) of the halo to be added around measurement lines.getHaloThickness()
public int getHaloThickness()
setHaloThickness(int)
public void setHaloColor(Color aHaloColor)
aHaloColor
- the color of the halo to be added around measurement lines.getHaloColor()
public Color getHaloColor()
setHaloColor(Color)
public boolean isPreserveMeasurement()
setPreserveMeasurement(boolean)
.public void setPreserveMeasurement(boolean aPreserveMeasurement)
startInteraction(com.luciad.view.gxy.ILcdGXYView)
and terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
. If set to false, the previous measurement is removed every
time the controller is started.aPreserveMeasurement
- True to preserve measurements, false otherwise.public ILcdGXYLayer getGXYLayer()
If the preserve measurement is set to false, the contents of the layer are cleared when terminating the interaction with the controller. If it is set ot true, the measurements are kept.
If the allow multiple measurements flag is set ot true, the layer contains at most one measurement. If not, it can contain any number of measurements.
setAllowMultipleMeasurements(boolean)
,
setPreserveMeasurement(boolean)
public void setAllowMultipleMeasurements(boolean aAllowMultipleMeasurements)
Multiple measurements only works when using a TLcdGXYNewController2. If not, creating a new measurement can be interrupted when touching an other measurement.
In order to have control over the removal of measurements, the measurement layer can be used,
getGXYLayer()
can be used.
aAllowMultipleMeasurements
- true to allow multiple measurements at the same time.public boolean isAllowMultipleMeasurements()
setAllowMultipleMeasurements(boolean)
public void setAlwaysCreate(boolean aAlwaysCreate)
allowing multiple measurements
.
It allows you to define a new measurement starting from an existing one.
The default value is false
, which means that clicking or dragging an existing measurement edits that
measurement.
snappables list
.
samples.gxy.common.controller.SnappablesSubsetList
sample class and
adding the ruler's layer to it as follows:
new TLcdAdvancedMapRulerController() {
public void startInteraction(ILcdGXYView aGXYView) {
super.startInteraction(aGXYView);
// Allow snapping to the ruler controller measurements
fSnappables.getSnappableLayers().add(getGXYLayer());
}
public void terminateInteraction(ILcdGXYView aGXYView) {
fSnappables.getSnappableLayers().remove(getGXYLayer());
super.terminateInteraction(aGXYView);
}
};
aAlwaysCreate
- true to always define new measurementssetAllowMultipleMeasurements(boolean)
public boolean isAlwaysCreate()
setAllowMultipleMeasurements(boolean)
allows you to
define a new measurement starting from an existing one.public void setAddGXYLayerToGXYView(boolean aAddGXYLayerToGXYView)
The layer will only display its contents after terminating interaction with the view when the preserve measurements property is enabled, and when the remove measurement layer setting is disabled.
aAddGXYLayerToGXYView
- true if the measurement layer should be added to the view,
and false otherwise.setPreserveMeasurement(boolean)
,
setRemoveGXYLayerFromGXYView(boolean)
public boolean isAddGXYLayerToGXYView()
setAddGXYLayerToGXYView(boolean)
public void setRemoveGXYLayerFromGXYView(boolean aRemoveGXYLayerFromGXYView)
aRemoveGXYLayerFromGXYView
- true if the measurement layer should be removed from the view,
and false otherwise.setAddGXYLayerToGXYView(boolean)
public boolean isRemoveGXYLayerFromGXYView()
(boolean)
public void setLabelAlignment(int aLabelAlignment)
aLabelAlignment
- The alignment of the label. One of
TLcdGXYPolylineLabelPainter.ABOVE
,
TLcdGXYPolylineLabelPainter.CENTER
,
TLcdGXYPolylineLabelPainter.BELOW
public int getLabelAlignment()
TLcdGXYPolylineLabelPainter.ABOVE
,
TLcdGXYPolylineLabelPainter.CENTER
,
TLcdGXYPolylineLabelPainter.BELOW
.public void setTotalDistanceLabelFont(Font aTotalDistanceLabelFont)
aTotalDistanceLabelFont
- The font.public Font getTotalDistanceLabelFont()
public void setSegmentLabelFont(Font aSegmentLabelFont)
isDisplayAzimuth()
is true) to the given font.aSegmentLabelFont
- The new font.public Font getSegmentLabelFont()
isDisplayAzimuth()
is true).public boolean isLabelFontBorder()
setLabelFontBorder(boolean)
public void setLabelFontBorder(boolean aLabelFontBorder)
aLabelFontBorder
- True if text should be bordered, false otherwise.isLabelFontBorder()
public void setLabelForeground(Color aLabelForeground)
aLabelForeground
- The foreground color of the labels.public Color getLabelForeground()
public void setLabelBackground(Color aLabelBackground)
isLabelFilled()
returns true, or to paint
a border around the text when isLabelFontBorder()
returns true.aLabelBackground
- The background color of the labels.public Color getLabelBackground()
public void setLabelSelectionColor(Color aLabelSelectionColor)
aLabelSelectionColor
- The label selection color.public Color getLabelSelectionColor()
public void setLabelFrame(boolean aLabelFrame)
aLabelFrame
- True if the labels should be surrounded by a frame,
false otherwise.public boolean isLabelFrame()
public void setLabelRotationAllowed(boolean aLabelRotationAllowed)
aLabelRotationAllowed
- True if the labels can be rotated, false otherwise.public boolean isLabelRotationAllowed()
setLabelRotationAllowed(boolean)
public void setLabelFilled(boolean aLabelFilled)
getLabelBackground()
color.aLabelFilled
- True if a filled rectangle is painted behind the
labels, false otherwise.public boolean isLabelFilled()
public void setLabelVGap(int aVerticalGap)
aVerticalGap
- The orthogonal distance (in pixels) between the label and the line segment.public int getLabelVGap()
public ILcdIcon getHotPointIcon()
null
.null
.setHotPointIcon(com.luciad.gui.ILcdIcon)
public void setHotPointIcon(ILcdIcon aHotPointIcon)
aHotPointIcon
- The hot point icon, or null
for a default icon.ALcdGXYPen.setHotPointIcon(com.luciad.gui.ILcdIcon)
public int getMeasurementPointCount()
getMeasurementPoint(int)
public ILcdPoint getMeasurementPoint(int aIndex)
aIndex
- The index of the point to retrieve. 0 <= aIndex < getMeasurementPointCount()getMeasurementPointCount()
public ILcdGeoReference getMeasurementGeoReference()
getMeasurementPointCount()
public int getMeasurementSegmentCount()
getMeasurementSegmentDistance(int)
,
getMeasurementSegmentAzimuth(int)
public double getMeasurementSegmentDistance(int aIndex)
Double.NaN
if no distance is available. Please note that
Double.NaN == Double.NaN
always returns false
,
one must use Double.isNaN( double )
.aIndex
- The index of the segment. 0 <= aIndex < getMeasurementSegmentCount()getMeasurementSegmentCount()
public double getMeasurementSegmentAzimuth(int aIndex)
Double.NaN
if
no azimuth is available. Please note that Double.NaN ==
Double.NaN
always returns false
, one must use
Double.isNaN( double )
.aIndex
- The index of the segment. 0 <= aIndex < getMeasurementSegmentCount()getMeasurementSegmentCount()
public double getMeasurementTotalDistance()
Double.NaN
if no total
distance is available. Please note that Double.NaN ==
Double.NaN
always returns false
, one must use
Double.isNaN( double )
.protected TLcdGXYLayer createGXYLayer()
The default implementation returns a new TLcdGXYLayer.
protected ILcdGXYPainter createGXYPolylinePainter()
ILcd3DEditablePolyline
.
The properties of the returned painter must be synchronized with the
properties of this controller. For example, if the lineStyle of this controller is
changed, the returned painter must respect this change. This can easily
be achieved by adding a property change listener to this controller that
synchronizes the properties of this controller and the painter.
If you override this method, make sure that the painter also implements ILcdGXYEditor,
or override createGXYPolylineEditor()
as well.ILcd3DEditablePolyline
objects.protected ILcdGXYEditor createGXYPolylineEditor()
ILcd3DEditablePolyline
.
The properties of the returned editor must be synchronized with the
properties of this controller. For example, if the lineStyle of this controller is
changed, the returned editor must respect this change. This can easily
be achieved by adding a property change listener to this controller that
synchronizes the properties of this controller and the painter.
The default implementation of this method calls createGXYPolylinePainter()
and casts it to ILcdGXYEditor
.ILcd3DEditablePolyline
objects.protected ILcdGXYPainter createGXYEqualDistanceCurvePainter()
ILcd3DEditablePolyline
, and draw the equal distance
curve when the polyline is modified.
The properties of the returned painter must be synchronized with the
properties of this controller. For example, if the lineStyle of this controller is
changed, the returned painter must respect this change. This can easily
be achieved by adding a property change listener to this controller that
synchronizes the properties of this controller and the painter.ILcd3DEditablePolyline
objects and paints the equal distance curve
when the polyline is modified.protected ILcdGXYLabelPainter createGXYLabelPainter()
ILcdGXYMultiLabelPainter
to put
multiple labels on the one polyline.
This label painter must accept objects of type
ILcd3DEditablePolyline
. This object implements both
ILcdDataObject
and
ILcdFeatured
. The object has the following three properties (features):
Double
Vector
of Double
s) containing
the distance in meters for every segmentILcdGXYLabelPainter
responsible to paint the distance labels etc.protected ILcdGXYLayerLabelPainter createGXYLayerLabelPainter()
ILcdGXYLayerLabelPainter
for the ruler controller. This painter
is used to position the different labels, so it contains the label decluttering logic.ILcdGXYLayerLabelPainter
responsible to position the labels.protected double calculateDistance(ILcdPoint aPoint1, ILcdPoint aPoint2, ILcdGeoReference aGeoReference, int aMeasureMode, ILcdGXYContext aGXYContext)
aPoint1
- The first point.aPoint2
- The second point.aGeoReference
- The geo reference of the points.aMeasureMode
- The measure mode: one of MEASURE_GEODETIC,
MEASURE_RHUMBLINE or MEASURE_PROJECTION_PLANEaGXYContext
- The context.Double.NaN == Double.NaN
always returns false
,
one must use Double.isNaN( double )
.protected double calculateAzimuth(ILcdPoint aPoint1, ILcdPoint aPoint2, ILcdGeoReference aGeoReference, int aMeasureMode, ILcdGXYContext aGXYContext)
aPoint1
- The first point.aPoint2
- The second point.aGeoReference
- The geo reference of the points.aMeasureMode
- The measure mode: one of MEASURE_GEODETIC,
MEASURE_RHUMBLINE or MEASURE_PROJECTION_PLANEaGXYContext
- The context.Double.NaN == Double.NaN
always returns false
,
one must use Double.isNaN( double )
.public ILcdGXYChainableController getNextGXYController()
ILcdGXYChainableController
getNextGXYController
in interface ILcdGXYChainableController
ILcdGXYChainableController.setNextGXYController(ILcdGXYChainableController)
public void setNextGXYController(ILcdGXYChainableController aNext)
ILcdGXYChainableController
setNextGXYController
in interface ILcdGXYChainableController
aNext
- the reference to the controller that will be the next element in the chainILcdGXYChainableController.getNextGXYController()
public void appendGXYController(ILcdGXYChainableController aEnd)
ILcdGXYChainableController
appendGXYController
in interface ILcdGXYChainableController
aEnd
- the controller to be appended to the end of the chain.public void handleAWTEvent(AWTEvent aEvent)
ILcdAWTEventListener
handleAWTEvent
in interface ILcdAWTEventListener
aEvent
- The event to be handled.