GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
geos::operation::valid::IsValidOp Class Reference

Implements the algorithsm required to compute the isValid() method for Geometrys. More...

#include <IsValidOp.h>

Collaboration diagram for geos::operation::valid::IsValidOp:
[legend]

Public Member Functions

 IsValidOp (const geom::Geometry *geom)
 
virtual ~IsValidOp ()
 TODO: validErr can't be a pointer! More...
 
bool isValid ()
 
TopologyValidationErrorgetValidationError ()
 
void setSelfTouchingRingFormingHoleValid (bool p_isValid)
 Sets whether polygons using Self-Touching Rings to form holes are reported as valid. More...
 

Static Public Member Functions

static const geom::CoordinatefindPtNotNode (const geom::CoordinateSequence *testCoords, const geom::LinearRing *searchRing, const geomgraph::GeometryGraph *graph)
 Find a point from the list of testCoords that is NOT a node in the edge for the list of searchCoords. More...
 
static bool isValid (const geom::Coordinate &coord)
 Checks whether a coordinate is valid for processing. Coordinates are valid iff their x and y coordinates are in the range of the floating point representation. More...
 
static bool isValid (const geom::Geometry &geom)
 Tests whether a geom::Geometry is valid. More...
 

Private Member Functions

void checkValid ()
 
void checkValid (const geom::Geometry *g)
 
void checkValid (const geom::Point *g)
 
void checkValid (const geom::LinearRing *g)
 
void checkValid (const geom::LineString *g)
 
void checkValid (const geom::Polygon *g)
 
void checkValid (const geom::MultiPolygon *g)
 
void checkValid (const geom::GeometryCollection *gc)
 
void checkConsistentArea (geomgraph::GeometryGraph *graph)
 
void checkNoSelfIntersectingRings (geomgraph::GeometryGraph *graph)
 
void checkNoSelfIntersectingRing (geomgraph::EdgeIntersectionList &eiList)
 
void checkTooFewPoints (geomgraph::GeometryGraph *graph)
 
void checkHolesInShell (const geom::Polygon *p, geomgraph::GeometryGraph *graph)
 
void checkHolesNotNested (const geom::Polygon *p, geomgraph::GeometryGraph *graph)
 
void checkShellsNotNested (const geom::MultiPolygon *mp, geomgraph::GeometryGraph *graph)
 
void checkConnectedInteriors (geomgraph::GeometryGraph &graph)
 
void checkInvalidCoordinates (const geom::CoordinateSequence *cs)
 
void checkInvalidCoordinates (const geom::Polygon *poly)
 
void checkClosedRings (const geom::Polygon *poly)
 
void checkClosedRing (const geom::LinearRing *ring)
 

Private Attributes

const geom::GeometryparentGeometry
 the base Geometry to be validated More...
 
bool isChecked
 
TopologyValidationErrorvalidErr
 
bool isSelfTouchingRingFormingHoleValid
 

Friends

class Unload
 

Detailed Description

Implements the algorithsm required to compute the isValid() method for Geometrys.

Definition at line 61 of file IsValidOp.h.

Constructor & Destructor Documentation

geos::operation::valid::IsValidOp::IsValidOp ( const geom::Geometry geom)
inline

Definition at line 195 of file IsValidOp.h.

virtual geos::operation::valid::IsValidOp::~IsValidOp ( )
inlinevirtual

TODO: validErr can't be a pointer!

Definition at line 205 of file IsValidOp.h.

Member Function Documentation

void geos::operation::valid::IsValidOp::checkClosedRing ( const geom::LinearRing ring)
private
void geos::operation::valid::IsValidOp::checkClosedRings ( const geom::Polygon poly)
private
void geos::operation::valid::IsValidOp::checkConnectedInteriors ( geomgraph::GeometryGraph graph)
private
void geos::operation::valid::IsValidOp::checkConsistentArea ( geomgraph::GeometryGraph graph)
private
void geos::operation::valid::IsValidOp::checkHolesInShell ( const geom::Polygon p,
geomgraph::GeometryGraph graph 
)
private

Test that each hole is inside the polygon shell. This routine assumes that the holes have previously been tested to ensure that all vertices lie on the shell or inside it. A simple test of a single point in the hole can be used, provide the point is chosen such that it does not lie on the boundary of the shell.

Parameters
pthe polygon to be tested for hole inclusion
grapha geomgraph::GeometryGraph incorporating the polygon
void geos::operation::valid::IsValidOp::checkHolesNotNested ( const geom::Polygon p,
geomgraph::GeometryGraph graph 
)
private

