geos::operation::cluster::AbstractClusterFinder Class Referenceabstract

`#include <AbstractClusterFinder.h>`

Inheritance diagram for geos::operation::cluster::AbstractClusterFinder:

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

## Protected Member Functions

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)

## 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

  g | A 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

  g | A 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

  g | A 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

  g | A 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

  g | A 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 )

protected virtual

Given a vector and index of components,

Parameters

  components | a vector of Geometry components
  index | a spatial index storing pointers to those components
  uf | a 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 | ) |

protected pure virtual

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

Parameters

  a | Geometry

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 )

protected pure virtual

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

Parameters

  a | Geometry
  b | Geometry

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:

- AbstractClusterFinder.h