Class TLspBoundsEditor

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

public class TLspBoundsEditor extends ALspEditor
Enables visual editing of ILcd2DEditableBounds and ILcd3DEditableBounds objects in an ILspView.

Handles

The bounds editor defines the following edit handles for a bounds object:
  • Corner handles: allows the user to edit the bounds by moving its corners. The user can change the position of the corners by dragging its handle. This handle generates MOVE operations, with a POINT_IDNETIFIER property, with NORTH_EAST, NORTH_WEST, SOUTH_EAST or SOUTH_WEST as value.
  • Object translation handle: allows the user to translate the bounds object. This handle generates MOVE operations, without any additional properties.
  • Height translation handle: (only for 3D bounds in a 3D view) allows the user to edit the height (above the terrain) of the bounds object. This handle generates MOVE operations, with a OPERATION_IDENTIFIER property, with HEIGHT as value.
  • Minimum height handle: (only for 3D bounds in a 3D view) allows the user to edit the height above the terrain of the location point of the bounds. This handle generates MOVE operations, with a OPERATION_IDENTIFIER property, with MINIMUM_HEIGHT as value.
  • Maximum height handle: (only for 3D bounds in a 3D view) allows the user to edit the depth of the bounds. This handle generates MOVE operations, with a OPERATION_IDENTIFIER property, with MAXIMUM_HEIGHT as value.

The following figure illustrates all the handles for both 2D and 3D bounds objects: the red dots represent the corner handles, the green area can be used to activate the object translation handle (or the projected shape handle in the 3D case), the blue dots represent the minimum and maximum height handles and finally the 3D bounds shape (drawn in cyan) represents the height translation handle:

Edit handles for bounds objects.
(left) handles for a 2D bounds object (right) handles for a 3D bounds object

Editing

Based on the TLspEditOperation, generated by an edit handle (see description of handles above), this editor performs different edit operations on the associated bounds 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 handles: Translates one of the corners of the bounds.

    Editing a corner of a bounds object.

    (left) 2D bounds case (right) 3D bounds case

  • Object translation handle: the editor translates the entire circle.

    Translating a bounds object.

    (left) 2D bounds case (right) 3D bounds case

  • Height translation handle: 3D only, modifies the height of the 3D bounds.

    Changing the height of the 3D bounds object.

  • Minimum height handle: 3D only, modifies the minimum height of the 3D bounds.

    Changing the minimum height of the 3D bounds object.

  • Maximum height handle: 3D only, modifies the maximum height of the 3D bounds.

    Changing the maximum height of the 3D bounds object.

Creation

The creation process of a 2D bounds object consists of two steps:
  1. the first step initializes the location of the bounds
  2. the second step initializes the width and height of the bounds
The creation process of a 3D bounds object adds two more steps to the 2D bounds creation process above:
  1. the third step initializes the depth of the bounds
  2. the fourth step initializes the height of the bounds above the terrain
Below are four figures that illustrate the respective steps of the creation process. The third and fourth figure only apply to 3D bounds objects in a 3D view. Relevant changes that are new in each step are marked in red:

Setting the location of the bounds.
Initializing the radius.
Initializing the depth.
Initializing the height.
Adding points to the buffer Initializing the width (3D only) Initializing the depth (3D only) Initializing the height
Since:
2012.0
  • Constructor Details

    • TLspBoundsEditor

      public TLspBoundsEditor()
      Creates a new TLspBoundsEditor. 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 ILcd2DEditableBounds.
      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.

      The createBoundsResizeHandle is called 4 times, one time for each corner of the bounds.

      This method only delegate to the first three methods is the object is an ILcd3DEditableBounds and if the current view world transformation is a TLspViewXYZWorldTransformation3D.

      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:
    • createMinimumHeightHandle

      protected ALspEditHandle createMinimumHeightHandle(ILcd3DEditableBounds aBounds, TLspEditContext aContext)
      Creates an edit handle that allows the user to edit the Z-value of the given 3D bounds' location by dragging it up/down.

      The handle is painted at the location of the focus point of the given bounds. The handle's height above the terrain is always equal to aBounds.getLocation().getZ().

      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. This method is only called when the bounds is a ILcd3DEditableBounds.

      By default this method returns a handle with a OPERATION_IDENTIFIER user property, with MINIMUM_HEIGHT as value.

      Parameters:
      aBounds - the bounds for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null when no handle is needed
    • createHeightTranslationHandle

      protected ALspEditHandle createHeightTranslationHandle(ILcd3DEditableBounds aBounds, TLspEditContext aContext)
      Creates an edit handle that allows the user to edit the height above the terrain of the given 3D bounds by dragging the bounds up/down.

      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. This method is only called when the bounds is a ILcd3DEditableBounds.

      By default this method returns a handle with a OPERATION_IDENTIFIER user property, with HEIGHT as value.

      Parameters:
      aBounds - the bounds for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null when no handle is needed
    • createMaximumHeightHandle

      protected ALspEditHandle createMaximumHeightHandle(ILcd3DEditableBounds aBounds, TLspEditContext aContext)
      Creates an edit handle that allows the user to edit the depth of the given 3D bounds by dragging it up/down.

      The handle is painted at the location of the focus point of the given bounds. The handle's height above the terrain is always equal to aBounds.getLocation().getZ() + aBounds.getDepth().

      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. This method is only called when the bounds is a ILcd3DEditableBounds.

      By default this method returns a handle with a OPERATION_IDENTIFIER user property, with MAXIMUM_HEIGHT as value.

      Parameters:
      aBounds - the bounds for which the handle is created
      aContext - the current context
      Returns:
      an edit handle or null when no handle is needed
    • createObjectTranslationHandle

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

      protected ALspEditHandle createBoundsResizeHandle(ILcd2DEditableBounds aBounds, TLspEditContext aContext, TLspBoundsEditor.HandleIdentifier aPointID)
      Creates a handle that allows the user to resize the given bounds object by translating one of its corner points.
      Parameters:
      aBounds - the bounds object for which the handle is created
      aContext - the current context
      aPointID - corner of the bounds for which to create a handle
      Returns:
      a resize handle or null when no resize 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 ILcd2DEditableBounds, 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. If any of the operations contains the OPERATION_IDENTIFIER property, with a HandleIdentifier as value, then this editor will only perform that particular operation. Otherwise it will move 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.