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(const geom::Geometry *g);
00073 void checkValid(const geom::Point *g);
00074 void checkValid(const geom::LinearRing *g);
00075 void checkValid(const geom::LineString *g);
00076 void checkValid(const geom::Polygon *g);
00077 void checkValid(const geom::MultiPolygon *g);
00078 void checkValid(const geom::GeometryCollection *gc);
00079 void checkConsistentArea(geomgraph::GeometryGraph *graph);
00080
00081
00090 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
00091
00098 void checkNoSelfIntersectingRing(
00099 geomgraph::EdgeIntersectionList &eiList);
00100
00101 void checkTooFewPoints(geomgraph::GeometryGraph *graph);
00102
00114 void checkHolesInShell(const geom::Polygon *p,
00115 geomgraph::GeometryGraph *graph);
00116
00129 void checkHolesNotNested(const geom::Polygon *p,
00130 geomgraph::GeometryGraph *graph);
00131
00146 void checkShellsNotNested(const geom::MultiPolygon *mp,
00147 geomgraph::GeometryGraph *graph);
00148
00160 void checkShellNotNested(const geom::LinearRing *shell,
00161 const geom::Polygon *p,
00162 geomgraph::GeometryGraph *graph);
00163
00174 const geom::Coordinate *checkShellInsideHole(
00175 const geom::LinearRing *shell,
00176 const geom::LinearRing *hole,
00177 geomgraph::GeometryGraph *graph);
00178
00179 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
00180
00181 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
00182
00183 void checkInvalidCoordinates(const geom::Polygon *poly);
00184
00185 void checkClosedRings(const geom::Polygon *poly);
00186
00187 void checkClosedRing(const geom::LinearRing *ring);
00188
00189 bool isSelfTouchingRingFormingHoleValid;
00190
00191 public:
00198 static const geom::Coordinate *findPtNotNode(
00199 const geom::CoordinateSequence *testCoords,
00200 const geom::LinearRing *searchRing,
00201 geomgraph::GeometryGraph *graph);
00202
00211 static bool isValid(const geom::Coordinate &coord);
00212
00213 IsValidOp(const geom::Geometry *geom)
00214 :
00215 parentGeometry(geom),
00216 isChecked(false),
00217 validErr(NULL),
00218 isSelfTouchingRingFormingHoleValid(false)
00219 {}
00220
00222 virtual ~IsValidOp() {
00223 delete validErr;
00224 }
00225
00226 bool isValid();
00227
00228 TopologyValidationError* getValidationError();
00229
00256 void setSelfTouchingRingFormingHoleValid(bool isValid)
00257 {
00258 isSelfTouchingRingFormingHoleValid = isValid;
00259 }
00260
00261 };
00262
00263 }
00264 }
00265 }
00266
00267 #endif // GEOS_OP_ISVALIDOP_H
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278