GEOS  3.3.8
MCIndexSnapRounder.h
00001 /**********************************************************************
00002  * $Id: MCIndexSnapRounder.h 3524 2011-11-30 09:49:58Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006      Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: noding/snapround/MCIndexSnapRounder.java r480 (JTS-1.12)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00021 #define GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <geos/noding/Noder.h> // for inheritance
00026 #include <geos/noding/NodedSegmentString.h> // for inlines
00027 #include <geos/noding/snapround/MCIndexPointSnapper.h> // for inines
00028 #include <geos/algorithm/LineIntersector.h> // for composition
00029 #include <geos/geom/Coordinate.h> // for use in vector
00030 #include <geos/geom/PrecisionModel.h> // for inlines
00031 
00032 #include <vector>
00033 
00034 #ifdef _MSC_VER
00035 #pragma warning(push)
00036 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00037 #endif
00038 
00039 // Forward declarations
00040 namespace geos {
00041         namespace algorithm {
00042                 class LineIntersector;
00043         }
00044         namespace noding {
00045                 class SegmentString;
00046                 class MCIndexNoder;
00047         }
00048 }
00049 
00050 namespace geos {
00051 namespace noding { // geos::noding
00052 namespace snapround { // geos::noding::snapround
00053 
00054 
00075 class GEOS_DLL MCIndexSnapRounder: public Noder { // implments Noder
00076 
00077 public:
00078 
00079         MCIndexSnapRounder(geom::PrecisionModel& nPm)
00080     :
00081                 pm(nPm),
00082                 scaleFactor(nPm.getScale()),
00083                 pointSnapper(0)
00084   {
00085     li.setPrecisionModel(&pm);
00086   }
00087 
00088         std::vector<SegmentString*>* getNodedSubstrings() const {
00089           return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
00090   }
00091 
00092         void computeNodes(std::vector<SegmentString*>* segStrings);
00093  
00102         void computeVertexSnaps(std::vector<SegmentString*>& edges);
00103 
00104 private:
00105 
00107         geom::PrecisionModel& pm;
00108 
00109         algorithm::LineIntersector li;
00110 
00111         double scaleFactor;
00112 
00113         std::vector<SegmentString*>* nodedSegStrings;
00114 
00115         std::auto_ptr<MCIndexPointSnapper> pointSnapper;
00116 
00117         void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
00118 
00119         
00127         void findInteriorIntersections(MCIndexNoder& noder,
00128                         std::vector<SegmentString*>* segStrings,
00129                         std::vector<geom::Coordinate>& intersections);
00130 
00135         void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
00136 
00141         void computeVertexSnaps(NodedSegmentString* e);
00142         
00143         void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
00144 
00145     // Declare type as noncopyable
00146     MCIndexSnapRounder(const MCIndexSnapRounder& other);
00147     MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs);
00148 };
00149 
00150 } // namespace geos::noding::snapround
00151 } // namespace geos::noding
00152 } // namespace geos
00153 
00154 #ifdef _MSC_VER
00155 #pragma warning(pop)
00156 #endif
00157 
00158 #endif // GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00159 
00160 /**********************************************************************
00161  * $Log$
00162  * Revision 1.2  2006/03/24 09:52:41  strk
00163  * USE_INLINE => GEOS_INLINE
00164  *
00165  * Revision 1.1  2006/03/14 12:55:56  strk
00166  * Headers split: geomgraphindex.h, nodingSnapround.h
00167  *
00168  **********************************************************************/
00169