Class PolygonHandlesProvider
- All Implemented Interfaces:
IGeometryHandlesProvider,AutoCloseable
Polygon geometries.
It delegates its handle creation to a delegate IGeometryHandlesProvider for its exterior and interior PolylineRing instances.
Note: the handle to translate the entire feature is typically created by the IFeatureHandlesProvider. FeatureHandlesProvider does this by default.
Limitations of this handle provider:
- it does not create a handle to remove interior
PolylineRinginstances - it does not create a handle to add new interior
PolylineRinginstances - it does not prevent you from modifying the
PolylineRinginstances that overlap with otherPolylineRinginstances, or that self-overlap.
- Since:
- 2024.1
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new handles provider that can create handles for aPolygongeometry. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanProvide(Observable<@Nullable Geometry> geometry, FeatureEditContext context) Indicates if this handles provider can create handles for the given geometry.voidclose()booleanprotected voidfinalize()Returns theIGeometryHandlesProviderthat is used to provide handles for exterior and interiorPolylineRinginstances.inthashCode()provide(Observable<@Nullable Geometry> geometry, FeatureEditContext context, IGeometryEditCallback geometryEditCallback) Returns the handles for the given feature.provideTranslateAction(Observable<@Nullable Geometry> geometry, FeatureEditContext context, IGeometryEditCallback geometryEditCallback) Provides a translate action that can be used by the caller to add translation behavior.voidSets theIGeometryHandlesProviderthat is used to provide handles for the exterior and interiorPolylineRinginstances.
-
Constructor Details
-
PolygonHandlesProvider
public PolygonHandlesProvider()Creates a new handles provider that can create handles for aPolygongeometry.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
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:
canProvidein interfaceIGeometryHandlesProvider- Parameters:
geometry- an observable geometry, cannot benullcontext- the context. Contains additional information about the edited feature, cannot benull.- 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:
translationof features is handled byIFeatureHandlesProvider. So geometry handles providers should not provide handles to translate a geometry.- Specified by:
providein interfaceIGeometryHandlesProvider- Parameters:
geometry- the observable geometry for which to provide handles, cannot benull.context- the context. Contains additional information about the edited feature, cannot benull.geometryEditCallback- a callback that notifies the caller when theFeaturehas changed, cannot benull.- 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, for example theFeatureHandlesProviderimplementation. It calls this method to retrieve a translate action, and uses it to create aTranslateEditHandle.When
ITranslateEditAction#translateis called, the returned implementation must:- apply a translation to the geometry
- apply this
IGeometryHandlesProvider's constraint (if configured) to the translated geometry - call
IGeometryEditCallbackwith the resulting geometry
- Specified by:
provideTranslateActionin interfaceIGeometryHandlesProvider- Parameters:
geometry- the observable geometry for which to provide a translate action, cannot benullcontext- the context, cannot benullgeometryEditCallback- a callback that notifies the caller of this method when a translation has occurred, cannot benull- Returns:
- a translate action. Never
null.
-
setPolylineRingHandlesProvider
public void setPolylineRingHandlesProvider(@NotNull IGeometryHandlesProvider provider) throws NullPointerException Sets theIGeometryHandlesProviderthat is used to provide handles for the exterior and interiorPolylineRinginstances.If this method is not called, a
defaultimplementation is used.- Parameters:
provider- theIGeometryHandlesProviderto use, cannot benull.- Throws:
NullPointerException- whennullis passed.
-
getPolylineRingHandlesProvider
Returns theIGeometryHandlesProviderthat is used to provide handles for exterior and interiorPolylineRinginstances.- Returns:
- the
IGeometryHandlesProviderthat is used to provide handles for exterior and interiorPolylineRinginstances. - See Also:
-
hashCode
public int hashCode() -
equals
-