00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_OP_ISVALIDOP_H
00023 #define GEOS_OP_ISVALIDOP_H
00024
00025 #include <geos/export.h>
00026
00027 #include <geos/operation/valid/TopologyValidationError.h>
00028
00029
00030 namespace geos {
00031 namespace util {
00032 class TopologyValidationError;
00033 }
00034 namespace geom {
00035 class CoordinateSequence;
00036 class GeometryFactory;
00037 class Geometry;
00038 class Point;
00039 class LinearRing;
00040 class LineString;
00041 class Polygon;
00042 class GeometryCollection;
00043 class MultiPolygon;
00044 class MultiLineString;
00045 }
00046 namespace geomgraph {
00047 class DirectedEdge;
00048 class EdgeIntersectionList;
00049 class PlanarGraph;
00050 class GeometryGraph;
00051 }
00052 }
00053
00054 namespace geos {
00055 namespace operation {
00056 namespace valid {
00057
00062 class GEOS_DLL IsValidOp {
00063 friend class Unload;
00064 private:
00066 const geom::Geometry *parentGeometry;
00067
00068 bool isChecked;
00069
00070
00071 TopologyValidationError* validErr;
00072
00073
00074 void checkValid();
00075
00076 void checkValid(const geom::Geometry *g);
00077 void checkValid(const geom::Point *g);
00078 void checkValid(const geom::LinearRing *g);
00079 void checkValid(const geom::LineString *g);
00080 void checkValid(const geom::Polygon *g);
00081 void checkValid(const geom::MultiPolygon *g);
00082 void checkValid(const geom::GeometryCollection *gc);
00083 void checkConsistentArea(geomgraph::GeometryGraph *graph);
00084
00085
00094 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
00095
00102 void checkNoSelfIntersectingRing(
00103 geomgraph::EdgeIntersectionList &eiList);
00104
00105 void checkTooFewPoints(geomgraph::GeometryGraph *graph);
00106
00118 void checkHolesInShell(const geom::Polygon *p,
00119 geomgraph::GeometryGraph *graph);
00120
00133 void checkHolesNotNested(const geom::Polygon *p,
00134 geomgraph::GeometryGraph *graph);
00135
00150 void checkShellsNotNested(const geom::MultiPolygon *mp,
00151 geomgraph::GeometryGraph *graph);
00152
00164 void checkShellNotNested(const geom::LinearRing *shell,
00165 const geom::Polygon *p,
00166 geomgraph::GeometryGraph *graph);
00167
00178 const geom::Coordinate *checkShellInsideHole(
00179 const geom::LinearRing *shell,
00180 const geom::LinearRing *hole,
00181 geomgraph::GeometryGraph *graph);
00182
00183 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
00184
00185 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
00186
00187 void checkInvalidCoordinates(const geom::Polygon *poly);
00188
00189 void checkClosedRings(const geom::Polygon *poly);
00190
00191 void checkClosedRing(const geom::LinearRing *ring);
00192
00193 bool isSelfTouchingRingFormingHoleValid;
00194
00195 public:
00202 static const geom::Coordinate *findPtNotNode(
00203 const geom::CoordinateSequence *testCoords,
00204 const geom::LinearRing *searchRing,
00205 geomgraph::GeometryGraph *graph);
00206
00215 static bool isValid(const geom::Coordinate &coord);
00216
00223 static bool isValid(const geom::Geometry &geom);
00224
00225 IsValidOp(const geom::Geometry *geom)
00226 :
00227 parentGeometry(geom),
00228 isChecked(false),
00229 validErr(NULL),
00230 isSelfTouchingRingFormingHoleValid(false)
00231 {}
00232
00234 virtual ~IsValidOp() {
00235 delete validErr;
00236 }
00237
00238 bool isValid();
00239
00240 TopologyValidationError* getValidationError();
00241
00268 void setSelfTouchingRingFormingHoleValid(bool isValid)
00269 {
00270 isSelfTouchingRingFormingHoleValid = isValid;
00271 }
00272
00273 };
00274
00275 }
00276 }
00277 }
00278
00279 #endif // GEOS_OP_ISVALIDOP_H
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290