PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ lwcollection_ngeoms()

int lwcollection_ngeoms ( const LWCOLLECTION col)

Definition at line 318 of file lwcollection.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

319 {
320  uint32_t i;
321  int ngeoms = 0;
322 
323  if ( ! col )
324  {
325  lwerror("Null input geometry.");
326  return 0;
327  }
328 
329  for ( i = 0; i < col->ngeoms; i++ )
330  {
331  if ( col->geoms[i])
332  {
333  switch (col->geoms[i]->type)
334  {
335  case POINTTYPE:
336  case LINETYPE:
337  case CIRCSTRINGTYPE:
338  case POLYGONTYPE:
339  ngeoms += 1;
340  break;
341  case MULTIPOINTTYPE:
342  case MULTILINETYPE:
343  case MULTICURVETYPE:
344  case MULTIPOLYGONTYPE:
345  ngeoms += col->ngeoms;
346  break;
347  case COLLECTIONTYPE:
348  ngeoms += lwcollection_ngeoms((LWCOLLECTION*)col->geoms[i]);
349  break;
350  }
351  }
352  }
353  return ngeoms;
354 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
uint32_t ngeoms
Definition: liblwgeom.h:509
unsigned int uint32_t
Definition: uthash.h:78
int lwcollection_ngeoms(const LWCOLLECTION *col)
Definition: lwcollection.c:318
LWGEOM ** geoms
Definition: liblwgeom.h:511
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function: