GEOS  3.14.0dev
SnappingNoder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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/snap/SnappingNoder.java
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <geos/export.h>
22 
23 #include <geos/geom/Coordinate.h>
24 #include <geos/geom/CoordinateSequence.h>
25 #include <geos/geom/Envelope.h>
26 #include <geos/noding/Noder.h>
27 #include <geos/noding/snap/SnappingPointIndex.h>
28 
29 
30 // Forward declarations
31 namespace geos {
32 namespace geom {
33 class Envelope;
34 class PrecisionModel;
35 }
36 namespace noding {
37 class NodedSegmentString;
38 }
39 }
40 
41 namespace geos {
42 namespace noding { // geos::noding
43 namespace snap { // geos::noding::snap
44 
67 class GEOS_DLL SnappingNoder : public Noder {
68 
69 private:
70 
71  // Members
72  double snapTolerance;
73  SnappingPointIndex snapIndex;
74  std::vector<SegmentString*>* nodedResult;
75 
76  // Methods
77 
78  void seedSnapIndex(std::vector<SegmentString*>& segStrings);
79 
80  void snapVertices(std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& nodedStrings);
81 
82  SegmentString* snapVertices(SegmentString* ss);
83 
84  std::unique_ptr<geom::CoordinateSequence> snap(const geom::CoordinateSequence* cs);
85 
94  std::unique_ptr<std::vector<SegmentString*>> snapIntersections(std::vector<SegmentString*>& inputSS);
95 
96 
97 public:
98 
103  SnappingNoder(double p_snapTolerance)
104  : snapTolerance(p_snapTolerance)
105  , snapIndex(p_snapTolerance)
106  {}
107 
111  std::vector<SegmentString*>* getNodedSubstrings() const override;
112 
113  void computeNodes(std::vector<SegmentString*>* inputSegStrings) override;
114 
115 
116 };
117 
118 
119 } // namespace geos::noding::snap
120 } // namespace geos::noding
121 } // namespace geos
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Computes all intersections between segments in a set of SegmentString.
Definition: Noder.h:46
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:47
Definition: SnappingNoder.h:67
std::vector< SegmentString * > * getNodedSubstrings() const override
SnappingNoder(double p_snapTolerance)
Definition: SnappingNoder.h:103
void computeNodes(std::vector< SegmentString * > *inputSegStrings) override
Computes the noding for a collection of SegmentStrings.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25