SimpleSnapRounder.h

00001 /**********************************************************************
00002  * $Id: SimpleSnapRounder.h 1820 2006-09-06 16:54:23Z mloskot $
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 #ifndef GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00017 #define GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00018 
00019 #include <vector>
00020 
00021 #include <geos/inline.h>
00022 
00023 #include <geos/noding/Noder.h> // for inheritance
00024 #include <geos/algorithm/LineIntersector.h> // for composition
00025 #include <geos/geom/Coordinate.h> // for use in vector
00026 #include <geos/geom/PrecisionModel.h> // for inlines (should drop)
00027 
00028 // Forward declarations
00029 namespace geos {
00030         namespace geom {
00031                 //class PrecisionModel;
00032         }
00033         namespace algorithm {
00034                 class LineIntersector;
00035         }
00036         namespace noding {
00037                 class SegmentString;
00038                 namespace snapround {
00039                         class HotPixel;
00040                 }
00041         }
00042 }
00043 
00044 namespace geos {
00045 namespace noding { // geos::noding
00046 namespace snapround { // geos::noding::snapround
00047 
00068 class SimpleSnapRounder: public Noder { // implements NoderIface
00069 
00070 private:
00071         const geom::PrecisionModel& pm;
00072         algorithm::LineIntersector li;
00073         double scaleFactor;
00074         std::vector<SegmentString*>* nodedSegStrings;
00075 
00076         void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
00077 
00078         void snapRound(std::vector<SegmentString*>* segStrings,
00079                         algorithm::LineIntersector& li);
00080 
00092         void findInteriorIntersections(std::vector<SegmentString*>& segStrings,
00093                         algorithm::LineIntersector& li, std::vector<geom::Coordinate>& ret);
00094 
00100         void computeSnaps(const std::vector<SegmentString*>& segStrings,
00101                 std::vector<geom::Coordinate>& snapPts);
00102 
00103         void computeSnaps(SegmentString* ss, std::vector<geom::Coordinate>& snapPts);
00104 
00110         void computeVertexSnaps(SegmentString* e0, SegmentString* e1);
00111 
00112 public:
00113 
00114         SimpleSnapRounder(const geom::PrecisionModel& newPm);
00115 
00116         std::vector<SegmentString*>* getNodedSubstrings() const;
00117 
00118         void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00119 
00120         void add(const SegmentString* segStr);
00121 
00131         static bool addSnappedNode(const HotPixel& hotPix,
00132                         SegmentString& segStr,
00133                         unsigned int segIndex);
00134 
00141         void computeVertexSnaps(const std::vector<SegmentString*>& edges);
00142 };
00143 
00144 } // namespace geos::noding::snapround
00145 } // namespace geos::noding
00146 } // namespace geos
00147 
00148 //#ifdef GEOS_INLINE
00149 //# include "geos/noding/snapround/SimpleSnapRounder.inl"
00150 //#endif
00151 
00152 #endif // GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00153 
00154 /**********************************************************************
00155  * $Log$
00156  * Revision 1.3  2006/05/03 15:02:49  strk
00157  * moved some implementations from header to .cpp file (taken out of inline)
00158  *
00159  * Revision 1.2  2006/03/24 09:52:41  strk
00160  * USE_INLINE => GEOS_INLINE
00161  *
00162  * Revision 1.1  2006/03/14 12:55:56  strk
00163  * Headers split: geomgraphindex.h, nodingSnapround.h
00164  *
00165  **********************************************************************/
00166 

Generated on Fri Mar 27 04:53:01 2009 for GEOS by  doxygen 1.5.4