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

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

449 {
450  LWCOLLECTION *colout;
451 
452  /* Return 2D empty */
453  if( lwcollection_is_empty(col) )
454  {
455  colout = lwcollection_construct_empty(col->type, col->srid, hasz, hasm);
456  }
457  else
458  {
459  int i;
460  LWGEOM **geoms = NULL;
461  geoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
462  for( i = 0; i < col->ngeoms; i++ )
463  {
464  geoms[i] = lwgeom_force_dims(col->geoms[i], hasz, hasm);
465  }
466  colout = lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, geoms);
467  }
468  return colout;
469 }
int lwcollection_is_empty(const LWCOLLECTION *col)
Definition: lwcollection.c:471
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 * lwgeom_force_dims(const LWGEOM *lwgeom, int hasz, int hasm)
Definition: lwgeom.c:670
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: