GEOS 3.14.0dev
Public Member Functions | Protected Member Functions | List of all members
geos::operation::cluster::AbstractClusterFinder Class Referenceabstract

#include <AbstractClusterFinder.h>

Inheritance diagram for geos::operation::cluster::AbstractClusterFinder:
geos::operation::cluster::DBSCANClusterFinder geos::operation::cluster::EnvelopeDistanceClusterFinder geos::operation::cluster::EnvelopeIntersectsClusterFinder geos::operation::cluster::GeometryDistanceClusterFinder geos::operation::cluster::GeometryIntersectsClusterFinder

Public Member Functions

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::GeometryclusterToCollection (std::unique_ptr< geom::Geometry > &&g)
 
std::unique_ptr< geom::GeometryclusterToCollection (const geom::Geometry &g)
 

Protected Member Functions

virtual bool shouldJoin (const geom::Geometry *a, const geom::Geometry *b)=0
 
virtual const geom::EnvelopequeryEnvelope (const geom::Geometry *a)=0
 
virtual Clusters process (const std::vector< const geom::Geometry * > &components, index::strtree::TemplateSTRtree< std::size_t > &index, UnionFind &uf)
 

Detailed Description

AbstractClusterFinder defines an interface for bottom-up clustering algorithms, where spatial index queries can be used to identify geometries that should be clustered together.

Member Function Documentation

◆ cluster()

Clusters geos::operation::cluster::AbstractClusterFinder::cluster ( const std::vector< const geom::Geometry * > &  g)

Cluster the provided geometries, returning an object that provides access to the components of each cluster.

Parameters
gA vector of geometries to cluster

◆ clusterToCollection() [1/2]

std::unique_ptr< geom::Geometry > geos::operation::cluster::AbstractClusterFinder::clusterToCollection ( const geom::Geometry g)

Cluster the components of the provided geometry, returning a GeometryCollection. The input geometry will not be modified.

Parameters
gA geometry whose components should be clustered.
Returns
a GeometryCollection, with each sub-geometry representing a single cluster.

◆ clusterToCollection() [2/2]

std::unique_ptr< geom::Geometry > geos::operation::cluster::AbstractClusterFinder::clusterToCollection ( std::unique_ptr< geom::Geometry > &&  g)

Cluster the components of the provided geometry, returning a GeometryCollection. This function will take ownership of the provided geometry. Any components that are included in a cluster will be returned. Components that are not included in any cluster will be destroyed.

Parameters
gA geometry whose components should be clustered.
Returns
a GeometryCollection, with each sub-geometry representing a single cluster.

◆ clusterToVector() [1/2]

std::vector< std::unique_ptr< geom::Geometry > > geos::operation::cluster::AbstractClusterFinder::clusterToVector ( const geom::Geometry g)

Cluster the components of the provided geometry, returning a vector of clusters. The input geometry will not be modified.

Parameters
gA geometry whose components should be clustered.
Returns
a Geometry vector, with each entry representing a single cluster.

◆ clusterToVector() [2/2]

std::vector< std::unique_ptr< geom::Geometry > > geos::operation::cluster::AbstractClusterFinder::clusterToVector ( std::unique_ptr< geom::Geometry > &&  g)

Cluster the components of the provided geometry, returning a vector of clusters. This function will take ownership of the provided geometry. Any components that are included in a cluster will be returned. Components that are not included in any cluster will be destroyed.

Parameters
gA geometry whose components should be clustered.
Returns
a Geometry vector, with each entry representing a single cluster.

◆ process()

virtual Clusters geos::operation::cluster::AbstractClusterFinder::process ( const std::vector< const geom::Geometry * > &  components,
index::strtree::TemplateSTRtree< std::size_t > &  index,
UnionFind uf 
)
protectedvirtual

Given a vector and index of components,

Parameters
componentsa vector of Geometry components
indexa spatial index storing pointers to those components
ufa UnionFind
Returns
a vector of with the indices of all components that should be included in a cluster

Reimplemented in geos::operation::cluster::DBSCANClusterFinder.

◆ queryEnvelope()

virtual const geom::Envelope & geos::operation::cluster::AbstractClusterFinder::queryEnvelope ( const geom::Geometry a)
protectedpure virtual

Provide an query Envelope that can be used to find all geometries possibly in the same cluster as the input.

Parameters
aGeometry
Returns
an Envelope suitable for querying

Implemented in geos::operation::cluster::DBSCANClusterFinder, geos::operation::cluster::EnvelopeDistanceClusterFinder, geos::operation::cluster::EnvelopeIntersectsClusterFinder, geos::operation::cluster::GeometryDistanceClusterFinder, and geos::operation::cluster::GeometryIntersectsClusterFinder.

◆ shouldJoin()

virtual bool geos::operation::cluster::AbstractClusterFinder::shouldJoin ( const geom::Geometry a,
const geom::Geometry b 
)
protectedpure virtual

Determine whether two geometries should be considered in the same cluster.

Parameters
aGeometry
bGeometry
Returns
true if the clusters associated with a and b should be merged.

Implemented in geos::operation::cluster::DBSCANClusterFinder, geos::operation::cluster::EnvelopeDistanceClusterFinder, geos::operation::cluster::EnvelopeIntersectsClusterFinder, geos::operation::cluster::GeometryDistanceClusterFinder, and geos::operation::cluster::GeometryIntersectsClusterFinder.


The documentation for this class was generated from the following file: