159{
160 uint32_t p, i;
163 {
165 .num_items_found = 0,
166 .items_found_size = 0
167 };
169
170 if (num_geoms <= 1)
172
174 if (tree.tree == NULL)
175 {
178 }
179
180 for (p = 0; p < num_geoms; p++)
181 {
182 const GEOSPreparedGeometry* prep = NULL;
183
184 if (!geoms[p] || GEOSisEmpty(geoms[p]))
185 continue;
186
189
191 {
193
195 {
196 int geos_type = GEOSGeomTypeId(geoms[p]);
197 int geos_result;
198
199
200
201
202
203 if (geos_type != GEOS_POINT && geos_type != GEOS_MULTIPOINT)
204 {
205
206 if (prep == NULL)
207 {
208 prep = GEOSPrepare(geoms[p]);
209 }
210 geos_result = GEOSPreparedIntersects(prep, geoms[q]);
211 }
212 else
213 {
214 geos_result = GEOSIntersects(geoms[p], geoms[q]);
215 }
216 if (geos_result > 1)
217 {
219 break;
220 }
221 else if (geos_result)
222 {
224 }
225 }
226 }
227
228 if (prep)
229 GEOSPreparedGeom_destroy(prep);
230
231 if (!success)
232 break;
233 }
234
237
239 return success;
240}
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)