GEOS 3.14.0dev
DisjointSubsetUnion.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2022 ISciences LLC
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 <geos/geom/Geometry.h>
19#include <geos/operation/cluster/DisjointOperation.h>
20#include <geos/operation/cluster/GeometryIntersectsClusterFinder.h>
21#include <geos/operation/overlayng/OverlayNGRobust.h>
22
23namespace geos {
24namespace operation {
25namespace geounion {
26
27class GEOS_DLL DisjointSubsetUnion {
28public:
36 static std::unique_ptr<geom::Geometry> Union(const geom::Geometry* g) {
37 operation::cluster::GeometryIntersectsClusterFinder f;
38 operation::cluster::DisjointOperation op(f);
39 op.setSplitInputs(true);
40
41 return op.processDisjointSubsets(*g, [](const geom::Geometry& subset) {
42 return subset.Union();
43 });
44 }
45};
46
47}
48}
49}
Basic namespace for all GEOS functionalities.
Definition geos.h:39