GEOS  3.9.1dev
Classes | Public Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
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>

Collaboration diagram for geos::operation::polygonize::Polygonizer:
[legend]

Classes

class  LineStringAdder
 

Public Member Functions

 Polygonizer (bool onlyPolygonal=false)
 Create a Polygonizer with the same GeometryFactory as the input Geometrys. More...
 
 ~Polygonizer ()=default
 
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. More...
 
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. More...
 
void add (geom::Geometry *g)
 
void add (const geom::Geometry *g)
 
std::vector< std::unique_ptr< geom::Polygon > > getPolygons ()
 Gets the list of polygons formed by the polygonization. More...
 
const std::vector< const geom::LineString * > & getDangles ()
 Get the list of dangling lines found during polygonization. More...
 
bool hasDangles ()
 
const std::vector< const geom::LineString * > & getCutEdges ()
 Get the list of cut edges found during polygonization. More...
 
bool hasCutEdges ()
 
const std::vector< std::unique_ptr< geom::LineString > > & getInvalidRingLines ()
 Get the list of lines forming invalid rings found during polygonization. More...
 
bool hasInvalidRingLines ()
 
bool allInputsFormPolygons ()
 

Protected Attributes

std::unique_ptr< PolygonizeGraphgraph
 
std::vector< const geom::LineString * > dangles
 
std::vector< const geom::LineString * > cutEdges
 
std::vector< std::unique_ptr< geom::LineString > > invalidRingLines
 
std::vector< EdgeRing * > holeList
 
std::vector< EdgeRing * > shellList
 
std::vector< std::unique_ptr< geom::Polygon > > polyList
 

Private Member Functions

void add (const geom::LineString *line)
 
void polygonize ()
 
void findShellsAndHoles (const std::vector< EdgeRing * > &edgeRingList)
 
void findDisjointShells ()
 

Static Private Member Functions

static void findValidRings (const std::vector< EdgeRing * > &edgeRingList, std::vector< EdgeRing * > &validEdgeRingList, std::vector< std::unique_ptr< geom::LineString >> &invalidRingList)
 
static void findOuterShells (std::vector< EdgeRing * > &shellList)
 
static std::vector< std::unique_ptr< geom::Polygon > > extractPolygons (std::vector< EdgeRing * > &shellList, bool includeAll)
 

Private Attributes

LineStringAdder lineStringAdder
 
bool extractOnlyPolygonal
 
bool computed
 

Friends

class Polygonizer::LineStringAdder
 

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:

Definition at line 83 of file Polygonizer.h.

Constructor & Destructor Documentation

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
geos::operation::polygonize::Polygonizer::~Polygonizer ( )
default

Member Function Documentation

void geos::operation::polygonize::Polygonizer::add ( const geom::LineString line)
private

Add a linestring to the graph of polygon edges.

Parameters
linethe LineString to add
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
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
void geos::operation::polygonize::Polygonizer::add ( 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
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
bool geos::operation::polygonize::Polygonizer::allInputsFormPolygons ( )
static std::vector<std::unique_ptr<geom::Polygon> > geos::operation::polygonize::Polygonizer::extractPolygons ( std::vector< EdgeRing * > &  shellList,
bool  includeAll 
)
staticprivate
void geos::operation::polygonize::Polygonizer::findDisjointShells ( )
private
static void geos::operation::polygonize::Polygonizer::findOuterShells ( std::vector< EdgeRing * > &  shellList)
staticprivate
void geos::operation::polygonize::Polygonizer::findShellsAndHoles ( const std::vector< EdgeRing * > &  edgeRingList)
private
static void geos::operation::polygonize::Polygonizer::findValidRings ( const std::vector< EdgeRing * > &  edgeRingList,
std::vector< EdgeRing * > &  validEdgeRingList,
std::vector< std::unique_ptr< geom::LineString >> &  invalidRingList 
)
staticprivate
const std::vector<const geom::LineString*>& 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 which are cut edges.
const std::vector<const geom::LineString*>& 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 which are dangles.
const std::vector<std::unique_ptr<geom::LineString> >& 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 input LineStrings which form invalid rings
std::vector<std::unique_ptr<geom::Polygon> > geos::operation::polygonize::Polygonizer::getPolygons ( )

Gets the list of polygons formed by the polygonization.

Ownership of vector is transferred to caller, subsequent calls will return NULL.

Returns
a collection of Polygons
bool geos::operation::polygonize::Polygonizer::hasCutEdges ( )
bool geos::operation::polygonize::Polygonizer::hasDangles ( )
bool geos::operation::polygonize::Polygonizer::hasInvalidRingLines ( )
void geos::operation::polygonize::Polygonizer::polygonize ( )
private

Perform the polygonization, if it has not already been carried out.

Friends And Related Function Documentation

friend class Polygonizer::LineStringAdder
friend

Definition at line 237 of file Polygonizer.h.

Member Data Documentation

bool geos::operation::polygonize::Polygonizer::computed
private

Definition at line 124 of file Polygonizer.h.

std::vector<const geom::LineString*> geos::operation::polygonize::Polygonizer::cutEdges
protected

Definition at line 132 of file Polygonizer.h.

std::vector<const geom::LineString*> geos::operation::polygonize::Polygonizer::dangles
protected

Definition at line 131 of file Polygonizer.h.

bool geos::operation::polygonize::Polygonizer::extractOnlyPolygonal
private

Definition at line 123 of file Polygonizer.h.

std::unique_ptr<PolygonizeGraph> geos::operation::polygonize::Polygonizer::graph
protected

Definition at line 128 of file Polygonizer.h.

std::vector<EdgeRing*> geos::operation::polygonize::Polygonizer::holeList
protected

Definition at line 135 of file Polygonizer.h.

std::vector<std::unique_ptr<geom::LineString> > geos::operation::polygonize::Polygonizer::invalidRingLines
protected

Definition at line 133 of file Polygonizer.h.

LineStringAdder geos::operation::polygonize::Polygonizer::lineStringAdder
private

Definition at line 97 of file Polygonizer.h.

std::vector<std::unique_ptr<geom::Polygon> > geos::operation::polygonize::Polygonizer::polyList
protected

Definition at line 137 of file Polygonizer.h.

std::vector<EdgeRing*> geos::operation::polygonize::Polygonizer::shellList
protected

Definition at line 136 of file Polygonizer.h.


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