Class ALcdPanNavigationControl

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.luciad.gui.swing.navigationcontrols.ALcdPanNavigationControl
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
TLspPanNavigationControl

public abstract class ALcdPanNavigationControl extends JPanel
This class implements the pan component of the navigation panel. Pressing or dragging the mouse over the component will specify a certain point. This point will correspond with the position of the mouse cursor with respect to the center of the component. The point can be retrieved using the method getPoint().

Usually implementations will want to know when this point is changed internally, as a consequence of mouse events directly on the component. A subclass therefore has to implement certain abstract methods. The point is only available after a mouse pressed event is received and before a mouse released event is received. These events trigger calls o the abstract methods interactionStarted() and interactionStopped() respectively. As such they notify the implementing class that between these calls, the method getPoint() will return a point that can be used to interact with a view or any other object. Usually this point will be used to pan or rotate a view. A call to startInteraction can for instance start a timer that will periodically check the value returned by getPoint to pan the view until the timer is stopped by a call to endInteraction .

The appearance of this component is specified by a number of images. Furthermore the appearance can be changed at runtime. The method setEnabled(boolean) can be used to toggle between an active and an inactive appearance. By default the active appearance is only used when the mouse hovers over the component. The active/inactive appearance is usually shared with a few other (navigation control) components. See TLcdMouseOverGroup for more details.

The exact appearance is specified by the following images in png format:

  • pan_inactive.png: the pan panel, when the navigation panel is inactive.
  • pan.png: the pan panel, when the navigation panel is active.
  • pan_direction.png: the direction indicator when dragging or pressing the mouse over the panel.
All the images should be square and should have the same dimensions. The dimension of the images will also be the dimension of the component. Also keep in mind that 'pan_direction.png' will be rotated arround the center of the images.

Below you can see what the pan control looks like with the default set of images.

Since:
10.0
See Also:
  • Field Details

    • PAN_COMPONENT_DIR

      public static final String PAN_COMPONENT_DIR
      Default name of the subfolder in the navigationcontrols image folder containing all pan panel images.
      See Also:
  • Constructor Details

    • ALcdPanNavigationControl

      public ALcdPanNavigationControl(String aImagePath) throws IOException
      A constructor for the pancomponent. The constructor also loads the necessary images and will initialize all the subcomponents of the panel.

      The default image path is usually the path to the root folder of the navigation controls + PAN_COMPONENT_DIR. This constant can be used by factory methods to create a complete set of navigation controls with a single path to a root folder.

      Parameters:
      aImagePath - The (relative or absolute) path to the directory where the images are stored. For relative paths, the classpath and the working directory are searched.
      Throws:
      IOException - when one of the necessary images is missing.
  • Method Details

    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • getPoint

      protected Point2D.Double getPoint()
      This method returns a point that represents where the mouse is located over the panel. It corresponds with the location of the mouse relative to the center of the component, but scaled using the Dimension of the panel, so the resulting X and Y values are between 1 and -1. Note: you should only use this method between a call to interactionStarted() and a call to interactionStopped(). It will not return usable values at any other time.
      Returns:
      a point representing the relative position of the mouse with respect to the center of the panel.
      See Also:
    • interactionStarted

      protected abstract void interactionStarted()
      This method will be called when the mouse starts interacting with the panel. Between a call to this method and a call to interactionStopped() the method getPoint() will return a point that can be used to interact with an object.
      See Also:
    • interactionStopped

      protected abstract void interactionStopped()
      This method will be called when the mouse stops interacting with the panel. Between a call to interactionStarted() and a call to this method, the method getPoint() will return a point that can be used to interact with an object.
      See Also:
    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the dimension specified by the images used.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      the size of the images this panel is a based on.
    • getMinimumSize

      public Dimension getMinimumSize()
      Returns the dimension specified by the images used.
      Overrides:
      getMinimumSize in class JComponent
      Returns:
      the size of the images this panel is a based on.
    • getMaximumSize

      public Dimension getMaximumSize()
      Returns the dimension specified by the images used.
      Overrides:
      getMaximumSize in class JComponent
      Returns:
      the size of the images this panel is based on.