Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

IsValidOp.h

00001 /**********************************************************************
00002  * $Id: IsValidOp.h 2572 2009-06-08 22:10:55Z 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(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 } // namespace geos.operation.valid
00264 } // namespace geos.operation
00265 } // namespace geos
00266 
00267 #endif // GEOS_OP_ISVALIDOP_H
00268 
00269 /**********************************************************************
00270  * $Log$
00271  * Revision 1.2  2006/03/29 13:53:59  strk
00272  * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages.
00273  *
00274  * Revision 1.1  2006/03/20 16:57:44  strk
00275  * spatialindex.h and opValid.h headers split
00276  *
00277  **********************************************************************/
00278 

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4