PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwcollection_force_dims()

LWCOLLECTION* lwcollection_force_dims ( const LWCOLLECTION lwcol,
int  hasz,
int  hasm,
double  zval,
double  mval 
)

Definition at line 476 of file lwcollection.c.

477 {
478  LWCOLLECTION *colout;
479 
480  /* Return 2D empty */
481  if( lwcollection_is_empty(col) )
482  {
483  colout = lwcollection_construct_empty(col->type, col->srid, hasz, hasm);
484  }
485  else
486  {
487  uint32_t i;
488  LWGEOM **geoms = NULL;
489  geoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
490  for( i = 0; i < col->ngeoms; i++ )
491  {
492  geoms[i] = lwgeom_force_dims(col->geoms[i], hasz, hasm, zval, mval);
493  }
494  colout = lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, geoms);
495  }
496  return colout;
497 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
LWGEOM * lwgeom_force_dims(const LWGEOM *lwgeom, int hasz, int hasm, double zval, double mval)
Definition: lwgeom.c:817
int lwcollection_is_empty(const LWCOLLECTION *col)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:42

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().

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