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
00073 void checkValid();
00074
00075 void checkValid(const geom::Geometry *g);
00076 void checkValid(const geom::Point *g);
00077 void checkValid(const geom::LinearRing *g);
00078 void checkValid(const geom::LineString *g);
00079 void checkValid(const geom::Polygon *g);
00080 void checkValid(const geom::MultiPolygon *g);
00081 void checkValid(const geom::GeometryCollection *gc);
00082 void checkConsistentArea(geomgraph::GeometryGraph *graph);
00083
00084
00093 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
00094
00101 void checkNoSelfIntersectingRing(
00102 geomgraph::EdgeIntersectionList &eiList);
00103
00104 void checkTooFewPoints(geomgraph::GeometryGraph *graph);
00105
00117 void checkHolesInShell(const geom::Polygon *p,
00118 geomgraph::GeometryGraph *graph);
00119
00132 void checkHolesNotNested(const geom::Polygon *p,
00133 geomgraph::GeometryGraph *graph);
00134
00149 void checkShellsNotNested(const geom::MultiPolygon *mp,
00150 geomgraph::GeometryGraph *graph);
00151
00163 void checkShellNotNested(const geom::LinearRing *shell,
00164 const geom::Polygon *p,
00165 geomgraph::GeometryGraph *graph);
00166
00177 const geom::Coordinate *checkShellInsideHole(
00178 const geom::LinearRing *shell,
00179 const geom::LinearRing *hole,
00180 geomgraph::GeometryGraph *graph);
00181
00182 void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
00183
00184 void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
00185
00186 void checkInvalidCoordinates(const geom::Polygon *poly);
00187
00188 void checkClosedRings(const geom::Polygon *poly);
00189
00190 void checkClosedRing(const geom::LinearRing *ring);
00191
00192 bool isSelfTouchingRingFormingHoleValid;
00193
00194 public:
00201 static const geom::Coordinate *findPtNotNode(
00202 const geom::CoordinateSequence *testCoords,
00203 const geom::LinearRing *searchRing,
00204 geomgraph::GeometryGraph *graph);
00205
00214 static bool isValid(const geom::Coordinate &coord);
00215
00222 static bool isValid(const geom::Geometry &geom);
00223
00224 IsValidOp(const geom::Geometry *geom)
00225 :
00226 parentGeometry(geom),
00227 isChecked(false),
00228 validErr(NULL),
00229 isSelfTouchingRingFormingHoleValid(false)
00230 {}
00231
00233 virtual ~IsValidOp() {
00234 delete validErr;
00235 }
00236
00237 bool isValid();
00238
00239 TopologyValidationError* getValidationError();
00240
00267 void setSelfTouchingRingFormingHoleValid(bool isValid)
00268 {
00269 isSelfTouchingRingFormingHoleValid = isValid;
00270 }
00271
00272 };
00273
00274 }
00275 }
00276 }
00277
00278 #endif // GEOS_OP_ISVALIDOP_H