PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ cluster_intersecting()

int cluster_intersecting ( GEOSGeometry **  geoms,
uint32_t  num_geoms,
GEOSGeometry ***  clusterGeoms,
uint32_t num_clusters 
)

Takes an array of GEOSGeometry* and constructs an array of GEOSGeometry*, where each element in the constructed array is a GeometryCollection representing a set of interconnected geometries.

Caller is responsible for freeing the input array, but not for destroying the GEOSGeometry* items inside it.

Definition at line 243 of file lwgeom_geos_cluster.c.

References combine_geometries(), LW_FAILURE, UF_create(), UF_destroy(), and union_intersecting_pairs().

Referenced by clusterintersecting_garray(), and perform_cluster_intersecting_test().

244 {
245  int cluster_success;
246  UNIONFIND* uf = UF_create(num_geoms);
247 
248  if (union_intersecting_pairs(geoms, num_geoms, uf) == LW_FAILURE)
249  {
250  UF_destroy(uf);
251  return LW_FAILURE;
252  }
253 
254  cluster_success = combine_geometries(uf, (void**) geoms, num_geoms, (void***) clusterGeoms, num_clusters, 0);
255  UF_destroy(uf);
256  return cluster_success;
257 }
void UF_destroy(UNIONFIND *uf)
Definition: lwunionfind.c:53
#define LW_FAILURE
Definition: liblwgeom.h:79
UNIONFIND * UF_create(uint32_t N)
Definition: lwunionfind.c:34
static int combine_geometries(UNIONFIND *uf, void **geoms, uint32_t num_geoms, void ***clustersGeoms, uint32_t *num_clusters, char is_lwgeom)
Uses a UNIONFIND to identify the set with which each input geometry is associated, and groups the geometries into GeometryCollections.
static int union_intersecting_pairs(GEOSGeometry **geoms, uint32_t num_geoms, UNIONFIND *uf)
Here is the call graph for this function:
Here is the caller graph for this function: