GEOS 3.3.1
|
00001 /********************************************************************** 00002 * $Id: HotPixel.h 3255 2011-03-01 17:56:10Z 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 * 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 00161 HotPixel(const geom::Coordinate& pt, 00162 double scaleFact, 00163 algorithm::LineIntersector& li); 00164 00168 const geom::Coordinate& getCoordinate() const { return originalPt; } 00169 00177 const geom::Envelope& getSafeEnvelope() const; 00178 00186 bool intersects(const geom::Coordinate& p0, 00187 const geom::Coordinate& p1) const; 00188 00197 bool addSnappedNode(NodedSegmentString& segStr, std::size_t segIndex); 00198 00199 }; 00200 00201 } // namespace geos::noding::snapround 00202 } // namespace geos::noding 00203 } // namespace geos 00204 00205 #ifdef _MSC_VER 00206 #pragma warning(pop) 00207 #endif 00208 00209 #ifdef GEOS_INLINE 00210 # include "geos/noding/snapround/HotPixel.inl" 00211 #endif 00212 00213 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H 00214 00215 /********************************************************************** 00216 * $Log$ 00217 * Revision 1.3 2006/05/03 17:50:49 strk 00218 * Doxygen comments 00219 * 00220 * Revision 1.2 2006/03/24 09:52:41 strk 00221 * USE_INLINE => GEOS_INLINE 00222 * 00223 * Revision 1.1 2006/03/14 12:55:56 strk 00224 * Headers split: geomgraphindex.h, nodingSnapround.h 00225 * 00226 **********************************************************************/ 00227