GEOS  3.8.0dev
IndexedNestedRingTester.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: operation/valid/IndexedNestedRingTester.java r399 (JTS-1.12)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
20 #define GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
21 
22 #include <vector> // for composition
23 
24 // Forward declarations
25 namespace geos {
26 namespace geom {
27 //class Envelope;
28 class Coordinate;
29 class LinearRing;
30 }
31 namespace index {
32 class SpatialIndex;
33 }
34 namespace geomgraph {
35 class GeometryGraph;
36 }
37 }
38 
39 namespace geos {
40 namespace operation { // geos.operation
41 namespace valid { // geos.operation.valid
42 
50 public:
51  // @param newGraph : ownership retained by caller
53  :
54  graph(newGraph),
55  //totalEnv(0),
56  index(nullptr),
57  nestedPt(nullptr)
58  {
59  }
60 
62 
63  /*
64  * Be aware that the returned Coordinate (if != NULL)
65  * will point to storage owned by one of the LinearRing
66  * previously added. If you destroy them, this
67  * will point to an invalid memory address.
68  */
69  const geom::Coordinate*
70  getNestedPoint() const
71  {
72  return nestedPt;
73  }
74 
76  void
77  add(const geom::LinearRing* ring)
78  {
79  rings.push_back(ring);
80  }
81 
82  bool isNonNested();
83 
84 private:
85 
88 
90  std::vector<const geom::LinearRing*> rings;
91 
92  // CHECK: Owned by (seems unused)?
93  //geom::Envelope* totalEnv;
94 
95  // Owned by us (use unique_ptr ?)
96  geos::index::SpatialIndex* index; // 'index' in JTS
97 
98  // Externally owned, if not null
99  const geom::Coordinate* nestedPt;
100 
101  void buildIndex();
102 };
103 
104 } // namespace geos.operation.valid
105 } // namespace geos.operation
106 } // namespace geos
107 
108 #endif // GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_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
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:47
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
void add(const geom::LinearRing *ring)
Definition: IndexedNestedRingTester.h:77
Tests whether any of a set of LinearRings are nested inside another ring in the set, using a spatial index to speed up the comparisons.
Definition: IndexedNestedRingTester.h:49