Package com.luciad.tea
Class TLcdTerrainRulerController
java.lang.Object
com.luciad.view.gxy.controller.ALcdGXYController
com.luciad.view.gxy.controller.ALcdGXYSmartController
com.luciad.view.map.TLcdAdvancedMapRulerController
com.luciad.tea.TLcdTerrainRulerController
- All Implemented Interfaces:
ILcdUndoableSource
,ILcdAWTEventListener
,ILcdStatusSource
,ILcdGXYChainableController
,ILcdGXYController
,KeyListener
,MouseListener
,MouseMotionListener
,Serializable
,EventListener
Extension of
TLcdAdvancedMapRulerController
which takes into account
underlying terrain for distance calculations. Distance of every segment is calculated iteratively until
one of the following conditions is met:
- the difference between two consecutive calculations is less than the absolute tolerance set,
- the relative difference (compared to the latest calculation) between two consecutive calculations is less than the relative tolerance set,
- the distance between points generated in between the start and end point in the segment is less than the minimum step size set.
- the number of points generated in between the start and end point of the segment is higher than the maximum number of samples set.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.map.TLcdAdvancedMapRulerController
TLcdAdvancedMapRulerController.MeasurementChangeListener
-
Field Summary
Fields inherited from class com.luciad.view.map.TLcdAdvancedMapRulerController
MEASURE_GEODETIC, MEASURE_PROJECTION_PLANE, MEASURE_RHUMBLINE, RULER_MODEL_TYPE_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected double
calculateDistance
(ILcdPoint aStartPoint, ILcdPoint aEndPoint, ILcdGeoReference aGeoReference, int aMeasuringMode, ILcdGXYContext aGXYContext) Calculates the distance between the two points, taking into account the path defined by the measuring mode.double
Returns the absolute tolerance in meters for the distance calculated.int
Returns the maximum number of points that should be sampled in between two points for every segment.int
Returns the minimum number of intermediate points in between the start point and end point of every segment which are used in calculation of the distance of one segment.int
Returns the minimum distance (expressed in meters) between two intermediate points generated when calculating the distance of a segment.double
Returns the relative tolerance for the distance calculated.boolean
Returns whether terrain should be taken into account when computing the distance.retrieveSegmentScanner
(int aMeasuringMode, ILcdGeoReference aGeoReference, ILcdGXYContext aGXYContext) Returns a suitable segment scanner depending on the measuring mode and the reference of the start and end point.void
setAbsoluteTolerance
(double aAbsoluteTolerance) Sets the absolute tolerance in meters for the distance calculated.void
setMaximumSamples
(int aMaximumSamples) Sets the maximum number of points that should be sampled in between two points for every segment.void
setMinimumSamples
(int aMinimumSamples) Sets the minimum number of intermediate points in between the start point and end point of every segment which are used in calculation of the distance of one segment.void
setMinimumStepSize
(int aMinimumStepSize) Sets the minimum distance expressed in meters between two intermediate points generated when calculating the distance of a segment.void
setRelativeTolerance
(double aRelativeTolerance) Sets the relative tolerance for the distance calculated.void
setTerrainElevationProvider
(ALcdTerrainElevationProvider aTerrainElevationProvider) Sets the terrain elevation provider which is responsible for return elevation data on any segment of the ruler.void
setTraceOn
(boolean aTraceOn) Enables tracing for this class instance.void
setUseTerrain
(boolean aUseTerrain) Sets whether terrain should be taken into account when computing the distance.Methods inherited from class com.luciad.view.map.TLcdAdvancedMapRulerController
addMeasurementChangeListener, addPropertyChangeListener, appendGXYController, calculateAzimuth, createGXYEqualDistanceCurvePainter, createGXYLabelPainter, createGXYLayer, createGXYLayerLabelPainter, createGXYPolylineEditor, createGXYPolylinePainter, firePropertyChangeEvent, getAzimuthFormat, getCursor, getDistanceFormat, getGXYEditController, getGXYLayer, getGXYNewController, getHaloColor, getHaloThickness, getHotPointIcon, getLabelAlignment, getLabelBackground, getLabelForeground, getLabelSelectionColor, getLabelVGap, getLayered, getLineStyle, getMeasurementGeoReference, getMeasurementPoint, getMeasurementPointCount, getMeasurementSegmentAzimuth, getMeasurementSegmentCount, getMeasurementSegmentDistance, getMeasurementTotalDistance, getMeasureMode, getNextGXYController, getSegmentLabelFont, getSnappables, getTotalDistanceLabelFont, handleAWTEvent, isAddGXYLayerToGXYView, isAllowMultipleMeasurements, isAlwaysCreate, isDisplayAzimuth, isDrawEqualDistanceCurve, isHaloEnabled, isLabelFilled, isLabelFontBorder, isLabelFrame, isLabelRotationAllowed, isPreserveMeasurement, isRemoveGXYLayerFromGXYView, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, recalculateMeasureMents, removeMeasurementChangeListener, removePropertyChangeListener, setAddGXYLayerToGXYView, setAllowMultipleMeasurements, setAlwaysCreate, setAzimuthFormat, setDisplayAzimuth, setDistanceFormat, setDrawEqualDistanceCurve, setGXYEditController, setGXYNewController, setHaloColor, setHaloEnabled, setHaloThickness, setHotPointIcon, setLabelAlignment, setLabelBackground, setLabelFilled, setLabelFontBorder, setLabelForeground, setLabelFrame, setLabelRotationAllowed, setLabelSelectionColor, setLabelVGap, setLineStyle, setMeasureMode, setNextGXYController, setPreserveMeasurement, setRemoveGXYLayerFromGXYView, setSegmentLabelFont, setSnappables, setTotalDistanceLabelFont, startInteraction, terminateInteraction, viewRepaint
Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYSmartController
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, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCT
Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYController
addStatusListener, asGXYController, fireStatusEvent, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYController
getIcon, getName, getShortDescription
-
Constructor Details
-
TLcdTerrainRulerController
public TLcdTerrainRulerController()Default constructor. Note that this constructor will turn off drawing the equal distance curve as this is not correct when terrain data is taken into account.
-
-
Method Details
-
setTerrainElevationProvider
Sets the terrain elevation provider which is responsible for return elevation data on any segment of the ruler.- Parameters:
aTerrainElevationProvider
- the terrain elevation provider which is responsible for return elevation data on any segment of the ruler.
-
calculateDistance
protected double calculateDistance(ILcdPoint aStartPoint, ILcdPoint aEndPoint, ILcdGeoReference aGeoReference, int aMeasuringMode, ILcdGXYContext aGXYContext) Calculates the distance between the two points, taking into account the path defined by the measuring mode. Depending on the value ofisUseTerrain()
the terrain altitude provided by the terrain elevation provider is taken into account.- Overrides:
calculateDistance
in classTLcdAdvancedMapRulerController
- Parameters:
aStartPoint
- the first pointaEndPoint
- the second pointaGeoReference
- the reference the points are defined inaMeasuringMode
- the mode defining the path from the start point to the end pointaGXYContext
- the context in which the distance is measured.- Returns:
- the distance between the two points, taking into account the path defined by the measuring mode.
-
setAbsoluteTolerance
public void setAbsoluteTolerance(double aAbsoluteTolerance) Sets the absolute tolerance in meters for the distance calculated. Default value is 10 meters. This value is used as a stop condition when iteratively computing the distance between two points. When the difference between two computations is smaller than the absolute tolerance, the iteration is stopped.- Parameters:
aAbsoluteTolerance
- the absolute tolerance in meters for the distance calculated.- See Also:
-
getAbsoluteTolerance
public double getAbsoluteTolerance()Returns the absolute tolerance in meters for the distance calculated.- Returns:
- the absolute tolerance in meters for the distance calculated.
- See Also:
-
setRelativeTolerance
public void setRelativeTolerance(double aRelativeTolerance) Sets the relative tolerance for the distance calculated. Default value is 0.01. This value is used as a stop condition when iteratively computing the distance between two points. When the difference between two computations is smaller relatively to the last computation than the relative tolerance, the iteration is stopped.- Parameters:
aRelativeTolerance
- the relative tolerance for the distance calculated.- See Also:
-
getRelativeTolerance
public double getRelativeTolerance()Returns the relative tolerance for the distance calculated.- Returns:
- the relative tolerance in meters for the distance calculated.
- See Also:
-
setUseTerrain
public void setUseTerrain(boolean aUseTerrain) Sets whether terrain should be taken into account when computing the distance. Default value is true.- Parameters:
aUseTerrain
- whether terrain should be taken into account when computing the distance.- See Also:
-
isUseTerrain
public boolean isUseTerrain()Returns whether terrain should be taken into account when computing the distance.- Returns:
- whether terrain should be taken into account when computing the distance.
- See Also:
-
retrieveSegmentScanner
public ILcdSegmentScanner retrieveSegmentScanner(int aMeasuringMode, ILcdGeoReference aGeoReference, ILcdGXYContext aGXYContext) throws IllegalArgumentException Returns a suitable segment scanner depending on the measuring mode and the reference of the start and end point. The context is passed for the projection plane mode.- Parameters:
aMeasuringMode
- the mode defining the path between the two points.aGeoReference
- the reference of the two points.- Returns:
- a
TLcdGeodeticSegmentScanner
forTLcdAdvancedMapRulerController.MEASURE_GEODETIC
, aTLcdRhumblineSegmentScanner
forTLcdAdvancedMapRulerController.MEASURE_RHUMBLINE
- Throws:
IllegalArgumentException
- when the measuring mode isTLcdAdvancedMapRulerController.MEASURE_PROJECTION_PLANE
and the world reference of the view is not a grid reference.
-
getMinimumSamples
public int getMinimumSamples()Returns the minimum number of intermediate points in between the start point and end point of every segment which are used in calculation of the distance of one segment.- Returns:
- the minimum number of points in between the start point and end point.
- See Also:
-
setMinimumSamples
public void setMinimumSamples(int aMinimumSamples) Sets the minimum number of intermediate points in between the start point and end point of every segment which are used in calculation of the distance of one segment. Default value is 100.- Parameters:
aMinimumSamples
- the minimum number of points in between the start point and end point.- See Also:
-
getMinimumStepSize
public int getMinimumStepSize()Returns the minimum distance (expressed in meters) between two intermediate points generated when calculating the distance of a segment.- Returns:
- the minimum distance expressed in meters between two intermediate points generated when calculating the distance of a segment.
- See Also:
-
setMinimumStepSize
public void setMinimumStepSize(int aMinimumStepSize) Sets the minimum distance expressed in meters between two intermediate points generated when calculating the distance of a segment. This value is used as a stop condition when iteratively computing the distance between two points. Default value is 10.- Parameters:
aMinimumStepSize
- the minimum distance (expressed in meters) between two intermediate points generated when calculating the distance of a segment.- See Also:
-
getMaximumSamples
public int getMaximumSamples()Returns the maximum number of points that should be sampled in between two points for every segment. This value is used as a stop condition when computing the distance iteratively.- Returns:
- the maximum number of points that should be sampled in between two points for every segment.
-
setMaximumSamples
public void setMaximumSamples(int aMaximumSamples) Sets the maximum number of points that should be sampled in between two points for every segment. This value is used as a stop condition when computing the distance iteratively. Default value is 10000.- Parameters:
aMaximumSamples
- the maximum number of points that should be sampled in between two points for every segment.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Description copied from class:ALcdGXYSmartController
Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Overrides:
setTraceOn
in classALcdGXYSmartController
- 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.
-