public class TLspShapeListEditor extends ALspEditor
ILcd2DEditablePointList
objects as well as
ILcdShapeList
containing ILcd2DEditablePointList
shapes is:
ILspEditor editor = new TLspShapeListEditor(new TLsp2DPointListEditor());This editor has creation support for shape lists containing exactly one shape.
Modifier and Type | Class and Description |
---|---|
static class |
TLspShapeListEditor.PropertyKeys
Defines keys used by the enclosing editor implementation to store properties in its
edit handles.
|
Constructor and Description |
---|
TLspShapeListEditor(ILspEditor aDelegateEditor)
Creates a new shape list editor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canEdit(TLspEditContext aContext)
Determines whether or not the
geometry inside the given context can be edited by this editor. |
boolean |
canPerformOperation(TLspEditOperation aOperation,
TLspEditContext aContext)
Determines whether or not the editor knows how to apply the given edit operation to the
supplied geometry.
|
TLspEditOperationResult |
edit(TLspEditOperation aOperation,
ELspInteractionStatus aInteractionStatus,
TLspEditContext aContext)
Applies an interaction obtained from a handle to the object being edited.
|
protected TLspEditOperationResult |
editImpl(TLspEditOperation aOperation,
ELspInteractionStatus aInteractionStatus,
TLspEditContext aContext)
Called by the
edit method to edit the given object based on the given
edit operation . |
ALspEditHandle |
getCreateHandle(TLspEditContext aContext)
Returns a handle that is used to create the given object.
|
List<ALspEditHandle> |
getEditHandles(TLspEditContext aContext)
Returns a set of handles for editing the given object.
|
canCopyGeometry, copyGeometrySFCT, fireUndoableHappened
public TLspShapeListEditor(ILspEditor aDelegateEditor)
aDelegateEditor
- the delegate editor used to edit the shapes of the shape list objectspublic boolean canEdit(TLspEditContext aContext)
geometry inside the given context
can be edited by this editor. Override this method to provide a custom implementation.
The default implementation determines whether the given object is cloneable. This editor can
only edit cloneable objects.
Returns true
if the given object is an instance of ILcdShapeList
and if the given geometry is cloneable.canEdit
in interface ILspEditor
canEdit
in class ALspEditor
aContext
- provides context information to the editortrue
if the above conditions are met, false
otherwise.public boolean canPerformOperation(TLspEditOperation aOperation, TLspEditContext aContext)
true
if the model reference of the edit operation
is equal to that of the edited object.
If the object is not a shapelist, this method delegates to the delegate editor.
Otherwise, the method returns true
if the model reference of the edit operation
is equal to that of the edited object and if the given operation contains a valid
SHAPE_IDENTIFIER
or
if the edit operation is a move operation. False
otherwise.canPerformOperation
in interface ILspEditor
canPerformOperation
in class ALspEditor
aOperation
- the operation to be appliedaContext
- the edit contexttrue
if the above conditions are met.public TLspEditOperationResult edit(TLspEditOperation aOperation, ELspInteractionStatus aInteractionStatus, TLspEditContext aContext)
Note: Only override this method if you want to bypass the undo/redo support
provided by this abstract class. For most use cases, it is preferred to override
editImpl
instead.
SHAPE_IDENTIFIER
user property, then the operation will only be applied on that specific shape. If the operation
is a move operation (without a shape identifier), then the move operation is applied to all subshapes
of the shape list editor.edit
in interface ILspEditor
edit
in class ALspEditor
aOperation
- describes the edit that should occur. This is usually generated
by the handles. It is up
to the concrete editor to determine how to handle this event.aInteractionStatus
- the interaction statusaContext
- the edit context @return the result of the edit operationALspEditor.editImpl(com.luciad.view.lightspeed.editor.operation.TLspEditOperation, com.luciad.view.lightspeed.editor.operation.ELspInteractionStatus, TLspEditContext)
protected TLspEditOperationResult editImpl(TLspEditOperation aOperation, ELspInteractionStatus aInteractionStatus, TLspEditContext aContext)
edit
method to edit the given object based on the given
edit operation
.
Note that this method does not need to lock the model of the object, this already happens in the
edit
method.
This method delegates to the delegate editor if the shape is not a shapelist.
Otherwise, if the operation contains a
SHAPE_IDENTIFIER
user property, then the operation will only be applied on that specific shape. If the operation
is a move operation (without a shape identifier), then the move operation is applied to all subshapes
of the shape list editor.editImpl
in class ALspEditor
aOperation
- the event that contains the information on how to edit the objectaInteractionStatus
- the interaction statusaContext
- the edit contextFAILED
if the given object is not a shape list, or the conditions described above are not met.
SUCCESS
otherwise. If the delegate editor
requires handle invalidation, this will also be made clear in the result.public ALspEditHandle getCreateHandle(TLspEditContext aContext)
ALspCreateHandle
which is a specialized handle implementation used for creating an object.
This method delegates to the delegate editor if the shape is not a shapelist.
Otherwise, it returns null unless the shapelist contains exactly one shape.
In this case, this method returns the handle generated by the delegate editor.
The handle is augmented with a user property containing
SHAPE_IDENTIFIER
as a key, and
the sub-shape for which it should be applied as a reference.aContext
- provides context information such as the layer for which the object
is being edited.SHAPE_IDENTIFIER
identifying
the shape for which the handle is relevant in the subshape.ALspCreateHandle
,
TLspCreateController
public List<ALspEditHandle> getEditHandles(TLspEditContext aContext)
edit
method. As a way to communicate with this method,
handles will copy their properties to the edit operation properties.
This method always delegates to the delegate editor.
If the object is a shape list, each handle is augmented with a user property containing
SHAPE_IDENTIFIER
as a key, and
the sub-shape for which it should be applied as a reference.
The only exception in this process is the ALspObjectTranslationHandle
, which is not augmented with this property. This is because object touch
handles work on domain objects and not on sub-shapes.aContext
- provides context information such as the layer for which the object
is being edited.SHAPE_IDENTIFIER
identifying the shape for which the handle is relevant in the subshape.TLspEditController