GEOS 3.3.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

HotPixel.h
1 /**********************************************************************
2 * $Id: HotPixel.h 3527 2011-12-06 17:26:09Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: noding/snapround/HotPixel.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
21 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H
22
23 #include <geos/export.h>
24
25 #include <geos/inline.h>
26
27 #include <geos/geom/Coordinate.h> // for composition
28 #include <geos/geom/Envelope.h> // for auto_ptr
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 class Envelope;
39 }
40 namespace algorithm {
41 class LineIntersector;
42 }
43 namespace noding {
44 class NodedSegmentString;
45 }
46 }
47
48 namespace geos {
49 namespace noding { // geos::noding
50 namespace snapround { // geos::noding::snapround
51
63 class GEOS_DLL HotPixel {
64
65 private:
66
67 algorithm::LineIntersector& li;
68
69 geom::Coordinate pt;
70 const geom::Coordinate& originalPt;
71 geom::Coordinate ptScaled;
72
73 mutable geom::Coordinate p0Scaled;
74 mutable geom::Coordinate p1Scaled;
75
76 double scaleFactor;
77
78 double minx;
79 double maxx;
80 double miny;
81 double maxy;
82
90 std::vector<geom::Coordinate> corner;
91
93 mutable std::auto_ptr<geom::Envelope> safeEnv;
94
95 void initCorners(const geom::Coordinate& pt);
96
97 double scale(double val) const;
98
99 void copyScaled(const geom::Coordinate& p,
100 geom::Coordinate& pScaled) const;
101
123 bool intersectsToleranceSquare(const geom::Coordinate& p0,
124 const geom::Coordinate& p1) const;
125
126
141 bool intersectsPixelClosure(const geom::Coordinate& p0,
142 const geom::Coordinate& p1);
143
144 bool intersectsScaled(const geom::Coordinate& p0,
145 const geom::Coordinate& p1) const;
146
147 // Declare type as noncopyable
148 HotPixel(const HotPixel& other);
149 HotPixel& operator=(const HotPixel& rhs);
150
151 public:
152
162 HotPixel(const geom::Coordinate& pt,
163 double scaleFact,
164 algorithm::LineIntersector& li);
165
169 const geom::Coordinate& getCoordinate() const { return originalPt; }
170
178 const geom::Envelope& getSafeEnvelope() const;
179
187 bool intersects(const geom::Coordinate& p0,
188 const geom::Coordinate& p1) const;
189
198 bool addSnappedNode(NodedSegmentString& segStr, std::size_t segIndex);
199
200 };
201
202 } // namespace geos::noding::snapround
203 } // namespace geos::noding
204 } // namespace geos
205
206 #ifdef _MSC_VER
207 #pragma warning(pop)
208 #endif
209
210 #ifdef GEOS_INLINE
211 # include "geos/noding/snapround/HotPixel.inl"
212 #endif
213
214 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
215
216 /**********************************************************************
217 * $Log$
218 * Revision 1.3 2006/05/03 17:50:49 strk
219 * Doxygen comments
220 *
221 * Revision 1.2 2006/03/24 09:52:41 strk
222 * USE_INLINE => GEOS_INLINE
223 *
224 * Revision 1.1 2006/03/14 12:55:56 strk
225 * Headers split: geomgraphindex.h, nodingSnapround.h
226 *
227 **********************************************************************/
228