GEOS  3.3.3
IndexedNestedRingTester.h
1 /**********************************************************************
2  * $Id: IndexedNestedRingTester.h 3426 2011-07-05 11:49:01Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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/IndexedNestedRingTester.java r399 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
21 #define GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
22 
23 #include <vector> // for composition
24 
25 // Forward declarations
26 namespace geos {
27  namespace geom {
28  //class Envelope;
29  class Coordinate;
30  class LinearRing;
31  }
32  namespace index {
33  class SpatialIndex;
34  }
35  namespace geomgraph {
36  class GeometryGraph;
37  }
38 }
39 
40 namespace geos {
41 namespace operation { // geos.operation
42 namespace valid { // geos.operation.valid
43 
51 {
52 public:
53  // @param newGraph : ownership retained by caller
54  IndexedNestedRingTester(geomgraph::GeometryGraph* newGraph)
55  :
56  graph(newGraph),
57  //totalEnv(0),
58  index(0),
59  nestedPt(0)
60  {
61  }
62 
64 
65  /*
66  * Be aware that the returned Coordinate (if != NULL)
67  * will point to storage owned by one of the LinearRing
68  * previously added. If you destroy them, this
69  * will point to an invalid memory address.
70  */
71  const geom::Coordinate* getNestedPoint() const
72  {
73  return nestedPt;
74  }
75 
77  void add(const geom::LinearRing* ring)
78  {
79  rings.push_back(ring);
80  }
81 
82  bool isNonNested();
83 
84 private:
85 
87  geomgraph::GeometryGraph* graph;
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 auto_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
109 
110 /**********************************************************************
111  * $Log$
112  **********************************************************************/
113