Class CompositeGeometryHandlesProvider

java.lang.Object
com.luciad.edit.geometries.CompositeGeometryHandlesProvider
All Implemented Interfaces:
IGeometryHandlesProvider, AutoCloseable

public final class CompositeGeometryHandlesProvider extends Object implements AutoCloseable, IGeometryHandlesProvider
A composite implementation of IGeometryHandlesProvider.

This composite allows you to:

The composite implementation uses its delegate instances in a specific order. The order is based on the priority you assign when you add the delegate instance. If the priorities of two instances are equal, the instance that you added first gets priority.

A default implementation is available, see createDefault.

  • Constructor Details

    • CompositeGeometryHandlesProvider

      public CompositeGeometryHandlesProvider()
      Creates an empty composite instance.
  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • createDefault

      @NotNull public static CompositeGeometryHandlesProvider createDefault()
      Creates a a composite instance with a default set of instances that can handle the following geometries:

      Returns:
      a composite instance with a default set of instances. These instances are registered using CompositeGeometryHandlesProvider::PriorityDefault.
    • canProvide

      public boolean canProvide(@NotNull Observable<@Nullable Geometry> geometry, @NotNull FeatureEditContext context)
      Indicates if this handles provider can create handles for the given geometry.
      Specified by:
      canProvide in interface IGeometryHandlesProvider
      Parameters:
      geometry - an observable geometry, cannot be null
      context - the context. Contains additional information about the edited feature, cannot be null.
      Returns:
      if this handles provider can provide handles and a translate action for the given Feature
    • provide

      @NotNull public IEditHandles provide(@NotNull Observable<@Nullable Geometry> geometry, @NotNull FeatureEditContext context, @NotNull IGeometryEditCallback geometryEditCallback)
      Returns the handles for the given feature.

      Note: translation of features is handled by IFeatureHandlesProvider. So geometry handles providers should not provide handles to translate a geometry.

      Specified by:
      provide in interface IGeometryHandlesProvider
      Parameters:
      geometry - the observable geometry for which to provide handles, cannot be null.
      context - the context. Contains additional information about the edited feature, cannot be null.
      geometryEditCallback - a callback that notifies the caller when the Feature has changed, cannot be null.
      Returns:
      handles for the given feature. Never null.
    • provideTranslateAction

      @NotNull public ITranslateEditAction provideTranslateAction(@NotNull Observable<@Nullable Geometry> geometry, @NotNull FeatureEditContext context, @NotNull IGeometryEditCallback geometryEditCallback)
      Provides a translate action that can be used by the caller to add translation behavior.

      A translation handle is typically added by an IFeatureHandlesProvider, like for example the FeatureHandlesProvider implementation. It calls this method to retrieve a translate action, and uses it to create a TranslateEditHandle.

      When ITranslateEditAction#translate is called, the returned implementation must:

      Specified by:
      provideTranslateAction in interface IGeometryHandlesProvider
      Parameters:
      geometry - the observable geometry for which to provide a translate action, cannot be null
      context - the context, cannot be null
      geometryEditCallback - a callback that notifies the caller of this method when a translation has occurred, cannot be null
      Returns:
      a translate action. Never null.
    • add

      public void add(@NotNull IGeometryHandlesProvider handlesProvider, @NotNull Priority priority) throws NullPointerException
      Adds the given instance to the list of registered instances with the given priority.

      If you want to remove an instance again, use CompositeGeometryHandlesProvider#remove.

      Parameters:
      handlesProvider - a new instance to register, cannot be null
      priority - a priority. The default is PriorityDefault.
      Throws:
      NullPointerException - when null is passed.
    • add

      public void add(@NotNull IGeometryHandlesProvider handlesProvider) throws NullPointerException
      Adds the given instance to the list of registered instances with the given priority.

      If you want to remove an instance again, use CompositeGeometryHandlesProvider#remove.

      Parameters:
      handlesProvider - a new instance to register, cannot be null
      Throws:
      NullPointerException - when null is passed.
    • remove

      public void remove(@NotNull IGeometryHandlesProvider handlesProvider) throws NullPointerException
      Removes this given instance from the list of registered instances.

      Nothing will happen if the given instance was never added before.

      Parameters:
      handlesProvider - the instance to remove from this composite, cannot be null.
      Throws:
      NullPointerException - when null is passed.
    • getList

      @NotNull public List<@NotNull IGeometryHandlesProvider> getList()
      Returns the list containing all registered instances, ordered by priority (highest priority first).
      Returns:
      the list containing all registered instances, ordered by priority (highest priority first).
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object