GEOS  3.13.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 
22 namespace geos {
23  namespace geom {
24  class Polygon;
25  class LineString;
26  class LinearRing;
27  class GeometryFactory;
28  }
29 }
30 
37 
38 
39 namespace geos {
40 namespace operation {
41 namespace geounion {
42 
43  class GEOS_DLL CoverageUnion {
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:65
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Definition: LineSegment.h:61
Definition: LineString.h:65
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:60
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25