Class TLcdTerrainProfileController

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

public class TLcdTerrainProfileController extends ALcdGXYSmartController implements MouseListener, MouseMotionListener, PropertyChangeListener
A ILcdGXYController implementation that contains information on the altitude of terrain beneath the position of the mouse over the view. The controller allows to draw a line segment on the map of which a side-view or profile can be calculated. This profile can then be displayed by an ILcdProfileView.
See Also:
  • Constructor Details

    • TLcdTerrainProfileController

      public TLcdTerrainProfileController()
  • Method Details

    • getGXYViewBasedTerrainElevationProvider

      public TLcdGXYViewBasedTerrainElevationProvider getGXYViewBasedTerrainElevationProvider()
      Returns the provider that is used to retrieve elevation data for this profile controller.
      Returns:
      the provider that is used to retrieve elevation data for this profile controller.
      See Also:
    • setGXYViewBasedTerrainElevationProvider

      public void setGXYViewBasedTerrainElevationProvider(TLcdGXYViewBasedTerrainElevationProvider aViewElevationProvider)
      Sets a new elevation provider to retrieve elevation data for this profile controller.
      Parameters:
      aViewElevationProvider - the elevation provider to be used.
      See Also:
    • resetProfile

      public void resetProfile()
      Clear the profile.
    • startInteraction

      public void startInteraction(ILcdGXYView aGXYView)
      Description copied from class: ALcdGXYController
      Sets up the controller to receive input through the view passed.

      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.

      Specified by:
      startInteraction in interface ILcdGXYController
      Overrides:
      startInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController will interact with.
      See Also:
    • terminateInteraction

      public void terminateInteraction(ILcdGXYView aGXYView)
      Description copied from class: ALcdGXYController
      Releases a few items. Can be redefined but this 'super' method should be called too.
      Specified by:
      terminateInteraction in interface ILcdGXYController
      Overrides:
      terminateInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController interacted with.
      See Also:
    • cleanGhost

      public void cleanGhost(ILcdGXYView aGXYView)
      Remove the ghost line segment of the controller from the view.
      Parameters:
      aGXYView - The view from which to remove the line.
    • paint

      public void paint(Graphics aGraphics)
      Description copied from class: ALcdGXYController
      Enables the controller to give visual feedback on the current user interactions. Note that the controller is responsible for repainting the view.

      Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.

      Specified by:
      paint in interface ILcdGXYController
      Overrides:
      paint in class ALcdGXYController
      Parameters:
      aGraphics - the Graphics on which the view was rendered.
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class ALcdGXYSmartController
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class ALcdGXYSmartController
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
      Overrides:
      mouseClicked in class ALcdGXYSmartController
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
      Overrides:
      mouseEntered in class ALcdGXYSmartController
    • mouseExited

      public void mouseExited(MouseEvent e)
      Description copied from class: ALcdGXYSmartController
      Will perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit properties
      Specified by:
      mouseExited in interface MouseListener
      Overrides:
      mouseExited in class ALcdGXYSmartController
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class ALcdGXYSmartController
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class ALcdGXYSmartController
    • setProfileView

      public void setProfileView(ILcdProfileView aProfileView)
      Sets the ILcdProfileView to show the terrain profile on
      Parameters:
      aProfileView - The ILcdProfileView to be set
      See Also:
    • getProfileView

      public ILcdProfileView getProfileView()
      Gets the ILcdProfileView the terrain profile is shown on
      Returns:
      the ILcdProfileView the terrain profile is shown on.
      See Also:
    • setGhostColor

      public void setGhostColor(Color aGhostColor)
      Sets the property that holds the color of the lines and circles that are drawn.
      Parameters:
      aGhostColor - the color to use for the drawing of lines and circles.
      See Also:
    • getGhostColor

      public Color getGhostColor()
      Gets the property that holds the color of the lines and circles that are drawn.
      Returns:
      the color to use for the drawing of lines and circles.
      See Also:
    • setGhostLineWidth

      public void setGhostLineWidth(int aGhostLineWidth)
      GhostLineWidth is the property that holds the width of the lines and circle that are drawn. This property has an effect only for JVM versions higher than 1.2. For lower versions, the line width will be always 1.
      Parameters:
      aGhostLineWidth - the line width to set.
      See Also:
    • getGhostLineWidth

      public int getGhostLineWidth()
      GhostLineWidth is the property that holds the width of the lines and circle that are drawn. This property has an effect only for JVM versions upper that 1.2 For lower versions, the line width will be always 1.
      Returns:
      the current line width.
      See Also:
    • setFont

      public void setFont(Font newFont)
      Sets the Font for drawing the labels to newFont.
      Parameters:
      newFont - the new font for drawing the labels.
      See Also:
    • getFont

      public Font getFont()
      Gets the Font for drawing the labels.
      Returns:
      the font used for drawing the labels.
      See Also:
    • setFallBackOnNonVisibleLayers

      public void setFallBackOnNonVisibleLayers(boolean aFallBackOnNonVisibleLayers)
      By default only visible layers will be scanned for terrain information. When set to true, also layers that are not visible will be scanned.
      Parameters:
      aFallBackOnNonVisibleLayers - the flag indicating if invisible layers should be scanned.
      See Also:
    • isFallBackOnNonVisibleLayers

      public boolean isFallBackOnNonVisibleLayers()
      Returns the flag indicating if invisible layers should be scanned. Default is false.
      Returns:
      the flag indicating if invisible layers should be scanned.
      See Also:
    • setForeground

      public void setForeground(Color newForeground)
      Sets the color for drawing the labels to newForeground.
      Parameters:
      newForeground - the new color for drawing the labels.
      See Also:
    • getForeground

      public Color getForeground()
      Gets the color for drawing the labels.
      Returns:
      the color for drawing the labels.
      See Also:
    • setBackground

      public void setBackground(Color aBackground)
      Sets the color of the label frames filling to aBackground.
      Parameters:
      aBackground - the new color of the label frames filling.
      See Also:
    • getBackground

      public Color getBackground()
      Gets the color of the label frames filling.
      Returns:
      the color of the label frames filling.
      See Also:
    • setTextColor

      public void setTextColor(Color aTextColor)
      Sets the color of the text to aTextColor.
      Parameters:
      aTextColor - the new color of the text.
      See Also:
    • getTextColor

      public Color getTextColor()
      Gets the color of the text.
      Returns:
      the color of the text.
      See Also:
    • setValueFormat

      public void setValueFormat(ILcdFormatter aValueFormat)
      Sets the formatter used to format elevation values.
      Parameters:
      aValueFormat - the formatter used to format elevation values.
      See Also:
    • getValueFormat

      public ILcdFormatter getValueFormat()
      Gets the formatter used to format elevation values.
      Returns:
      the formatter used to format elevation values.
      See Also:
    • setScanResolution

      public void setScanResolution(double aScanResolution)
      Sets scan resolution in meters.
      Parameters:
      aScanResolution - the new scan resolution in meters.
      See Also:
    • getScanResolution

      public double getScanResolution()
      Gets scan resolution in meters.
      Returns:
      the scan resolution in meters.
      See Also:
    • setUnknownElevationLabeled

      public void setUnknownElevationLabeled(boolean aUnknownElevationLabeled)
      Sets the flag indicating whether points corresponding to unknown elevation values should be labeled or not. The default is false.
      Parameters:
      aUnknownElevationLabeled - the new flag indicating if invalid elevation points are labeled.
      See Also:
    • isUnknownElevationLabeled

      public boolean isUnknownElevationLabeled()
      Returns whether points corresponding to invalid elevation values should be labeled or not.
      Returns:
      whether invalid elevation points are labeled or not.
      See Also:
    • setOutOfRasterBoundsValueLabeled

      public void setOutOfRasterBoundsValueLabeled(boolean aOutOfRasterBoundsValueLabeled)
      Sets the flag indicating whether points corresponding to unknown elevation values should be labeled or not. The default is false.
      Parameters:
      aOutOfRasterBoundsValueLabeled - the new flag indicating if invalid elevation points are labeled.
      See Also:
    • isOutOfRasterBoundsValueLabeled

      public boolean isOutOfRasterBoundsValueLabeled()
      Returns whether points corresponding to invalid elevation values should be labeled or not.
      Returns:
      whether invalid elevation points are labeled or not.
      See Also:
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • formatAltitude

      protected String formatAltitude(double aAltitude)
      Returns a string representation of the given altitude value. This implementation checks whether a value format is set. If so, this format is used to format the altitude, otherwise the default Double.toString method is used.
      Parameters:
      aAltitude - the altitude value to format.
      Returns:
      a string representation of the given altitude value.
      See Also:
    • shouldDisplayLabel

      protected boolean shouldDisplayLabel(double aElevationValue)
      Checks whether the elevation is an unknown value as returned by the terrain elevation provider. If so, a label is displayed depending on the values of the properties OutOfRasterBoundsLabeled and UnknownElevationLabeled.
      Parameters:
      aElevationValue - the value to display a label for, or not.
      Returns:
      true for known values and, depending on the properties OutOfRasterBoundsLabeled and UnknownElevationLabeled, for the corresponding unknown values, otherwise false.
      See Also: