GEOS
3.3.7
|
00001 /********************************************************************** 00002 * $Id: IsValidOp.h 3258 2011-03-02 13:13:50Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2010 Sandro Santilli <strk@keybit.net> 00008 * Copyright (C) 2005-2006 Refractions Research Inc. 00009 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00010 * 00011 * This is free software; you can redistribute and/or modify it under 00012 * the terms of the GNU Lesser General Public Licence as published 00013 * by the Free Software Foundation. 00014 * See the COPYING file for more information. 00015 * 00016 ********************************************************************** 00017 * 00018 * Last port: operation/valid/IsValidOp.java r335 (JTS-1.12) 00019 * 00020 **********************************************************************/ 00021 00022 #ifndef GEOS_OP_ISVALIDOP_H 00023 #define GEOS_OP_ISVALIDOP_H 00024 00025 #include <geos/export.h> 00026 00027 #include <geos/operation/valid/TopologyValidationError.h> // for inlined destructor 00028 00029 // Forward declarations 00030 namespace geos { 00031 namespace util { 00032 class TopologyValidationError; 00033 } 00034 namespace geom { 00035 class CoordinateSequence; 00036 class GeometryFactory; 00037 class Geometry; 00038 class Point; 00039 class LinearRing; 00040 class LineString; 00041 class Polygon; 00042 class GeometryCollection; 00043 class MultiPolygon; 00044 class MultiLineString; 00045 } 00046 namespace geomgraph { 00047 class DirectedEdge; 00048 class EdgeIntersectionList; 00049 class PlanarGraph; 00050 class GeometryGraph; 00051 } 00052 } 00053 00054 namespace geos { 00055 namespace operation { // geos::operation 00056 namespace valid { // geos::operation::valid 00057 00062 class GEOS_DLL IsValidOp { 00063 friend class Unload; 00064 private: 00066 const geom::Geometry *parentGeometry; 00067 00068 bool isChecked; 00069 00070 // CHECKME: should this really be a pointer ? 00071 TopologyValidationError* validErr; 00072 00073 // This is the version using 'isChecked' flag 00074 void checkValid(); 00075 00076 void checkValid(const geom::Geometry *g); 00077 void checkValid(const geom::Point *g); 00078 void checkValid(const geom::LinearRing *g); 00079 void checkValid(const geom::LineString *g); 00080 void checkValid(const geom::Polygon *g); 00081 void checkValid(const geom::MultiPolygon *g); 00082 void checkValid(const geom::GeometryCollection *gc); 00083 void checkConsistentArea(geomgraph::GeometryGraph *graph); 00084 00085 00094 void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph); 00095 00102 void checkNoSelfIntersectingRing( 00103 geomgraph::EdgeIntersectionList &eiList); 00104 00105 void checkTooFewPoints(geomgraph::GeometryGraph *graph); 00106 00118 void checkHolesInShell(const geom::Polygon *p, 00119 geomgraph::GeometryGraph *graph); 00120 00133 void checkHolesNotNested(const geom::Polygon *p, 00134 geomgraph::GeometryGraph *graph); 00135 00150 void checkShellsNotNested(const geom::MultiPolygon *mp, 00151 geomgraph::GeometryGraph *graph); 00152 00164 void checkShellNotNested(const geom::LinearRing *shell, 00165 const geom::Polygon *p, 00166 geomgraph::GeometryGraph *graph); 00167 00178 const geom::Coordinate *checkShellInsideHole( 00179 const geom::LinearRing *shell, 00180 const geom::LinearRing *hole, 00181 geomgraph::GeometryGraph *graph); 00182 00183 void checkConnectedInteriors(geomgraph::GeometryGraph &graph); 00184 00185 void checkInvalidCoordinates(const geom::CoordinateSequence *cs); 00186 00187 void checkInvalidCoordinates(const geom::Polygon *poly); 00188 00189 void checkClosedRings(const geom::Polygon *poly); 00190 00191 void checkClosedRing(const geom::LinearRing *ring); 00192 00193 bool isSelfTouchingRingFormingHoleValid; 00194 00195 public: 00202 static const geom::Coordinate *findPtNotNode( 00203 const geom::CoordinateSequence *testCoords, 00204 const geom::LinearRing *searchRing, 00205 geomgraph::GeometryGraph *graph); 00206 00215 static bool isValid(const geom::Coordinate &coord); 00216 00223 static bool isValid(const geom::Geometry &geom); 00224 00225 IsValidOp(const geom::Geometry *geom) 00226 : 00227 parentGeometry(geom), 00228 isChecked(false), 00229 validErr(NULL), 00230 isSelfTouchingRingFormingHoleValid(false) 00231 {} 00232 00234 virtual ~IsValidOp() { 00235 delete validErr; 00236 } 00237 00238 bool isValid(); 00239 00240 TopologyValidationError* getValidationError(); 00241 00268 void setSelfTouchingRingFormingHoleValid(bool isValid) 00269 { 00270 isSelfTouchingRingFormingHoleValid = isValid; 00271 } 00272 00273 }; 00274 00275 } // namespace geos.operation.valid 00276 } // namespace geos.operation 00277 } // namespace geos 00278 00279 #endif // GEOS_OP_ISVALIDOP_H 00280 00281 /********************************************************************** 00282 * $Log$ 00283 * Revision 1.2 2006/03/29 13:53:59 strk 00284 * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages. 00285 * 00286 * Revision 1.1 2006/03/20 16:57:44 strk 00287 * spatialindex.h and opValid.h headers split 00288 * 00289 **********************************************************************/ 00290