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

◆ lwgeom_count_geometries()

static int32 lwgeom_count_geometries ( LWGEOM lwgeom,
bool  patches_as_geometries 
)
static

Definition at line 246 of file lwgeom_ogc.c.

247{
248 int32 ret = 0;
249
250 if (lwgeom_is_empty(lwgeom))
251 {
252 ret = 0;
253 }
254 else if (lwgeom_is_unitary(lwgeom))
255 {
256 /* If it's a TIN or PolyhedralSurface and we want to count patches */
257 if (lwgeom_has_patches(lwgeom) && patches_as_geometries)
258 {
260 ret = col ? col->ngeoms : 1;
261 }
262 else
263 {
264 ret = 1;
265 }
266 }
267 else
268 {
270 ret = col->ngeoms;
271 }
272
273 return ret;
274}
int lwgeom_is_unitary(const LWGEOM *geom)
Determine whether a Geometry is a bag of sub-geometries.
Definition lwgeom.c:1168
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition lwgeom.c:261
int lwgeom_has_patches(const LWGEOM *geom)
Definition lwgeom.c:1154
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
unsigned int int32
Definition shpopen.c:54
uint32_t ngeoms
Definition liblwgeom.h:580

References lwgeom_as_lwcollection(), lwgeom_has_patches(), lwgeom_is_empty(), lwgeom_is_unitary(), and LWCOLLECTION::ngeoms.

Referenced by LWGEOM_numgeometries_collection(), and LWGEOM_numpatches().

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