GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: noding/snapround/HotPixel.java r320 (JTS-1.12) 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H 00020 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H 00021 00022 #include <geos/export.h> 00023 00024 #include <geos/inline.h> 00025 00026 #include <geos/geom/Coordinate.h> // for composition 00027 #include <geos/geom/Envelope.h> // for auto_ptr 00028 00029 #ifdef _MSC_VER 00030 #pragma warning(push) 00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00032 #endif 00033 00034 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Envelope; 00038 } 00039 namespace algorithm { 00040 class LineIntersector; 00041 } 00042 namespace noding { 00043 class NodedSegmentString; 00044 } 00045 } 00046 00047 namespace geos { 00048 namespace noding { // geos::noding 00049 namespace snapround { // geos::noding::snapround 00050 00062 class GEOS_DLL HotPixel { 00063 00064 private: 00065 00066 algorithm::LineIntersector& li; 00067 00068 geom::Coordinate pt; 00069 const geom::Coordinate& originalPt; 00070 geom::Coordinate ptScaled; 00071 00072 mutable geom::Coordinate p0Scaled; 00073 mutable geom::Coordinate p1Scaled; 00074 00075 double scaleFactor; 00076 00077 double minx; 00078 double maxx; 00079 double miny; 00080 double maxy; 00081 00089 std::vector<geom::Coordinate> corner; 00090 00092 mutable std::auto_ptr<geom::Envelope> safeEnv; 00093 00094 void initCorners(const geom::Coordinate& pt); 00095 00096 double scale(double val) const; 00097 00098 void copyScaled(const geom::Coordinate& p, 00099 geom::Coordinate& pScaled) const; 00100 00122 bool intersectsToleranceSquare(const geom::Coordinate& p0, 00123 const geom::Coordinate& p1) const; 00124 00125 00140 bool intersectsPixelClosure(const geom::Coordinate& p0, 00141 const geom::Coordinate& p1); 00142 00143 bool intersectsScaled(const geom::Coordinate& p0, 00144 const geom::Coordinate& p1) const; 00145 00146 // Declare type as noncopyable 00147 HotPixel(const HotPixel& other); 00148 HotPixel& operator=(const HotPixel& rhs); 00149 00150 public: 00151 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