Class TLspTouchSelectEditController

java.lang.Object
com.luciad.view.lightspeed.controller.ALspController
com.luciad.view.lightspeed.controller.touch.TLspTouchSelectEditController
All Implemented Interfaces:
ILcdUndoableSource, ILcdAWTEventListener, ILspController

public class TLspTouchSelectEditController extends ALspController implements ILcdUndoableSource
Combines the select and edit controller for touch based input.

The handleFXEventImpl(Event aEvent) converts the native JavaFX TouchEvent to a TLcdTouchEvent and passes it to the ALspController.handleAWTEvent(AWTEvent aEvent).

Since:
2012.0
  • Constructor Details

    • TLspTouchSelectEditController

      public TLspTouchSelectEditController()
      Creates a TLspTouchSelectEditController with a default name, icon, short description, sensitivity and move event threshold.
  • Method Details

    • setSelectControllerModel

      public void setSelectControllerModel(TLspSelectControllerModel aControllerModel)
      Configures the controller model used for selection
      Parameters:
      aControllerModel - the new controller model, never null
      Since:
      2019.1
    • getSelectControllerModel

      public TLspSelectControllerModel getSelectControllerModel()
      Returns the controller model used for selection.
      Returns:
      the controller model used for selection, never null
      Since:
      2019.1
    • getHandleStyler

      public ILspStyler getHandleStyler()
      Returns the handle styler used to style handles in this edit controller. By default this is an instance of TLspEditHandleStyler
      Returns:
      the handle styler
    • setHandleStyler

      public void setHandleStyler(ILspStyler aHandleStyler)
      Sets the handle styler used to style handles in this edit controller.
      Parameters:
      aHandleStyler - The handle styler to use
    • getFocusHandleStyler

      public ILspStyler getFocusHandleStyler()
      Returns the handle styler used to style handles that have focus in this edit controller. By default this is an instance of TLspEditHandleStyler
      Returns:
      the handle styler
    • setFocusHandleStyler

      public void setFocusHandleStyler(ILspStyler aHandleStyler)
      Sets the handle styler used to style handles that have focus in this edit controller.
      Parameters:
      aHandleStyler - The handle styler to use
    • getSnapperProvider

      public ILspSnapperProvider getSnapperProvider()
      Gets the snapper provider used by this edit controller
      Returns:
      the snapper provider used by this edit controller
    • setSnapperProvider

      public void setSnapperProvider(ILspSnapperProvider aSnapperProvider)
      Sets the snapper provider used by this edit controller
      Parameters:
      aSnapperProvider - the snapper provider used by this edit controller
    • getSnapperStyler

      public ILspStyler getSnapperStyler()
      Gets the snapper styler used by this edit controller
      Returns:
      the snapper styler used by this edit controller
    • setSnapperStyler

      public void setSnapperStyler(ILspStyler aStyler)
      Sets the snapper styler used by this edit controller
      Parameters:
      aStyler - the snapper styler used by this edit controller
    • setDrawTouchPoints

      public void setDrawTouchPoints(boolean aDrawTouchPoints)
      Determines whether this controller should visualize touch points in the view. If true, the controller's paint() method will draw a circle at the location of each current touch point. By default, this property is set to false.
      Parameters:
      aDrawTouchPoints - whether or not to visualize touch points in the view
    • isDrawTouchPoints

      public boolean isDrawTouchPoints()
      Returns true if this controller is configured to visualize touch points in the view. By default, this feature is off.
      Returns:
      true if this controller is configured to visualize touch points in the view
      See Also:
    • setSensitivity

      public void setSensitivity(double aSensitivity)
      Sets the sensitivity of the controller for both editing and selection to the same value.
      Parameters:
      aSensitivity - the sensitivity.
    • setSelectionSensitivity

      public void setSelectionSensitivity(double aSensitivity)
      Sets the sensitivity of the controller for selection operations. The default value is 1 pixel.
      Parameters:
      aSensitivity - the selection sensitivity
    • setEditingSensitivity

      public void setEditingSensitivity(double aSensitivity)
      Sets the sensitivity of the controller for editing operations. The default value is 20 pixels.
      Parameters:
      aSensitivity - the editing sensitivity
    • getEditingSensitivity

      public double getEditingSensitivity()
      Returns the current sensitivity of the controller for editing operations.
      Returns:
      the editing sensitivity
    • getSelectionSensitivity

      public double getSelectionSensitivity()
      Returns the current sensitivity of the controller for selection operations.
      Returns:
      the selection sensitivity
    • getMoveThreshold

      public int getMoveThreshold()

      Returns the current threshold for move events.

      As long as a touch point remains within the threshold it is considered to be stationary, and eligible for a touch and hold.

      The default value for this property is 3.

      Returns:
      the current threshold for move events.
      See Also:
    • setMoveThreshold

      public void setMoveThreshold(int aMoveThreshold)

      Sets the threshold for move events.

      As long as a touch point remains within the threshold it is considered to be stationary, and eligible for a touch and hold.

      The new value of the threshold will not affect any events which arrived at the controller prior to the change in threshold.

      The default value for this property is 3.

      Parameters:
      aMoveThreshold - the threshold for move events. Must be positive.
      See Also:
    • getTouchAndHoldTime

      public int getTouchAndHoldTime()
      Returns the time (in milliseconds) it takes for a touch and hold to be registered.
      Returns:
      the time spent waiting on a touch and hold.
      See Also:
    • setTouchAndHoldTime

      public void setTouchAndHoldTime(int aTouchAndHoldTime)
      Sets the time (in milliseconds) it takes for a touch and hold to be registered. If the finger does not move (over the move threshold) in that time, a touch and hold is registered. The default value is 1000.
      Parameters:
      aTouchAndHoldTime - the time it takes to recognize a touch and hold.
    • setStringTranslator

      public void setStringTranslator(ILcdStringTranslator aStringTranslator)

      Sets the ILcdStringTranslator that this controller should use to translate the Strings that will be visible in the user interface.

      This method should be called before this controller is used. Any Strings already created by this controller will not be translated with the specified translator. The ILcdStringTranslator does not translate the controller's name and description.

      The following list of Strings are translated by the given instance:

      • "Edit {0}". {0} will be replaced by the result of calling Object.toString() on the edited object. E.g. "Edit Polygon".
      • The result of calling Object.toString() on the edited objects. E.g. "Polygon".
      • "Undo {0}". {0} will be replaced by the display name of the action that is to be undone. E.g. "Undo Edit Polygon".
      • "Redo {0}". {0} will be replaced by the display name of the action that is to be redone. E.g. "Redo Edit Polygon".
      The ILcdStringTranslator needs to be able to translate what is passed in {0}, but not the entire formatted String. For example, for "Edit {0}" it needs to be able to translate "Edit {0}" itself and the edited object's Object.toString(), e.g. "Polygon", but not "Edit Polygon".
      Parameters:
      aStringTranslator - The ILcdStringTranslator that should be used. Must not be null.
    • getStringTranslator

      public ILcdStringTranslator getStringTranslator()

      Returns the ILcdStringTranslator set on this controller.

      Returns:
      The translator set on this controller. Never null.
    • selectWhat

      protected Set<TLspPaintRepresentation> selectWhat(TLcdTouchPoint aTouchPoint, ALspSelectInput aInput)

      Returns the mode that defines by what objects can be selected: by their bodies, their labels, ...

      This method can be overridden to alter its behavior. By default it returns a set containing all available paint representations in the view.

      Parameters:
      aTouchPoint - The last touch point that was involved in the selection change.
      aInput - The selection input
      Returns:
      an set of paint representations indicating which interact with the selection functionality.
    • selectChoice

      protected TLspSelectChoice selectChoice(TLcdTouchPoint aTouchPoint, ALspSelectInput aInput, Set<TLspPaintRepresentation> aRepresentations)

      Returns the TLspSelectChoice to use, a parameter that indicates how to select the actual candidates from a set of possible selection candidates.

      By default TLspSelectChoice.DEFAULT is returned.

      This method can be overridden to alter its behavior.
      Parameters:
      aTouchPoint - The last touch point that was involved in the selection change.
      aInput - The selection input.
      aRepresentations - The paint representations interacting with selection.
      Returns:
      The select choice
    • selectMode

      protected TLspSelectMode selectMode(TLcdTouchPoint aTouchPoint, ALspSelectInput aInput, Set<TLspPaintRepresentation> aRepresentations, TLspSelectChoice aChoice)

      Returns the mode that defines how the objects involved in the selection should interact with the existing selection, for example add them, remove them, toggle their selection state, etc.

      By default TLspSelectMode.REPLACE is returned.

      This method can be overridden to alter its behavior.
      Parameters:
      aTouchPoint - The last touch point that was involved in the selection change.
      aInput - The selection input.
      aRepresentations - The paint representations interacting with selection.
      aChoice - The TLspSelectChoice that will be used.
      Returns:
      The select mode.
    • handleAWTEventImpl

      public AWTEvent handleAWTEventImpl(AWTEvent aEvent)
      Description copied from class: ALspController
      Called by handleAWTEvent. Returns null when the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen with TLcdTouchEvents). When the controller did not use the given event, it is returned unaltered.
      Specified by:
      handleAWTEventImpl in class ALspController
      Parameters:
      aEvent - the event to be handled.
      Returns:
      null when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
    • handleFXEventImpl

      public Event handleFXEventImpl(Event aEvent)
      Description copied from class: ALspController
      Called by handleFXEvent. Returns null when the controller consumed the event. When the controller did not use the given event, it is returned unaltered.
      Overrides:
      handleFXEventImpl in class ALspController
      Parameters:
      aEvent - the event to be handled.
      Returns:
      null when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
    • startInteractionImpl

      protected void startInteractionImpl(ILspView aView)
      Description copied from class: ALspController
      The specific implementation of startInteraction for this controller.
      Overrides:
      startInteractionImpl in class ALspController
      Parameters:
      aView - the view to start interaction with.
    • terminateInteractionImpl

      protected void terminateInteractionImpl(ILspView aView)
      Description copied from class: ALspController
      The specific implementation of terminateInteraction for this controller.
      Overrides:
      terminateInteractionImpl in class ALspController
      Parameters:
      aView - the view to terminate interaction with.
    • paint

      public TLspPaintProgress paint(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase)
      Description copied from class: ALspController
      Paints the visual feedback of this controller.

      This method is called multiple times for different paint phases.

      Empty implementation. Redefine ALspController.paintImpl(com.luciad.view.opengl.binding.ILcdGLDrawable, com.luciad.view.lightspeed.ILspView, com.luciad.view.lightspeed.TLspPaintPhase) method to render on the ILcdGLDrawable on which the view is rendered.

      Specified by:
      paint in interface ILspController
      Overrides:
      paint in class ALspController
      Parameters:
      aGLDrawable - the ILcdGLDrawable on which the view is rendered.
      aView - the view.
      aPaintPhase - the current paint phase
      Returns:
      whether or not the painting was finished.
    • getNextController

      public ILspController getNextController()
      Description copied from interface: ILspController
      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.

      Specified by:
      getNextController in interface ILspController
      Overrides:
      getNextController in class ALspController
      Returns:
      a reference to the next controller.
      See Also:
    • appendController

      public void appendController(ILspController aEnd)
      Description copied from interface: ILspController
      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.

      Specified by:
      appendController in interface ILspController
      Overrides:
      appendController in class ALspController
      Parameters:
      aEnd - the controller to be appended to the end of the chain.
    • addUndoableListener

      public void addUndoableListener(ILcdUndoableListener aUndoableListener)
      Description copied from interface: ILcdUndoableSource
      Adds a listener to this source, so this listener is notified when something undoable has happened.
      Specified by:
      addUndoableListener in interface ILcdUndoableSource
      Parameters:
      aUndoableListener - The listener to be notified when something undoable has happened.
    • removeUndoableListener

      public void removeUndoableListener(ILcdUndoableListener aUndoableListener)
      Description copied from interface: ILcdUndoableSource
      Removes the specified listener so it is no longer notified.
      Specified by:
      removeUndoableListener in interface ILcdUndoableSource
      Parameters:
      aUndoableListener - The listener to remove.
    • getLayered

      public ILcdLayered getLayered()
      Description copied from interface: ILspController

      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.

      Specified by:
      getLayered in interface ILspController
      Overrides:
      getLayered in class ALspController
      Returns:
      an ILcdLayered object, or null if this controller has no layers.