Class TLcdVVJPanel

All Implemented Interfaces:
ILcdPropertyChangeSource, ImageObserver, MenuContainer, Serializable, Accessible

public class TLcdVVJPanel extends JPanel implements ILcdPropertyChangeSource
This JPanel allows to display one vertical profile (for example a 3D polyline of lon/lat/height points) and a number of sub-profiles that are associated to the main profile. A sub-profile is divided into sub-profile steps. The number of steps of each sub-profile is equal to the number of points it contains minus one. A sub-profile step has a ratio, that is the percentage on the x-axis it represents, relatively to the main-profile (e.g. the sum of all the ratios for one sub-profile is exactly 1).
See Also:
  • Field Details

  • Constructor Details

    • TLcdVVJPanel

      public TLcdVVJPanel()
      Default constructor, no ILcdVVModel is set. The default renderer is used.
  • Method Details

    • setClassTraceOn

      public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
    • isClassTraceOn

      public static boolean isClassTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • setTraceOn

      public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      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.
      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.
    • isTraceOn

      public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • getAltitudeUnit

      public TLcdAltitudeUnit getAltitudeUnit()
      Returns the unit to use when displaying altitudes.
      Returns:
      the unit to use when displaying altitudes.
    • setAltitudeUnit

      public void setAltitudeUnit(TLcdAltitudeUnit aAltitudeUnit)
      Sets the unit to use when displaying altitudes. The unit is taken into account when computing the number of grid-lines and the labels painted for the ordinates.

      Note: To have a coherent view of the data, the altitude unit should be the same on the view as on the grid renderer. As long as the grid renderer on the view is not changed, the altitude unit is passed on directly to the grid renderer.

      Parameters:
      aAltitudeUnit - the unit to use when displaying altitudes.
    • setAdjustTopGridLineWhenEqual

      public void setAdjustTopGridLineWhenEqual(boolean aBoolean)
      Parameters:
      aBoolean - to indicate if you want to see an extra grid-line if the max value is equal to the top grid-line.
    • isAdjustTopGridLineWhenEqual

      public boolean isAdjustTopGridLineWhenEqual()
      Returns whether an extra grid-line is painted if the max value is equal to the top grid-line.
      Returns:
      whether an extra grid-line is painted if the max value is equal to the top grid-line.
    • setAdjustBottomGridLineWhenEqual

      public void setAdjustBottomGridLineWhenEqual(boolean aBoolean)
      Parameters:
      aBoolean - to indicate if you want to see an extra grid-line if the min value is equal to the bottom grid-line.
    • isAdjustBottomGridLineWhenEqual

      public boolean isAdjustBottomGridLineWhenEqual()
      Returns whether an extra grid-line is painted if the min value is equal to the bottom grid-line.
      Returns:
      true if an extra grid-line is painted if the min value is equal to the bottom grid-line.
    • setPaintAllLabels

      public void setPaintAllLabels(boolean aBoolean)
      Sets whether a label should be painted for the point touched by the mouse or for all points in the main profile.
      Parameters:
      aBoolean - indicates whether all the point-icons should be labeled or just the point that the mouse is over
      See Also:
    • isPaintAllLabels

      public boolean isPaintAllLabels()
      Returns whether all labels should painted or only the label of the point on which the mouse is located.
      Returns:
      false to only have a label painted on the point touched by the mouse, true to have labels painted for all points. Default value is false.
      See Also:
    • isPaintEditedLabel

      public boolean isPaintEditedLabel()
      Should the label of the point being edited be painted.
      Returns:
      whether the point being edited should be labeled. Default value is true.
      See Also:
    • setPaintEditedLabel

      public void setPaintEditedLabel(boolean aPaintEditedLabel)
      Sets whether the point which is being edited should be labeled while editing.
      Parameters:
      aPaintEditedLabel - true to display the label of the point being edited.
      See Also:
    • addCursorChangeListener

      public void addCursorChangeListener(ILcdVVCursorChangeEventListener aListener)
      Adds a listener that should be notified if the vertical cursor has moved.
      Parameters:
      aListener - to be notified when the vertical cursor has moved.
      See Also:
    • removeCursorChangeListener

      public void removeCursorChangeListener(ILcdVVCursorChangeEventListener aListener)
      No longer notifies a listener of changes to the vertical cursor.
      Parameters:
      aListener - the listener that should no longer be notified of changes to the vertical cursor.
      See Also:
    • setStartingPointIndex

      public void setStartingPointIndex(int aStartingPointIndex)
      Sets the index of the first point of the model which should be rendered. This enables a visual filter on the model. The default value is 0.
      Parameters:
      aStartingPointIndex - the first point of the underlying ILcdVVModel to take into account when rendering.
      Note:This is taken into account when calling the ILcdVVGridRenderer when painting the labels, but not when painting the points, i.e. ILcdVVRenderer.paintPointIcon(java.awt.Graphics, TLcdVVJPanel, int, int, java.awt.Rectangle) is not called with absolute model index of the point, but with the index relative to the starting point index. ILcdVVRenderer.paintPointLabel(java.awt.Graphics, TLcdVVJPanel, int, int, int) is called with the absolute model index.
      See Also:
    • setEndingPointIndex

      public void setEndingPointIndex(int aEndingPointIndex)
      Sets the index of the last point of the mode which should be painted. This enables a visual filter on the model.
      Parameters:
      aEndingPointIndex - the last point of the underlying ILcdVVModel to take into account when drawing.
      See Also:
    • getLeftScalingIndex

      public int getLeftScalingIndex()
      Deprecated.
      Returns:
      the starting point index.
    • getStartingPointIndex

      public int getStartingPointIndex()
      Returns the index of the point in the model at which drawing begins. For example, when the starting point index is 1 the left most point and first segment is not painted. When a model change occurs, this parameter is reset.
      Returns:
      the index of the point in the model at which drawing begins.
      See Also:
    • getRightScalingIndex

      public int getRightScalingIndex()
      Deprecated.
      use #getEndingPointIndex
      Returns:
      the ending point index.
    • getEndingPointIndex

      public int getEndingPointIndex()
      Returns:
      The index of the ILcdVVModel point to stop rendering at. Default value is -1, meaning that all points starting from the starting point index should be taken into account for rendering. When a model change occurs, this parameter is reset.
    • setLeftOffset

      public void setLeftOffset(double aLeftOffset)
      Parameters:
      aLeftOffset - a fraction [0-1[ of the ILcdVVModel data "width" to be hidden on the left side of this TLcdVVJPanel.
    • getLeftOffset

      public double getLeftOffset()
      Returns:
      the fraction of the model, between the starting point and the ending point, that should not be taken into account, from the starting point on.
      See Also:
    • setRightOffset

      public void setRightOffset(double aRightOffset)
      Parameters:
      aRightOffset - a ratio [0,1[ of the ILcdVVModel data "width" to be hidden on the right side of this TLcdVVJPanel.
    • getRightOffset

      public double getRightOffset()
      See Also:
    • setSubProfileScaled

      public final void setSubProfileScaled(boolean aBoolean)
      When the ordinate is constructed, should the values of the sub-profiles be taken into account?
      Parameters:
      aBoolean - False => only the points of the main-profile are used to construct the ordinate.
    • isSubProfileScaled

      public final boolean isSubProfileScaled()
      See Also:
    • setTopBottomOffsets

      public void setTopBottomOffsets(double aTopOffset, double aBottomOffset, boolean aRepaint)
      Sets the top and bottom offset in meters. Only altitudes in this range will be taken into account when calculating the highest and lowest altitude to be painted.
      Parameters:
      aTopOffset - the top altitude to be painted. Setting this value to Double.MAX_VALUE will blank this property, returning the maximum value of the model whenever it is required.
      aBottomOffset - the bottom altitude to be painted. Setting this value to -Double.MAX_VALUE will blank this property, returning the maximum value of the model whenever it is required.
      aRepaint - whether or not the view should be repainted.
    • getBottomOffset

      public double getBottomOffset()
      Returns the lowest altitude (in meters) to take into account when calculating the altitude range to be painted. This is not necessarily equal to the actual lowest displayed altitude. If the property is set to -Double.MAX_VALUE, the minimum altitude of the current model is returned.
      Returns:
      the minimum altitude of the model (if it's not empty) if this property was set to -Double.MAX_VALUE, the value of the property otherwise.
      See Also:
    • getTopOffset

      public double getTopOffset()
      Returns the highest altitude (in meters) to take into account when calculating the altitude range to be displayed. This is not necessarily equal to the actual highest displayed altitude. If the property is set to -Double.MAX_VALUE, the maximum altitude of the current model is returned.
      Returns:
      the maximum altitude of the model (if it's not empty) if this property was set to -Double.MAX_VALUE, the value of the property otherwise.
      See Also:
    • getMinimumViewAltitude

      public double getMinimumViewAltitude()
      Returns the lowest altitude in model coordinates which is painted in the panel. Note: this can be different from the bottom offset of the view, since the altitude range painted can vary due to snapping to the horizontal grid-lines and setting of the properties adjustBottomGridLineWhenEqual.
      Returns:
      the lowest altitude in model coordinates which is painted in the panel.
      See Also:
    • getMaximumViewAltitude

      public double getMaximumViewAltitude()
      Returns the highest altitude in model coordinates which is painted in the panel. Note: this can be different from the top offset of the view, since the altitude range painted can vary due to snapping to the horizontal grid-lines and setting of the properties adjustTopGridLineWhenEqual.
      Returns:
      the highest altitude in model coordinates which is painted in the panel.
      See Also:
    • setVVModel

      public void setVVModel(ILcdVVModel aNewVVModel)
      Parameters:
      aNewVVModel - The underlying ILcdVVModel that contains all the information for displaying profile on that TLcdVVJPanel.
      See Also:
    • getVVModel

      public ILcdVVModel getVVModel()
      See Also:
    • setVVRenderer

      public void setVVRenderer(ILcdVVRenderer aNewVVRenderer)
      Parameters:
      aNewVVRenderer - the new renderer to use for displaying profile data.
    • getVVRenderer

      public ILcdVVRenderer getVVRenderer()
      See Also:
    • setVVGridRenderer

      public void setVVGridRenderer(ILcdVVGridRenderer aGridRenderer)
      Sets a new ILcdVVGridRenderer
    • getVVGridRenderer

      public ILcdVVGridRenderer getVVGridRenderer()
      See Also:
    • setVVGridLineOrdinateProvider

      public void setVVGridLineOrdinateProvider(ILcdVVGridLineOrdinateProvider aVVGridLineOrdinateProvider)
      Sets the grid-line ordinate provider used for the vertical view grid.
      Parameters:
      aVVGridLineOrdinateProvider - The new grid-line ordinate provider.
      See Also:
    • getVVGridLineOrdinateProvider

      public ILcdVVGridLineOrdinateProvider getVVGridLineOrdinateProvider()
      Returns the grid-line ordinate provider used for the vertical view grid.
      Returns:
      the grid-line ordinate provider used for the vertical view grid.
      See Also:
    • getVVGridCoordinates

      public ILcdVVGridCoordinates getVVGridCoordinates()
    • setVVXAxisRenderer

      public void setVVXAxisRenderer(ILcdVVXAxisRenderer aXAxisRenderer)
      Set the ILcdVVXAxisRenderer responsible for decorating the X-axis.
    • getVVXAxisRenderer

      public ILcdVVXAxisRenderer getVVXAxisRenderer()
      Returns:
      the ILcdVVXAxisRenderer responsible for decorating the X-axis, null if no ILcdVVXAxisRenderer is set.
    • isVerticalCursorVisible

      public boolean isVerticalCursorVisible()
      Returns:
      true if the vertical cursor is shown, false otherwise.
    • isXAxisLabeled

      public boolean isXAxisLabeled()
      Returns:
      true is the ILcdXAxisRenderer is used or not to decorate the XAxis. When true is returned, but no ILcdVVXAxisRenderer is set, no painting on the X-axis is being done.
    • setXAxisLabeled

      public void setXAxisLabeled(boolean aBoolean)
      See Also:
    • setVerticalCursorVisible

      public void setVerticalCursorVisible(boolean aBoolean)
      Parameters:
      aBoolean - indicating whether the Vertical Cursor should be shown.
    • setVerticalCursorPosition

      public void setVerticalCursorPosition(ILcdPoint aPoint)
      Moves the vertical cursor to the location of the given main profile point in the view. If the point is not one of the points of the main profile, the cursor won't be moved.

      This method resets the vertical cursor's percentage.

      Parameters:
      aPoint - a point of the main profile, so one of the points returned by getVVModel.getPoint(int aIndex).
      See Also:
    • getVerticalCursorPosition

      public ILcdPoint getVerticalCursorPosition()
      Returns the main profile point, that, together with the point to the right of it, defines the X-axis positions between which the vertical cursor is positioned. The vertical cursor is positioned relatively between the X-axis positions of the returned point and point to the right of it.
      Returns:
      the main profile point defining the vertical cursor's location
      See Also:
    • setVerticalCursorLeftPointIndex

      public void setVerticalCursorLeftPointIndex(int aMainProfileIndex)
      Moves the vertical cursor to the location of the main profile point at the given index in the view. This method resets the vertical cursor's percentage.
      Parameters:
      aMainProfileIndex - index of a point of the main profile
      See Also:
    • getVerticalCursorLeftPointIndex

      public int getVerticalCursorLeftPointIndex()
      Returns the index of the main profile point, that, together with the point to the right of it, defines the X-axis positions between which the vertical cursor is positioned.
      Returns:
      the index of the main profile point located at the left of the vertical cursor, or -1 if the cursor is not visible
      See Also:
    • getSensitivity

      public int getSensitivity()
      Returns the sensitivity when interacting with altitude points and the vertical cursor. It defines how far (in screen coordinates) the input location (mouse cursor, etc...) can be from the visual representation of an object on the screen and still interact with it.
      Returns:
      the sensitivity to be used when interacting with altitude points and the vertical cursor
      Since:
      2017.0
      See Also:
    • setSensitivity

      public void setSensitivity(int aSensitivity)
      Configures the sensitivity when interacting with altitude points and the vertical cursor. It defines how far (in screen coordinates) the input location (mouse cursor, etc...) can be from the visual representation of an object on the screen and still interact with it.
      Parameters:
      aSensitivity - the new sensitivity to be used when interacting with altitude points and the vertical cursor
      Since:
      2017.0
      See Also:
    • setVerticalCursorPercentage

      public void setVerticalCursorPercentage(double aPercentage)
      Moves the vertical cursor to a location between getVerticalCursorPosition() and the profile point to the right of the position.
      Parameters:
      aPercentage - a real value between 0 and 1 defining the cursor's relative distance between getVerticalCursorPosition() and the point to its right
      See Also:
    • getVerticalCursorPercentage

      public double getVerticalCursorPercentage()
      Returns the cursor's relative distance between the getVerticalCursorPosition() and the profile point to the right of the position.
      Returns:
      a real value between 0 and 1 defining the cursor's relative distance between getVerticalCursorPosition() and the point to its right
      See Also:
    • isBuffered

      public boolean isBuffered()
      Returns whether caching of the profiles and grid-lines is on or off.
      Returns:
      true if caching of the profiles and grid-lines is on, false otherwise.
      See Also:
    • setBuffered

      public void setBuffered(boolean aBuffered)
      Turns caching of the profiles and grid-lines on or off.
      Parameters:
      aBuffered - true to cache the grid-lines, the main profile and the sub profile in an image, thus improving performance.
      See Also:
    • setSnapViewToGrid

      public void setSnapViewToGrid(boolean aSnapToGrid)

      Sets whether the vertical view should snap to the grid or not.

      If this property is set to true, the vertical view will not display the bottom offset as a minimum and the top offset as a maximum, but instead it will use the method ILcdVVGridLineOrdinateProvider.getSnappedRange(double, com.luciad.util.ILcdInterval, com.luciad.util.TLcdAltitudeUnit) to determine the interval to show.

      The default value of this property is true for backward compatibility reasons.

      Parameters:
      aSnapToGrid - the flag indicating if the vertical view snaps to the grid or not.
      See Also:
    • isSnapViewToGrid

      public boolean isSnapViewToGrid()
      Returns whether the vertical view should snap to the grid or not.
      Returns:
      whether the vertical view should snap to the grid or not.
      See Also:
    • paintComponent

      public void paintComponent(Graphics g)
      The main entry point for this class. Will only be executed when a VVModel has been set and the VVModel has points.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - the Graphics the component should be painted on.
    • retrieveMinimumAltitude

      public double retrieveMinimumAltitude(boolean aUseSubProfiles)
      Retrieves the minimum altitude of the points in the vertical view. Depending on the value of the parameter passed the sub profiles are taken into account too. This method can also be used to determine the minimum altitude to display in a vertical view (see getBottomOffset()).
      Parameters:
      aUseSubProfiles - whether or not to take the sub profiles into account.
      Returns:
      the minimum altitude of the points in the vertical view.
    • retrieveMaximumAltitude

      public double retrieveMaximumAltitude(boolean aUseSubProfiles)
      Retrieves the minimum altitude of the model points in the vertical view. Depending on the value of the parameter passed the sub profiles are taken into account too. This method can also be used to determine the maximum altitude to display in a vertical view (see getTopOffset()).
      Parameters:
      aUseSubProfiles - whether or not to take the sub profiles into account.
      Returns:
      the minimum altitude of the points in the vertical view.
    • setCursor

      public void setCursor(Cursor aCursor)
      Overrides:
      setCursor in class Component