GEOS 3.15.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/SegmentString.h>
28#include <geos/noding/snap/SnappingPointIndex.h>
29
30
31// Forward declarations
32namespace geos {
33namespace geom {
34class Envelope;
35class PrecisionModel;
36}
37namespace noding {
38class NodedSegmentString;
39}
40}
41
42namespace geos {
43namespace noding { // geos::noding
44namespace snap { // geos::noding::snap
45
68class GEOS_DLL SnappingNoder : public Noder {
69
70private:
71
72 // Members
73 double snapTolerance;
74 SnappingPointIndex snapIndex;
75 std::vector<std::unique_ptr<SegmentString>> nodedResult;
76
77 // Methods
78
79 void seedSnapIndex(const std::vector<SegmentString*>& segStrings);
80
81 void snapVertices(const std::vector<SegmentString*>& segStrings, std::vector<SegmentString*>& nodedStrings);
82
83 std::unique_ptr<SegmentString> snapVertices(const SegmentString* ss);
84
85 std::unique_ptr<geom::CoordinateSequence> snap(const geom::CoordinateSequence* cs);
86
95 std::vector<std::unique_ptr<SegmentString>> snapIntersections(std::vector<SegmentString*>& inputSS);
96
97
98public:
99
104 SnappingNoder(double p_snapTolerance)
105 : snapTolerance(p_snapTolerance)
106 , snapIndex(p_snapTolerance)
107 {}
108
112 std::vector<std::unique_ptr<SegmentString>> getNodedSubstrings() override;
113
114 void computeNodes(const std::vector<SegmentString*>& inputSegStrings) override;
115
116
117};
118
119
120} // namespace geos::noding::snap
121} // namespace geos::noding
122} // 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:44
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
Definition SnappingNoder.h:68
SnappingNoder(double p_snapTolerance)
Definition SnappingNoder.h:104
std::vector< std::unique_ptr< SegmentString > > getNodedSubstrings() override
void computeNodes(const std::vector< SegmentString * > &inputSegStrings) override
Computes the noding for a collection of SegmentStrings.
Basic namespace for all GEOS functionalities.
Definition geos.h:38