GEOS: HotPixel.h Source File

GEOS 3.5.0

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

- File List

HotPixel.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: noding/snapround/HotPixel.java r320 (JTS-1.12)
16 *
17 **********************************************************************/
18
19 #ifndef GEOS_NODING_SNAPROUND_HOTPIXEL_H
20 #define GEOS_NODING_SNAPROUND_HOTPIXEL_H
21
22 #include <geos/export.h>
23
24 #include <geos/inline.h>
25
26 #include <geos/geom/Coordinate.h> // for composition
27 #include <geos/geom/Envelope.h> // for auto_ptr
28
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33
34 // Forward declarations
35 namespace geos {
36 namespace geom {
37 class Envelope;
38 }
39 namespace algorithm {
40 class LineIntersector;
41 }
42 namespace noding {
43 class NodedSegmentString;
44 }
45 }
46
47 namespace geos {
48 namespace noding { // geos::noding
49 namespace snapround { // geos::noding::snapround
50
62 class GEOS_DLL HotPixel {
63
64 private:
65
66 algorithm::LineIntersector& li;
67
68 geom::Coordinate pt;
69 const geom::Coordinate& originalPt;
70 geom::Coordinate ptScaled;
71
72 mutable geom::Coordinate p0Scaled;
73 mutable geom::Coordinate p1Scaled;
74
75 double scaleFactor;
76
77 double minx;
78 double maxx;
79 double miny;
80 double maxy;
81
89 std::vector<geom::Coordinate> corner;
90
92 mutable std::auto_ptr<geom::Envelope> safeEnv;
93
94 void initCorners(const geom::Coordinate& pt);
95
96 double scale(double val) const;
97
98 void copyScaled(const geom::Coordinate& p,
99 geom::Coordinate& pScaled) const;
100
122 bool intersectsToleranceSquare(const geom::Coordinate& p0,
123 const geom::Coordinate& p1) const;
124
125
140 bool intersectsPixelClosure(const geom::Coordinate& p0,
141 const geom::Coordinate& p1);
142
143 bool intersectsScaled(const geom::Coordinate& p0,
144 const geom::Coordinate& p1) const;
145
146 // Declare type as noncopyable
147 HotPixel(const HotPixel& other);
148 HotPixel& operator=(const HotPixel& rhs);
149
150 public:
151
161 HotPixel(const geom::Coordinate& pt,
162 double scaleFact,
163 algorithm::LineIntersector& li);
164
168 const geom::Coordinate& getCoordinate() const { return originalPt; }
169
177 const geom::Envelope& getSafeEnvelope() const;
178
186 bool intersects(const geom::Coordinate& p0,
187 const geom::Coordinate& p1) const;
188
197 bool addSnappedNode(NodedSegmentString& segStr, std::size_t segIndex);
198
199 };
200
201 } // namespace geos::noding::snapround
202 } // namespace geos::noding
203 } // namespace geos
204
205 #ifdef _MSC_VER
206 #pragma warning(pop)
207 #endif
208
209 #ifdef GEOS_INLINE
210 # include "geos/noding/snapround/HotPixel.inl"
211 #endif
212
213 #endif // GEOS_NODING_SNAPROUND_HOTPIXEL_H
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
geos::noding::snapround::HotPixel
Implements a "hot pixel" as used in the Snap Rounding algorithm.
Definition: HotPixel.h:62
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::noding::snapround::HotPixel::getCoordinate
const geom::Coordinate & getCoordinate() const
Return reference to original Coordinate (the one provided at construction time)
Definition: HotPixel.h:168
geos::noding::NodedSegmentString
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:57
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition: LineIntersector.h:49
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25