GEOS  3.8.0dev
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 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31 #endif
32 
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 class Coordinate;
37 class LinearRing;
38 }
39 namespace geomgraph {
40 class GeometryGraph;
41 }
42 }
43 
44 namespace geos {
45 namespace operation { // geos::operation
46 namespace valid { // geos::operation::valid
47 
54 class GEOS_DLL SimpleNestedRingTester {
55 private:
56  geomgraph::GeometryGraph* graph; // used to find non-node vertices
57  std::vector<geom::LinearRing*> rings;
58  geom::Coordinate* nestedPt;
59 public:
61  :
62  graph(newGraph),
63  rings(),
64  nestedPt(nullptr)
65  {}
66 
68  {
69  }
70 
71  void
72  add(geom::LinearRing* ring)
73  {
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  */
84  getNestedPoint()
85  {
86  return nestedPt;
87  }
88 
89  bool isNonNested();
90 };
91 
92 } // namespace geos.operation.valid
93 } // namespace geos.operation
94 } // namespace geos
95 
96 #ifdef _MSC_VER
97 #pragma warning(pop)
98 #endif
99 
100 #endif // GEOS_OP_SIMPLENESTEDRINGTESTER_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
A GeometryGraph is a graph that models a given Geometry.
Definition: GeometryGraph.h:73
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple...
Definition: LinearRing.h:54
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:54