GEOS 3.11.1
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/Envelope.h>
25#include <geos/noding/Noder.h>
26#include <geos/noding/snap/SnappingPointIndex.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 snap { // geos::noding::snap
43
66class GEOS_DLL SnappingNoder : public Noder {
67
68private:
69
70 // Members
71 double snapTolerance;
72 SnappingPointIndex snapIndex;
73 std::vector<SegmentString*>* nodedResult;
74
75 // Methods
76
77 void seedSnapIndex(std::vector<SegmentString*>& segStrings);
78
79 void snapVertices(std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& nodedStrings);
80
81 SegmentString* snapVertices(SegmentString* ss);
82
83 std::unique_ptr<std::vector<geom::Coordinate>> snap(geom::CoordinateSequence* cs);
84
93 std::unique_ptr<std::vector<SegmentString*>> snapIntersections(std::vector<SegmentString*>& inputSS);
94
95
96public:
97
102 SnappingNoder(double p_snapTolerance)
103 : snapTolerance(p_snapTolerance)
104 , snapIndex(p_snapTolerance)
105 {}
106
110 std::vector<SegmentString*>* getNodedSubstrings() const override;
111
112 void computeNodes(std::vector<SegmentString*>* inputSegStrings) override;
113
114
115};
116
117
118} // namespace geos::noding::snap
119} // namespace geos::noding
120} // namespace geos
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
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:45
Definition: SnappingNoder.h:66
SnappingNoder(double p_snapTolerance)
Definition: SnappingNoder.h:102
std::vector< SegmentString * > * getNodedSubstrings() const override
void computeNodes(std::vector< SegmentString * > *inputSegStrings) override
Computes the noding for a collection of SegmentStrings.
Basic namespace for all GEOS functionalities.
Definition: geos.h:39