GEOS: MCIndexNoder.h Source File

GEOS 3.3.8

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

- File List

MCIndexNoder.h
1 /**********************************************************************
2 * $Id: MCIndexNoder.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research 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: noding/MCIndexNoder.java rev. 1.6 (JTS-1.9)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_NODING_MCINDEXNODER_H
21 #define GEOS_NODING_MCINDEXNODER_H
22
23 #include <geos/export.h>
24
25 #include <geos/inline.h>
26
27 #include <geos/index/chain/MonotoneChainOverlapAction.h> // for inheritance
28 #include <geos/noding/SinglePassNoder.h> // for inheritance
29 #include <geos/index/strtree/STRtree.h> // for composition
30 #include <geos/util.h>
31
32 #include <vector>
33 #include <iostream>
34
35 #ifdef _MSC_VER
36 #pragma warning(push)
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
38 #endif
39
40 // Forward declarations
41 namespace geos {
42 namespace geom {
43 class LineSegment;
44 }
45 namespace noding {
46 class SegmentString;
47 class SegmentIntersector;
48 }
49 }
50
51 namespace geos {
52 namespace noding { // geos.noding
53
64 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
65
66 private:
67 std::vector<index::chain::MonotoneChain*> monoChains;
68 index::strtree::STRtree index;
69 int idCounter;
70 std::vector<SegmentString*>* nodedSegStrings;
71 // statistics
72 int nOverlaps;
73
74 void intersectChains();
75
76 void add(SegmentString* segStr);
77
78 public:
79
80 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
81 :
82 SinglePassNoder(nSegInt),
83 idCounter(0),
84 nodedSegStrings(NULL),
85 nOverlaps(0)
86 {}
87
88 ~MCIndexNoder();
89
91 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
92
93 index::SpatialIndex& getIndex();
94
95 std::vector<SegmentString*>* getNodedSubstrings() const;
96
97 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
98
99 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
100 public:
101 SegmentOverlapAction(SegmentIntersector& newSi)
102 :
103 index::chain::MonotoneChainOverlapAction(),
104 si(newSi)
105 {}
106
107 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
108 index::chain::MonotoneChain& mc2, std::size_t start2);
109 private:
110 SegmentIntersector& si;
111
112 // Declare type as noncopyable
113 SegmentOverlapAction(const SegmentOverlapAction& other);
114 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
115 };
116
117 };
118
119 } // namespace geos.noding
120 } // namespace geos
121
122 #ifdef _MSC_VER
123 #pragma warning(pop)
124 #endif
125
126 #ifdef GEOS_INLINE
127 # include <geos/noding/MCIndexNoder.inl>
128 #endif
129
130 #endif // GEOS_NODING_MCINDEXNODER_H
131
132 /**********************************************************************
133 * $Log$
134 * Revision 1.4 2006/03/24 09:52:41 strk
135 * USE_INLINE => GEOS_INLINE
136 *
137 * Revision 1.3 2006/03/22 18:12:31 strk
138 * indexChain.h header split.
139 *
140 * Revision 1.2 2006/03/14 12:55:56 strk
141 * Headers split: geomgraphindex.h, nodingSnapround.h
142 *
143 * Revision 1.1 2006/03/09 16:46:49 strk
144 * geos::geom namespace definition, first pass at headers split
145 *
146 **********************************************************************/
147