GEOS  3.9.1dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geos::geom::util::GeometryEditor Class Reference

#include <GeometryEditor.h>

Collaboration diagram for geos::geom::util::GeometryEditor:
[legend]

Public Member Functions

 GeometryEditor ()
 
 GeometryEditor (const GeometryFactory *newFactory)
 
std::unique_ptr< Geometryedit (const Geometry *geometry, GeometryEditorOperation *operation)
 

Private Member Functions

std::unique_ptr< PolygoneditPolygon (const Polygon *polygon, GeometryEditorOperation *operation)
 
std::unique_ptr< GeometryCollectioneditGeometryCollection (const GeometryCollection *collection, GeometryEditorOperation *operation)
 

Private Attributes

const GeometryFactoryfactory
 

Detailed Description

Supports creating a new Geometry which is a modification of an existing one. Geometry objects are intended to be treated as immutable. This class allows you to "modify" a Geometry by traversing it and creating a new Geometry with the same overall structure but possibly modified components.

The following kinds of modifications can be made:

Note that all changes must be consistent with the original Geometry's structure (e.g. a Polygon cannot be collapsed into a LineString).

The resulting Geometry is not checked for validity. If validity needs to be enforced, the new Geometry's isValid should be checked.

See also
Geometry::isValid

Definition at line 79 of file GeometryEditor.h.

Constructor & Destructor Documentation

geos::geom::util::GeometryEditor::GeometryEditor ( )

Creates a new GeometryEditor object which will create an edited Geometry with the same GeometryFactory as the input Geometry.

geos::geom::util::GeometryEditor::GeometryEditor ( const GeometryFactory newFactory)

Creates a new GeometryEditor object which will create the edited Geometry with the given GeometryFactory

Parameters
newFactorythe GeometryFactory to create the edited Geometry with

Member Function Documentation

std::unique_ptr<Geometry> geos::geom::util::GeometryEditor::edit ( const Geometry geometry,
GeometryEditorOperation operation 
)

Edit the input Geometry with the given edit operation. Clients will create subclasses of GeometryEditorOperation or CoordinateOperation to perform required modifications.

Parameters
geometrythe Geometry to edit
operationthe edit operation to carry out
Returns
a new Geometry which is the result of the editing
std::unique_ptr<GeometryCollection> geos::geom::util::GeometryEditor::editGeometryCollection ( const GeometryCollection collection,
GeometryEditorOperation operation 
)
private
std::unique_ptr<Polygon> geos::geom::util::GeometryEditor::editPolygon ( const Polygon polygon,
GeometryEditorOperation operation 
)
private

Member Data Documentation

const GeometryFactory* geos::geom::util::GeometryEditor::factory
private

The factory used to create the modified Geometry

Definition at line 84 of file GeometryEditor.h.


The documentation for this class was generated from the following file: