Class TLspEllipseEditor

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

public class TLspEllipseEditor extends ALspEditor
Enables visual editing of ILcd2DEditableEllipse objects in an ILspView.

Handles

The ellipse editor defines the following edit handles for an ellipse object:
  • Corner point handles: allows the user to edit the corner points of the ellipse. The user can change the location of these corner points by dragging the corresponding handle. These handles generate MOVE operations, with a HANDLE_IDENTIFIER property and MAJOR_AXIS, MAJOR_AXIS_OPPOSITE, MINOR_AXIS or MINOR_AXIS_OPPOSITE as value.
  • Center point handle: allows the user to translate the center of the ellipse. 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 as value.
  • Object translation handle: allows the user to translate the ellipse object. This handle generates MOVE operations, without any additional properties.

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

The handles of a regular ellipse

Editing

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

    Moving a corner point handle of an ellipse.
  • Center point handle: the editor translates the entire ellipse. The figure below illustrates this behaviour when moving the center point.

    Moving the center point handle.
  • Object translation handle: the editor translates the entire ellipse. 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

Creation

The creation process of an ellipse object consists of the following steps:
  1. the first step sets the center of the ellipse
  2. the second step initializes the major axis of the ellipse
  3. the third step initializes the minor axis of the ellipse

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 major axis
Initializing the minor axis
Setting the center point Initializing the major axis Initializing the minor axis
Since:
2012.0
  • Constructor Details

    • TLspEllipseEditor

      public TLspEllipseEditor()
      Creates a new TLspEllipseEditor. 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 ILcd2DEditableEllipse.
      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.
    • 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(ILcd2DEditableEllipse aEllipse, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given shape. By default this is a TLspObjectTranslationHandle.
      Parameters:
      aEllipse - the shape for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createMajorAxisHandle

      protected ALspEditHandle createMajorAxisHandle(ILcd2DEditableEllipse aEllipse, TLspEditContext aContext)
      Creates an edit handle that allows to change the major axis of the ellipse.
      Parameters:
      aEllipse - the ellipse
      aContext - provides context information such as the model reference in which the ellipse is defined
      Returns:
      an edit handle or null if no handle is needed
    • createMinorAxisHandle

      protected ALspEditHandle createMinorAxisHandle(ILcd2DEditableEllipse aEllipse, TLspEditContext aContext)
      Creates an edit handle that allows to change the minor axis of the ellipse.
      Parameters:
      aEllipse - the ellipse
      aContext - provides context information such as the model reference in which the ellipse is defined
      Returns:
      an edit handle or null if no handle is needed
    • createCenterHandle

      protected ALspEditHandle createCenterHandle(ILcd2DEditableEllipse aEllipse, TLspEditContext aContext)
      Creates an edit handle that allows to translate the ellipse by dragging the center point.
      Parameters:
      aEllipse - the ellipse
      aContext - provides context information such as the model reference in which the ellipse is defined
      Returns:
      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 returns an ALspCreateHandle capable of creating an ILcd2DEditableEllipse, 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:
    • 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 any of the operations contains the HANDLE_IDENTIFIER property, with a HandleIdentifier as value, then this editor will only perform the operation on that particular point, otherwise it will perform it on the entire object.
      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.