Interface ILspController

All Superinterfaces:
ILcdAWTEventListener
All Known Implementing Classes:
ALspActionController, ALspConfinedTouchController, ALspController, ALspTouchController, TLspClickActionController, TLspCreateController, TLspEditController, TLspFlickerController, TLspInteractiveLabelsController, TLspKeyActionController, TLspMagnifierController, TLspPanController, TLspPortholeController, TLspRecenterProjectionController, TLspRotateController, TLspRulerController, TLspSelectController, TLspSwipeController, TLspTouchAndHoldActionController, TLspTouchCreateController, TLspTouchNavigateController, TLspTouchSelectEditController, TLspZoomByRectangleController, TLspZoomController, TLspZoomToController

public interface ILspController extends ILcdAWTEventListener
Interprets user interaction on an ILspView. When a controller is assigned to a view (using setController), startInteraction is called. From then on, the controller is responsible for interpreting the user interaction on the view, until terminateInteraction is called for that view.

Interpreting the user interaction may consist of changing the internal state of the view or any of its constituents. For example, a zoom controller may change the view's scale, while a select controller may change the selection state of an object in a layer which is part of the view. Note that consumption of user interaction is not part of this interface, but is performed by the view, which will forward input events to the controller's handleAWTEvent method.

The controller may indicate how user interaction is interpreted by rendering visual feedback on the view using the paint method. Note that the controller is responsible for repainting the view as needed. To distinguish between controllers, each controller has a name, a short description and an ILcdIcon.

Controllers are designed to be an element in a controller chain, passing along events and method calls.

A controller keeps a reference to the next controller in the chain. The controller is free to decide what methods and/or events should be delegated to the rest of the chain.

Note that input events received by a controller may contain a position expressed in "toolkit coordinates". On systems that use DPI scaling, these do not correspond to Lightspeed view coordinates. Users who wish to transform the cursor position to a geographic location, for instance, must therefore be aware of this difference. For more information on DPI scaling and toolkit/view coordinates, see ALspViewXYZWorldTransformation.

Since:
2012.0
  • Method Details

    • handleFXEvent

      default void handleFXEvent(Event aEvent)
      Called when the controller is set on a TLspFXView and the view receives an input event.
      Parameters:
      aEvent - the event received by the view
      Since:
      2019.0
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener aListener)
      Adds a PropertyChangeListener to this ILspController.
      Parameters:
      aListener - the listener
    • removePropertyChangeListener

      void removePropertyChangeListener(PropertyChangeListener aListener)
      Removes the given PropertyChangeListener from this ILspController.
      Parameters:
      aListener - the listener.
    • getName

      String getName()
      Gets the name of this controller.
      Returns:
      the name of this controller
    • getShortDescription

      String getShortDescription()
      Gets a short description for this controller.
      Returns:
      a short description for this controller
    • getIcon

      ILcdIcon getIcon()
      Gets the icon that is used for example on buttons in the graphical user interface to identify this controller.
      Returns:
      this controller's graphical icon
    • startInteraction

      void startInteraction(ILspView aView)
      Called to start interacting with the controller. This automatically happens when setting the controller on the view using ILspView.setController(com.luciad.view.lightspeed.controller.ILspController).
      Parameters:
      aView - the view the controller operates on
    • terminateInteraction

      void terminateInteraction(ILspView aView)
      Terminates interaction with this controller. This automatically happens when setting a different controller on the view using ILspView.setController(com.luciad.view.lightspeed.controller.ILspController).
      Parameters:
      aView - the view the controller was operating on
    • paint

      TLspPaintProgress paint(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase)
      Paints the visual feedback of this controller.

      This method is called multiple times for different paint phases.

      Parameters:
      aGLDrawable - the drawable that should be painted on
      aView - the view that is painted on
      aPaintPhase - the current paint phase
      Returns:
      a TLspPaintProgress object describing the completeness of the paint operation.
    • getNextController

      ILspController getNextController()
      Returns a reference to the controller that is located after this one in a chain, or null if this controller is the last element of the chain.

      Note that this reference is not allowed to change while the controller is attached to a view directly or indirectly.

      Returns:
      a reference to the next controller.
      See Also:
    • appendController

      void appendController(ILspController aEnd)
      This method will append the passed controller to the end of the chain. The controller will be stored as the next controller in the last element of the current chain.

      Note that this method is not allowed to be called while the controller is attached to a view directly or indirectly. Unattach the controller first, before calling this method.

      Parameters:
      aEnd - the controller to be appended to the end of the chain.
    • getLayered

      ILcdLayered getLayered()

      Returns an ILcdLayered for this controller. Custom implementations of this method should take care to return the same ILcdLayered instance every time this method is called to guarantee correct working of the ILcdLayered interface.

      The returned layered object should contain layers that are relevant to this controller. Any view using this controller should take into account the layers of its active controller.

      Note that the ILcdLayered is only allowed to contain ILspLayer instances.

      Returns:
      an ILcdLayered object, or null if this controller has no layers.