GEOS
3.2.3
|
00001 /********************************************************************** 00002 * $Id: IsValidOp.h 2942 2010-03-18 18:26:02Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: operation/valid/IsValidOp.java rev. 1.41 (JTS-1.10) 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> // for inlined destructor 00027 00028 // Forward declarations 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 { // geos::operation 00055 namespace valid { // geos::operation::valid 00056 00061 class GEOS_DLL IsValidOp { 00062 friend class Unload; 00063 private: 00065 const geom::Geometry *parentGeometry; 00066 00067 bool isChecked; 00068 00069 // CHECKME: should this really be a pointer ? 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 } // namespace geos.operation.valid 00265 } // namespace geos.operation 00266 } // namespace geos 00267 00268 #endif // GEOS_OP_ISVALIDOP_H 00269 00270 /********************************************************************** 00271 * $Log$ 00272 * Revision 1.2 2006/03/29 13:53:59 strk 00273 * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages. 00274 * 00275 * Revision 1.1 2006/03/20 16:57:44 strk 00276 * spatialindex.h and opValid.h headers split 00277 * 00278 **********************************************************************/ 00279