00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_OP_ISVALIDOP_H
00022 #define GEOS_OP_ISVALIDOP_H
00023
00024 #include <geos/export.h>
00025
00026 #include <geos/operation/valid/TopologyValidationError.h>
00027
00028
00029 namespace geos {
00030 namespace util {
00031 class TopologyValidationError;
00032 }
00033 namespace geom {
00034 class CoordinateSequence;
00035 class GeometryFactory;
00036 class Geometry;
00037 class Point;
00038 class LinearRing;
00039 class LineString;
00040 class Polygon;
00041 class GeometryCollection;
00042 class MultiPolygon;
00043 class MultiLineString;
00044 }
00045 namespace geomgraph {
00046 class DirectedEdge;
00047 class EdgeIntersectionList;
00048 class PlanarGraph;
00049 class GeometryGraph;
00050 }
00051 }
00052
00053 namespace geos {
00054 namespace operation {
00055 namespace valid {
00056
00061 class GEOS_DLL IsValidOp {
00062 friend class Unload;
00063 private:
00065 const geom::Geometry *parentGeometry;
00066
00067 bool isChecked;
00068
00069
00070 TopologyValidationError* validErr;
00071
00072 void checkValid();
00073 void checkValid(const geom::Geometry *g);
00074 void checkValid(const geom::Point *g);
00075 void checkValid(const geom::LinearRing *g);
00076 void checkValid(const geom::LineString *g);
00077 void checkValid(const geom::Polygon *g);
00078 void checkValid(const geom::MultiPolygon *g);
00079 void checkValid(const geom::GeometryCollection *gc);
00080 void checkConsistentArea(geomgraph::GeometryGraph *graph);
00081
00082
00091 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
00092
00099 void checkNoSelfIntersectingRing(
00100 geomgraph::EdgeIntersectionList &eiList);
00101
00102 void checkTooFewPoints(geomgraph::GeometryGraph *graph);
00103
00115 void checkHolesInShell(const geom::Polygon *p,
00116 geomgraph::GeometryGraph *graph);
00117
00130 void checkHolesNotNested(const geom::Polygon *p,
00131 geomgraph::GeometryGraph *graph);
00132
00147 void checkShellsNotNested(const geom::MultiPolygon *mp,
00148 geomgraph::GeometryGraph *graph);
00149
00161 void checkShellNotNested(const geom::LinearRing *shell,
00162 const geom::Polygon *p,
00163 geomgraph::GeometryGraph *graph);
00164
00175 const geom::Coordinate *checkShellInsideHole(
00176 const geom::LinearRing *shell,
00177 const geom::LinearRing *hole,
00178 geomgraph::GeometryGraph *graph);
00179
00180 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
00181
00182 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
00183
00184 void checkInvalidCoordinates(const geom::Polygon *poly);
00185
00186 void checkClosedRings(const geom::Polygon *poly);
00187
00188 void checkClosedRing(const geom::LinearRing *ring);
00189
00190 bool isSelfTouchingRingFormingHoleValid;
00191
00192 public:
00199 static const geom::Coordinate *findPtNotNode(
00200 const geom::CoordinateSequence *testCoords,
00201 const geom::LinearRing *searchRing,
00202 geomgraph::GeometryGraph *graph);
00203
00212 static bool isValid(const geom::Coordinate &coord);
00213
00214 IsValidOp(const geom::Geometry *geom)
00215 :
00216 parentGeometry(geom),
00217 isChecked(false),
00218 validErr(NULL),
00219 isSelfTouchingRingFormingHoleValid(false)
00220 {}
00221
00223 virtual ~IsValidOp() {
00224 delete validErr;
00225 }
00226
00227 bool isValid();
00228
00229 TopologyValidationError* getValidationError();
00230
00257 void setSelfTouchingRingFormingHoleValid(bool isValid)
00258 {
00259 isSelfTouchingRingFormingHoleValid = isValid;
00260 }
00261
00262 };
00263
00264 }
00265 }
00266 }
00267
00268 #endif // GEOS_OP_ISVALIDOP_H
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279