GEOS 3.6.2
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
35namespace geos {
36 namespace geom {
37 class Envelope;
38 }
39 namespace algorithm {
40 class LineIntersector;
41 }
42 namespace noding {
44 }
45}
46
47namespace geos {
48namespace noding { // geos::noding
49namespace snapround { // geos::noding::snapround
50
62class GEOS_DLL HotPixel {
63
64private:
65
67
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
150public:
151
162 double scaleFact,
164
168 const geom::Coordinate& getCoordinate() const { return originalPt; }
169
178
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
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:53
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
bool intersects(const geom::Coordinate &p0, const geom::Coordinate &p1) const
bool addSnappedNode(NodedSegmentString &segStr, std::size_t segIndex)
const geom::Coordinate & getCoordinate() const
Return reference to original Coordinate (the one provided at construction time).
Definition HotPixel.h:168
const geom::Envelope & getSafeEnvelope() const
Returns a "safe" envelope that is guaranteed to contain the hot pixel. Keeps ownership of it.
HotPixel(const geom::Coordinate &pt, double scaleFact, algorithm::LineIntersector &li)
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes to implement the Snap Rounding algorithm for noding linestrings.
Definition HotPixel.h:49
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition PreparedLineString.h:27
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25