Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / include / geos / noding / MCIndexNoder.h
blob457f8e4356dc77a435a22f9f3d2e6032e53dfe76
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
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.
13 **********************************************************************
15 * Last port: noding/MCIndexNoder.java rev. 1.6 (JTS-1.9)
17 **********************************************************************/
19 #ifndef GEOS_NODING_MCINDEXNODER_H
20 #define GEOS_NODING_MCINDEXNODER_H
22 #include <geos/export.h>
24 #include <geos/inline.h>
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>
31 #include <vector>
32 #include <iostream>
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
39 // Forward declarations
40 namespace geos {
41 namespace geom {
42 class LineSegment;
44 namespace noding {
45 class SegmentString;
46 class SegmentIntersector;
50 namespace geos {
51 namespace noding { // geos.noding
53 /** \brief
54 * Nodes a set of SegmentString using a index based
55 * on index::chain::MonotoneChain and a index::SpatialIndex.
57 * The {@link SpatialIndex} used should be something that supports
58 * envelope (range) queries efficiently (such as a index::quadtree::Quadtree
59 * or index::strtree::STRtree.
61 * Last port: noding/MCIndexNoder.java rev. 1.4 (JTS-1.7)
63 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
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;
73 void intersectChains();
75 void add(SegmentString* segStr);
77 public:
79 MCIndexNoder(SegmentIntersector *nSegInt=NULL)
81 SinglePassNoder(nSegInt),
82 idCounter(0),
83 nodedSegStrings(NULL),
84 nOverlaps(0)
87 ~MCIndexNoder();
89 /// Return a reference to this instance's std::vector of MonotoneChains
90 std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
92 index::SpatialIndex& getIndex();
94 std::vector<SegmentString*>* getNodedSubstrings() const;
96 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
98 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
99 public:
100 SegmentOverlapAction(SegmentIntersector& newSi)
102 index::chain::MonotoneChainOverlapAction(),
103 si(newSi)
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;
111 // Declare type as noncopyable
112 SegmentOverlapAction(const SegmentOverlapAction& other);
113 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
118 } // namespace geos.noding
119 } // namespace geos
121 #ifdef _MSC_VER
122 #pragma warning(pop)
123 #endif
125 #ifdef GEOS_INLINE
126 # include <geos/noding/MCIndexNoder.inl>
127 #endif
129 #endif // GEOS_NODING_MCINDEXNODER_H
131 /**********************************************************************
132 * $Log$
133 * Revision 1.4 2006/03/24 09:52:41 strk
134 * USE_INLINE => GEOS_INLINE
136 * Revision 1.3 2006/03/22 18:12:31 strk
137 * indexChain.h header split.
139 * Revision 1.2 2006/03/14 12:55:56 strk
140 * Headers split: geomgraphindex.h, nodingSnapround.h
142 * Revision 1.1 2006/03/09 16:46:49 strk
143 * geos::geom namespace definition, first pass at headers split
145 **********************************************************************/