GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

MCIndexNoder.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
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: noding/MCIndexNoder.java rev. 1.6 (JTS-1.9)
16 *
17 **********************************************************************/
18
19 #ifndef GEOS_NODING_MCINDEXNODER_H
20 #define GEOS_NODING_MCINDEXNODER_H
21
22 #include <geos/export.h>
23
24 #include <geos/inline.h>
25
26 #include <geos/index/chain/MonotoneChainOverlapAction.h> // for inheritance
27 #include <geos/noding/SinglePassNoder.h> // for inheritance
28 #include <geos/index/strtree/STRtree.h> // for composition
29 #include <geos/util.h>
30
31 #include <vector>
32 #include <iostream>
33
34 #ifdef _MSC_VER
35 #pragma warning(push)
36 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 #endif
38
39 // Forward declarations
40 namespace geos {
41 namespace geom {
42 class LineSegment;
43 }
44 namespace noding {
45 class SegmentString;
46 class SegmentIntersector;
47 }
48 }
49
50 namespace geos {
51 namespace noding { // geos.noding
52
63 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
64
65 private:
66 std::vector<index::chain::MonotoneChain*> monoChains;
67 index::strtree::STRtree index;
68 int idCounter;
69 std::vector<SegmentString*>* nodedSegStrings;
70 // statistics
71 int nOverlaps;
72
73 void intersectChains();
74
75 void add(SegmentString* segStr);
76
77 public:
78
79 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
80 :
81 SinglePassNoder(nSegInt),
82 idCounter(0),
83 nodedSegStrings(NULL),
84 nOverlaps(0)
85 {}
86
87 ~MCIndexNoder();
88
90 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
91
92 index::SpatialIndex& getIndex();
93
94 std::vector<SegmentString*>* getNodedSubstrings() const;
95
96 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
97
98 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
99 public:
100 SegmentOverlapAction(SegmentIntersector& newSi)
101 :
102 index::chain::MonotoneChainOverlapAction(),
103 si(newSi)
104 {}
105
106 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
107 index::chain::MonotoneChain& mc2, std::size_t start2);
108 private:
109 SegmentIntersector& si;
110
111 // Declare type as noncopyable
112 SegmentOverlapAction(const SegmentOverlapAction& other);
113 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
114 };
115
116 };
117
118 } // namespace geos.noding
119 } // namespace geos
120
121 #ifdef _MSC_VER
122 #pragma warning(pop)
123 #endif
124
125 #ifdef GEOS_INLINE
126 # include <geos/noding/MCIndexNoder.inl>
127 #endif
128
129 #endif // GEOS_NODING_MCINDEXNODER_H