Class TLspShapeListEditor

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

public class TLspShapeListEditor extends ALspEditor
Editor wrapper for editing shapes that are contained in a shape list. The individual shapes should be editable by the delegate editor.

An example of an editor that can edit 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.
Since:
2012.0
  • Constructor Details

    • TLspShapeListEditor

      public TLspShapeListEditor(ILspEditor aDelegateEditor)
      Creates a new shape list editor.
      Parameters:
      aDelegateEditor - the delegate editor used to edit the shapes of the shape list objects
  • Method Details

    • 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.

      Returns true if the given object is an instance of ILcdShapeList and if the given geometry is cloneable.

      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.
    • 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.

      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.

      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 above conditions are met.
    • 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.

      Applies the given edit operation on the shape list or delegates to the delegate editor. 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.

      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 - the interaction status
      aContext - the edit context @return the result of the edit operation
      Returns:
      information about the result of the operation
      See Also:
    • editImpl

      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.

      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.

      Specified by:
      editImpl in class ALspEditor
      Parameters:
      aOperation - the event that contains the information on how to edit the object
      aInteractionStatus - the interaction status
      aContext - the edit context
      Returns:
      FAILED 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.
    • 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.

      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.
      Parameters:
      aContext - provides context information such as the layer for which the object is being edited.
      Returns:
      null if the shapelist does not contain exactly one shape, or the handle generated by the delegate editor, augmented with a SHAPE_IDENTIFIER identifying the shape for which the handle is relevant in the subshape.
      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. 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.

      Parameters:
      aContext - provides context information such as the layer for which the object is being edited.
      Returns:
      the handles generated by the delegate editor, augmented with a SHAPE_IDENTIFIER identifying the shape for which the handle is relevant in the subshape.
      See Also: