GEOS  3.3.5
HotPixel.h
00001 /**********************************************************************
00002  * $Id: HotPixel.h 3527 2011-12-06 17:26:09Z 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/HotPixel.java r320 (JTS-1.12)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
00021 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <geos/inline.h>
00026 
00027 #include <geos/geom/Coordinate.h> // for composition
00028 #include <geos/geom/Envelope.h> // for auto_ptr
00029 
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034 
00035 // Forward declarations
00036 namespace geos {
00037         namespace geom {
00038                 class Envelope;
00039         }
00040         namespace algorithm {
00041                 class LineIntersector;
00042         }
00043         namespace noding {
00044                 class NodedSegmentString;
00045         }
00046 }
00047 
00048 namespace geos {
00049 namespace noding { // geos::noding
00050 namespace snapround { // geos::noding::snapround
00051 
00063 class GEOS_DLL HotPixel {
00064 
00065 private:
00066 
00067         algorithm::LineIntersector& li;
00068 
00069         geom::Coordinate pt;
00070         const geom::Coordinate& originalPt;
00071         geom::Coordinate ptScaled;
00072 
00073         mutable geom::Coordinate p0Scaled;
00074         mutable geom::Coordinate p1Scaled;
00075 
00076         double scaleFactor;
00077 
00078         double minx;
00079         double maxx;
00080         double miny;
00081         double maxy;
00082 
00090         std::vector<geom::Coordinate> corner;
00091 
00093         mutable std::auto_ptr<geom::Envelope> safeEnv; 
00094 
00095         void initCorners(const geom::Coordinate& pt);
00096 
00097         double scale(double val) const;
00098 
00099         void copyScaled(const geom::Coordinate& p,
00100                         geom::Coordinate& pScaled) const;
00101 
00123         bool intersectsToleranceSquare(const geom::Coordinate& p0,
00124                         const geom::Coordinate& p1) const;
00125  
00126 
00141         bool intersectsPixelClosure(const geom::Coordinate& p0,
00142                         const geom::Coordinate& p1);
00143 
00144         bool intersectsScaled(const geom::Coordinate& p0,
00145                         const geom::Coordinate& p1) const;
00146  
00147     // Declare type as noncopyable
00148     HotPixel(const HotPixel& other);
00149     HotPixel& operator=(const HotPixel& rhs);
00150 
00151 public:
00152 
00162         HotPixel(const geom::Coordinate& pt,
00163                         double scaleFact,
00164                         algorithm::LineIntersector& li);
00165 
00169         const geom::Coordinate& getCoordinate() const { return originalPt; }
00170 
00178         const geom::Envelope& getSafeEnvelope() const;
00179 
00187         bool intersects(const geom::Coordinate& p0,
00188                         const geom::Coordinate& p1) const;
00189  
00198         bool addSnappedNode(NodedSegmentString& segStr, std::size_t segIndex);
00199 
00200 };
00201 
00202 } // namespace geos::noding::snapround
00203 } // namespace geos::noding
00204 } // namespace geos
00205 
00206 #ifdef _MSC_VER
00207 #pragma warning(pop)
00208 #endif
00209 
00210 #ifdef GEOS_INLINE
00211 # include "geos/noding/snapround/HotPixel.inl"
00212 #endif
00213 
00214 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
00215 
00216 /**********************************************************************
00217  * $Log$
00218  * Revision 1.3  2006/05/03 17:50:49  strk
00219  * Doxygen comments
00220  *
00221  * Revision 1.2  2006/03/24 09:52:41  strk
00222  * USE_INLINE => GEOS_INLINE
00223  *
00224  * Revision 1.1  2006/03/14 12:55:56  strk
00225  * Headers split: geomgraphindex.h, nodingSnapround.h
00226  *
00227  **********************************************************************/
00228