GeometryEditor class
A class which supports creating new {@link Geometry}s which are modifications of existing ones, maintaining the same type structure. Geometry objects are intended to be treated as immutable. This class "modifies" Geometrys by traversing them, applying a user-defined {@link GeometryEditorOperation}, {@link CoordinateSequenceOperation} or {@link CoordinateOperation} and creating new Geometrys with the same structure but (possibly) modified components.
Examples of the kinds of modifications which can be made are:
- the values of the coordinates may be changed. The editor does not check whether changing coordinate values makes the result Geometry invalid
- the coordinate lists may be changed (e.g. by adding, deleting or modifying coordinates). The modified coordinate lists must be consistent with their original parent component (e.g. a LinearRing must always have at least 4 coordinates, and the first and last coordinate must be equal)
- components of the original geometry may be deleted (e.g. holes may be removed from a Polygon, or LineStrings removed from a MultiLineString). Deletions will be propagated up the component tree appropriately.
This class supports creating an edited Geometry
using a different GeometryFactory
via the {@link #GeometryEditor(GeometryFactory)}
constructor.
Examples of situations where this is required is if the geometry is
transformed to a new SRID and/or a new PrecisionModel.
Usage Notes
- The resulting Geometry is not checked for validity. If validity needs to be enforced, the new Geometry's {@link Geometry#isValid} method should be called.
- By default the UserData of the input geometry is not copied to the result.
@see GeometryTransformer @see Geometry#isValid
@version 1.7
Constructors
- GeometryEditor(GeometryFactory factory)
- Creates a new GeometryEditor object which will create edited {@link Geometry}s with the given {@link GeometryFactory}.
- GeometryEditor.empty()
- Creates a new GeometryEditor object which will create edited {@link Geometry}s with the same {@link GeometryFactory} as the input Geometry.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isUserDataCopied ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
edit(
Geometry? geometry, GeometryEditorOperation operation) → Geometry? - Edit the input {@link Geometry} with the given edit operation. Clients can create subclasses of {@link GeometryEditorOperation} or {@link CoordinateOperation} to perform required modifications.
-
editGeometryCollection(
GeometryCollection collection, GeometryEditorOperation operation) → GeometryCollection -
editInternal(
Geometry geometry, GeometryEditorOperation operation) → Geometry? -
editPolygon(
Polygon? polygon, GeometryEditorOperation operation) → Polygon -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCopyUserData(
bool isUserDataCopied) → void - Sets whether the User Data is copied to the edit result. Only the object reference is copied.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited