GEOS  3.3.9
SimpleSnapRounder.h
00001 /**********************************************************************
00002  * $Id: SimpleSnapRounder.h 3239 2011-02-23 14:37:29Z 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/SimpleSnapRounder.java r320 (JTS-1.12)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00021 #define GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <vector>
00026 
00027 #include <geos/inline.h>
00028 
00029 #include <geos/noding/Noder.h> // for inheritance
00030 #include <geos/algorithm/LineIntersector.h> // for composition
00031 #include <geos/geom/Coordinate.h> // for use in vector
00032 #include <geos/geom/PrecisionModel.h> // for inlines (should drop)
00033 
00034 // Forward declarations
00035 namespace geos {
00036         namespace geom {
00037                 //class PrecisionModel;
00038         }
00039         namespace algorithm {
00040                 class LineIntersector;
00041         }
00042         namespace noding {
00043                 class SegmentString;
00044                 class NodedSegmentString;
00045                 namespace snapround {
00046                         class HotPixel;
00047                 }
00048         }
00049 }
00050 
00051 namespace geos {
00052 namespace noding { // geos::noding
00053 namespace snapround { // geos::noding::snapround
00054 
00074 class GEOS_DLL SimpleSnapRounder: public Noder { // implements NoderIface
00075 
00076 public:
00077 
00078         SimpleSnapRounder(const geom::PrecisionModel& newPm);
00079 
00080         std::vector<SegmentString*>* getNodedSubstrings() const;
00081 
00082         void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00083 
00084         void add(const SegmentString* segStr);
00085 
00093         void computeVertexSnaps(const std::vector<SegmentString*>& edges);
00094 
00095 private:
00096 
00097         const geom::PrecisionModel& pm;
00098         algorithm::LineIntersector li;
00099         double scaleFactor;
00100         std::vector<SegmentString*>* nodedSegStrings;
00101 
00102         void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
00103 
00104         void snapRound(std::vector<SegmentString*>* segStrings,
00105                         algorithm::LineIntersector& li);
00106 
00118         void findInteriorIntersections(std::vector<SegmentString*>& segStrings,
00119                         algorithm::LineIntersector& li, std::vector<geom::Coordinate>& ret);
00120 
00126         void computeSnaps(const std::vector<SegmentString*>& segStrings,
00127                 std::vector<geom::Coordinate>& snapPts);
00128 
00129         void computeSnaps(NodedSegmentString* ss, std::vector<geom::Coordinate>& snapPts);
00130 
00136         void computeVertexSnaps(NodedSegmentString* e0, NodedSegmentString* e1);
00137 
00138     // Declare type as noncopyable
00139     SimpleSnapRounder(const SimpleSnapRounder& other);
00140     SimpleSnapRounder& operator=(const SimpleSnapRounder& rhs);
00141 };
00142 
00143 } // namespace geos::noding::snapround
00144 } // namespace geos::noding
00145 } // namespace geos
00146 
00147 //#ifdef GEOS_INLINE
00148 //# include "geos/noding/snapround/SimpleSnapRounder.inl"
00149 //#endif
00150 
00151 #endif // GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H
00152 
00153 /**********************************************************************
00154  * $Log$
00155  * Revision 1.3  2006/05/03 15:02:49  strk
00156  * moved some implementations from header to .cpp file (taken out of inline)
00157  *
00158  * Revision 1.2  2006/03/24 09:52:41  strk
00159  * USE_INLINE => GEOS_INLINE
00160  *
00161  * Revision 1.1  2006/03/14 12:55:56  strk
00162  * Headers split: geomgraphindex.h, nodingSnapround.h
00163  *
00164  **********************************************************************/
00165