GEOS  3.10.0
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
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 
71 class GEOS_DLL SnapRoundingNoder : public Noder {
72 
73 private:
74 
75  // Members
76  const geom::PrecisionModel* pm;
77  noding::snapround::HotPixelIndex pixelIndex;
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 
106  std::vector<geom::Coordinate> round(const std::vector<geom::Coordinate>& pts) const;
107 
115  void computeSnaps(const std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& snapped);
116  NodedSegmentString* computeSegmentSnaps(NodedSegmentString* ss);
117 
126  void snapSegment(geom::Coordinate& p0, geom::Coordinate& p1, NodedSegmentString* ss, std::size_t segIndex);
127 
132  void addVertexNodeSnaps(NodedSegmentString* ss);
133 
134  void snapVertexNode(const geom::Coordinate& p0, NodedSegmentString* ss, std::size_t segIndex);
135 
136 public:
137 
139  : pm(p_pm)
140  , pixelIndex(p_pm)
141  {}
142 
146  std::vector<SegmentString*>* getNodedSubstrings() const override;
147 
152  void computeNodes(std::vector<SegmentString*>* inputSegStrings) override; //override
153 
154 };
155 
156 
157 } // namespace geos::noding::snapround
158 } // namespace geos::noding
159 } // namespace geos
160 
161 
162 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Specifies the precision model of the Coordinate in a Geometry.
Definition: PrecisionModel.h:87
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:49
Definition: SnapRoundingNoder.h:71
std::vector< SegmentString * > * getNodedSubstrings() const override
void computeNodes(std::vector< SegmentString * > *inputSegStrings) override
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26