Package com.luciad.models.features
Class DefaultFeatureGeometryProvider
java.lang.Object
com.luciad.models.features.DefaultFeatureGeometryProvider
- All Implemented Interfaces:
IFeatureGeometryProvider,AutoCloseable
public final class DefaultFeatureGeometryProvider
extends Object
implements AutoCloseable, IFeatureGeometryProvider
Default geometry provider that works for Features with a
DataType using a GeometryDataAnnotation.
It is implemented as follows:
- getGeometry: Calls
Feature#findGeometry - applyGeometry: Uses
Feature#asBuilderto copy-and-edit a feature, and replaces theGeometryvalue of the property in theGeometryDataAnnotationby a newGeometry
This class should not be used when:
- The geometry of the feature is not exposed using
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. - The returned geometry is not the same as the geometry exposed by
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 anEllipse, which also has a location and an orientation. - The feature has properties that are derived from the geometry. A simple example is a feature that has a
Geometryproperty, and a property with the length of that geometry. When theGeometryproperty changes, the length property needs to change as well. You can do so by providing a custom implementation ofIFeatureGeometryProvider#applyGeometrythat changes the geometry, but also changes the length property.
In these cases, a custom IFeatureGeometryProvider implementation needs to be used.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyGeometry(Feature originalFeature, Geometry newGeometry) voidclose()booleanprotected voidfinalize()getGeometry(Feature feature) inthashCode()
-
Constructor Details
-
DefaultFeatureGeometryProvider
public DefaultFeatureGeometryProvider()
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getGeometry
Return the geometry for aFeature(for example aGeometryusing which aGeometrycan be edited or created).This
Geometryis not necessarily the same geometry as the one used for painting.See
IFeatureGeometryProviderfor more information.- Specified by:
getGeometryin interfaceIFeatureGeometryProvider- Parameters:
feature- theFeatureto edit- Returns:
- the
Geometryusing which aFeaturecan be edited, ornullif theFeaturecan not be edited using aGeometry
-
applyGeometry
@Nullable public Feature applyGeometry(@NotNull Feature originalFeature, @NotNull Geometry newGeometry) Updates the originalFeatureusing the modifiedGeometry, and returns it.This
Geometryis not necessarily the same geometry as the one used for painting. SeeIFeatureGeometryProviderfor an example.- Specified by:
applyGeometryin interfaceIFeatureGeometryProvider- Parameters:
originalFeature- the originalFeaturenewGeometry- a newGeometryto apply on theFeature- Returns:
- a new
Feature, based on a modifiedGeometry
-
hashCode
public int hashCode() -
equals
-