GEOS  3.9.1dev
IsValidOp.h
Go to the documentation of this file.
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
29 namespace geos {
30 namespace util {
31 class TopologyValidationError;
32 }
33 namespace geom {
34 class CoordinateSequence;
35 class GeometryFactory;
36 class Geometry;
37 class Point;
38 class LinearRing;
39 class LineString;
40 class Polygon;
41 class GeometryCollection;
42 class MultiPolygon;
43 class MultiLineString;
44 }
45 namespace geomgraph {
46 class DirectedEdge;
47 class EdgeIntersectionList;
48 class PlanarGraph;
49 class GeometryGraph;
50 }
51 }
52 
53 namespace geos {
54 namespace operation { // geos::operation
55 namespace valid { // geos::operation::valid
56 
62  friend class Unload;
63 private:
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,
118  geomgraph::GeometryGraph* graph);
119 
132  void checkHolesNotNested(const geom::Polygon* p,
133  geomgraph::GeometryGraph* graph);
134 
149  void checkShellsNotNested(const geom::MultiPolygon* mp,
150  geomgraph::GeometryGraph* graph);
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 
164 
165 public:
172  static const geom::Coordinate* findPtNotNode(
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 
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
void setSelfTouchingRingFormingHoleValid(bool p_isValid)
Sets whether polygons using Self-Touching Rings to form holes are reported as valid.
Definition: IsValidOp.h:238
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.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
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
IsValidOp(const geom::Geometry *geom)
Definition: IsValidOp.h:195
A list of edge intersections along an Edge.
virtual ~IsValidOp()
TODO: validErr can&#39;t be a pointer!
Definition: IsValidOp.h:205
Represents a linear polygon, which may include holes.
Definition: Polygon.h:64
const geom::Geometry * parentGeometry
the base Geometry to be validated
Definition: IsValidOp.h:65
Represents a collection of heterogeneous Geometry objects.
Basic namespace for all GEOS functionalities.
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:54
The internal representation of a list of coordinates inside a Geometry.
TopologyValidationError * validErr
Definition: IsValidOp.h:70
Contains information about the nature and location of a geom::Geometry validation error...