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
00031 namespace geos {
00032 namespace geom {
00033 class Envelope;
00034 }
00035 namespace algorithm {
00036 class LineIntersector;
00037 }
00038 namespace noding {
00039 class NodedSegmentString;
00040 }
00041 }
00042
00043 namespace geos {
00044 namespace noding {
00045 namespace snapround {
00046
00058 class GEOS_DLL HotPixel {
00059
00060 private:
00061
00062 algorithm::LineIntersector& li;
00063
00064 geom::Coordinate pt;
00065 const geom::Coordinate& originalPt;
00066 geom::Coordinate ptScaled;
00067
00068 mutable geom::Coordinate p0Scaled;
00069 mutable geom::Coordinate p1Scaled;
00070
00071 double scaleFactor;
00072
00073 double minx;
00074 double maxx;
00075 double miny;
00076 double maxy;
00077
00085 std::vector<geom::Coordinate> corner;
00086
00088 mutable std::auto_ptr<geom::Envelope> safeEnv;
00089
00090 void initCorners(const geom::Coordinate& pt);
00091
00092 double scale(double val) const;
00093
00094 void copyScaled(const geom::Coordinate& p,
00095 geom::Coordinate& pScaled) const;
00096
00118 bool intersectsToleranceSquare(const geom::Coordinate& p0,
00119 const geom::Coordinate& p1) const;
00120
00121
00136 bool intersectsPixelClosure(const geom::Coordinate& p0,
00137 const geom::Coordinate& p1);
00138
00139
00140 HotPixel(const HotPixel& other);
00141 HotPixel& operator=(const HotPixel& rhs);
00142
00143 public:
00144
00145 HotPixel(const geom::Coordinate& pt,
00146 double scaleFact,
00147 algorithm::LineIntersector& li);
00148
00152 const geom::Coordinate& getCoordinate() const { return originalPt; }
00153
00158 const geom::Envelope& getSafeEnvelope() const;
00159
00160 bool intersectsScaled(const geom::Coordinate& p0,
00161 const geom::Coordinate& p1) const;
00162
00163 bool intersects(const geom::Coordinate& p0,
00164 const geom::Coordinate& p1) const;
00165
00174 bool addSnappedNode(NodedSegmentString& segStr, size_t segIndex);
00175
00176 };
00177
00178
00179
00180 }
00181 }
00182 }
00183
00184 #ifdef GEOS_INLINE
00185 # include "geos/noding/snapround/HotPixel.inl"
00186 #endif
00187
00188 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202