PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcollection_force_dims()

LWCOLLECTION* lwcollection_force_dims ( const LWCOLLECTION lwcol,
int  hasz,
int  hasm 
)

Definition at line 486 of file lwcollection.c.

487 {
488  LWCOLLECTION *colout;
489 
490  /* Return 2D empty */
491  if( lwcollection_is_empty(col) )
492  {
493  colout = lwcollection_construct_empty(col->type, col->srid, hasz, hasm);
494  }
495  else
496  {
497  uint32_t i;
498  LWGEOM **geoms = NULL;
499  geoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
500  for( i = 0; i < col->ngeoms; i++ )
501  {
502  geoms[i] = lwgeom_force_dims(col->geoms[i], hasz, hasm);
503  }
504  colout = lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, geoms);
505  }
506  return colout;
507 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
LWGEOM * lwgeom_force_dims(const LWGEOM *lwgeom, int hasz, int hasm)
Definition: lwgeom.c:799
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: