GEOS 3.14.0dev
SnapRoundingNoder.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/SnapRoundingNoder.java r320 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/export.h>
22
23#include <geos/geom/Coordinate.h>
24#include <geos/geom/Envelope.h>
25#include <geos/noding/snapround/HotPixelIndex.h>
26#include <geos/noding/Noder.h>
27
28
29// Forward declarations
30namespace geos {
31namespace geom {
32class Envelope;
33class PrecisionModel;
34}
35namespace noding {
36class NodedSegmentString;
37}
38}
39
40namespace geos {
41namespace noding { // geos::noding
42namespace snapround { // geos::noding::snapround
43
71class GEOS_DLL SnapRoundingNoder : public Noder {
72
73private:
78 static constexpr int INTERSECTION_NEARNESS_FACTOR = 100;
79
80 // Members
81 const geom::PrecisionModel* pm;
82 noding::snapround::HotPixelIndex pixelIndex;
83 std::vector<SegmentString*> snappedResult;
84
85 // Methods
86 void snapRound(std::vector<SegmentString*>& inputSegStrings, std::vector<SegmentString*>& resultNodedSegments);
87
95 void addVertexPixels(std::vector<SegmentString*>& segStrings);
96
102 void addIntersectionPixels(std::vector<SegmentString*>& segStrings);
103
111 std::unique_ptr<geom::CoordinateSequence> round(const geom::CoordinateSequence& pts) const;
112
120 void computeSnaps(const std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& snapped);
121 NodedSegmentString* computeSegmentSnaps(NodedSegmentString* ss);
122
131 void snapSegment(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1, NodedSegmentString* ss, std::size_t segIndex);
132
137 void addVertexNodeSnaps(NodedSegmentString* ss);
138
139 void snapVertexNode(const geom::CoordinateXY& p0, NodedSegmentString* ss, std::size_t segIndex);
140
141public:
142
144 : pm(p_pm)
145 , pixelIndex(p_pm)
146 {}
147
151 std::vector<SegmentString*>* getNodedSubstrings() const override;
152
157 void computeNodes(std::vector<SegmentString*>* inputSegStrings) override; //override
158
159};
160
161
162} // namespace geos::noding::snapround
163} // namespace geos::noding
164} // namespace geos
165
166
167
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:88
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
Computes all intersections between segments in a set of SegmentString.
Definition Noder.h:46
Definition SnapRoundingNoder.h:71
void computeNodes(std::vector< SegmentString * > *inputSegStrings) override
std::vector< SegmentString * > * getNodedSubstrings() const override
Basic namespace for all GEOS functionalities.
Definition geos.h:39