00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00020 #define GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00021
00022 #include <geos/export.h>
00023
00024 #include <geos/noding/Noder.h>
00025 #include <geos/noding/NodedSegmentString.h>
00026 #include <geos/noding/snapround/MCIndexPointSnapper.h>
00027 #include <geos/algorithm/LineIntersector.h>
00028 #include <geos/geom/Coordinate.h>
00029 #include <geos/geom/PrecisionModel.h>
00030
00031 #include <vector>
00032
00033 #ifdef _MSC_VER
00034 #pragma warning(push)
00035 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00036 #endif
00037
00038
00039 namespace geos {
00040 namespace algorithm {
00041 class LineIntersector;
00042 }
00043 namespace noding {
00044 class SegmentString;
00045 class MCIndexNoder;
00046 }
00047 }
00048
00049 namespace geos {
00050 namespace noding {
00051 namespace snapround {
00052
00053
00074 class GEOS_DLL MCIndexSnapRounder: public Noder {
00075
00076 public:
00077
00078 MCIndexSnapRounder(const geom::PrecisionModel& nPm)
00079 :
00080 pm(nPm),
00081 scaleFactor(nPm.getScale()),
00082 pointSnapper(0)
00083 {
00084 li.setPrecisionModel(&pm);
00085 }
00086
00087 std::vector<SegmentString*>* getNodedSubstrings() const {
00088 return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
00089 }
00090
00091 void computeNodes(std::vector<SegmentString*>* segStrings);
00092
00101 void computeVertexSnaps(std::vector<SegmentString*>& edges);
00102
00103 private:
00104
00106 const geom::PrecisionModel& pm;
00107
00108 algorithm::LineIntersector li;
00109
00110 double scaleFactor;
00111
00112 std::vector<SegmentString*>* nodedSegStrings;
00113
00114 std::auto_ptr<MCIndexPointSnapper> pointSnapper;
00115
00116 void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
00117
00118
00126 void findInteriorIntersections(MCIndexNoder& noder,
00127 std::vector<SegmentString*>* segStrings,
00128 std::vector<geom::Coordinate>& intersections);
00129
00134 void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
00135
00140 void computeVertexSnaps(NodedSegmentString* e);
00141
00142 void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
00143
00144
00145 MCIndexSnapRounder(const MCIndexSnapRounder& other);
00146 MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs);
00147 };
00148
00149 }
00150 }
00151 }
00152
00153 #ifdef _MSC_VER
00154 #pragma warning(pop)
00155 #endif
00156
00157 #endif // GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H