Class TLspFXCompassNavigationControl

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.layout.Pane
javafx.scene.layout.AnchorPane
com.luciad.view.lightspeed.javafx.navigationcontrols.TLspFXCompassNavigationControl
All Implemented Interfaces:
Styleable, EventTarget

public class TLspFXCompassNavigationControl extends AnchorPane
A Node to control a TLspFXView in the following ways:
  • Rotating the map can be done by dragging the outer ring. The rotation can be reset by clicking the north indicator.
  • The central area off the control can be used to pan the map. In a 3D view this can also be used to change the pitch off the camera.

Customizing the appearance

The appearance of this control is specified by a number of images. The active appearance is only used when the mouse hovers over the component.

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

  • compass_arrows_inactive.png: the arrows that indicate the compass direction, when the navigation control is inactive.
  • compass_circles_inactive.png: The center of the navigation control when it's inactive. This image will be used when the control is not in pan mode.
  • compass_arrows.png: the arrows that indicate the compass direction, when the navigation control is active
  • compass_circles.png: The center of the navigation control when it's active. This image will be used when the contol is not in pan mode.
  • compass_indicator_selected.png: the north arrow when the mouse hovers over it.
  • compass_direction.png: the direction indicator when pressing or dragging the mouse over the control.
  • compass_ring_inactive.png: the draggable rotation ring when it isn't used.
  • compass_ring.png: the draggable rotation ring when it is used.
All the images should be square and should have the same dimensions. The dimension of the images will also be the dimension of the navigation control. Also keep in mind that 'compass_arrows_inactive.png', 'compass_arrows.png', 'compass_indicator_selected.png' and 'compass_direction.png' will be rotated around the center of the images.

Example

The following snippet adds the compass control to the overlay panel of a view.
    //Create a compass control for the view
    TLspFXCompassNavigationControl compassControl = new TLspFXCompassNavigationControl(view);

    //Get the overlay panel from the view and add the control to it
    view.getOverlayNodes().stream()
        .filter(TLcdOverlayPane.class::isInstance)
        .map(TLcdOverlayPane.class::cast)
        .findFirst()
        .ifPresent(aOverlayPane -> aOverlayPane.add(compassControl, TLcdOverlayPane.Location.SOUTH_EAST));
Since:
2021.0
  • Field Details

    • COMPASS_COMPONENT_DIR

      public static final String COMPASS_COMPONENT_DIR
      Default name of the subfolder in the navigation controls image folder containing all compass panel images.
      See Also:
    • COMPASSPAN_COMPONENT_DIR

      public static final String COMPASSPAN_COMPONENT_DIR
      Default name of the subfolder in the navigation controls image folder containing all compass panel images when the compass panel will be used for panning (in 2D for example). The default images show a hand instead of an eye then.
      See Also:
  • Constructor Details

    • TLspFXCompassNavigationControl

      public TLspFXCompassNavigationControl(TLspFXView aView) throws IOException
      A constructor for the compass component of the navigation controls for a TLspFXView.
      Parameters:
      aView - The view this panel will interact with.
      Throws:
      IOException - when one of the necessary images is missing.
    • TLspFXCompassNavigationControl

      public TLspFXCompassNavigationControl(TLspFXView aView, boolean aPan) throws IOException
      A constructor for the compass component of the navigation controls for a TLspFXView.
      Parameters:
      aView - the view this panel will interact with.
      aPan - determines whether the inner ring of the compass is used for panning.
      Throws:
      IOException - when one of the necessary images is missing.
    • TLspFXCompassNavigationControl

      public TLspFXCompassNavigationControl(TLspFXView aView, boolean aPan, String aImagePath) throws IOException
      A constructor for the compass component of the navigation controls for a TLspFXView. The default image path is usually the path to the root folder of the navigation controls + COMPASS_COMPONENT_DIR or COMPASSPAN_COMPONENT_DIR. The directory COMPASSPAN_COMPONENT_DIR should contain a set of images to be used when the compass will be able to pan the view. These constants can be used by factory methods to create a complete set of navigation controls with a single path to a root folder.

      Parameters:
      aView - the view this panel will interact with.
      aPan - determines whether the inner ring of the compass is used for panning.
      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

    • getMinAnimationDuration

      public double getMinAnimationDuration()
      Gets the minimum duration of the animation used when resetting the orientation to north.
      Returns:
      the minimum duration in seconds.
      See Also:
    • setMinAnimationDuration

      public void setMinAnimationDuration(double aMinAnimationDuration)
      Sets the minimum duration of the animation used when resetting the orientation to north. The actual duration will be linearly interpolated between the minimum and maximum duration based in the difference between the current angle and the north.

      By default, the minimum duration is 0.5 second. Set both this and the setMaxAnimationDuration(double) maximum duration } to 0 if no animation is required.

      Parameters:
      aMinAnimationDuration - expressed in seconds.
      See Also:
    • getMaxAnimationDuration

      public double getMaxAnimationDuration()
      Gets the maximum duration of the animation used when resetting the orientation to north.
      Returns:
      the minimum duration in seconds.
      See Also:
    • setMaxAnimationDuration

      public void setMaxAnimationDuration(double aMaxAnimationDuration)
      Sets the maximum duration of the animation used when resetting the orientation to north. The actual duration will be linearly interpolated between the minimum and maximum duration based on the difference between the current angle and the north.

      By default, the duration is 1.5 second. et both this and the setMinAnimationDuration(double) minimum duration } to 0 if no animation is required.

      Parameters:
      aMaxAnimationDuration - expressed in seconds.
      See Also:
    • isInnerRingPan

      public boolean isInnerRingPan()
      Returns what view navigation happens when the inside ring of the compass navigation is used.
      • false will trigger rotation (and pitching in a 3D view). This is the default.
      • true will trigger panning.
      Returns:
      the current behavior, true for panning, false for rotation
    • setInnerRingPan

      public void setInnerRingPan(boolean aInnerRingPan)
      Indicates what view navigation needs to happen when the inside ring of the compass navigation is used.
      • false will trigger rotation (and pitching in a 3D view). This is the default.
      • true will trigger panning.
      Parameters:
      aInnerRingPan - true for panning, false for rotation
    • setMagneticNorthMap

      public void setMagneticNorthMap(ILcdMagneticNorthMap aMagneticNorthMap)
      Lets the compass point to the magnetic north instead of true north, using the given magnetic north map.
      Parameters:
      aMagneticNorthMap - the map to use. If null, the compass will point to the true north
    • getMagneticNorthMap

      public ILcdMagneticNorthMap getMagneticNorthMap()
      Returns the magnetic north map to be used to point to the magnetic north.
      Returns:
      the map to use. If null, the compass will point to the true north