GEOS 3.9.1
IsValidOp.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2010 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: operation/valid/IsValidOp.java r335 (JTS-1.12)
18 *
19 **********************************************************************/
20
21#ifndef GEOS_OP_ISVALIDOP_H
22#define GEOS_OP_ISVALIDOP_H
23
24#include <geos/export.h>
25
26#include <geos/operation/valid/TopologyValidationError.h> // for inlined destructor
27
28// Forward declarations
29namespace geos {
30namespace util {
31class TopologyValidationError;
32}
33namespace geom {
34class CoordinateSequence;
35class GeometryFactory;
36class Geometry;
37class Point;
38class LinearRing;
39class LineString;
40class Polygon;
41class GeometryCollection;
42class MultiPolygon;
43class MultiLineString;
44}
45namespace geomgraph {
46class DirectedEdge;
47class EdgeIntersectionList;
48class PlanarGraph;
49class GeometryGraph;
50}
51}
52
53namespace geos {
54namespace operation { // geos::operation
55namespace valid { // geos::operation::valid
56
61class GEOS_DLL IsValidOp {
62 friend class Unload;
63private:
65 const geom::Geometry* parentGeometry;
66
67 bool isChecked;
68
69 // CHECKME: should this really be a pointer ?
71
72 // This is the version using 'isChecked' flag
73 void checkValid();
74
75 void checkValid(const geom::Geometry* g);
76 void checkValid(const geom::Point* g);
77 void checkValid(const geom::LinearRing* g);
78 void checkValid(const geom::LineString* g);
79 void checkValid(const geom::Polygon* g);
80 void checkValid(const geom::MultiPolygon* g);
81 void checkValid(const geom::GeometryCollection* gc);
82 void checkConsistentArea(geomgraph::GeometryGraph* graph);
83
84
93 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph* graph);
94
101 void checkNoSelfIntersectingRing(
103
104 void checkTooFewPoints(geomgraph::GeometryGraph* graph);
105
117 void checkHolesInShell(const geom::Polygon* p,
119
132 void checkHolesNotNested(const geom::Polygon* p,
134
149 void checkShellsNotNested(const geom::MultiPolygon* mp,
151
152
153 void checkConnectedInteriors(geomgraph::GeometryGraph& graph);
154
155 void checkInvalidCoordinates(const geom::CoordinateSequence* cs);
156
157 void checkInvalidCoordinates(const geom::Polygon* poly);
158
159 void checkClosedRings(const geom::Polygon* poly);
160
161 void checkClosedRing(const geom::LinearRing* ring);
162
163 bool isSelfTouchingRingFormingHoleValid;
164
165public:
173 const geom::CoordinateSequence* testCoords,
174 const geom::LinearRing* searchRing,
175 const geomgraph::GeometryGraph* graph);
176
185 static bool isValid(const geom::Coordinate& coord);
186
193 static bool isValid(const geom::Geometry& geom);
194
195 IsValidOp(const geom::Geometry* geom)
196 :
197 parentGeometry(geom),
198 isChecked(false),
199 validErr(nullptr),
200 isSelfTouchingRingFormingHoleValid(false)
201 {}
202
204 virtual
206 {
207 delete validErr;
208 }
209
210 bool isValid();
211
212 TopologyValidationError* getValidationError();
213
237 void
239 {
240 isSelfTouchingRingFormingHoleValid = p_isValid;
241 }
242
243};
244
245} // namespace geos.operation.valid
246} // namespace geos.operation
247} // namespace geos
248
249#endif // GEOS_OP_ISVALIDOP_H
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a collection of heterogeneous Geometry objects.
Definition: GeometryCollection.h:55
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:54
Definition: MultiPolygon.h:59
Definition: Point.h:66
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
A list of edge intersections along an Edge.
Definition: EdgeIntersectionList.h:60
A GeometryGraph is a graph that models a given Geometry.
Definition: GeometryGraph.h:74
Implements the algorithsm required to compute the isValid() method for Geometrys.
Definition: IsValidOp.h:61
static bool isValid(const geom::Coordinate &coord)
Checks whether a coordinate is valid for processing. Coordinates are valid iff their x and y coordina...
static bool isValid(const geom::Geometry &geom)
Tests whether a geom::Geometry is valid.
static const geom::Coordinate * findPtNotNode(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.
virtual ~IsValidOp()
TODO: validErr can't be a pointer!
Definition: IsValidOp.h:205
void setSelfTouchingRingFormingHoleValid(bool p_isValid)
Sets whether polygons using Self-Touching Rings to form holes are reported as valid.
Definition: IsValidOp.h:238
Contains information about the nature and location of a geom::Geometry validation error.
Definition: TopologyValidationError.h:40
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26