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 public:
00140
00141 HotPixel(const geom::Coordinate& pt,
00142 double scaleFact,
00143 algorithm::LineIntersector& li);
00144
00148 const geom::Coordinate& getCoordinate() const { return originalPt; }
00149
00154 const geom::Envelope& getSafeEnvelope() const;
00155
00156 bool intersectsScaled(const geom::Coordinate& p0,
00157 const geom::Coordinate& p1) const;
00158
00159 bool intersects(const geom::Coordinate& p0,
00160 const geom::Coordinate& p1) const;
00161
00170 bool addSnappedNode(NodedSegmentString& segStr, size_t segIndex);
00171
00172 };
00173
00174
00175
00176 }
00177 }
00178 }
00179
00180 #ifdef GEOS_INLINE
00181 # include "geos/noding/snapround/HotPixel.inl"
00182 #endif
00183
00184 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198