Class PolylineHandlesProvider

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

public final class PolylineHandlesProvider extends Object implements AutoCloseable, IGeometryHandlesProvider
This provider can create handles to edit Polyline geometries.

It offer the following handles:

Note: the handle to translate the entire feature is typically created by the IFeatureHandlesProvider. FeatureHandlesProvider does this by default.

  • Constructor Details Link icon

    • PolylineHandlesProvider Link icon

      public PolylineHandlesProvider()
      Creates a new handles provider that can create handles to modify Polyline geometries.
  • Method Details Link icon

    • finalize Link icon

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

      public void close()
      Specified by:
      close in interface AutoCloseable
    • canProvide Link icon

      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 Link icon

      @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 Link icon

      @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.
    • getHandleFactory Link icon

      @NotNull public PolylineHandlesProvider.IHandleFactory getHandleFactory()
      Returns the handle factory used by the handles provider.
      Returns:
      the handle factory used by the handles provider.
    • setHandleFactory Link icon

      public void setHandleFactory(@NotNull PolylineHandlesProvider.IHandleFactory handleFactory) throws NullPointerException
      Sets the handle factory used by the handles provider.

      If this method is not called, a default handle factory is used. You can change the behavior of this default handle factory by:

      • wrapping it with your own IHandleFactory implementation, by delegating to the default factory
      • omitting/replacing one or more handles that are returned
      Parameters:
      handleFactory - a handle factory
      Throws:
      NullPointerException - when null is passed.
    • setMinPointCount Link icon

      public void setMinPointCount(long minPointCount) throws IllegalArgumentException
      Sets the minimum number of points a polyline can have.

      If a polyline's point count is lower than or equal to this value, this handles provider will not provide handles to remove points from that polyline. By default, this value is 2.

      Parameters:
      minPointCount - the minimum number of points allowed.
      Throws:
      IllegalArgumentException - if minPointCount is lower than 2, or higher than the current maximum point count.
    • getMinPointCount Link icon

      public long getMinPointCount()
      Returns the minimum number of points a polyline can have.
      Returns:
      the minimum number of points a polyline can have.
      See Also:
    • setMaxPointCount Link icon

      public void setMaxPointCount(long maxPointCount) throws IllegalArgumentException
      Sets the maximum number of points a polyline can have.

      If a polyline's point count is higher than or equal to this value, this handles provider will not provide handles to insert, prepend or append new points for that polyline. By default, this value is the maximum value of size_t, which realistically corresponds to "no maximum".

      Parameters:
      maxPointCount - the maximum number of points allowed.
      Throws:
      IllegalArgumentException - if maxPointCount is lower than the current min point count.
    • getMaxPointCount Link icon

      public long getMaxPointCount()
      Returns the maximum number of points a polyline can have.
      Returns:
      the maximum number of points a polyline can have.
      See Also:
    • setConstraint Link icon

      public void setConstraint(@Nullable IPolylineConstraint constraint)
      Sets the constraint that is applied to the handles' edit actions.

      They always call this constraint with a PolylineChange, describing a single change. More specifically:

      Parameters:
      constraint - the constraint that is applied to the handles' edit actions, or null if no constraint should be applied.
    • getConstraint Link icon

      @Nullable public IPolylineConstraint getConstraint()
      Returns the constraint that is applied to the handles' edit actions.

      Can be null if no constraint is set.

      Returns:
      the constraint that is applied to the handles' edit actions, or null if no constraint is set.