AbstractClusterFinder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020-2022 Daniel Baston
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <memory>
#include <vector>
#include <geos/export.h>
#include <geos/index/strtree/TemplateSTRtree.h>
#include <geos/operation/cluster/Clusters.h>
// Forward declarations
namespace geos {
namespace geom {
class Envelope;
class Geometry;
}
namespace operation {
namespace cluster {
class UnionFind;
}
}
}
namespace geos {
namespace operation {
namespace cluster {
class GEOS_DLL AbstractClusterFinder {
public:
Clusters cluster(const std::vector<const geom::Geometry*>& g);
std::vector<std::unique_ptr<geom::Geometry>> clusterToVector(std::unique_ptr<geom::Geometry> && g);
std::vector<std::unique_ptr<geom::Geometry>> clusterToVector(const geom::Geometry& g);
std::unique_ptr<geom::Geometry> clusterToCollection(std::unique_ptr<geom::Geometry> && g);
std::unique_ptr<geom::Geometry> clusterToCollection(const geom::Geometry & g);
protected:
virtual bool shouldJoin(const geom::Geometry* a, const geom::Geometry* b) = 0;
virtual const geom::Envelope& queryEnvelope(const geom::Geometry* a) = 0;
virtual Clusters process(const std::vector<const geom::Geometry*> & components,
index::strtree::TemplateSTRtree<std::size_t> & index,
UnionFind & uf);
private:
static std::vector<std::unique_ptr<geom::Geometry>> getComponents(std::unique_ptr<geom::Geometry>&& g);
};
}
}
}
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::operation::cluster::AbstractClusterFinder
Definition AbstractClusterFinder.h:45
geos::operation::cluster::AbstractClusterFinder::process
virtual Clusters process(const std::vector< const geom::Geometry * > &components, index::strtree::TemplateSTRtree< std::size_t > &index, UnionFind &uf)
geos::operation::cluster::AbstractClusterFinder::clusterToVector
std::vector< std::unique_ptr< geom::Geometry > > clusterToVector(const geom::Geometry &g)
geos::operation::cluster::AbstractClusterFinder::shouldJoin
virtual bool shouldJoin(const geom::Geometry *a, const geom::Geometry *b)=0
geos::operation::cluster::AbstractClusterFinder::clusterToCollection
std::unique_ptr< geom::Geometry > clusterToCollection(std::unique_ptr< geom::Geometry > &&g)
geos::operation::cluster::AbstractClusterFinder::queryEnvelope
virtual const geom::Envelope & queryEnvelope(const geom::Geometry *a)=0
geos::operation::cluster::AbstractClusterFinder::cluster
Clusters cluster(const std::vector< const geom::Geometry * > &g)
geos::operation::cluster::AbstractClusterFinder::clusterToCollection
std::unique_ptr< geom::Geometry > clusterToCollection(const geom::Geometry &g)
geos::operation::cluster::AbstractClusterFinder::clusterToVector
std::vector< std::unique_ptr< geom::Geometry > > clusterToVector(std::unique_ptr< geom::Geometry > &&g)
geos::operation::cluster::UnionFind
Definition UnionFind.h:32
geos::geom
Definition Angle.h:26
geos::index
Provides classes for various kinds of spatial indexes.
Definition CleanCoverage.h:39
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38