public class TLspExtrudedShapeEditor extends ALspEditor
ILcd2DEditablePointList
objects as well as
ILcdEditableExtrudedShape
with a base shape of type ILcd2DEditablePointList
is:
TLspCompositeEditor compositeEditor = new TLspCompositeEditor(); compositeEditor.addEditor(new TLspExtrudedShapeEditor(compositeEditor)); compositeEditor.addEditor(new TLsp2DPointListEditor());
Note that the shape editor
is already a
composite editor containing all LuciadLightspeed editors, including the extruded shape editor.
This editor defines the following as handles for an ILcdEditableExtrudedShape
object:
MOVE
operations, with a HANDLE_IDENTIFIER
property and
MINIMUM_HEIGHT
as value.MOVE
operations, with a HANDLE_IDENTIFIER
property and
MAXIMUM_HEIGHT
as value.MOVE
operations, with a HANDLE_IDENTIFIER
property and HEIGHT
as value.MOVE
operations, without properties. These operations
are delegated to the base shape editor.ILcdEditableExtrudedShape
object with an ILcd2DEditableEllipse
object as base shape : the base shape handles
are indicates as red dots, the green area represents the projected shape handle, the blue
dots represent the min- and max height handle and finally the extruded shape itself represents
the height translation handle.
TLspEditOperation
, generated by an edit handle (see description
of handles above), this editor performs different edit operations on the associated extruded shape.
The images below illustrate the effect of the different handles. In each image the
gray color represents the previous state of the object and the red color represents the edited object:
![]() |
![]() |
|
Creating the base shape | Initializing the height of the extruded shape |
Modifier and Type | Class and Description |
---|---|
static class |
TLspExtrudedShapeEditor.HandleIdentifier
Describes the type of an edit handle created by the enclosing editor implementation.
|
static class |
TLspExtrudedShapeEditor.PropertyKeys
Defines keys used by the enclosing editor implementation to store properties in its
edit handles.
|
Constructor and Description |
---|
TLspExtrudedShapeEditor()
Creates a new
TLspExtrudedShapeEditor . |
TLspExtrudedShapeEditor(ILspEditor aBaseEditor)
Creates a new extruded shape editor with the given base shape editor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canCopyGeometry(Object aSourceGeometry,
Object aDestinationGeometry)
Tests whether this editor can apply the properties of a template source object to the
given target object.
|
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.
|
void |
copyGeometrySFCT(Object aSourceGeometry,
Object aDestinationGeometrySFCT)
Method that takes the given source object and applies all geometry to the
destination object.
|
protected ALspEditHandle |
createHeightHandle(ILcdEditableExtrudedShape shape,
TLspEditContext aContext)
Creates an edit handle that allows the user to adjust the minimum- and maximum height of
the given extruded shape simultaneously by dragging the shape up/down.
|
protected ALspEditHandle |
createMaximumHandle(ILcdEditableExtrudedShape shape,
ILcdPoint basePoint,
TLspEditContext aContext)
Creates an edit handle that allows the user to adjust the maximum height of the given
extruded shape by dragging it up/down.
|
protected ALspEditHandle |
createMinimumHandle(ILcdEditableExtrudedShape shape,
ILcdPoint basePoint,
TLspEditContext aContext)
Creates an edit handle that allows the user to adjust the minimum height of the given
extruded shape by dragging it up/down.
|
protected ALspEditHandle |
createProjectedShapeTranslationHandle(ILcdEditableExtrudedShape shape,
TLspEditContext aContext)
Creates an edit handle that allows the user to translate the given extruded shape in 2D
(i.e. parallel to the terrain).
|
TLspEditOperationResult |
edit(TLspEditOperation aOperation,
ELspInteractionStatus aInteractionStatus,
TLspEditContext aContext)
Applies an interaction obtained from a handle to the object being edited.
|
protected TLspEditOperationResult |
editImpl(TLspEditOperation aEvent,
ELspInteractionStatus aInteractionStatus,
TLspEditContext aContext)
Called by the
edit method to edit the given object based on the given
edit operation . |
ILspEditor |
getBaseShapeEditor()
Gets the editor that is used to edit or create the base
shape of an extruded shape.
|
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.
|
double |
getInitialZValue()
The initial minimal and maximal z-value of a created extruded
shape is set to this value.
|
void |
setInitialZValue(double aInitialZValue)
Set the initial minimal and maximal z-value used when
creating new extruded shapes to the given value.
|
fireUndoableHappened
public TLspExtrudedShapeEditor()
TLspExtrudedShapeEditor
. This constructor does not initialize any state. When using
this constructor, it will not be possible to edit the base shape, only its height.public TLspExtrudedShapeEditor(ILspEditor aBaseEditor)
aBaseEditor
- the editor that will be used to edit the base shapespublic double getInitialZValue()
public void setInitialZValue(double aInitialZValue)
aInitialZValue
- the initial minimal and maximal z-value that a new
extruded shape will be created with.public ILspEditor getBaseShapeEditor()
public 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.
By default, this implementation determines whether the given object is cloneable and if the
given object is an instance of ILcdEditableExtrudedShape
.canEdit
in interface ILspEditor
canEdit
in class ALspEditor
aContext
- provides context information to the editortrue
if the above conditions are met, false
otherwise.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.
HANDLE_IDENTIFIER
property, with a HandleIdentifier
as value, then this editor will only
perform the MOVE
operation on that particular point.
Further this implementation delegates to the base shape editor.
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.
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
- aContext
- the edit context @return the result of the edit operationeditImpl(com.luciad.view.lightspeed.editor.operation.TLspEditOperation, com.luciad.view.lightspeed.editor.operation.ELspInteractionStatus, com.luciad.view.lightspeed.editor.TLspEditContext)
public boolean canPerformOperation(TLspEditOperation aOperation, TLspEditContext aContext)
true
if the model reference of the edit operation
is equal to that of the edited object.
By default this method returns true
if the model reference of the edit operation
is equal to that of the edited object.canPerformOperation
in interface ILspEditor
canPerformOperation
in class ALspEditor
aOperation
- the operation to be appliedaContext
- the edit contextpublic ALspEditHandle getCreateHandle(TLspEditContext aContext)
ALspCreateHandle
which is a specialized handle implementation used for creating an object.
By default, this method returns an ALspCreateHandle
capable of creating an ILcdExtrudedShape
, as described in the class javadoc. If the given object is not an
ILcdExtrudedShape
, this method returns a create handle that is capable
of creating the base shape only.aContext
- provides context information such as the layer for which the object
is being creatednull
if creation should not be allowed.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.
By default this method delegates to the base shape editor.
It also delegates to the following methods:
These methods are added for convenience, so they can easily be overridden.aContext
- provides context information such as the layer for which the object
is being editedTLspEditController
protected ALspEditHandle createMinimumHandle(ILcdEditableExtrudedShape shape, ILcdPoint basePoint, TLspEditContext aContext)
shape
- the extruded shape for which the handle is createdbasePoint
- the base point which provides the XY location of the resulting handleaContext
- the current contextnull
if no handle is neededprotected ALspEditHandle createHeightHandle(ILcdEditableExtrudedShape shape, TLspEditContext aContext)
shape
- the extruded shape for which the handle is createdaContext
- the current contextnull
if no handle is neededprotected ALspEditHandle createMaximumHandle(ILcdEditableExtrudedShape shape, ILcdPoint basePoint, TLspEditContext aContext)
shape
- the extruded shape for which the handle is createdbasePoint
- the base point which provides the XY location of the resulting handleaContext
- the current contextnull
if no handle is neededprotected ALspEditHandle createProjectedShapeTranslationHandle(ILcdEditableExtrudedShape shape, TLspEditContext aContext)
shape
- the extruded shape for which the handle is createdaContext
- the current contextnull
if no handle is neededprotected TLspEditOperationResult editImpl(TLspEditOperation aEvent, 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.
By default, this editor can handle the following operations:
If any of the operations contains the HANDLE_IDENTIFIER
property, with a HandleIdentifier
as value, then this editor will only
perform the MOVE
operation on that particular point.
Further this implementation delegates to the base shape editor.editImpl
in class ALspEditor
aEvent
- the event that contains the information on how to edit the objectaInteractionStatus
- the interaction statusaContext
- the edit contextpublic boolean canCopyGeometry(Object aSourceGeometry, Object aDestinationGeometry)
ALspEditor
canCopyGeometry
in class ALspEditor
aSourceGeometry
- a template source object from which the geometry will be copied fromaDestinationGeometry
- a destination object to which the geometry will be copied tocopyGeometrySFCT
would succeed, false otherwise.ALspEditor.copyGeometrySFCT(java.lang.Object, java.lang.Object)
public void copyGeometrySFCT(Object aSourceGeometry, Object aDestinationGeometrySFCT)
ALspEditor
Method that takes the given source object and applies all geometry to the destination object.
This method is called when performing an undo or redo operation. Before editing an object, a clone is created from the geometry. When performing e.g. an undo operation, the state of the clone is applied on the geometry object using this method. Something similar happens for a redo operation.
By default, this method supports all default (editable) shapes in LuciadLightspeed. Custom editors should override this method to allow this editor to apply changes to the original object given a modified instance of it.
copyGeometrySFCT
in class ALspEditor
aSourceGeometry
- A template source object to copy the geometry from.aDestinationGeometrySFCT
- A destination object to copy the geometry to.