Class TLspExtrudedShapeEditor

java.lang.Object
com.luciad.view.lightspeed.editor.ALspEditor
com.luciad.view.lightspeed.editor.TLspExtrudedShapeEditor
All Implemented Interfaces:
ILspEditor

public class TLspExtrudedShapeEditor extends ALspEditor
Adds editing capabilities for extruded versions of objects. The base shapes are editable with the wrapped base shape editor. If the edited object is not an extruded shape, the editing is forwarded to the base shape editor.

An example of an editor that can edit 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.

Handles

This editor defines the following as handles for an ILcdEditableExtrudedShape object:

  • Base shape handles: these are the handles that are provided by the base shape editor and allow the user to edit the base shape of the extruded shape. They are drawn on top of the terrain and function the same as when they are used to edit a 2D shape.
  • Minimum height handle: only for extruded shapes in a 3D view. Allows the user to edit the minimum height of the extruded shape. This handle generates MOVE operations, with a HANDLE_IDENTIFIER property and MINIMUM_HEIGHT as value.
  • Maximum height handle: only for extruded shapes in a 3D view. Allows the user to edit the maximum height of the extruded shape. This handle generates MOVE operations, with a HANDLE_IDENTIFIER property and MAXIMUM_HEIGHT as value.
  • Height translation handle: only for extruded shapes in a 3D view. Allows the user to edit the height of the extruded shape above the terrain, which boils down to simultaneously changing the minimum- and maximum height of the extruded shape. This handle generates MOVE operations, with a HANDLE_IDENTIFIER property and HEIGHT as value.
  • Projected Shape handle: only for extruded shapes in a 3D view. Allows the user to translate the extruded shape horizontally (i.e. parallel to the terrain). This handle is painted as the base shape on the terrain and can be activated by pressing on that base shape. This handle generates MOVE operations, without properties. These operations are delegated to the base shape editor.

The following image clarifies the handle locations for a 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.

The edit handles of an extruded shape

Editing

Based on the 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:
  • Base shape handle: the editor adjusts the base shape by delegating to the set base shape editor.

    Editing the base shape.
    In this figure the minor axis handle of the ellipse base shape is edited.

  • Minimum height handle: 3D only, modifies the minimum height of the extruded shape.

    Editing the minimum height of the extruded shape.

  • Maximum height handle: 3D only, modifies the maximum height of the extruded shape.

    Editing the maximum height of the extruded shape.

  • Height translation handle: 3D only, modifies the height of the extruded shape.

    Editing the height of the extruded shape.

  • Projected shape handle: 3D only, moves the shape parallel to the terrain.

    Translating the extruded shape.

Creation

The initialization process of an extruded shape consists of two distinct steps:
  1. first the base shape is initialized at the initial height.
  2. when in a 3D view, the next step defines the maximum height of the extruded shape

The figures below illustrate the two steps of the creation process. Relevant changes that are new in each step are marked in red.

