17#include <geos/export.h>
18#include <geos/operation/cluster/AbstractClusterFinder.h>
19#include <geos/operation/cluster/GeometryFlattener.h>
20#include <geos/geom/Geometry.h>
21#include <geos/geom/GeometryFactory.h>
27class GEOS_DLL DisjointOperation {
29 DisjointOperation(AbstractClusterFinder& finder) : m_finder(finder), m_split_inputs(false) {}
34 void setSplitInputs(
bool b) {
47 template<
typename Function>
48 std::unique_ptr<geom::Geometry> processDisjointSubsets(
const geom::Geometry& g, Function&& f) {
49 if (g.getNumGeometries() == 1) {
53 auto flattened = m_split_inputs ? operation::cluster::GeometryFlattener::flatten(g.clone()) : g.clone();
54 auto clustered = m_finder.clusterToVector(std::move(flattened));
56 for (
auto& subset : clustered) {
60 auto coll = g.getFactory()->createGeometryCollection(std::move(clustered));
62 return operation::cluster::GeometryFlattener::flatten(std::move(coll));
66 AbstractClusterFinder& m_finder;
Basic namespace for all GEOS functionalities.
Definition geos.h:39