public class TLspEditController extends ALspController implements ILcdUndoableSource
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)
.Constructor and Description |
---|
TLspEditController()
Creates a new edit controller.
|
Modifier and Type | Method and Description |
---|---|
void |
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.
|
ILspStyler |
getFocusHandleLabelStyler()
Returns the styler used to style handle labels that have focus in this edit controller.
|
ILspStyler |
getFocusHandleStyler()
Returns the styler used to style handles that have focus in this edit controller.
|
ILspStyler |
getHandleLabelStyler()
Returns the styler that is used for handle labels that are not focused.
|
ILspStyler |
getHandleStyler()
Returns the styler that is used for handles that are not focused.
|
ILcdLayered |
getLayered()
Returns an
ILcdLayered for this controller. |
protected List<ALspMultiObjectHandle> |
getMultiObjectHandles(Collection<TLspDomainObjectContext> aObjectsSFCT)
Returns the multi object handles of this controller.
|
double |
getSensitivity()
Returns the sensitivity of this controller.
|
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. |
AWTEvent |
handleAWTEventImpl(AWTEvent aEvent)
Called by
handleAWTEvent . |
javafx.event.Event |
handleFXEventImpl(javafx.event.Event aEvent)
Called by
handleFXEvent . |
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 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 |
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 |
terminateInteractionForLayer(ILspLayer aLayer)
Counterpart of startInteractionForLayer(com.luciad.view.lightspeed.layer.ILspLayer)
which removes the edit controller's listeners from the given layer.
|
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
public double getSensitivity()
public void setSensitivity(double aSensitivity)
aSensitivity
- the sensitivity of this controllerpublic 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 ILspStyler getHandleLabelStyler()
public void setHandleLabelStyler(ILspStyler aHandleStyler)
aHandleStyler
- The handle styler to usepublic ILspStyler getFocusHandleLabelStyler()
public void setFocusHandleLabelStyler(ILspStyler aHandleStyler)
aHandleStyler
- The handle styler to usepublic 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
.public void startInteraction(ILspView aView)
ALspController
ILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
.
This implementation sends out a status event based on the short description
.
It also calls startInteraction
on the next controller. Override startInteractionImpl
if you want to add your own behavior to this
controller.startInteraction
in interface ILspController
startInteraction
in class ALspController
aView
- the view the controller operates onprotected void startInteractionForLayer(ILspLayer aLayer)
aLayer
- the layer to be tracked for editing-related changespublic void terminateInteraction(ILspView aView)
ALspController
ILspView.setController(com.luciad.view.lightspeed.controller.ILspController)
.
This implementation also calls terminateInteraction
on the next controller.
Override terminateInteractionImpl
if you want to add your own behavior
to this controller.terminateInteraction
in interface ILspController
terminateInteraction
in class ALspController
aView
- the view the controller was operating onprotected void terminateInteractionForLayer(ILspLayer aLayer)
aLayer
- the layer from which to remove editing-related listenersprotected List<TLspDomainObjectContext> getEditingCandidates(ILspView aView)
TLspDomainObjectContext
so that it can
be linked back to the layer in which it is contained.aView
- the view in which to look for editing candidatesprotected List<ALspMultiObjectHandle> getMultiObjectHandles(Collection<TLspDomainObjectContext> aObjectsSFCT)
aObjectsSFCT
- the list of objects for which a handle should be generatedpublic 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 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.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 void addUndoableListener(ILcdUndoableListener aListener)
ILcdUndoableSource
addUndoableListener
in interface ILcdUndoableSource
aListener
- The listener to be notified when something undoable has happened.public void removeUndoableListener(ILcdUndoableListener aListener)
ILcdUndoableSource
removeUndoableListener
in interface ILcdUndoableSource
aListener
- 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