/usr/include/geos/operation/valid/IsValidOp.h is in libgeos-dev 3.2.2-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | /**********************************************************************
* $Id: IsValidOp.h 2942 2010-03-18 18:26:02Z strk $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/valid/IsValidOp.java rev. 1.41 (JTS-1.10)
*
**********************************************************************/
#ifndef GEOS_OP_ISVALIDOP_H
#define GEOS_OP_ISVALIDOP_H
#include <geos/export.h>
#include <geos/operation/valid/TopologyValidationError.h> // for inlined destructor
// Forward declarations
namespace geos {
namespace util {
class TopologyValidationError;
}
namespace geom {
class CoordinateSequence;
class GeometryFactory;
class Geometry;
class Point;
class LinearRing;
class LineString;
class Polygon;
class GeometryCollection;
class MultiPolygon;
class MultiLineString;
}
namespace geomgraph {
class DirectedEdge;
class EdgeIntersectionList;
class PlanarGraph;
class GeometryGraph;
}
}
namespace geos {
namespace operation { // geos::operation
namespace valid { // geos::operation::valid
/** \brief
* Implements the algorithsm required to compute the <code>isValid()</code>
* method for {@link Geometry}s.
*/
class GEOS_DLL IsValidOp {
friend class Unload;
private:
/// the base Geometry to be validated
const geom::Geometry *parentGeometry;
bool isChecked;
// CHECKME: should this really be a pointer ?
TopologyValidationError* validErr;
void checkValid();
void checkValid(const geom::Geometry *g);
void checkValid(const geom::Point *g);
void checkValid(const geom::LinearRing *g);
void checkValid(const geom::LineString *g);
void checkValid(const geom::Polygon *g);
void checkValid(const geom::MultiPolygon *g);
void checkValid(const geom::GeometryCollection *gc);
void checkConsistentArea(geomgraph::GeometryGraph *graph);
/**
* Check that there is no ring which self-intersects
* (except of course at its endpoints).
* This is required by OGC topology rules (but not by other models
* such as ESRI SDE, which allow inverted shells and exverted holes).
*
* @param graph the topology graph of the geometry
*/
void checkNoSelfIntersectingRings(geomgraph::GeometryGraph *graph);
/**
* check that a ring does not self-intersect, except at its endpoints.
* Algorithm is to count the number of times each node along edge
* occurs.
* If any occur more than once, that must be a self-intersection.
*/
void checkNoSelfIntersectingRing(
geomgraph::EdgeIntersectionList &eiList);
void checkTooFewPoints(geomgraph::GeometryGraph *graph);
/**
* Test that each hole is inside the polygon shell.
* This routine assumes that the holes have previously been tested
* to ensure that all vertices lie on the shell or inside it.
* A simple test of a single point in the hole can be used,
* provide the point is chosen such that it does not lie on the
* boundary of the shell.
*
* @param p the polygon to be tested for hole inclusion
* @param graph a geomgraph::GeometryGraph incorporating the polygon
*/
void checkHolesInShell(const geom::Polygon *p,
geomgraph::GeometryGraph *graph);
/**
* Tests that no hole is nested inside another hole.
* This routine assumes that the holes are disjoint.
* To ensure this, holes have previously been tested
* to ensure that:
*
* - they do not partially overlap
* (checked by <code>checkRelateConsistency</code>)
* - they are not identical
* (checked by <code>checkRelateConsistency</code>)
*
*/
void checkHolesNotNested(const geom::Polygon *p,
geomgraph::GeometryGraph *graph);
/**
* Tests that no element polygon is wholly in the interior of another
* element polygon.
*
* Preconditions:
*
* - shells do not partially overlap
* - shells do not touch along an edge
* - no duplicate rings exist
*
* This routine relies on the fact that while polygon shells
* may touch at one or more vertices, they cannot touch at
* ALL vertices.
*/
void checkShellsNotNested(const geom::MultiPolygon *mp,
geomgraph::GeometryGraph *graph);
/**
* Check if a shell is incorrectly nested within a polygon.
* This is the case if the shell is inside the polygon shell,
* but not inside a polygon hole.
* (If the shell is inside a polygon hole, the nesting is valid.)
*
* The algorithm used relies on the fact that the rings must be
* properly contained.
* E.g. they cannot partially overlap (this has been previously
* checked by <code>checkRelateConsistency</code>
*/
void checkShellNotNested(const geom::LinearRing *shell,
const geom::Polygon *p,
geomgraph::GeometryGraph *graph);
/**
* This routine checks to see if a shell is properly contained
* in a hole.
* It assumes that the edges of the shell and hole do not
* properly intersect.
*
* @return <code>null</code> if the shell is properly contained, or
* a Coordinate which is not inside the hole if it is not
*
*/
const geom::Coordinate *checkShellInsideHole(
const geom::LinearRing *shell,
const geom::LinearRing *hole,
geomgraph::GeometryGraph *graph);
void checkConnectedInteriors(geomgraph::GeometryGraph &graph);
void checkInvalidCoordinates(const geom::CoordinateSequence *cs);
void checkInvalidCoordinates(const geom::Polygon *poly);
void checkClosedRings(const geom::Polygon *poly);
void checkClosedRing(const geom::LinearRing *ring);
bool isSelfTouchingRingFormingHoleValid;
public:
/**
* Find a point from the list of testCoords
* that is NOT a node in the edge for the list of searchCoords
*
* @return the point found, or NULL if none found
*/
static const geom::Coordinate *findPtNotNode(
const geom::CoordinateSequence *testCoords,
const geom::LinearRing *searchRing,
geomgraph::GeometryGraph *graph);
/**
* Checks whether a coordinate is valid for processing.
* Coordinates are valid iff their x and y coordinates are in the
* range of the floating point representation.
*
* @param coord the coordinate to validate
* @return <code>true</code> if the coordinate is valid
*/
static bool isValid(const geom::Coordinate &coord);
IsValidOp(const geom::Geometry *geom)
:
parentGeometry(geom),
isChecked(false),
validErr(NULL),
isSelfTouchingRingFormingHoleValid(false)
{}
/// TODO: validErr can't be a pointer!
virtual ~IsValidOp() {
delete validErr;
}
bool isValid();
TopologyValidationError* getValidationError();
/** \brief
* Sets whether polygons using <b>Self-Touching Rings</b> to form
* holes are reported as valid.
*
* If this flag is set, the following Self-Touching conditions
* are treated as being valid:
* <ul>
* <li>the shell ring self-touches to create a hole touching the shell
* <li>a hole ring self-touches to create two holes touching at a point
* </ul>
* <p>
* The default (following the OGC SFS standard)
* is that this condition is <b>not</b> valid (<code>false</code>).
* <p>
* This does not affect whether Self-Touching Rings
* disconnecting the polygon interior are considered valid
* (these are considered to be <b>invalid</b> under the SFS,
* and many other spatial models as well).
* This includes "bow-tie" shells,
* which self-touch at a single point causing the interior to
* be disconnected,
* and "C-shaped" holes which self-touch at a single point causing
* an island to be formed.
*
* @param isValid states whether geometry with this condition is valid
*/
void setSelfTouchingRingFormingHoleValid(bool isValid)
{
isSelfTouchingRingFormingHoleValid = isValid;
}
};
} // namespace geos.operation.valid
} // namespace geos.operation
} // namespace geos
#endif // GEOS_OP_ISVALIDOP_H
/**********************************************************************
* $Log$
* Revision 1.2 2006/03/29 13:53:59 strk
* EdgeRing equipped with Invariant testing function and lots of exceptional assertions. Removed useless heap allocations, and pointers usages.
*
* Revision 1.1 2006/03/20 16:57:44 strk
* spatialindex.h and opValid.h headers split
*
**********************************************************************/
|