Public Member Functions | Static Public Member Functions

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>

List of all members.

Public Member Functions

 EdgeRing (const geom::GeometryFactory *newFactory)
void add (const planargraph::DirectedEdge *de)
 Adds a DirectedEdge which is known to form part of this ring.
bool isHole ()
 Tests whether this ring is a hole.
void addHole (geom::LinearRing *hole)
 Adds a hole to the polygon formed by this ring.
geom::PolygongetPolygon ()
 Computes the Polygon formed by this ring and any contained holes.
bool isValid ()
 Tests if the LinearRing ring formed by this edge ring is topologically valid.
geom::LineStringgetLineString ()
 Gets the coordinates for this ring as a LineString.
geom::LinearRinggetRingInternal ()
 Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem).
geom::LinearRinggetRingOwnership ()
 Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topology problem).

Static Public Member Functions

static EdgeRingfindEdgeRingContaining (EdgeRing *testEr, std::vector< EdgeRing * > *shellList)
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.
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.

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.


Member Function Documentation

void geos::operation::polygonize::EdgeRing::add ( const planargraph::DirectedEdge de  ) 

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

Parameters:
de the DirectedEdge to add. Ownership to the caller.
void geos::operation::polygonize::EdgeRing::addHole ( geom::LinearRing hole  ) 

Adds a hole to the polygon formed by this ring.

Parameters:
hole the LinearRing forming the hole.
static EdgeRing* geos::operation::polygonize::EdgeRing::findEdgeRingContaining ( EdgeRing testEr,
std::vector< EdgeRing * > *  shellList 
) [static]

Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, 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
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
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.

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.

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

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
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:
pt a Coordinate for the test point
pts an array of Coordinate to test
Returns:
true if the point is in the array
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:
testPts the CoordinateSequence to test
pts the CoordinateSequence to test the input points against
Returns:
a Coordinate reference from testPts which is not in pts, or Coordinate::nullCoord

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