Class TLspSphereEditor

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

public class TLspSphereEditor extends ALspEditor
Enables visual editing of ILcd3DEditableSphere objects in an ILspView.

Handles

The sphere editor defines the following edit handles for a sphere object:
  • Radius handle: allows the user to edit the radius of the sphere. The user can change the radius by dragging the outline of the sphere. 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 sphere object. This handle generates MOVE operations, without any additional properties.
  • Height translation handle: only for spheres in a 3D view, allows the user to edit the height of the sphere. The user can change the height by translating this handle. This handle generates MOVE operations, with a Z constraint, and a HANDLE_IDENTIFIER property with HEIGHT_POINT as value.

The following figure illustrates all the handles: the red dots represent the radius- and center handles, the circle shape represents the projected shape handle and the sphere object represents the height translation handle.

Editing handles for sphere objects.

Editing

Based on the TLspEditOperation, generated by an edit handle (see description of handles above), this editor performs different edit operations on the associated sphere 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:
  • Radius handle: the editor modifies the radius of the sphere. The figure below illustrates this behavior.

    Editing the radius of a sphere object.

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

    Translating a sphere object.

  • Object translation handle: the editor translates the entire sphere. 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).
  • Height translation handle: 3D only, the editor modifies the height of the dome. The figure below illustrates this behavior.

    Changing the height of a sphere object.

Creation

The creation process of a sphere consists of two distinct steps:
  1. the first step initializes the XY position of the sphere's center point, putting it at ground level
  2. the second step initializes the radius of the sphere
In a 3D view, and extra step is added:
  1. the third step initializes the height of the sphere's center point above the terrain
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.
Initializing the height.
Setting the center point. Initializing the radius. (3D only) Initializing the height.
Since:
2012.0
  • Constructor Details

    • TLspSphereEditor

      public TLspSphereEditor()
      Creates a new TLspSphereEditor. 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 ILcd3DEditableSphere.
      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 PROPERTY_CHANGE operation contains a HandleIdentifier property, and if this property is RADIUS, then the radius of the sphere 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.
    • 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 ILcd3DEditableSphere, 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:
    • 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:
    • createRadiusHandle

      protected ALspEditHandle createRadiusHandle(ILcd3DEditableSphere aSphere, TLspEditContext aContext)
      Creates an edit handle that allows the user to edit the radius of the given sphere by dragging it.
      Parameters:
      aSphere - the sphere for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed.
    • createCenterHandle

      protected ALspEditHandle createCenterHandle(ILcd3DEditableSphere aSphere, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given sphere in 2D by dragging it. By default this method returns a TLspPointTranslationHandle with a HANDLE_IDENTIFIER property with CENTER_POINT as value.
      Parameters:
      aSphere - the sphere for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed.
    • createHeightTranslationHandle

      protected ALspEditHandle createHeightTranslationHandle(ILcd3DEditableSphere aSphere, TLspEditContext aContext)
      Creates an edit handle that allows the user to alter the height above the terrain of the given sphere by dragging it up/down.

      By default this method returns a TLspObjectHeightTranslationHandle with a HANDLE_IDENTIFIER property with HEIGHT_POINT as value.

      Note that by default this method only returns a height translation handle when the current view is a 3D view. If this is not the case, this method returns null since in a 2D view, the height translation handle is not useful.

      Parameters:
      aSphere - the sphere for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed
    • createObjectTranslationHandle

      protected ALspEditHandle createObjectTranslationHandle(ILcd3DEditableSphere aSphere, TLspEditContext aContext)
      Creates an edit handle that allows the user to translate the given shape.

      By default, in a 3D view, this handle is visualized as a circle (i.e. a projected version of the sphere) on the terrain. The returned handle is a TLspProjectedObjectTranslationHandle.

      By default, in a 2D view, the handle becomes a regular object translation handle. The returned handle is a TLspObjectTranslationHandle.

      Parameters:
      aSphere - the shape for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null if no handle is needed