Class TLspTouchSelectEditController
- All Implemented Interfaces:
ILcdUndoableSource
,ILcdAWTEventListener
,ILspController
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 Summary
ConstructorDescriptionCreates a TLspTouchSelectEditController with a default name, icon, short description, sensitivity and move event threshold. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUndoableListener
(ILcdUndoableListener aUndoableListener) Adds a listener to this source, so this listener is notified when something undoable has happened.void
This method will append the passed controller to the end of the chain.double
Returns the current sensitivity of the controller for editing operations.Returns the handle styler used to style handles that have focus in this edit controller.Returns the handle styler used to style handles in this edit controller.Returns anILcdLayered
for this controller.int
Returns the current threshold for move events.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.Returns the controller model used for selection.double
Returns the current sensitivity of the controller for selection operations.Gets the snapper provider used by this edit controllerGets the snapper styler used by this edit controllerReturns theILcdStringTranslator
set on this controller.int
Returns the time (in milliseconds) it takes for a touch and hold to be registered.handleAWTEventImpl
(AWTEvent aEvent) Called byhandleAWTEvent
.handleFXEventImpl
(Event aEvent) Called byhandleFXEvent
.boolean
Returns true if this controller is configured to visualize touch points in the view.paint
(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase) Paints the visual feedback of this controller.void
removeUndoableListener
(ILcdUndoableListener aUndoableListener) Removes the specified listener so it is no longer notified.protected TLspSelectChoice
selectChoice
(TLcdTouchPoint aTouchPoint, ALspSelectInput aInput, Set<TLspPaintRepresentation> aRepresentations) Returns theTLspSelectChoice
to use, a parameter that indicates how to select the actual candidates from a set of possible selection candidates.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.protected Set
<TLspPaintRepresentation> selectWhat
(TLcdTouchPoint aTouchPoint, ALspSelectInput aInput) Returns the mode that defines by what objects can be selected: by their bodies, their labels, ...void
setDrawTouchPoints
(boolean aDrawTouchPoints) Determines whether this controller should visualize touch points in the view.void
setEditingSensitivity
(double aSensitivity) Sets the sensitivity of the controller for editing operations.void
setFocusHandleStyler
(ILspStyler aHandleStyler) Sets the handle styler used to style handles that have focus in this edit controller.void
setHandleStyler
(ILspStyler aHandleStyler) Sets the handle styler used to style handles in this edit controller.void
setMoveThreshold
(int aMoveThreshold) Sets the threshold for move events.void
setSelectControllerModel
(TLspSelectControllerModel aControllerModel) Configures the controller model used for selectionvoid
setSelectionSensitivity
(double aSensitivity) Sets the sensitivity of the controller for selection operations.void
setSensitivity
(double aSensitivity) Sets the sensitivity of the controller for both editing and selection to the same value.void
setSnapperProvider
(ILspSnapperProvider aSnapperProvider) Sets the snapper provider used by this edit controllervoid
setSnapperStyler
(ILspStyler aStyler) Sets the snapper styler used by this edit controllervoid
setStringTranslator
(ILcdStringTranslator aStringTranslator) Sets theILcdStringTranslator
that this controller should use to translate theStrings
that will be visible in the user interface.void
setTouchAndHoldTime
(int aTouchAndHoldTime) Sets the time (in milliseconds) it takes for a touch and hold to be registered.protected void
startInteractionImpl
(ILspView aView) The specific implementation ofstartInteraction
for this controller.protected void
terminateInteractionImpl
(ILspView aView) The specific implementation ofterminateInteraction
for this controller.Methods inherited from class com.luciad.view.lightspeed.controller.ALspController
addPropertyChangeListener, addStatusListener, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getName, getShortDescription, getView, handleAWTEvent, handleFXEvent, paintImpl, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteraction, terminateInteraction
-
Constructor Details
-
TLspTouchSelectEditController
public TLspTouchSelectEditController()Creates a TLspTouchSelectEditController with a default name, icon, short description, sensitivity and move event threshold.
-
-
Method Details
-
setSelectControllerModel
Configures the controller model used for selection- Parameters:
aControllerModel
- the new controller model, never null- Since:
- 2019.1
-
getSelectControllerModel
Returns the controller model used for selection.- Returns:
- the controller model used for selection, never null
- Since:
- 2019.1
-
getHandleStyler
Returns the handle styler used to style handles in this edit controller. By default this is an instance ofTLspEditHandleStyler
- Returns:
- the handle styler
-
setHandleStyler
Sets the handle styler used to style handles in this edit controller.- Parameters:
aHandleStyler
- The handle styler to use
-
getFocusHandleStyler
Returns the handle styler used to style handles that have focus in this edit controller. By default this is an instance ofTLspEditHandleStyler
- Returns:
- the handle styler
-
setFocusHandleStyler
Sets the handle styler used to style handles that have focus in this edit controller.- Parameters:
aHandleStyler
- The handle styler to use
-
getSnapperProvider
Gets the snapper provider used by this edit controller- Returns:
- the snapper provider used by this edit controller
-
setSnapperProvider
Sets the snapper provider used by this edit controller- Parameters:
aSnapperProvider
- the snapper provider used by this edit controller
-
getSnapperStyler
Gets the snapper styler used by this edit controller- Returns:
- the snapper styler used by this edit controller
-
setSnapperStyler
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'spaint()
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 themove 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
Sets the
ILcdStringTranslator
that this controller should use to translate theStrings
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. TheILcdStringTranslator
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 callingObject.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".
ILcdStringTranslator
needs to be able to translate what is passed in{0}
, but not the entire formattedString
. For example, for "Edit {0}" it needs to be able to translate "Edit {0}" itself and the edited object'sObject.toString()
, e.g. "Polygon", but not "Edit Polygon".- Parameters:
aStringTranslator
- TheILcdStringTranslator
that should be used. Must not benull
.
- "Edit {0}".
-
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
This method can be overridden to alter its behavior.TLspSelectChoice.DEFAULT
is returned.- 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
This method can be overridden to alter its behavior.TLspSelectMode.REPLACE
is returned.- 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
Description copied from class:ALspController
Called byhandleAWTEvent
. Returnsnull
when the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen withTLcdTouchEvent
s). When the controller did not use the given event, it is returned unaltered.- Specified by:
handleAWTEventImpl
in classALspController
- 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
Description copied from class:ALspController
Called byhandleFXEvent
. Returnsnull
when the controller consumed the event. When the controller did not use the given event, it is returned unaltered.- Overrides:
handleFXEventImpl
in classALspController
- 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
Description copied from class:ALspController
The specific implementation ofstartInteraction
for this controller.- Overrides:
startInteractionImpl
in classALspController
- Parameters:
aView
- the view to start interaction with.
-
terminateInteractionImpl
Description copied from class:ALspController
The specific implementation ofterminateInteraction
for this controller.- Overrides:
terminateInteractionImpl
in classALspController
- 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 interfaceILspController
- Overrides:
paint
in classALspController
- 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
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 interfaceILspController
- Overrides:
getNextController
in classALspController
- Returns:
- a reference to the next controller.
- See Also:
-
appendController
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 interfaceILspController
- Overrides:
appendController
in classALspController
- Parameters:
aEnd
- the controller to be appended to the end of the chain.
-
addUndoableListener
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 interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSource
Removes the specified listener so it is no longer notified.- Specified by:
removeUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aUndoableListener
- The listener to remove.
-
getLayered
Description copied from interface:ILspController
Returns an
ILcdLayered
for this controller. Custom implementations of this method should take care to return the sameILcdLayered
instance every time this method is called to guarantee correct working of theILcdLayered
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 interfaceILspController
- Overrides:
getLayered
in classALspController
- Returns:
- an ILcdLayered object, or null if this controller has no layers.
-