GEOS  3.4.2
IndexedNestedRingTester.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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 {
51 public:
52  // @param newGraph : ownership retained by caller
54  :
55  graph(newGraph),
56  //totalEnv(0),
57  index(0),
58  nestedPt(0)
59  {
60  }
61 
63 
64  /*
65  * Be aware that the returned Coordinate (if != NULL)
66  * will point to storage owned by one of the LinearRing
67  * previously added. If you destroy them, this
68  * will point to an invalid memory address.
69  */
70  const geom::Coordinate* getNestedPoint() const
71  {
72  return nestedPt;
73  }
74 
76  void add(const geom::LinearRing* ring)
77  {
78  rings.push_back(ring);
79  }
80 
81  bool isNonNested();
82 
83 private:
84 
87 
89  std::vector<const geom::LinearRing*> rings;
90 
91  // CHECK: Owned by (seems unused)?
92  //geom::Envelope* totalEnv;
93 
94  // Owned by us (use auto_ptr ?)
95  geos::index::SpatialIndex* index; // 'index' in JTS
96 
97  // Externally owned, if not null
98  const geom::Coordinate *nestedPt;
99 
100  void buildIndex();
101 };
102 
103 } // namespace geos.operation.valid
104 } // namespace geos.operation
105 } // namespace geos
106 
107 #endif // GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: GeometryGraph.h:72
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:47
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
void add(const geom::LinearRing *ring)
Definition: IndexedNestedRingTester.h:76
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