/src/geos/include/geos/operation/overlayng/CoverageUnion.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 | | #include <memory> |
19 | | |
20 | | // Forward declarations |
21 | | namespace geos { |
22 | | namespace geom { |
23 | | class Geometry; |
24 | | } |
25 | | } |
26 | | |
27 | | namespace geos { // geos. |
28 | | namespace operation { // geos.operation |
29 | | namespace overlayng { // geos.operation.overlayng |
30 | | |
31 | | /** |
32 | | * Unions a valid coverage of polygons or lines |
33 | | * in an efficient way. |
34 | | * |
35 | | * A valid polygonal coverage is a collection of geom::Polygon |
36 | | * which satisfy the following conditions: |
37 | | * |
38 | | * * Vector-clean - Line segments within the collection |
39 | | * must either be identical or intersect only at endpoints. |
40 | | * * Non-overlapping - No two polygons |
41 | | * may overlap. Equivalently, polygons must be interior-disjoint. |
42 | | * |
43 | | * A valid linear coverage is a collection of geom::LineString |
44 | | * which satisfies the Vector-clean condition. |
45 | | * Note that this does not require the LineStrings to be fully noded |
46 | | * - i.e. they may contain coincident linework. |
47 | | * Coincident line segments are dissolved by the union. |
48 | | * Currently linear output is not merged (this may be added in a future release.) |
49 | | * |
50 | | * Currently no checking is done to determine whether the input is a valid coverage. |
51 | | * This is because coverage validation involves segment intersection detection, |
52 | | * which is much more expensive than the union phase. |
53 | | * If the input is not a valid coverage |
54 | | * then in some cases this will be detected during processing |
55 | | * and a util::TopologyException is thrown. |
56 | | * Otherwise, the computation will produce output, but it will be invalid. |
57 | | * |
58 | | * Unioning a valid coverage implies that no new vertices are created. |
59 | | * This means that a precision model does not need to be specified. |
60 | | * The precision of the vertices in the output geometry is not changed. |
61 | | * |
62 | | * @author Martin Davis |
63 | | * |
64 | | * @see noding::SegmentExtractingNoder |
65 | | * |
66 | | */ |
67 | | class GEOS_DLL CoverageUnion { |
68 | | using Geometry = geos::geom::Geometry; |
69 | | |
70 | | private: |
71 | | |
72 | | CoverageUnion() |
73 | 0 | { |
74 | 0 | // No instantiation for now |
75 | 0 | }; |
76 | | |
77 | | |
78 | | |
79 | | public: |
80 | | |
81 | | static constexpr double AREA_PCT_DIFF_TOL = 1e-6; |
82 | | |
83 | | /** |
84 | | * Unions a valid polygonal coverage or linear network. |
85 | | * |
86 | | * @param coverage a coverage of polygons or lines |
87 | | * @return the union of the coverage |
88 | | * |
89 | | * @throws util::TopologyException in some cases if the coverage is invalid |
90 | | */ |
91 | | static std::unique_ptr<Geometry> geomunion(const Geometry* coverage); |
92 | | |
93 | | |
94 | | }; |
95 | | |
96 | | |
97 | | } // namespace geos.operation.overlayng |
98 | | } // namespace geos.operation |
99 | | } // namespace geos |