PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwcollection_extract_recursive()

static int lwcollection_extract_recursive ( const LWCOLLECTION col,
uint32_t  type,
LWCOLLECTION col_out 
)
static

Definition at line 408 of file lwcollection.c.

409{
410 size_t i;
411 size_t geoms_added = 0;
412
413 for (i = 0; i < col->ngeoms; i++)
414 {
415 LWGEOM *g = col->geoms[i];
417 {
419 geoms_added += lwcollection_extract_recursive(col_part, type, col_out);
420 }
421
422 if (lwgeom_get_type(g) == type && !lwgeom_is_empty(g))
423 {
424 lwcollection_add_lwgeom(col_out, lwgeom_clone(col->geoms[i]));
425 geoms_added++;
426 }
427 }
428 return geoms_added;
429}
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition lwgeom.c:261
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition lwgeom.c:519
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM contains sub-geometries or not This basically just checks that the struct ...
Definition lwgeom.c:1125
static int lwcollection_extract_recursive(const LWCOLLECTION *col, uint32_t type, LWCOLLECTION *col_out)
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition lwinline.h:141
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:199
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575

References LWCOLLECTION::geoms, lwcollection_add_lwgeom(), lwcollection_extract_recursive(), lwgeom_as_lwcollection(), lwgeom_clone(), lwgeom_get_type(), lwgeom_is_collection(), lwgeom_is_empty(), and LWCOLLECTION::ngeoms.

Referenced by lwcollection_extract(), and lwcollection_extract_recursive().

Here is the call graph for this function:
Here is the caller graph for this function: