GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
geos::operation::polygonize::EdgeRing Class Reference

Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an outer shell or a hole. More...

#include <EdgeRing.h>

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

Public Member Functions

void add (const PolygonizeDirectedEdge *de)
 Adds a DirectedEdge which is known to form part of this ring. More...
 
EdgeRingfindEdgeRingContaining (const std::vector< EdgeRing * > &erList)
 Find the innermost enclosing shell EdgeRing containing this, if any. More...
 
 EdgeRing (const geom::GeometryFactory *newFactory)
 
 ~EdgeRing ()=default
 
void build (PolygonizeDirectedEdge *startDE)
 
void computeHole ()
 
bool isHole () const
 Tests whether this ring is a hole. More...
 
bool isIncludedSet () const
 
bool isIncluded () const
 
void setIncluded (bool included)
 
bool isProcessed () const
 
void setProcessed (bool processed)
 
void setShell (EdgeRing *shellRing)
 Sets the containing shell ring of a ring that has been determined to be a hole. More...
 
bool hasShell () const
 Tests whether this ring has a shell assigned to it. More...
 
EdgeRinggetShell ()
 Gets the shell for this ring. The shell is the ring itself if it is not a hole, otherwise it is the parent shell. More...
 
bool isOuterHole () const
 Tests whether this ring is an outer hole. A hole is an outer hole if it is not contained by any shell. More...
 
bool isOuterShell () const
 Tests whether this ring is an outer shell. More...
 
EdgeRinggetOuterHole () const
 Gets the outer hole of a shell, if it has one. An outer hole is one that is not contained in any other shell. More...
 
void updateIncludedRecursive ()
 Updates the included status for currently non-included shells based on whether they are adjacent to an included shell. More...
 
void addHole (geom::LinearRing *hole)
 Adds a hole to the polygon formed by this ring. More...
 
void addHole (EdgeRing *holeER)
 
std::unique_ptr< geom::PolygongetPolygon ()
 Computes the Polygon formed by this ring and any contained holes. More...
 
bool isValid ()
 Tests if the LinearRing ring formed by this edge ring is topologically valid. More...
 
std::unique_ptr< geom::LineStringgetLineString ()
 Gets the coordinates for this ring as a LineString. More...
 
geom::LinearRinggetRingInternal ()
 Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem). More...
 
std::unique_ptr< geom::LinearRinggetRingOwnership ()
 Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem). More...
 
bool isInRing (const geom::Coordinate &pt)
 

Static Public Member Functions

static std::vector< PolygonizeDirectedEdge * > findDirEdgesInRing (PolygonizeDirectedEdge *startDE)
 Traverses a ring of DirectedEdges, accumulating them into a list. More...
 
static const geom::CoordinateptNotInList (const geom::CoordinateSequence *testPts, const geom::CoordinateSequence *pts)
 Finds a point in a list of points which is not contained in another list of points. More...
 
static bool isInList (const geom::Coordinate &pt, const geom::CoordinateSequence *pts)
 Tests whether a given point is in an array of points. Uses a value-based test. More...
 

Private Types

typedef std::vector< const PolygonizeDirectedEdge * > DeList
 

Private Member Functions

const geom::CoordinateSequencegetCoordinates ()
 Computes the list of coordinates which are contained in this ring. The coordinates are computed once only and cached. More...
 
algorithm::locate::PointOnGeometryLocatorgetLocator ()
 

Static Private Member Functions

static void addEdge (const geom::CoordinateSequence *coords, bool isForward, geom::CoordinateArraySequence *coordList)
 

Private Attributes

const geom::GeometryFactoryfactory
 
DeList deList
 
std::unique_ptr< geom::LinearRingring
 
std::unique_ptr< geom::CoordinateArraySequenceringPts
 
std::unique_ptr< algorithm::locate::PointOnGeometryLocatorringLocator
 
std::unique_ptr< std::vector< std::unique_ptr< geom::LinearRing > > > holes
 
EdgeRingshell = nullptr
 
bool is_hole
 
bool is_processed = false
 
bool is_included_set = false
 
bool is_included = false
 
bool visitedByUpdateIncludedRecursive = false
 

Detailed Description

Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an outer shell or a hole.

Definition at line 66 of file operation/polygonize/EdgeRing.h.

Member Typedef Documentation

Definition at line 70 of file operation/polygonize/EdgeRing.h.

Constructor & Destructor Documentation

geos::operation::polygonize::EdgeRing::EdgeRing ( const geom::GeometryFactory newFactory)
explicit
geos::operation::polygonize::EdgeRing::~EdgeRing ( )
default

Member Function Documentation

void geos::operation::polygonize::EdgeRing::add ( const PolygonizeDirectedEdge de)

Adds a DirectedEdge which is known to form part of this ring.

Parameters
dethe DirectedEdge to add. Ownership to the caller.
static void geos::operation::polygonize::EdgeRing::addEdge ( const geom::CoordinateSequence coords,
bool  isForward,
geom::CoordinateArraySequence coordList 
)
staticprivate
void geos::operation::polygonize::EdgeRing::addHole ( geom::LinearRing hole)

Adds a hole to the polygon formed by this ring.

Parameters
holethe LinearRing forming the hole.
void geos::operation::polygonize::EdgeRing::addHole ( EdgeRing holeER)
void geos::operation::polygonize::EdgeRing::build ( PolygonizeDirectedEdge startDE)
void geos::operation::polygonize::EdgeRing::computeHole ( )
static std::vector<PolygonizeDirectedEdge*> geos::operation::polygonize::EdgeRing::findDirEdgesInRing ( PolygonizeDirectedEdge startDE)
static

Traverses a ring of DirectedEdges, accumulating them into a list.

This assumes that all dangling directed edges have been removed from the graph, so that there is always a next dirEdge.

Parameters
startDEthe DirectedEdge to start traversing at
Returns
a vector of DirectedEdges that form a ring
EdgeRing* geos::operation::polygonize::EdgeRing::findEdgeRingContaining ( const std::vector< EdgeRing * > &  erList)

Find the innermost enclosing shell EdgeRing containing this, if any.

The innermost enclosing ring is the smallest enclosing ring. The algorithm used depends on the fact that:

ring A contains ring B iff envelope(ring A) contains envelope(ring B)

This routine is only safe to use if the chosen point of the hole is known to be properly contained in a shell (which is guaranteed to be the case if the hole does not touch its shell)

Returns
containing EdgeRing, if there is one
null if no containing EdgeRing is found
const geom::CoordinateSequence* geos::operation::polygonize::EdgeRing::getCoordinates ( )
private

Computes the list of coordinates which are contained in this ring. The coordinates are computed once only and cached.

Returns
an array of the Coordinate in this ring
std::unique_ptr<geom::LineString> geos::operation::polygonize::EdgeRing::getLineString ( )

Gets the coordinates for this ring as a LineString.

Used to return the coordinates in this ring as a valid geometry, when it has been detected that the ring is topologically invalid.

Returns
a LineString containing the coordinates in this ring
algorithm::locate::PointOnGeometryLocator* geos::operation::polygonize::EdgeRing::getLocator ( )
inlineprivate

Definition at line 99 of file operation/polygonize/EdgeRing.h.

EdgeRing* geos::operation::polygonize::EdgeRing::getOuterHole ( ) const

Gets the outer hole of a shell, if it has one. An outer hole is one that is not contained in any other shell.

Each disjoint connected group of shells is surrounded by an outer hole.

Returns
the outer hole edge ring, or nullptr
std::unique_ptr<geom::Polygon> geos::operation::polygonize::EdgeRing::getPolygon ( )

Computes the Polygon formed by this ring and any contained holes.

LinearRings ownership is transferred to returned polygon. Subsequent calls to the function will return NULL.

Returns
the Polygon formed by this ring and its holes.
geom::LinearRing* geos::operation::polygonize::EdgeRing::getRingInternal ( )

Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem).

Ownership of ring is retained by the object. Details of problems are written to standard output.

std::unique_ptr<geom::LinearRing> geos::operation::polygonize::EdgeRing::getRingOwnership ( )

Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem).

Details of problems are written to standard output. Caller gets ownership of ring.

EdgeRing* geos::operation::polygonize::EdgeRing::getShell ( )
inline

Gets the shell for this ring. The shell is the ring itself if it is not a hole, otherwise it is the parent shell.

Returns
the shell for the ring

Definition at line 241 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::hasShell ( ) const
inline

Tests whether this ring has a shell assigned to it.

Returns
true if the ring has a shell

