GEOS: IsValidOp.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# IsValidOp.h

    00001 /**********************************************************************
    00002  * $Id: IsValidOp.h 1820 2006-09-06 16:54:23Z mloskot $
    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 #ifndef GEOS_OP_ISVALIDOP_H
    00018 #define GEOS_OP_ISVALIDOP_H
    00019
    00020 #include <geos/operation/valid/TopologyValidationError.h> // for inlined destructor
    00021
    00022 // Forward declarations
    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 { // geos::operation
    00049 namespace valid { // geos::operation::valid
    00050
    00056 class IsValidOp {
    00057 friend class Unload;
    00058 private:
    00059         const geom::Geometry *parentGeometry;  // the base Geometry to be validated
    00060         bool isChecked;
    00061         TopologyValidationError* validErr; // CHECKME: should this really be a pointer ?
    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 } // namespace geos.operation.valid
    00253 } // namespace geos.operation
    00254 } // namespace geos
    00255
    00256 #endif // GEOS_OP_ISVALIDOP_H
    00257
    00258 /**********************************************************************
    00259  * $Log$
    00260  * Revision 1.2  2006/03/29 13:53:59  strk
    00261  * EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages.
    00262  *
    00263  * Revision 1.1  2006/03/20 16:57:44  strk
    00264  * spatialindex.h and opValid.h headers split
    00265  *
    00266  **********************************************************************/
    00267