Class TLcdTerrainRulerController

All Implemented Interfaces:
ILcdUndoableSource, ILcdAWTEventListener, ILcdStatusSource, ILcdGXYChainableController, ILcdGXYController, KeyListener, MouseListener, MouseMotionListener, Serializable, EventListener

public class TLcdTerrainRulerController extends TLcdAdvancedMapRulerController
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.
Note that this holds for every segment separately. Different stop conditions might apply to different segments.
See Also:
  • 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

      public void setTerrainElevationProvider(ALcdTerrainElevationProvider aTerrainElevationProvider)
      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 of isUseTerrain() the terrain altitude provided by the terrain elevation provider is taken into account.
      Overrides:
      calculateDistance in class TLcdAdvancedMapRulerController
      Parameters:
      aStartPoint - the first point
      aEndPoint - the second point
      aGeoReference - the reference the points are defined in
      aMeasuringMode - the mode defining the path from the start point to the end point
      aGXYContext - 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 for TLcdAdvancedMapRulerController.MEASURE_GEODETIC, a TLcdRhumblineSegmentScanner for TLcdAdvancedMapRulerController.MEASURE_RHUMBLINE
      Throws:
      IllegalArgumentException - when the measuring mode is TLcdAdvancedMapRulerController.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 either 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.
      Overrides:
      setTraceOn in class ALcdGXYSmartController
      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.