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

Definition at line 115 of file lwgeom_geos_cluster.c.

References UnionIfIntersectingContext::error, UnionIfIntersectingContext::geoms, UnionIfIntersectingContext::p, UnionIfIntersectingContext::prep, UnionIfIntersectingContext::uf, UF_find(), and UF_union().

Referenced by union_intersecting_pairs().

116 {
117  struct UnionIfIntersectingContext *cxt = userdata;
118  if (cxt->error)
119  {
120  return;
121  }
122  uint32_t q = *((uint32_t*) item);
123  uint32_t p = *(cxt->p);
124 
125  if (p != q && UF_find(cxt->uf, p) != UF_find(cxt->uf, q))
126  {
127  int geos_type = GEOSGeomTypeId(cxt->geoms[p]);
128  int geos_result;
129 
130  /* Don't build prepared a geometry around a Point or MultiPoint -
131  * there are some problems in the implementation, and it's not clear
132  * there would be a performance benefit in any case. (See #3433)
133  */
134  if (geos_type != GEOS_POINT && geos_type != GEOS_MULTIPOINT)
135  {
136  /* Lazy initialize prepared geometry */
137  if (cxt->prep == NULL)
138  {
139  cxt->prep = GEOSPrepare(cxt->geoms[p]);
140  }
141  geos_result = GEOSPreparedIntersects(cxt->prep, cxt->geoms[q]);
142  }
143  else
144  {
145  geos_result = GEOSIntersects(cxt->geoms[p], cxt->geoms[q]);
146  }
147  if (geos_result > 1)
148  {
149  cxt->error = geos_result;
150  return;
151  }
152  if (geos_result)
153  {
154  UF_union(cxt->uf, p, q);
155  }
156  }
157 }
const GEOSPreparedGeometry * prep
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: