160{
161 uint32_t p, i;
164 {
166 .num_items_found = 0,
167 .items_found_size = 0
168 };
170
171 if (num_geoms <= 1)
173
175 if (tree.tree == NULL)
176 {
179 }
180
181 for (p = 0; p < num_geoms; p++)
182 {
183 const GEOSPreparedGeometry* prep = NULL;
184
185 if (!geoms[p] || GEOSisEmpty(geoms[p]))
186 continue;
187
190
192 {
194
196 {
197 int geos_type = GEOSGeomTypeId(geoms[p]);
198 int geos_result;
199
200
201
202
203
204 if (geos_type != GEOS_POINT && geos_type != GEOS_MULTIPOINT)
205 {
206
207 if (prep == NULL)
208 {
209 prep = GEOSPrepare(geoms[p]);
210 }
211 geos_result = GEOSPreparedIntersects(prep, geoms[q]);
212 }
213 else
214 {
215 geos_result = GEOSIntersects(geoms[p], geoms[q]);
216 }
217 if (geos_result > 1)
218 {
220 break;
221 }
222 else if (geos_result)
223 {
225 }
226 }
227 }
228
229 if (prep)
230 GEOSPreparedGeom_destroy(prep);
231
232 if (!success)
233 break;
234 }
235
238
240 return success;
241}
static void query_accumulate(void *item, void *userdata)
static struct STRTree make_strtree(void **geoms, uint32_t num_geoms, char is_lwgeom)
Make a GEOSSTRtree that stores a pointer to a variable containing the array index of the input geoms.
static void destroy_strtree(struct STRTree *tree)
Clean up STRTree after use.
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
void UF_union(UNIONFIND *uf, uint32_t i, uint32_t j)