Class TLspCircleEditor

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

public class TLspCircleEditor extends ALspEditor
Enables visual editing of ILcd2DEditableCircle objects in an ILspView.

Handles

The editor defines the following edit handles for a circle object:
  • Radius handle: allows the user to edit the radius of the circle. The user can change the radius by dragging the outline of the circle. This handle generates PROPERTY_CHANGE operations, with ""radius"" as property and a Double as value.
  • Center point handle: allows the user to translate the center of the arc. The user can change the position of the center point by dragging the handle. This handle generates MOVE operations, with a HANDLE_IDENTIFIER property with CENTER_POINT as value.
  • Object translation handle: allows the user to translate the circle object. This handle generates MOVE operations, without any additional properties.

The following figure illustrates all the handles: the point and center handles are represented by red points, the green fill color indicates the area that can be used to activate the object handles (note that the outline is also included in this area).

The handles of a circle

Editing

Based on the TLspEditOperation, generated by an edit handle (see description of handles above), this editor performs different edit operations on the associated circle object. 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:
  • Circle radius handle: the editor adjusts the radius of the circle, based on the new location of the point. The figure below illustrates this behaviour.

    Moving the circle radius handle of a circle.

  • Center point handle: the editor translates the entire circle. The figure below illustrates this behaviour.

    Moving the center point handle.

  • Object translation handle: the editor translates the entire circle. Note that the behaviour for this handle is identical to the behaviour of the center point handle, with the exception of how the handle is activated (see the Handles section above).

Creation

The creation process of a circle object consists of the following steps:
  1. the first step sets the center of the circle
  2. the second step initializes the radius of the circle

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

Setting the center point
Initializing the radius
Setting the center point Initializing the radius
Since:
2012.0
  • Constructor Details

    • TLspCircleEditor

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

      If the operation type is MOVE and the operation contains the HANDLE_IDENTIFIER property, then this editor will only perform the operation on the respective point, otherwise it will perform it on the entire circle.

      If the operation type is TLspEditOperationType.PROPERTY_CHANGE, and the name of the changed property is "radius", the radius of the circle is modified.

      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:
      The result of the operation: Whether or not there was success, and whether or not the current handles of the object should be invalidated.
    • 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 following methods:

      It returns a list containing the handles returned by those 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:
    • createObjectTranslationHandle

      protected ALspEditHandle createObjectTranslationHandle(ILcd2DEditableCircle aCircle, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given shape. By default this is a TLspObjectTranslationHandle.
      Parameters:
      aCircle - the shape for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createRadiusHandle

      protected ALspEditHandle createRadiusHandle(ILcd2DEditableCircle aCircle, TLspEditContext aContext)
      Creates an edit handle that allows the user to change the radius of the given circle by dragging a point on the radius.
      Parameters:
      aCircle - the circle for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null when no handle is needed
    • createCenterHandle

      protected ALspEditHandle createCenterHandle(ILcd2DEditableCircle aCircle, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given circle by translating its center point. By default this method returns a TLspPointTranslationHandle with a HANDLE_IDENTIFIER user property with CENTER_POINT as value.
      Parameters:
      aCircle - the circle for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null when 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 returns an ALspCreateHandle capable of creating an ILcd2DEditableCircle, as described in the class javadoc.

      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: