Class TLspNavigationControlsBuilder

java.lang.Object
com.luciad.view.lightspeed.swing.navigationcontrols.TLspNavigationControlsBuilder

public class TLspNavigationControlsBuilder extends Object

Builder for creating navigation control components that interacts with a view (ILspView).

The navigation controls
The navigation controls.

The navigation control component is composed out of different elements (from top to bottom):

  • The compass navigation control: the outer ring allows to change the rotation of the map, and the inner part allows to change the tilt the camera.
  • The pan navigation control: allows to pan the map around
  • The zoom control: allows to zoom in and out

Creating a navigation control component including all widgets can be done as follows:

    //Create the navigation controls
    //In this example, we use all available types of navigation controls
    Component navigationControls = TLspNavigationControlsBuilder.newBuilder(view)
                                                                .allNavigationControls()
                                                                .build();
The created component can be added to the overlay component of an ILspAWTView:
    //Add the navigation controls in the overlay panel of the view
    //This ensures that they are placed on top of the map
    view.getOverlayComponent().add(navigationControls, TLcdOverlayLayout.Location.NORTH_EAST);
This builder allows for a few modifications. For example:
  • Change the images by specifying the image path.
  • Only include a subset of widgets by using the *NavigationControl() method instead of the allNavigationControls() method.
If you need more specific modifications, you can use the other classes in this package directly to construct your own custom navigation controls.
Since:
2012.0
  • Constructor Details

    • TLspNavigationControlsBuilder

      protected TLspNavigationControlsBuilder(ILspView aView)
      Creates a TLspNavigationControlsBuilder with default initialization.
      Parameters:
      aView - the view that will interact with the navigation controls.
      See Also:
  • Method Details

    • newBuilder

      public static TLspNavigationControlsBuilder newBuilder(ILspView aView)
      Returns a builder to create navigation controls for the passed view.

      By default:

      • all navigation controls are enabled.
      • the small image path is used.
      • always active is disabled.
      • no tooltips are set.
      Parameters:
      aView - the view that will interact with the navigation controls.
      Returns:
      a TLspNavigationControlsBuilder
    • view

      Sets the view that will interact with the navigation controls.

      Note that a view must be set before navigation controls can be build with this builder.

      Parameters:
      aView - the view that will interact with the navigation controls.
      Returns:
      this builder.
    • allNavigationControls

      public TLspNavigationControlsBuilder allNavigationControls()
      Sets a compass, pan and zoom component on the navigation controls. In 2D mode the pan and rotate functionality is combined into a single compass control.
      Returns:
      this builder.
    • compassNavigationControl

      public TLspNavigationControlsBuilder compassNavigationControl()
      Sets a compass component on the navigation controls that can change the rotation of the view.
      Returns:
      this builder.
    • panNavigationControl

      public TLspNavigationControlsBuilder panNavigationControl()
      Sets a pan component on the navigation controls to pan the view.
      Returns:
      this builder.
    • compassAndPanNavigationControl

      public TLspNavigationControlsBuilder compassAndPanNavigationControl()
      Sets a compass and pan component on the navigation controls to rotate and pan the view. In 2D mode the pan and rotate functionality is combined into a single compass control.
      Returns:
      this builder.
    • zoomNavigationControl

      public TLspNavigationControlsBuilder zoomNavigationControl()
      Sets a zoom component on the navigation controls to zoom in/out on the view.
      Returns:
      this builder.
    • altitudeExaggerationControl

      public TLspNavigationControlsBuilder altitudeExaggerationControl()
      Sets an altitude exaggeration component on the navigation controls to exaggerate the terrain in the view.
      Returns:
      this builder
    • imagePath

      public TLspNavigationControlsBuilder imagePath(String aImagePath)
      Sets the path to the images used to alter the appearance of the compass, pan and navigation components.

      It is assumed that this folder contains a subfolder /compass, a subfolder /pan and a subfolder /zoom. The images in these folders must follow the naming conventions (see ALcdCompassNavigationControl, ALcdPanNavigationControl and ALcdZoomNavigationControl). The default image path is currently based on the TLcdIconFactory.getDefaultTheme() and TLcdIconFactory.getDefaultSize(), but this might change in future releases.

      Parameters:
      aImagePath - the path to the images.
      Returns:
      this builder.
    • smallImagePath

      public TLspNavigationControlsBuilder smallImagePath()
      Sets the image path to a path containing a default set of small images.
      Returns:
      this builder.
    • largeImagePath

      public TLspNavigationControlsBuilder largeImagePath()
      Sets the image path to a path containing a default set of large images.
      Returns:
      this builder.
    • alwaysActive

      public TLspNavigationControlsBuilder alwaysActive(boolean aIsAlwaysActive)
      Sets whether or not the navigation controls always appear active. When this is false, the components will switch to their inactive appearance whenever the mouse is not hovering over them.

      The default value is false.

      Parameters:
      aIsAlwaysActive - a boolean that indicates whether or not the navigation controls always appear active.
      Returns:
      this builder.
    • compassToolTip

      public TLspNavigationControlsBuilder compassToolTip(String aCompassToolTip)
      Sets the tooltip text for the compass tool.

      The default is null, meaning that the compass tool will have no tool-tip text.

      Parameters:
      aCompassToolTip - a String which will be used as a tool-tip text for the compass tool.
      Returns:
      this builder.
    • compassRingToolTip

      public TLspNavigationControlsBuilder compassRingToolTip(String aCompassRingToolTip)
      Sets the tooltip text for the compass ring tool.

      The default is null, meaning that the compass ring tool will have no tool-tip text.

      Parameters:
      aCompassRingToolTip - a String which will be used as a tool-tip text for the compass ring tool.
      Returns:
      this builder.
    • compassUpArrowToolTip

      public TLspNavigationControlsBuilder compassUpArrowToolTip(String aCompassUpArrowToolTip)
      Sets the tooltip text for the compass up arrow tool.

      The default is null, meaning that the compass up arrow tool will have no tool-tip text.

      Parameters:
      aCompassUpArrowToolTip - a String which will be used as a tool-tip text for the compass up arrow tool.
      Returns:
      this builder.
    • panToolTip

      public TLspNavigationControlsBuilder panToolTip(String aPanToolTip)
      Sets the tooltip text for the pan tool.

      The default is null, meaning that the pan tool will have no tool-tip text.

      Parameters:
      aPanToolTip - a String which will be used as a tool-tip text for the pan tool.
      Returns:
      this builder.
    • zoomToolTip

      public TLspNavigationControlsBuilder zoomToolTip(String aZoomToolTip)
      Sets the tooltip text for the zoom tool.

      The default is null, meaning that the zoom tool will have no tool-tip text.

      Parameters:
      aZoomToolTip - a String which will be used as a tool-tip text for the zoom tool.
      Returns:
      this builder.
    • altitudeExaggerationToolTip

      public TLspNavigationControlsBuilder altitudeExaggerationToolTip(String aAltitudeToolTip)
      Sets the tooltip text for the altitude exaggeration tool.

      The default is null, meaning that the altitude exaggeration tool will have no tool-tip text.

      Parameters:
      aAltitudeToolTip - a String which will be used as the tool-tip text for the altitude exaggeration tool.
      Returns:
      this builder
    • magneticNorthMap

      public TLspNavigationControlsBuilder magneticNorthMap(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 or not called, the compass will point to the true north.
    • build

      public Component build()
      Builds a Component that contains controls to navigate the given view.

      Note that at least the view that will interact with the navigation controls must be set before navigation controls can be build. If no navigation control has been added, the default controls are added.

      Note: this method does not add the Navigation controls on top of the view. To add this component to a (heavyweight) ILspView, see ILspAWTView.getOverlayComponent().

      Returns:
      the Component that contains controls to navigate the given view.