GEOS  3.9.1dev
SnapRoundingNoder.h
Go to the documentation of this file.
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>
26 #include <geos/noding/Noder.h>
27 
28 
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 class Envelope;
33 class PrecisionModel;
34 }
35 namespace noding {
36 class NodedSegmentString;
37 }
38 }
39 
40 namespace geos {
41 namespace noding { // geos::noding
42 namespace snapround { // geos::noding::snapround
43 
72 
73 private:
74 
75  // Members
78  std::vector<SegmentString*> snappedResult;
79 
80  // Methods
81  void snapRound(std::vector<SegmentString*>& inputSegStrings, std::vector<SegmentString*>& resultNodedSegments);
82 
90  void addVertexPixels(std::vector<SegmentString*>& segStrings);
91 
97  void addIntersectionPixels(std::vector<SegmentString*>& segStrings);
98 
99  void round(const geom::Coordinate& pt, geom::Coordinate& ptOut);
100 
108  std::unique_ptr<std::vector<geom::Coordinate>> round(const std::vector<geom::Coordinate>& pts);
109 
117  void computeSnaps(const std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& snapped);
118  NodedSegmentString* computeSegmentSnaps(NodedSegmentString* ss);
119 
128  void snapSegment(geom::Coordinate& p0, geom::Coordinate& p1, NodedSegmentString* ss, size_t segIndex);
129 
134  void addVertexNodeSnaps(NodedSegmentString* ss);
135 
136  void snapVertexNode(const geom::Coordinate& p0, NodedSegmentString* ss, size_t segIndex);
137 
138 public:
139 
141  : pm(p_pm)
142  , pixelIndex(p_pm)
143  {}
144 
148  std::vector<SegmentString*>* getNodedSubstrings() const override;
149 
154  void computeNodes(std::vector<SegmentString*>* inputSegStrings) override; //override
155 
156 };
157 
158 
159 } // namespace geos::noding::snapround
160 } // namespace geos::noding
161 } // namespace geos
162 
163 
164 
SnapRoundingNoder(const geom::PrecisionModel *p_pm)
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a list of contiguous line segments, and supports noding the segments.
Specifies the precision model of the Coordinate in a Geometry.
double round(double val)
Definition: math.h:36
Basic namespace for all GEOS functionalities.
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:49
std::vector< SegmentString * > snappedResult
noding::snapround::HotPixelIndex pixelIndex