Creating the base shape Initializing the height of the extruded shape
Creating the base shape Initializing the height of the extruded shape
Since:
2012.0
  • Constructor Details

    • TLspExtrudedShapeEditor

      public TLspExtrudedShapeEditor()
      Creates a new 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.
    • TLspExtrudedShapeEditor

      public TLspExtrudedShapeEditor(ILspEditor aBaseEditor)
      Creates a new extruded shape editor with the given base shape editor.
      Parameters:
      aBaseEditor - the editor that will be used to edit the base shapes
  • Method Details

    • getInitialZValue

      public double getInitialZValue()
      The initial minimal and maximal z-value of a created extruded shape is set to this value.

      The default value is set to 10000.

      Returns:
      the initial minimal and maximal z-value of a created extruded shape
    • setInitialZValue

      public void setInitialZValue(double aInitialZValue)
      Set the initial minimal and maximal z-value used when creating new extruded shapes to the given value.
      Parameters:
      aInitialZValue - the initial minimal and maximal z-value that a new extruded shape will be created with.
    • getBaseShapeEditor

      public ILspEditor getBaseShapeEditor()
      Gets the editor that is used to edit or create the base shape of an extruded shape.
      Returns:
      the base shape editor
    • canEdit

      public boolean canEdit(TLspEditContext aContext)
      Determines whether or not the 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.

      Specified by:
      canEdit in interface ILspEditor
      Overrides:
      canEdit in class ALspEditor
      Parameters:
      aContext - provides context information to the editor
      Returns:
      true if the above conditions are met, false otherwise.
    • edit

      public TLspEditOperationResult edit(TLspEditOperation aOperation, ELspInteractionStatus aInteractionStatus, TLspEditContext aContext)
      Applies an interaction obtained from a handle to the object being edited.

      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.

      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.

      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.

      Specified by:
      edit in interface ILspEditor
      Overrides:
      edit in class ALspEditor
      Parameters:
      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 operation
      Returns:
      information about the result of the operation
      See Also:
    • canPerformOperation

      public boolean canPerformOperation(TLspEditOperation aOperation, TLspEditContext aContext)
      Determines whether or not the editor knows how to apply the given edit operation to the supplied geometry.

      By default this method returns 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.

      Specified by:
      canPerformOperation in interface ILspEditor
      Overrides:
      canPerformOperation in class ALspEditor
      Parameters:
      aOperation - the operation to be applied
      aContext - the edit context
      Returns:
      true if the model reference of the edit operation is equal to that of the edited object
    • getCreateHandle

      public ALspEditHandle getCreateHandle(TLspEditContext aContext)
      Returns a handle that is used to create the given object. The returned handle is used by the controller to initialize the other of the object.

      Typically the returned handle is an instance of 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.

      Parameters:
      aContext - provides context information such as the layer for which the object is being created
      Returns:
      an edit handle, or null if creation should not be allowed.
      See Also:
    • getEditHandles

      public List<ALspEditHandle> getEditHandles(TLspEditContext aContext)
      Returns a set of handles for editing the given object.

      These handles will be able to generate edit operations, that are passed to the 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.
      Parameters:
      aContext - provides context information such as the layer for which the object is being edited
      Returns:
      the edit handles to edit the given object, or an empty list if it should not be possible to edit the given object.
      See Also:
    • createMinimumHandle

      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.
      Parameters:
      shape - the extruded shape for which the handle is created
      basePoint - the base point which provides the XY location of the resulting handle
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createHeightHandle

      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.
      Parameters:
      shape - the extruded shape for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createMaximumHandle

      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.
      Parameters:
      shape - the extruded shape for which the handle is created
      basePoint - the base point which provides the XY location of the resulting handle
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createProjectedShapeTranslationHandle

      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). This handle is visualized by painting the base shape on the terrain. Dragging the base shape around will also move the extruded shape.
      Parameters:
      shape - the extruded shape for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • editImpl

      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.

      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.

      Specified by:
      editImpl in class ALspEditor
      Parameters:
      aEvent - the event that contains the information on how to edit the object
      aInteractionStatus - the interaction status
      aContext - the edit context
      Returns:
      The result of the operation: Whether or not there was success, and whether or not the current handles of the object should be invalidated.
    • canCopyGeometry

      public boolean canCopyGeometry(Object aSourceGeometry, Object aDestinationGeometry)
      Description copied from class: ALspEditor
      Tests whether this editor can apply the properties of a template source object to the given target object. This method is not allowed to modify the parameters of the given objects.
      Overrides:
      canCopyGeometry in class ALspEditor
      Parameters:
      aSourceGeometry - a template source object from which the geometry will be copied from
      aDestinationGeometry - a destination object to which the geometry will be copied to
      Returns:
      true if a call to copyGeometrySFCT would succeed, false otherwise.
      See Also:
    • copyGeometrySFCT

      public void copyGeometrySFCT(Object aSourceGeometry, Object aDestinationGeometrySFCT)
      Description copied from class: 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.

      Overrides:
      copyGeometrySFCT in class ALspEditor
      Parameters:
      aSourceGeometry - A template source object to copy the geometry from.
      aDestinationGeometrySFCT - A destination object to copy the geometry to.