Tests that no hole is nested inside another hole. This routine assumes that the holes are disjoint. To ensure this, holes have previously been tested to ensure that:

  • they do not partially overlap (checked by checkRelateConsistency)
  • they are not identical (checked by checkRelateConsistency)
void geos::operation::valid::IsValidOp::checkInvalidCoordinates ( const geom::CoordinateSequence cs)
private
void geos::operation::valid::IsValidOp::checkInvalidCoordinates ( const geom::Polygon poly)
private
void geos::operation::valid::IsValidOp::checkNoSelfIntersectingRing ( geomgraph::EdgeIntersectionList eiList)
private

check that a ring does not self-intersect, except at its endpoints. Algorithm is to count the number of times each node along edge occurs. If any occur more than once, that must be a self-intersection.

void geos::operation::valid::IsValidOp::checkNoSelfIntersectingRings ( geomgraph::GeometryGraph graph)
private

Check that there is no ring which self-intersects (except of course at its endpoints). This is required by OGC topology rules (but not by other models such as ESRI SDE, which allow inverted shells and exverted holes).

Parameters
graphthe topology graph of the geometry
void geos::operation::valid::IsValidOp::checkShellsNotNested ( const geom::MultiPolygon mp,
geomgraph::GeometryGraph graph 
)
private

Tests that no element polygon is wholly in the interior of another element polygon.

Preconditions:

  • shells do not partially overlap
  • shells do not touch along an edge
  • no duplicate rings exist

This routine relies on the fact that while polygon shells may touch at one or more vertices, they cannot touch at ALL vertices.

void geos::operation::valid::IsValidOp::checkTooFewPoints ( geomgraph::GeometryGraph graph)
private
void geos::operation::valid::IsValidOp::checkValid ( )
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::Geometry g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::Point g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::LinearRing g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::LineString g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::Polygon g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::MultiPolygon g)
private
void geos::operation::valid::IsValidOp::checkValid ( const geom::GeometryCollection gc)
private
static const geom::Coordinate* geos::operation::valid::IsValidOp::findPtNotNode ( const geom::CoordinateSequence testCoords,
const geom::LinearRing searchRing,
const geomgraph::GeometryGraph graph 
)
static

Find a point from the list of testCoords that is NOT a node in the edge for the list of searchCoords.

Returns
the point found, or NULL if none found
TopologyValidationError* geos::operation::valid::IsValidOp::getValidationError ( )
static bool geos::operation::valid::IsValidOp::isValid ( const geom::Coordinate coord)
static

Checks whether a coordinate is valid for processing. Coordinates are valid iff their x and y coordinates are in the range of the floating point representation.

Parameters
coordthe coordinate to validate
Returns
true if the coordinate is valid
static bool geos::operation::valid::IsValidOp::isValid ( const geom::Geometry geom)
static

Tests whether a geom::Geometry is valid.

Parameters
geomthe Geometry to test
Returns
true if the geometry is valid
bool geos::operation::valid::IsValidOp::isValid ( )
void geos::operation::valid::IsValidOp::setSelfTouchingRingFormingHoleValid ( bool  p_isValid)
inline

Sets whether polygons using Self-Touching Rings to form holes are reported as valid.

If this flag is set, the following Self-Touching conditions are treated as being valid:

  • the shell ring self-touches to create a hole touching the shell
  • a hole ring self-touches to create two holes touching at a point

The default (following the OGC SFS standard) is that this condition is not valid (false).

This does not affect whether Self-Touching Rings disconnecting the polygon interior are considered valid (these are considered to be invalid under the SFS, and many other spatial models as well). This includes "bow-tie" shells, which self-touch at a single point causing the interior to be disconnected, and "C-shaped" holes which self-touch at a single point causing an island to be formed.

Parameters
p_isValidstates whether geometry with this condition is valid

Definition at line 238 of file IsValidOp.h.

Friends And Related Function Documentation

friend class Unload
friend

Definition at line 62 of file IsValidOp.h.

Member Data Documentation

bool geos::operation::valid::IsValidOp::isChecked
private

Definition at line 67 of file IsValidOp.h.

bool geos::operation::valid::IsValidOp::isSelfTouchingRingFormingHoleValid
private

Definition at line 163 of file IsValidOp.h.

const geom::Geometry* geos::operation::valid::IsValidOp::parentGeometry
private

the base Geometry to be validated

Definition at line 65 of file IsValidOp.h.

TopologyValidationError* geos::operation::valid::IsValidOp::validErr
private

Definition at line 70 of file IsValidOp.h.


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