public final class DefaultFeatureGeometryProvider extends Object implements AutoCloseable, IFeatureGeometryProvider
DataType
using a GeometryDataAnnotation
.
It is implemented as follows:
Feature#findGeometry
Feature#asBuilder
to copy-and-edit a feature, and replaces the Geometry
value of the property in the GeometryDataAnnotation
by a new Geometry
This class should not be used when:
Feature#findGeometry
. The geometry isn't an explicit part of the feature, for example, but you can derive it from other properties on the feature.
Feature#findGeometry
. It can be useful to display a distinct geometry when a user edits a feature. For example, when users edit the location and orientation of a vessel, you can show an Ellipse
, which also has a location and an orientation.
Geometry
property, and a property with the length of that geometry. When the Geometry
property changes, the length property needs to change as well. You can do so by providing a custom implementation of IFeatureGeometryProvider#applyGeometry
that changes the geometry, but also changes the length property.
In these cases, a custom IFeatureGeometryProvider
implementation needs to be used.
Constructor and Description |
---|
DefaultFeatureGeometryProvider() |
Modifier and Type | Method and Description |
---|---|
Feature |
applyGeometry(Feature originalFeature,
Geometry newGeometry)
|
void |
close() |
protected void |
finalize() |
Geometry |
getGeometry(Feature feature)
|
public void close()
close
in interface AutoCloseable
@Nullable public Geometry getGeometry(@NotNull Feature feature)
Feature
(for example a Geometry
using which a Geometry
can be edited or created).
This Geometry
is not necessarily the same geometry as the one used for painting.
See IFeatureGeometryProvider
for more information.
getGeometry
in interface IFeatureGeometryProvider
feature
- the Feature
to editGeometry
using which a Feature
can be edited, or null
if the Feature
can not be edited using a Geometry
@Nullable public Feature applyGeometry(@NotNull Feature originalFeature, @NotNull Geometry newGeometry)
Feature
using the modified Geometry
, and returns it.
This Geometry
is not necessarily the same geometry as the one used for painting. See IFeatureGeometryProvider
for an example.
applyGeometry
in interface IFeatureGeometryProvider
originalFeature
- the original Feature
newGeometry
- a new Geometry
to apply on the Feature
Feature
, based on a modified Geometry