00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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>
00028 #include <geos/geom/Envelope.h>
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
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 {
00050 namespace 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
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 }
00203 }
00204 }
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
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228