GEOS 3.14.0dev
operation/union/CoverageUnion.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
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/geom/LineSegment.h>
18#include <geos/geom/Geometry.h>
19
20#include <memory>
21
22namespace geos {
23 namespace geom {
24 class Polygon;
25 class LineString;
26 class LinearRing;
27 class GeometryFactory;
28 }
29}
30
31namespace geos {
32namespace operation {
33namespace geounion {
34
35 class GEOS_DLL CoverageUnion {
36 using Geometry = geos::geom::Geometry;
37 using GeometryFactory = geos::geom::GeometryFactory;
38 using Polygon = geos::geom::Polygon;
39 using LineString = geos::geom::LineString;
40 using LinearRing = geos::geom::LinearRing;
41 using LineSegment = geos::geom::LineSegment;
42
43
44 public:
45 static std::unique_ptr<Geometry> Union(const Geometry* geom);
46
47 private:
48 CoverageUnion() = default;
49
50 void extractRings(const Polygon* geom);
51 void extractRings(const Geometry* geom);
52 void extractSegments(const LineString* geom);
53 void sortRings();
54
55 std::unique_ptr<Geometry> polygonize(const GeometryFactory* gf);
56
57 std::vector<const LinearRing*> rings;
58 // std::unordered_set<geos::geom::LineSegment, geos::geom::LineSegment::HashCode> segments;
59 LineSegment::UnorderedSet segments;
60 static constexpr double AREA_PCT_DIFF_TOL = 1e-6;
61 };
62
63}
64}
65}
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Definition LineSegment.h:61
Definition LineString.h:66
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
Basic namespace for all GEOS functionalities.
Definition geos.h:39