GEOS  3.3.3
MCIndexSnapRounder.h
1 /**********************************************************************
2  * $Id: MCIndexSnapRounder.h 3524 2011-11-30 09:49:58Z strk $
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/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
21 #define GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
22 
23 #include <geos/export.h>
24 
25 #include <geos/noding/Noder.h> // for inheritance
26 #include <geos/noding/NodedSegmentString.h> // for inlines
27 #include <geos/noding/snapround/MCIndexPointSnapper.h> // for inines
28 #include <geos/algorithm/LineIntersector.h> // for composition
29 #include <geos/geom/Coordinate.h> // for use in vector
30 #include <geos/geom/PrecisionModel.h> // for inlines
31 
32 #include <vector>
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 algorithm {
42  class LineIntersector;
43  }
44  namespace noding {
45  class SegmentString;
46  class MCIndexNoder;
47  }
48 }
49 
50 namespace geos {
51 namespace noding { // geos::noding
52 namespace snapround { // geos::noding::snapround
53 
54 
75 class GEOS_DLL MCIndexSnapRounder: public Noder { // implments Noder
76 
77 public:
78 
80  :
81  pm(nPm),
82  scaleFactor(nPm.getScale()),
83  pointSnapper(0)
84  {
85  li.setPrecisionModel(&pm);
86  }
87 
88  std::vector<SegmentString*>* getNodedSubstrings() const {
89  return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
90  }
91 
92  void computeNodes(std::vector<SegmentString*>* segStrings);
93 
102  void computeVertexSnaps(std::vector<SegmentString*>& edges);
103 
104 private:
105 
108 
110 
111  double scaleFactor;
112 
113  std::vector<SegmentString*>* nodedSegStrings;
114 
115  std::auto_ptr<MCIndexPointSnapper> pointSnapper;
116 
117  void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
118 
119 
127  void findInteriorIntersections(MCIndexNoder& noder,
128  std::vector<SegmentString*>* segStrings,
129  std::vector<geom::Coordinate>& intersections);
130 
135  void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
136 
141  void computeVertexSnaps(NodedSegmentString* e);
142 
143  void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
144 
145  // Declare type as noncopyable
147  MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs);
148 };
149 
150 } // namespace geos::noding::snapround
151 } // namespace geos::noding
152 } // namespace geos
153 
154 #ifdef _MSC_VER
155 #pragma warning(pop)
156 #endif
157 
158 #endif // GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
159 
160 /**********************************************************************
161  * $Log$
162  * Revision 1.2 2006/03/24 09:52:41 strk
163  * USE_INLINE => GEOS_INLINE
164  *
165  * Revision 1.1 2006/03/14 12:55:56 strk
166  * Headers split: geomgraphindex.h, nodingSnapround.h
167  *
168  **********************************************************************/
169