Class TLspEditController
- All Implemented Interfaces:
ILcdUndoableSource
,ILcdAWTEventListener
,ILspController
getEditingCandidates
method. After retrieving the editing candidates,
this controller checks if there is an editor
set on the respective layer and activates the handles
associated with the editor.
These handles can be visualized, and styled using a handle styler.
When handles have focus, they are styled using a focus handle styler. This
makes it possible to highlight handles when hovering over them.
To paint handles, this controller uses a layer containing a shape painter that uses the same
ILspShapeDiscretizer
as the shape painter from the original layer. This makes it possible to support painting custom
shape handles (e.g. the projected shape handle under an extruded custom shape) in this controller.
If not shape discretizer is found in the original layer,
TLspShapeDiscretizer
is used instead.
During editing, it is possible to snap to other shapes. For this, a snapper provider can be used. The snappers can be visualized using a snapper styler.
This controller makes it possible to edit multiple objects at the same time. By default, it is
possible to move multiple objects at the same time, without being able edit the control points
of the shapes. This behavior can be customized using getMultiObjectHandles
.
When objects are edited, this controller notifies the layer by calling
ILspInteractivePaintableLayer.editedObjectChanged(java.lang.Object)
.- Since:
- 2012.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addUndoableListener
(ILcdUndoableListener aListener) Adds a listener to this source, so this listener is notified when something undoable has happened.protected List
<TLspDomainObjectContext> getEditingCandidates
(ILspView aView) Retrieves objects from the view that are candidates for editing.Returns the styler used to style handle labels that have focus in this edit controller.Returns the styler used to style handles that have focus in this edit controller.Returns the styler that is used for handle labels that are not focused.Returns the styler that is used for handles that are not focused.Returns anILcdLayered
for this controller.protected List
<ALspMultiObjectHandle> getMultiObjectHandles
(Collection<TLspDomainObjectContext> aObjectsSFCT) Returns the multi object handles of this controller.double
Returns the sensitivity of this controller.Gets the snapper provider used by this edit controllerGets the snapper styler used by this edit controllerReturns theILcdStringTranslator
set on this controller.handleAWTEventImpl
(AWTEvent aEvent) Called byhandleAWTEvent
.handleFXEventImpl
(Event aEvent) Called byhandleFXEvent
.void
removeUndoableListener
(ILcdUndoableListener aListener) Removes the specified listener so it is no longer notified.void
setFocusHandleLabelStyler
(ILspStyler aHandleStyler) Sets the styler used to style handle labels that have focus in this edit controller.void
setFocusHandleStyler
(ILspStyler aHandleStyler) Sets the styler used to style handles that have focus in this edit controller.void
setHandleLabelStyler
(ILspStyler aHandleStyler) Sets the handle styler used to style handle labels in this edit controller.void
setHandleStyler
(ILspStyler aHandleStyler) Sets the styler that is used for handles that are not focused.void
setSensitivity
(double aSensitivity) Sets the sensitivity of this controller.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
startInteraction
(ILspView aView) Called to start interacting with the controller.protected void
startInteractionForLayer
(ILspLayer aLayer) Adds listeners for various editing-related changes to the given layer.void
terminateInteraction
(ILspView aView) Terminates interaction with this controller.protected void
Counterpart of startInteractionForLayer(com.luciad.view.lightspeed.layer.ILspLayer) which removes the edit controller's listeners from the given layer.Methods inherited from class com.luciad.view.lightspeed.controller.ALspController
addPropertyChangeListener, addStatusListener, appendController, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getName, getNextController, getShortDescription, getView, handleAWTEvent, handleFXEvent, paint, paintImpl, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteractionImpl, terminateInteractionImpl
-
Constructor Details
-
TLspEditController
public TLspEditController()Creates a new edit controller.
-
-
Method Details
-
getSensitivity
public double getSensitivity()Returns the sensitivity of this controller.- Returns:
- the sensitivity of this controller
-
setSensitivity
public void setSensitivity(double aSensitivity) Sets the sensitivity of this controller.- Parameters:
aSensitivity
- the sensitivity of this controller
-
getHandleStyler
Returns the styler that is used for handles that are not focused. By default this is an instance ofTLspEditHandleStyler
- Returns:
- the handle styler
-
setHandleStyler
Sets the styler that is used for handles that are not focused.- Parameters:
aHandleStyler
- The handle styler to use
-
getFocusHandleStyler
Returns the 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 styler used to style handles that have focus in this edit controller.- Parameters:
aHandleStyler
- The handle styler to use
-
getHandleLabelStyler
Returns the styler that is used for handle labels that are not focused.- Returns:
- the handle styler
-
setHandleLabelStyler
Sets the handle styler used to style handle labels in this edit controller.- Parameters:
aHandleStyler
- The handle styler to use
-
getFocusHandleLabelStyler
Returns the styler used to style handle labels that have focus in this edit controller.- Returns:
- the handle styler
-
setFocusHandleLabelStyler
Sets the styler used to style handle labels that have focus in this edit controller.- Parameters:
aHandleStyler
- The handle styler to use
-
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
.
-
startInteraction
Description copied from class:ALspController
Called to start interacting with the controller. This automatically happens when setting the controller on the view usingILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
. This implementation sends out a status event based on theshort description
. It also callsstartInteraction
on the next controller. OverridestartInteractionImpl
if you want to add your own behavior to this controller.- Specified by:
startInteraction
in interfaceILspController
- Overrides:
startInteraction
in classALspController
- Parameters:
aView
- the view the controller operates on
-
startInteractionForLayer
Adds listeners for various editing-related changes to the given layer. This method is called by startInteraction(com.luciad.view.lightspeed.ILspView) for every layer in the view; the listeners are used by the edit controller to maintain its internal bookkeeping. This method should only be used when the edit controller is expected to track a layer that is not in the view, such as a controller layer.- Parameters:
aLayer
- the layer to be tracked for editing-related changes
-
terminateInteraction
Description copied from class:ALspController
Terminates interaction with this controller. This automatically happens when setting a different controller on the view usingILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
. This implementation also callsterminateInteraction
on the next controller. OverrideterminateInteractionImpl
if you want to add your own behavior to this controller.- Specified by:
terminateInteraction
in interfaceILspController
- Overrides:
terminateInteraction
in classALspController
- Parameters:
aView
- the view the controller was operating on
-
terminateInteractionForLayer
Counterpart of startInteractionForLayer(com.luciad.view.lightspeed.layer.ILspLayer) which removes the edit controller's listeners from the given layer. This method is called by terminateInteraction(com.luciad.view.lightspeed.ILspView) for every layer in the view. This method should only be used when the edit controller is expected to track a layer that is not in the view, such as a controller layer.- Parameters:
aLayer
- the layer from which to remove editing-related listeners
-
getEditingCandidates
Retrieves objects from the view that are candidates for editing. By default this method returns all currently selected objects, but it can be overridden if different behavior is desired. Each candidate object is wrapped in aTLspDomainObjectContext
so that it can be linked back to the layer in which it is contained.- Parameters:
aView
- the view in which to look for editing candidates- Returns:
- a list of potentially editable objects
-
getMultiObjectHandles
protected List<ALspMultiObjectHandle> getMultiObjectHandles(Collection<TLspDomainObjectContext> aObjectsSFCT) Returns the multi object handles of this controller. Typically these handle operates on a collection of objects instead of a single object. By default, this method returns null if the given object count is less than or equal to 1. When the amount of objects supplied is greater, a multi-object-translation handle is returned.- Parameters:
aObjectsSFCT
- the list of objects for which a handle should be generated- Returns:
- a list of multi object handles to use for the editing operation
-
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
-
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.
-
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.
-
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:
aListener
- 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:
aListener
- 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.
-