public final class PatchHandlesProvider extends Object implements AutoCloseable, IGeometryHandlesProvider
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 and Description |
---|
PatchHandlesProvider()
Creates a new handles provider that can provide handles a
Patch geometry. |
Modifier and Type | Method and Description |
---|---|
boolean |
canProvide(Observable<Geometry> geometry,
FeatureEditContext context)
Indicates if this handles provider can create handles for the given geometry.
|
void |
close() |
protected void |
finalize() |
IGeometryHandlesProvider |
getGeometryHandlesProvider() |
IEditHandles |
provide(Observable<Geometry> geometry,
FeatureEditContext context,
IGeometryEditCallback geometryEditCallback)
Returns the handles for the given feature.
|
ITranslateEditAction |
provideTranslateAction(Observable<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 the
IGeometryHandlesProvider that is used to provide handles for the base geometry . |
public PatchHandlesProvider()
Patch
geometry.public void close()
close
in interface AutoCloseable
public boolean canProvide(@NotNull Observable<Geometry> geometry, @NotNull FeatureEditContext context)
canProvide
in interface IGeometryHandlesProvider
geometry
- an observable geometry, cannot be null
context
- the context. Contains additional information about the edited feature, cannot be null
.Feature
@NotNull public IEditHandles provide(@NotNull Observable<Geometry> geometry, @NotNull FeatureEditContext context, @NotNull IGeometryEditCallback geometryEditCallback)
Note: translation
of features is handled by IFeatureHandlesProvider
. So geometry handles providers should not provide handles to translate a geometry.
provide
in interface IGeometryHandlesProvider
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
.null
.@NotNull public ITranslateEditAction provideTranslateAction(@NotNull Observable<Geometry> geometry, @NotNull FeatureEditContext context, @NotNull IGeometryEditCallback geometryEditCallback)
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:
IGeometryHandlesProvider
's constraint (if configured) on the translated geometry
IGeometryEditCallback
with the resulting geometry
provideTranslateAction
in interface IGeometryHandlesProvider
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
null
.public void setGeometryHandlesProvider(@NotNull IGeometryHandlesProvider handlesProvider) throws NullPointerException
IGeometryHandlesProvider
that is used to provide handles for the base geometry
.
If this method is not called, a default
implementation is used.
handlesProvider
- the IGeometryHandlesProvider
to use, cannot be null
.NullPointerException
- when null
is passed.@NotNull public IGeometryHandlesProvider getGeometryHandlesProvider()
IGeometryHandlesProvider
that is used to provide handles for the base geometry
.PatchHandlesProvider#setGeometryHandlesProvider