00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_OP_ISVALIDOP_H
00018 #define GEOS_OP_ISVALIDOP_H
00019
00020 #include <geos/operation/valid/TopologyValidationError.h>
00021
00022
00023 namespace geos {
00024 namespace util {
00025 class TopologyValidationError;
00026 }
00027 namespace geom {
00028 class CoordinateSequence;
00029 class GeometryFactory;
00030 class Geometry;
00031 class Point;
00032 class LinearRing;
00033 class LineString;
00034 class Polygon;
00035 class GeometryCollection;
00036 class MultiPolygon;
00037 class MultiLineString;
00038 }
00039 namespace geomgraph {
00040 class DirectedEdge;
00041 class EdgeIntersectionList;
00042 class PlanarGraph;
00043 class GeometryGraph;
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace operation {
00049 namespace valid {
00050
00056 class IsValidOp {
00057 friend class Unload;
00058 private:
00059 const geom::Geometry *parentGeometry;
00060 bool isChecked;
00061 TopologyValidationError* validErr;
00062 void checkValid(const geom::Geometry *g);
00063 void checkValid(const geom::Point *g);
00064 void checkValid(const geom::LinearRing *g);
00065 void checkValid(const geom::LineString *g);
00066 void checkValid(const geom::Polygon *g);
00067 void checkValid(const geom::MultiPolygon *g);
00068 void checkValid(const geom::GeometryCollection *gc);
00069 void checkConsistentArea(geomgraph::GeometryGraph *graph);
00070
00071
00080 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
00081
00088 void checkNoSelfIntersectingRing(
00089 geomgraph::EdgeIntersectionList &eiList);
00090
00091 void checkTooFewPoints(geomgraph::GeometryGraph *graph);
00092
00104 void checkHolesInShell(const geom::Polygon *p,
00105 geomgraph::GeometryGraph *graph);
00106
00119 void checkHolesNotNested(const geom::Polygon *p,
00120 geomgraph::GeometryGraph *graph);
00121
00136 void checkShellsNotNested(const geom::MultiPolygon *mp,
00137 geomgraph::GeometryGraph *graph);
00138
00150 void checkShellNotNested(const geom::LinearRing *shell,
00151 const geom::Polygon *p,
00152 geomgraph::GeometryGraph *graph);
00153
00164 const geom::Coordinate *checkShellInsideHole(
00165 const geom::LinearRing *shell,
00166 const geom::LinearRing *hole,
00167 geomgraph::GeometryGraph *graph);
00168
00169 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
00170
00171 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
00172
00173 void checkInvalidCoordinates(const geom::Polygon *poly);
00174
00175 void checkClosedRings(const geom::Polygon *poly);
00176
00177 void checkClosedRing(const geom::LinearRing *ring);
00178
00179 bool isSelfTouchingRingFormingHoleValid;
00180
00181 public:
00188 static const geom::Coordinate *findPtNotNode(
00189 const geom::CoordinateSequence *testCoords,
00190 const geom::LinearRing *searchRing, geomgraph::GeometryGraph *graph);
00191
00200 static bool isValid(const geom::Coordinate &coord);
00201
00202 IsValidOp(const geom::Geometry *geom)
00203 :
00204 parentGeometry(geom),
00205 isChecked(false),
00206 validErr(NULL),
00207 isSelfTouchingRingFormingHoleValid(false)
00208 {}
00209
00211 virtual ~IsValidOp() {
00212 delete validErr;
00213 }
00214
00215 bool isValid();
00216
00217 TopologyValidationError* getValidationError();
00218
00245 void setSelfTouchingRingFormingHoleValid(bool isValid)
00246 {
00247 isSelfTouchingRingFormingHoleValid = isValid;
00248 }
00249
00250 };
00251
00252 }
00253 }
00254 }
00255
00256 #endif // GEOS_OP_ISVALIDOP_H
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267