PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void union_if_dwithin ( void *  item,
void *  userdata 
)
static

Definition at line 161 of file lwgeom_geos_cluster.c.

References UnionIfDWithinContext::error, UnionIfDWithinContext::geoms, lwgeom_mindistance2d_tolerance(), UnionIfDWithinContext::p, UnionIfDWithinContext::tolerance, UnionIfDWithinContext::uf, UF_find(), and UF_union().

Referenced by union_pairs_within_distance().

162 {
163  struct UnionIfDWithinContext *cxt = userdata;
164  if (cxt->error)
165  {
166  return;
167  }
168  uint32_t q = *((uint32_t*) item);
169  uint32_t p = *(cxt->p);
170 
171  if (p != q && UF_find(cxt->uf, p) != UF_find(cxt->uf, q))
172  {
173  double mindist = lwgeom_mindistance2d_tolerance(cxt->geoms[p], cxt->geoms[q], cxt->tolerance);
174  if (mindist == FLT_MAX)
175  {
176  cxt->error = 1;
177  return;
178  }
179 
180  if (mindist <= cxt->tolerance)
181  {
182  UF_union(cxt->uf, p, q);
183  }
184  }
185 }
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
Definition: measures.c:199
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
Definition: lwunionfind.c:48
void UF_union(UNIONFIND *uf, uint32_t i, uint32_t j)
Definition: lwunionfind.c:65

Here is the call graph for this function:

Here is the caller graph for this function: