Class TLsp2DEditableShapeEditor

All Implemented Interfaces:

public class TLsp2DEditableShapeEditor extends ALspEditor
Enables visual editing of ILcd2DEditableShape objects in an ILspView. This editor acts as a very basic editor for any shape that doesn't implement anything more descriptive than ILcd2DEditableShape.


The editable shape editor defines the following edit handles for an editable shape:
  • Object translation handle: allows the user to translate the shape. This handle generates MOVE operations, with a xy constraint, without any additional properties.


Based on the TLspEditOperation, generated by an edit handle (see description of handles above), this editor performs different edit operations on the associated 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:
  • Object translation handle
    Translating a shape.


This editor does not support shape creation. For shape creation, refer to any of the more concrete editors available.
  • Constructor Details

    • TLsp2DEditableShapeEditor

      public TLsp2DEditableShapeEditor()
      Creates a new TLsp2DEditableShapeEditor. This constructor does not initialize any state.
  • Method Details

    • canEdit

      public boolean canEdit(TLspEditContext aContext)
      Returns true if super returns true and the given object is an instance of ILcd2DEditableShape.
      Specified by:
      canEdit in interface ILspEditor
      canEdit in class ALspEditor
      aContext - provides context information to the editor
      true if the above conditions are met, false otherwise.
    • 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.

      By default, this editor can handle the following operations:

      The move operation will move the object around.
      Specified by:
      editImpl in class ALspEditor
      aOperation - the event that contains the information on how to edit the object
      aInteractionStatus -
      aContext - the edit context
      SUCCESS if the above conditions are met, FAILED otherwise.
    • 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 createObjectTranslationHandle method. It is added for convenience, so it can easily be overridden. This method returns either a list with a single handle, or an empty list.

      aContext - provides context information such as the layer for which the object is being edited
      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:
    • createObjectTranslationHandle

      protected ALspEditHandle createObjectTranslationHandle(ILcd2DEditableShape aShape, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given shape. By default this is a TLspObjectTranslationHandle.
      aShape - the point list for which the handle is created
      aContext - the current context
      an edit handle or null if no handle is needed
    • 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 null.

      aContext - provides context information such as the layer for which the object is being created
      null by default.
      See Also: