GEOS  3.3.1
MCIndexSnapRounder.h
00001 /**********************************************************************
00002  * $Id: MCIndexSnapRounder.h 3368 2011-05-17 17:04:47Z 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 r320 (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 
00086         std::vector<SegmentString*>* getNodedSubstrings() const {
00087           return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
00088   }
00089 
00090         void computeNodes(std::vector<SegmentString*>* segStrings);
00091  
00100         void computeVertexSnaps(std::vector<SegmentString*>& edges);
00101 
00102 private:
00103 
00105         geom::PrecisionModel& pm;
00106 
00107         algorithm::LineIntersector li;
00108 
00109         double scaleFactor;
00110 
00111         std::vector<SegmentString*>* nodedSegStrings;
00112 
00113         std::auto_ptr<MCIndexPointSnapper> pointSnapper;
00114 
00115         void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
00116 
00117         
00125         void findInteriorIntersections(MCIndexNoder& noder,
00126                         std::vector<SegmentString*>* segStrings,
00127                         std::vector<geom::Coordinate>& intersections);
00128 
00133         void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
00134 
00139         void computeVertexSnaps(NodedSegmentString* e);
00140         
00141         void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
00142 
00143     // Declare type as noncopyable
00144     MCIndexSnapRounder(const MCIndexSnapRounder& other);
00145     MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs);
00146 };
00147 
00148 } // namespace geos::noding::snapround
00149 } // namespace geos::noding
00150 } // namespace geos
00151 
00152 #ifdef _MSC_VER
00153 #pragma warning(pop)
00154 #endif
00155 
00156 #endif // GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
00157 
00158 /**********************************************************************
00159  * $Log$
00160  * Revision 1.2  2006/03/24 09:52:41  strk
00161  * USE_INLINE => GEOS_INLINE
00162  *
00163  * Revision 1.1  2006/03/14 12:55:56  strk
00164  * Headers split: geomgraphindex.h, nodingSnapround.h
00165  *
00166  **********************************************************************/
00167