GEOS 3.15.0beta1
geos::operation::polygonize::Polygonizer Class Reference

Polygonizes a set of Geometrys which contain linework that represents the edges of a planar graph. More...

#include <Polygonizer.h>

Public Member Functions

 Polygonizer (bool onlyPolygonal=false)
 Create a Polygonizer with the same GeometryFactory as the input Geometrys.
void add (std::vector< geom::Geometry * > *geomList)
 Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used.
void add (std::vector< const geom::Geometry * > *geomList)
 Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used.
void add (const geom::Geometry *g)
std::vector< std::unique_ptr< geom::Polygon > > getPolygons ()
 Gets the list of Polygons formed by the polygonization. Any CurvePolygons formed will be omitted. This function is provided for backward-compatibility with callers expecting a return type of Polygon.
std::vector< std::unique_ptr< geom::Surface > > getSurfaces ()
 Gets the list of (Curve)Polygons formed by the polygonization.
const std::vector< const geom::SimpleCurve * > & getDangles ()
 Get the list of dangling lines found during polygonization.
bool hasDangles ()
const std::vector< const geom::SimpleCurve * > & getCutEdges ()
 Get the list of cut edges found during polygonization.
bool hasCutEdges ()
const std::vector< std::unique_ptr< geom::Curve > > & getInvalidRingLines ()
 Get the list of lines forming invalid rings found during polygonization.
bool hasInvalidRingLines ()
bool allInputsFormPolygons ()

Protected Attributes

std::unique_ptr< PolygonizeGraphgraph
std::vector< const geom::SimpleCurve * > dangles
std::vector< const geom::SimpleCurve * > cutEdges
std::vector< std::unique_ptr< geom::Curve > > invalidRingLines
std::vector< EdgeRing * > holeList
std::vector< EdgeRing * > shellList
std::vector< std::unique_ptr< geom::Surface > > polyList

Friends

class Polygonizer::SimpleCurveAdder

Detailed Description

Polygonizes a set of Geometrys which contain linework that represents the edges of a planar graph.

All types of Geometry are accepted as input; the constituent linework is extracted as the edges to be polygonized. The edges must be correctly noded; that is, they must only meet at their endpoints. Polygonization will accept incorrectly noded input but will not form polygons from non-noded edges, and reports them as errors.

The Polygonizer reports the follow kinds of errors:

  • Dangles - edges which have one or both ends which are not incident on another edge endpoint
  • Cut Edges - edges which are connected at both ends but which do not form part of a polygon
  • Invalid Ring Lines - edges which form rings which are invalid (e.g. the component lines contain a self-intersection)

    The Polygonizer constructor allows extracting only (Curve)Polygons which form a valid polygonal result. The set of extracted polygons is guaranteed to be edge-disjoint. This is useful when it is known that the input lines form a valid polygonal geometry (which may include holes or nested polygons).

Constructor & Destructor Documentation

◆ Polygonizer()

geos::operation::polygonize::Polygonizer::Polygonizer ( bool onlyPolygonal = false)
explicit

Create a Polygonizer with the same GeometryFactory as the input Geometrys.

Parameters
onlyPolygonaltrue if only polygons which form a valid polygonal geometry should be extracted

References Polygonizer().

Referenced by Polygonizer().

Member Function Documentation

◆ add() [1/3]

void geos::operation::polygonize::Polygonizer::add ( const geom::Geometry * g)

Add a geometry to the linework to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used

Parameters
ga Geometry with linework to be polygonized

◆ add() [2/3]

void geos::operation::polygonize::Polygonizer::add ( std::vector< const geom::Geometry * > * geomList)

Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used.

Parameters
geomLista list of Geometry with linework to be polygonized

◆ add() [3/3]

void geos::operation::polygonize::Polygonizer::add ( std::vector< geom::Geometry * > * geomList)

Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geometry may be added; the constituent linework will be extracted and used.

Parameters
geomLista list of Geometry with linework to be polygonized

◆ getCutEdges()

const std::vector< const geom::SimpleCurve * > & geos::operation::polygonize::Polygonizer::getCutEdges ( )

Get the list of cut edges found during polygonization.

Returns
a (possibly empty) collection of pointers to the input LineStrings or CircularStrings which are cut edges.

◆ getDangles()

const std::vector< const geom::SimpleCurve * > & geos::operation::polygonize::Polygonizer::getDangles ( )

Get the list of dangling lines found during polygonization.

Returns
a (possibly empty) collection of pointers to the input LineStrings or CircularStrings which are dangles.

◆ getInvalidRingLines()

const std::vector< std::unique_ptr< geom::Curve > > & geos::operation::polygonize::Polygonizer::getInvalidRingLines ( )

Get the list of lines forming invalid rings found during polygonization.

Returns
a (possibly empty) collection of pointers to the invalid rings

◆ getPolygons()

std::vector< std::unique_ptr< geom::Polygon > > geos::operation::polygonize::Polygonizer::getPolygons ( )

Gets the list of Polygons formed by the polygonization. Any CurvePolygons formed will be omitted. This function is provided for backward-compatibility with callers expecting a return type of Polygon.

Ownership of geometries is transferred to caller. Subsequent calls will return an empty vector.

Returns
a collection of Polygons

◆ getSurfaces()

std::vector< std::unique_ptr< geom::Surface > > geos::operation::polygonize::Polygonizer::getSurfaces ( )

Gets the list of (Curve)Polygons formed by the polygonization.

Ownership of geometries is transferred to caller. Subsequent calls will return an empty vector.

Returns
a collection of Polygons

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