Class TLspCompositeEditor

java.lang.Object
com.luciad.view.lightspeed.editor.TLspCompositeEditor
All Implemented Interfaces:
ILspEditor
Direct Known Subclasses:
TLspShapeEditor

public class TLspCompositeEditor extends Object implements ILspEditor

Composite editor for ILspEditor objects.

When an object is being edited by this editor, all editing related tasks are delegated to the first compatible editor found.

In case of delegate based editors (i.e. editors that delegate to another editor), it is both valid and recommended to have the composite editor be the delegate of the editor. So for shapelists and extruded shapes, the following construction is perfectly valid:

   //We create a composite editor that can handle circles, extruded circles, shapeslists with circles
   //and shapelists with extruded circles in them:
   TLspCompositeEditor compositeEditor = new TLspCompositeEditor();
   //Create and add shapelist editor with composite editor as delegate.
   compositeEditor.addEditor(new TLspShapeListEditor(compositeEditor));
   //Create and add extruded editor with composite editor as delegate.
   compositeEditor.addEditor(new TLspExtrudedShapeEditor(compositeEditor));
   //Create and add a circle editor
   compositeEditor.addEditor(new TLspCircleEditor());
 
Since:
2012.0
  • Constructor Details

    • TLspCompositeEditor

      public TLspCompositeEditor(ILspEditor... aEditors)
      Creates a new TLspCompositeEditor, composed of the given list of editors.
      Parameters:
      aEditors - a list of delegate editors.
  • Method Details

    • addEditor

      public void addEditor(ILspEditor aEditor)
      Adds the given editor to the list of editors.
      Parameters:
      aEditor - the editor to add
    • addEditor

      public void addEditor(ILspEditor aEditor, int aIndex)
      Adds the given editor to the list of editors. The editor is added at the given index. When an object is being edited by this editor, all editing related tasks are delegated to the first compatible editor found.
      Parameters:
      aEditor - the editor to add
      aIndex - the index at which to add the editor.
    • removeEditor

      public void removeEditor(ILspEditor aEditor)
      Removes the given editor from this composite.
      Parameters:
      aEditor - the editor to remove.
    • getEditors

      public List<ILspEditor> getEditors()
      Gets the list of editors this composite editor delegates to. The returned list is an unmodifiable list. Adding or removing editors should be done using other methods (addEditor and removeEditor).
      Returns:
      the list of editors
    • canEdit

      public boolean canEdit(TLspEditContext aContext)
      Returns true if one of the editors this composite is composed of can edit the given object.
      Specified by:
      canEdit in interface ILspEditor
      Parameters:
      aContext - provides context information to the editor
      Returns:
      true if the above conditions are met, false otherwise.
    • edit

      public TLspEditOperationResult edit(TLspEditOperation aOperation, ELspInteractionStatus aInteractionStatus, TLspEditContext aContext)
      Description copied from interface: ILspEditor
      Applies an interaction obtained from a handle to the object being edited.
      Specified by:
      edit in interface ILspEditor
      Parameters:
      aOperation - describes the edit that should occur. This is usually generated by the handles. It is up to the concrete editor to determine how to handle this event.
      aInteractionStatus - the interaction status
      aContext - the edit context
      Returns:
      information about the result of the operation
    • canPerformOperation

      public boolean canPerformOperation(TLspEditOperation aOperation, TLspEditContext aContext)
      Description copied from interface: ILspEditor
      Determines whether or not the editor knows how to apply the given edit operation to the supplied geometry.
      Specified by:
      canPerformOperation in interface ILspEditor
      Parameters:
      aOperation - the operation to be applied
      aContext - the edit context
      Returns:
      whether or not the editor can apply the given operation
    • 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 the given object, if one of the editors this composite is composed of can create the given object.

      Specified by:
      getCreateHandle in interface ILspEditor
      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.

      The default behavior of this method is as follows. If one of the editors this composite is composed of can edit the given object, it delegate to its getEditHandles method. Otherwise an empty list is returned.

      Specified by:
      getEditHandles in interface ILspEditor
      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: