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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUndoableListener(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 to style handle labels that are not focused.Returns the styler that is used for handles that are not focused.Returns anILcdLayeredfor this controller.protected List<ALspMultiObjectHandle> getMultiObjectHandles(Collection<TLspDomainObjectContext> aObjectsSFCT) Returns the multi object handles of this controller.doubleReturns the sensitivity of this controller.Gets the snapper provider used by this edit controllerGets the snapper styler used by this edit controllerReturns theILcdStringTranslatorset on this controller.handleAWTEventImpl(AWTEvent aEvent) Called byhandleAWTEvent.handleFXEventImpl(Event aEvent) Called byhandleFXEvent.voidremoveUndoableListener(ILcdUndoableListener aListener) Removes the specified listener so it is no longer notified.voidsetFocusHandleLabelStyler(ILspStyler aHandleStyler) Sets the styler used to style handle labels that have focus in this edit controller.voidsetFocusHandleStyler(ILspStyler aHandleStyler) Sets the styler used to style handles that have focus in this edit controller.voidsetHandleLabelStyler(ILspStyler aHandleStyler) Sets the handle styler used to style handle labels in this edit controller.voidsetHandleStyler(ILspStyler aHandleStyler) Sets the styler that is used for handles that are not focused.voidsetSensitivity(double aSensitivity) Sets the sensitivity of this controller.voidsetSnapperProvider(ILspSnapperProvider aSnapperProvider) Sets the snapper provider used by this edit controllervoidsetSnapperStyler(ILspStyler aStyler) Sets the snapper styler used by this edit controllervoidsetStringTranslator(ILcdStringTranslator aStringTranslator) Sets theILcdStringTranslatorthat this controller should use to translate theStringsthat will be visible in the user interface.voidstartInteraction(ILspView aView) Called to start interacting with the controller.protected voidstartInteractionForLayer(ILspLayer aLayer) Adds listeners for various editing-related changes to the given layer.voidterminateInteraction(ILspView aView) Terminates interaction with this controller.protected voidCounterpart 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 to style 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
ILcdStringTranslatorthat this controller should use to translate theStringsthat will be visible in the user interface.This method should be called before this controller is used. Any
Stringsalready created by this controller will not be translated with the specified translator. TheILcdStringTranslatordoes not translate the controller's name and description.The following list of
Stringsare 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".
ILcdStringTranslatorneeds 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- TheILcdStringTranslatorthat should be used. Must not benull.
- "Edit {0}".
-
getStringTranslator
Returns the
ILcdStringTranslatorset on this controller.- Returns:
- The translator set on this controller. Never
null.
-
startInteraction
Description copied from class:ALspControllerCalled 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 callsstartInteractionon the next controller. OverridestartInteractionImplif you want to add your own behavior to this controller.- Specified by:
startInteractionin interfaceILspController- Overrides:
startInteractionin 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:ALspControllerTerminates 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 callsterminateInteractionon the next controller. OverrideterminateInteractionImplif you want to add your own behavior to this controller.- Specified by:
terminateInteractionin interfaceILspController- Overrides:
terminateInteractionin 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 aTLspDomainObjectContextso 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:ALspControllerCalled byhandleFXEvent. Returnsnullwhen the controller consumed the event. When the controller did not use the given event, it is returned unaltered.- Overrides:
handleFXEventImplin classALspController- Parameters:
aEvent- the event to be handled.- Returns:
nullwhen the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
handleAWTEventImpl
Description copied from class:ALspControllerCalled byhandleAWTEvent. Returnsnullwhen the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen withTLcdTouchEvents). When the controller did not use the given event, it is returned unaltered.- Specified by:
handleAWTEventImplin classALspController- Parameters:
aEvent- the event to be handled.- Returns:
nullwhen the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
addUndoableListener
Description copied from interface:ILcdUndoableSourceAdds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListenerin interfaceILcdUndoableSource- Parameters:
aListener- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeUndoableListenerin interfaceILcdUndoableSource- Parameters:
aListener- The listener to remove.
-
getLayered
Description copied from interface:ILspControllerReturns an
ILcdLayeredfor this controller. Custom implementations of this method should take care to return the sameILcdLayeredinstance every time this method is called to guarantee correct working of theILcdLayeredinterface.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
ILspLayerinstances.- Specified by:
getLayeredin interfaceILspController- Overrides:
getLayeredin classALspController- Returns:
- an ILcdLayered object, or null if this controller has no layers.
-