Definition at line 231 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isHole ( ) const
inline

Tests whether this ring is a hole.

Due to the way the edges in the polyongization graph are linked, a ring is a hole if it is oriented counter-clockwise.

Returns
true if this ring is a hole

Definition at line 186 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isIncluded ( ) const
inline

Definition at line 200 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isIncludedSet ( ) const
inline

Definition at line 193 of file operation/polygonize/EdgeRing.h.

static bool geos::operation::polygonize::EdgeRing::isInList ( const geom::Coordinate pt,
const geom::CoordinateSequence pts 
)
static

Tests whether a given point is in an array of points. Uses a value-based test.

Parameters
pta Coordinate for the test point
ptsan array of Coordinate to test
Returns
true if the point is in the array
bool geos::operation::polygonize::EdgeRing::isInRing ( const geom::Coordinate pt)
inline

Definition at line 338 of file operation/polygonize/EdgeRing.h.

References geos::geom::EXTERIOR.

bool geos::operation::polygonize::EdgeRing::isOuterHole ( ) const
inline

Tests whether this ring is an outer hole. A hole is an outer hole if it is not contained by any shell.

Returns
true if the ring is an outer hole.

Definition at line 251 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isOuterShell ( ) const
inline

Tests whether this ring is an outer shell.

Returns
true if the ring is an outer shell.

Definition at line 264 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isProcessed ( ) const
inline

Definition at line 209 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::isValid ( )

Tests if the LinearRing ring formed by this edge ring is topologically valid.

static const geom::Coordinate& geos::operation::polygonize::EdgeRing::ptNotInList ( const geom::CoordinateSequence testPts,
const geom::CoordinateSequence pts 
)
static

Finds a point in a list of points which is not contained in another list of points.

Parameters
testPtsthe CoordinateSequence to test
ptsthe CoordinateSequence to test the input points against
Returns
a Coordinate reference from testPts which is not in pts, or Coordinate::nullCoord
void geos::operation::polygonize::EdgeRing::setIncluded ( bool  included)
inline

Definition at line 204 of file operation/polygonize/EdgeRing.h.

void geos::operation::polygonize::EdgeRing::setProcessed ( bool  processed)
inline

Definition at line 213 of file operation/polygonize/EdgeRing.h.

void geos::operation::polygonize::EdgeRing::setShell ( EdgeRing shellRing)
inline

Sets the containing shell ring of a ring that has been determined to be a hole.

Parameters
shellRingthe shell ring

Definition at line 222 of file operation/polygonize/EdgeRing.h.

void geos::operation::polygonize::EdgeRing::updateIncludedRecursive ( )

Updates the included status for currently non-included shells based on whether they are adjacent to an included shell.

Member Data Documentation

DeList geos::operation::polygonize::EdgeRing::deList
private

Definition at line 71 of file operation/polygonize/EdgeRing.h.

const geom::GeometryFactory* geos::operation::polygonize::EdgeRing::factory
private

Definition at line 68 of file operation/polygonize/EdgeRing.h.

std::unique_ptr<std::vector<std::unique_ptr<geom::LinearRing> > > geos::operation::polygonize::EdgeRing::holes
private

Definition at line 78 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::is_hole
private

Definition at line 81 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::is_included = false
private

Definition at line 84 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::is_included_set = false
private

Definition at line 83 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::is_processed = false
private

Definition at line 82 of file operation/polygonize/EdgeRing.h.

std::unique_ptr<geom::LinearRing> geos::operation::polygonize::EdgeRing::ring
private

Definition at line 74 of file operation/polygonize/EdgeRing.h.

std::unique_ptr<algorithm::locate::PointOnGeometryLocator> geos::operation::polygonize::EdgeRing::ringLocator
private

Definition at line 76 of file operation/polygonize/EdgeRing.h.

std::unique_ptr<geom::CoordinateArraySequence> geos::operation::polygonize::EdgeRing::ringPts
private

Definition at line 75 of file operation/polygonize/EdgeRing.h.

EdgeRing* geos::operation::polygonize::EdgeRing::shell = nullptr
private

Definition at line 80 of file operation/polygonize/EdgeRing.h.

bool geos::operation::polygonize::EdgeRing::visitedByUpdateIncludedRecursive = false
private

Definition at line 85 of file operation/polygonize/EdgeRing.h.


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