PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_force_dims()

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

Definition at line 458 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().

459 {
460  LWCOLLECTION *colout;
461 
462  /* Return 2D empty */
463  if( lwcollection_is_empty(col) )
464  {
465  colout = lwcollection_construct_empty(col->type, col->srid, hasz, hasm);
466  }
467  else
468  {
469  int i;
470  LWGEOM **geoms = NULL;
471  geoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
472  for( i = 0; i < col->ngeoms; i++ )
473  {
474  geoms[i] = lwgeom_force_dims(col->geoms[i], hasz, hasm);
475  }
476  colout = lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, geoms);
477  }
478  return colout;
479 }
uint8_t type
Definition: liblwgeom.h:487
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:481
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
LWGEOM ** geoms
Definition: liblwgeom.h:493
int32_t srid
Definition: liblwgeom.h:490
LWGEOM * lwgeom_force_dims(const LWGEOM *lwgeom, int hasz, int hasm)
Definition: lwgeom.c:714
void * lwalloc(size_t size)
Definition: lwutil.c:199
Here is the call graph for this function:
Here is the caller graph for this function: