Class PatchHandlesProvider
- All Implemented Interfaces:
IGeometryHandlesProvider
,AutoCloseable
edit handles
for a Patch
geometry.
It delegates handle creation to a handles provider
for the base geometry
.
Note: the handle to translate the entire feature is typically created by the IFeatureHandlesProvider
. FeatureHandlesProvider
does this by default.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canProvide
(Observable<@Nullable Geometry> geometry, FeatureEditContext context) Indicates if this handles provider can create handles for the given geometry.void
close()
protected void
finalize()
Returns theIGeometryHandlesProvider
that is used to provide handles for thebase geometry
.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.void
setGeometryHandlesProvider
(IGeometryHandlesProvider handlesProvider) Sets theIGeometryHandlesProvider
that is used to provide handles for thebase geometry
.
-
Constructor Details
-
PatchHandlesProvider
public PatchHandlesProvider()Creates a new handles provider that can provide handles aPatch
geometry.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in 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:
canProvide
in interfaceIGeometryHandlesProvider
- Parameters:
geometry
- an observable geometry, cannot benull
context
- 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:
translation
of features is handled byIFeatureHandlesProvider
. So geometry handles providers should not provide handles to translate a geometry.- Specified by:
provide
in 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 theFeature
has 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
, like for example theFeatureHandlesProvider
implementation. It calls this method to retrieve a translate action, and uses it to create aTranslateEditHandle
.When
ITranslateEditAction#translate
is called, the returned implementation must:- apply a translation on the geometry
- apply this
IGeometryHandlesProvider
's constraint (if configured) on the translated geometry - call
IGeometryEditCallback
with the resulting geometry
- Specified by:
provideTranslateAction
in interfaceIGeometryHandlesProvider
- Parameters:
geometry
- the observable geometry for which to provide a translate action, cannot benull
context
- the context, cannot benull
geometryEditCallback
- a callback that notifies the caller of this method when a translation has occurred, cannot benull
- Returns:
- a translate action. Never
null
.
-
setGeometryHandlesProvider
public void setGeometryHandlesProvider(@NotNull IGeometryHandlesProvider handlesProvider) throws NullPointerException Sets theIGeometryHandlesProvider
that is used to provide handles for thebase geometry
.If this method is not called, a
default
implementation is used.- Parameters:
handlesProvider
- theIGeometryHandlesProvider
to use, cannot benull
.- Throws:
NullPointerException
- whennull
is passed.
-
getGeometryHandlesProvider
Returns theIGeometryHandlesProvider
that is used to provide handles for thebase geometry
.- Returns:
- the
IGeometryHandlesProvider
that is used to provide handles for thebase geometry
. - See Also:
-