/src/geos/include/geos/noding/SegmentExtractingNoder.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2021 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 | | #pragma once |
16 | | |
17 | | #include <geos/export.h> |
18 | | |
19 | | #include <geos/geom/Coordinate.h> |
20 | | #include <geos/geom/Envelope.h> |
21 | | #include <geos/noding/Noder.h> |
22 | | #include <geos/noding/snap/SnappingPointIndex.h> |
23 | | |
24 | | |
25 | | // Forward declarations |
26 | | namespace geos { |
27 | | namespace geom { |
28 | | class Envelope; |
29 | | class PrecisionModel; |
30 | | } |
31 | | namespace noding { |
32 | | class SegmentString; |
33 | | } |
34 | | } |
35 | | |
36 | | namespace geos { |
37 | | namespace noding { // geos::noding |
38 | | |
39 | | /** |
40 | | * A noder which extracts all line segments |
41 | | * as SegmentString. |
42 | | * This enables fast overlay of geometries which are known to be already fully noded. |
43 | | * In particular, it provides fast union of polygonal and linear coverages. |
44 | | * Unioning a noded set of lines is an effective way |
45 | | * to perform line merging and line dissolving. |
46 | | * |
47 | | * No precision reduction is carried out. |
48 | | * If that is required, another noder must be used (such as a snap-rounding noder), |
49 | | * or the input must be precision-reduced beforehand. |
50 | | * |
51 | | */ |
52 | | class GEOS_DLL SegmentExtractingNoder : public Noder { |
53 | | |
54 | | private: |
55 | | |
56 | | std::vector<std::unique_ptr<SegmentString>> segList; |
57 | | |
58 | | void extractSegments( |
59 | | const std::vector<SegmentString*>& inputSegs, |
60 | | std::vector<std::unique_ptr<SegmentString>>& outputSegs); |
61 | | |
62 | | void extractSegments( |
63 | | const SegmentString* ss, |
64 | | std::vector<std::unique_ptr<SegmentString>>& outputSegs); |
65 | | |
66 | | |
67 | | public: |
68 | | |
69 | | /** |
70 | | * Creates a new segment-extracting noder. |
71 | | */ |
72 | 0 | SegmentExtractingNoder() = default; |
73 | | |
74 | | void computeNodes(const std::vector<SegmentString*>& segStrings) override; |
75 | | |
76 | | /** |
77 | | * @return a Collection of SegmentString representing the |
78 | | * substrings. Caller takes ownership over vector and contents. |
79 | | */ |
80 | | std::vector<std::unique_ptr<SegmentString>> getNodedSubstrings() override; |
81 | | |
82 | | // Declare type as noncopyable |
83 | | SegmentExtractingNoder(SegmentExtractingNoder const&) = delete; |
84 | | SegmentExtractingNoder& operator=(SegmentExtractingNoder const&) = delete; |
85 | | |
86 | | }; |
87 | | |
88 | | |
89 | | } // namespace geos::noding |
90 | | } // namespace geos |