public class TLspTouchSelectEditController extends ALspController implements ILcdUndoableSource
The handleFXEventImpl(Event aEvent) converts the native JavaFX TouchEvent
to a TLcdTouchEvent
and passes it to the ALspController.handleAWTEvent(AWTEvent aEvent).
Constructor and Description |
---|
TLspTouchSelectEditController()
Creates a TLspTouchSelectEditController with a default name, icon, short description,
sensitivity and move event threshold.
|
Modifier and Type | Method and Description |
---|---|
void |
addUndoableListener(ILcdUndoableListener aUndoableListener)
Adds a listener to this source, so this listener is notified when something undoable has
happened.
|
void |
appendController(ILspController aEnd)
This method will append the passed controller to the end of the chain.
|
double |
getEditingSensitivity()
Returns the current sensitivity of the controller for editing operations.
|
ILspStyler |
getFocusHandleStyler()
Returns the handle styler used to style handles that have focus in this
edit controller.
|
ILspStyler |
getHandleStyler()
Returns the handle styler used to style handles in this edit controller.
|
ILcdLayered |
getLayered()
Returns an
ILcdLayered for this controller. |
int |
getMoveThreshold()
Returns the current threshold for move events.
|
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.
|
TLspSelectControllerModel |
getSelectControllerModel()
Returns the controller model used for selection.
|
double |
getSelectionSensitivity()
Returns the current sensitivity of the controller for selection operations.
|
ILspSnapperProvider |
getSnapperProvider()
Gets the snapper provider used by this edit controller
|
ILspStyler |
getSnapperStyler()
Gets the snapper styler used by this edit controller
|
ILcdStringTranslator |
getStringTranslator()
Returns the
ILcdStringTranslator set on this controller. |
int |
getTouchAndHoldTime()
Returns the time (in milliseconds) it takes for a touch and hold to be registered.
|
AWTEvent |
handleAWTEventImpl(AWTEvent aEvent)
Called by
handleAWTEvent . |
javafx.event.Event |
handleFXEventImpl(javafx.event.Event aEvent)
Called by
handleFXEvent . |
boolean |
isDrawTouchPoints()
Returns true if this controller is configured to visualize touch points in the view.
|
TLspPaintProgress |
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 the
TLspSelectChoice 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 selection
|
void |
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 controller
|
void |
setSnapperStyler(ILspStyler aStyler)
Sets the snapper styler used by this edit controller
|
void |
setStringTranslator(ILcdStringTranslator aStringTranslator)
Sets the
ILcdStringTranslator that this controller should use to
translate the Strings 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 of
startInteraction for this controller. |
protected void |
terminateInteractionImpl(ILspView aView)
The specific implementation of
terminateInteraction for this controller. |
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
public TLspTouchSelectEditController()
public void setSelectControllerModel(TLspSelectControllerModel aControllerModel)
aControllerModel
- the new controller model, never nullpublic TLspSelectControllerModel getSelectControllerModel()
public ILspStyler getHandleStyler()
TLspEditHandleStyler
public void setHandleStyler(ILspStyler aHandleStyler)
aHandleStyler
- The handle styler to usepublic ILspStyler getFocusHandleStyler()
TLspEditHandleStyler
public void setFocusHandleStyler(ILspStyler aHandleStyler)
aHandleStyler
- The handle styler to usepublic ILspSnapperProvider getSnapperProvider()
public void setSnapperProvider(ILspSnapperProvider aSnapperProvider)
aSnapperProvider
- the snapper provider used by this edit controllerpublic ILspStyler getSnapperStyler()
public void setSnapperStyler(ILspStyler aStyler)
aStyler
- the snapper styler used by this edit controllerpublic void setDrawTouchPoints(boolean aDrawTouchPoints)
paint()
method will draw a circle at the location of each current touch point. By default, this
property is set to false.aDrawTouchPoints
- whether or not to visualize touch points in the viewpublic boolean isDrawTouchPoints()
setDrawTouchPoints(boolean)
public void setSensitivity(double aSensitivity)
aSensitivity
- the sensitivity.public void setSelectionSensitivity(double aSensitivity)
aSensitivity
- the selection sensitivitypublic void setEditingSensitivity(double aSensitivity)
aSensitivity
- the editing sensitivitypublic double getEditingSensitivity()
public double getSelectionSensitivity()
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.
setMoveThreshold(int)
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.
aMoveThreshold
- the threshold for move events. Must be positive.getMoveThreshold()
public int getTouchAndHoldTime()
setTouchAndHoldTime(int)
public void setTouchAndHoldTime(int aTouchAndHoldTime)
move threshold
) in that time, a touch and hold
is registered. The default value is 1000.aTouchAndHoldTime
- the time it takes to recognize a touch and hold.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:
{0}
will be replaced by the result of calling Object.toString()
on the edited object. E.g. "Edit Polygon".Object.toString()
on the edited objects. E.g. "Polygon".{0}
will be replaced by the display name of the action that is to be undone. E.g. "Undo Edit Polygon".{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 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".aStringTranslator
- The ILcdStringTranslator
that should be used. Must not be
null
.public ILcdStringTranslator getStringTranslator()
Returns the ILcdStringTranslator
set on this controller.
null
.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.aTouchPoint
- The last touch point that was involved in the
selection change.aInput
- The selection inputprotected 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.
aTouchPoint
- The last touch point that was involved in the
selection change.aInput
- The selection input.aRepresentations
- The paint representations interacting with selection.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.
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.public AWTEvent handleAWTEventImpl(AWTEvent aEvent)
ALspController
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
TLcdTouchEvent
s). When the controller did not use the given event, it is returned
unaltered.handleAWTEventImpl
in class ALspController
aEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.public javafx.event.Event handleFXEventImpl(javafx.event.Event aEvent)
ALspController
handleFXEvent
.
Returns null
when the controller consumed the event. When the controller did not use the
given event, it is returned unaltered.handleFXEventImpl
in class ALspController
aEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.protected void startInteractionImpl(ILspView aView)
ALspController
startInteraction
for this controller.startInteractionImpl
in class ALspController
aView
- the view to start interaction with.protected void terminateInteractionImpl(ILspView aView)
ALspController
terminateInteraction
for this controller.terminateInteractionImpl
in class ALspController
aView
- the view to terminate interaction with.public TLspPaintProgress paint(ILcdGLDrawable aGLDrawable, ILspView aView, TLspPaintPhase aPaintPhase)
ALspController
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.
paint
in interface ILspController
paint
in class ALspController
aGLDrawable
- the ILcdGLDrawable on which the view is rendered.aView
- the view.aPaintPhase
- the current paint phasepublic ILspController getNextController()
ILspController
getNextController
in interface ILspController
getNextController
in class ALspController
ILspController.appendController(com.luciad.view.lightspeed.controller.ILspController)
public void appendController(ILspController aEnd)
ILspController
appendController
in interface ILspController
appendController
in class ALspController
aEnd
- the controller to be appended to the end of the chain.public void addUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
addUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to be notified when something undoable has happened.public void removeUndoableListener(ILcdUndoableListener aUndoableListener)
ILcdUndoableSource
removeUndoableListener
in interface ILcdUndoableSource
aUndoableListener
- The listener to remove.public ILcdLayered getLayered()
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.
getLayered
in interface ILspController
getLayered
in class ALspController