GEOS 3.6.2
IsValidOp.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2010 Sandro Santilli <strk@keybit.net>
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 {
30 namespace util {
31 class TopologyValidationError;
32 }
33 namespace geom {
35 class GeometryFactory;
36 class Geometry;
37 class Point;
38 class LinearRing;
39 class LineString;
40 class Polygon;
42 class MultiPolygon;
43 class MultiLineString;
44 }
45 namespace geomgraph {
46 class DirectedEdge;
48 class PlanarGraph;
49 class GeometryGraph;
50 }
51}
52
53namespace geos {
54namespace operation { // geos::operation
55namespace valid { // geos::operation::valid
56
61class GEOS_DLL IsValidOp {
62friend 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
163 void checkShellNotNested(const geom::LinearRing *shell,
164 const geom::Polygon *p,
166
177 const geom::Coordinate *checkShellInsideHole(
178 const geom::LinearRing *shell,
179 const geom::LinearRing *hole,
181
182 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
183
184 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
185
186 void checkInvalidCoordinates(const geom::Polygon *poly);
187
188 void checkClosedRings(const geom::Polygon *poly);
189
190 void checkClosedRing(const geom::LinearRing *ring);
191
192 bool isSelfTouchingRingFormingHoleValid;
193
194public:
202 const geom::CoordinateSequence *testCoords,
203 const geom::LinearRing *searchRing,
205
214 static bool isValid(const geom::Coordinate &coord);
215
222 static bool isValid(const geom::Geometry &geom);
223
224 IsValidOp(const geom::Geometry *geom)
225 :
226 parentGeometry(geom),
227 isChecked(false),
228 validErr(NULL),
229 isSelfTouchingRingFormingHoleValid(false)
230 {}
231
233 virtual ~IsValidOp() {
234 delete validErr;
235 }
236
237 bool isValid();
238
239 TopologyValidationError* getValidationError();
240
268 {
269 isSelfTouchingRingFormingHoleValid = isValid;
270 }
271
272};
273
274} // namespace geos.operation.valid
275} // namespace geos.operation
276} // namespace geos
277
278#endif // GEOS_OP_ISVALIDOP_H
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:67
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Models an OGC SFS LinearRing.
Definition LinearRing.h:57
Models a collection of (}s.
Definition MultiLineString.h:51
Models a collection of Polygons.
Definition MultiPolygon.h:61
Definition Point.h:68
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
A directed EdgeEnd.
Definition geomgraph/DirectedEdge.h:44
Definition EdgeIntersectionList.h:59
Definition GeometryGraph.h:74
Represents a directed graph which is embeddable in a planar surface.
Definition geomgraph/PlanarGraph.h:75
static bool isValid(const geom::Coordinate &coord)
static bool isValid(const geom::Geometry &geom)
void setSelfTouchingRingFormingHoleValid(bool isValid)
Sets whether polygons using Self-Touching Rings to form holes are reported as valid.
Definition IsValidOp.h:267
static const geom::Coordinate * findPtNotNode(const geom::CoordinateSequence *testCoords, const geom::LinearRing *searchRing, geomgraph::GeometryGraph *graph)
virtual ~IsValidOp()
TODO: validErr can't be a pointer!
Definition IsValidOp.h:233
Contains information about the nature and location of a Geometry validation error.
Definition TopologyValidationError.h:40
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes that implement topology graphs.
Definition IndexedNestedRingTester.h:34
Provides classes for testing the validity of geometries.
Definition IndexedNestedRingTester.h:41
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25