PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWCOLLECTION* lwcollection_force_dims ( const LWCOLLECTION col,
int  hasz,
int  hasm 
)

Definition at line 471 of file lwcollection.c.

References LWCOLLECTION::geoms, lwalloc(), lwcollection_construct(), lwcollection_construct_empty(), lwcollection_is_empty(), lwgeom_force_dims(), LWCOLLECTION::ngeoms, LWCOLLECTION::srid, and LWCOLLECTION::type.

Referenced by lwgeom_force_dims().

472 {
473  LWCOLLECTION *colout;
474 
475  /* Return 2D empty */
476  if( lwcollection_is_empty(col) )
477  {
478  colout = lwcollection_construct_empty(col->type, col->srid, hasz, hasm);
479  }
480  else
481  {
482  uint32_t i;
483  LWGEOM **geoms = NULL;
484  geoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
485  for( i = 0; i < col->ngeoms; i++ )
486  {
487  geoms[i] = lwgeom_force_dims(col->geoms[i], hasz, hasm);
488  }
489  colout = lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, geoms);
490  }
491  return colout;
492 }
uint8_t type
Definition: liblwgeom.h:502
uint32_t ngeoms
Definition: liblwgeom.h:506
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:494
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
unsigned int uint32_t
Definition: uthash.h:78
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
LWGEOM ** geoms
Definition: liblwgeom.h:508
int32_t srid
Definition: liblwgeom.h:505
LWGEOM * lwgeom_force_dims(const LWGEOM *lwgeom, int hasz, int hasm)
Definition: lwgeom.c:801
void * lwalloc(size_t size)
Definition: lwutil.c:229

Here is the call graph for this function:

Here is the caller graph for this function: