GEOS  3.4.2
SimpleNestedRingTester.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: operation/valid/SimpleNestedRingTester.java rev. 1.14 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_SIMPLENESTEDRINGTESTER_H
21 #define GEOS_OP_SIMPLENESTEDRINGTESTER_H
22 
23 #include <geos/export.h>
24 
25 #include <cstddef>
26 #include <vector>
27 #include <cstddef>
28 
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33 
34 // Forward declarations
35 namespace geos {
36  namespace geom {
37  class Coordinate;
38  class LinearRing;
39  }
40  namespace geomgraph {
41  class GeometryGraph;
42  }
43 }
44 
45 namespace geos {
46 namespace operation { // geos::operation
47 namespace valid { // geos::operation::valid
48 
49 using namespace std;
50 
57 class GEOS_DLL SimpleNestedRingTester {
58 private:
59  geomgraph::GeometryGraph *graph; // used to find non-node vertices
60  std::vector<geom::LinearRing*> rings;
61  geom::Coordinate *nestedPt;
62 public:
64  :
65  graph(newGraph),
66  rings(),
67  nestedPt(NULL)
68  {}
69 
71  }
72 
73  void add(geom::LinearRing *ring) {
74  rings.push_back(ring);
75  }
76 
77  /*
78  * Be aware that the returned Coordinate (if != NULL)
79  * will point to storage owned by one of the LinearRing
80  * previously added. If you destroy them, this
81  * will point to an invalid memory address.
82  */
83  geom::Coordinate *getNestedPoint() {
84  return nestedPt;
85  }
86 
87  bool isNonNested();
88 };
89 
90 } // namespace geos.operation.valid
91 } // namespace geos.operation
92 } // namespace geos
93 
94 #ifdef _MSC_VER
95 #pragma warning(pop)
96 #endif
97 
98 #endif // GEOS_OP_SIMPLENESTEDRINGTESTER_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: GeometryGraph.h:72
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
Tests whether any of a set of LinearRings are nested inside another ring in the set, using a simple O(n^2) comparison.
Definition: SimpleNestedRingTester.h:57