GEOS: geos::geom::util::GeometryEditor Class Reference

Public Member Functions

# geos::geom::util::GeometryEditor Class Reference

`#include <GeometryEditor.h>`

List of all members.

## Public Member Functions
| GeometryEditor ()
| GeometryEditor (const GeometryFactory *newFactory)
Geometry * | edit (const Geometry *geometry, GeometryEditorOperation *operation)

## 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:

- the values of the coordinates may be changed. Changing coordinate values may make the result Geometry invalid; this is not checked by the GeometryEditor
- the coordinate lists may be changed (e.g. by adding or deleting coordinates). The modifed 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.

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

## 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:

  newFactory | the GeometryFactory to create the edited Geometry with

## Member Function Documentation

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:

  geometry | the Geometry to edit
  operation | the edit operation to carry out

Returns:
  a new Geometry which is the result of the editing

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

- GeometryEditor.h