PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwpoly_force_dims()

LWPOLY* lwpoly_force_dims ( const LWPOLY lwpoly,
int  hasz,
int  hasm 
)

Definition at line 381 of file lwpoly.c.

References lwalloc(), lwpoly_construct(), lwpoly_construct_empty(), lwpoly_is_empty(), LWPOLY::nrings, ptarray_force_dims(), LWPOLY::rings, LWPOLY::srid, and LWPOLY::type.

Referenced by lwgeom_force_dims().

382 {
383  LWPOLY *polyout;
384 
385  /* Return 2D empty */
386  if( lwpoly_is_empty(poly) )
387  {
388  polyout = lwpoly_construct_empty(poly->srid, hasz, hasm);
389  }
390  else
391  {
392  POINTARRAY **rings = NULL;
393  int i;
394  rings = lwalloc(sizeof(POINTARRAY*) * poly->nrings);
395  for( i = 0; i < poly->nrings; i++ )
396  {
397  rings[i] = ptarray_force_dims(poly->rings[i], hasz, hasm);
398  }
399  polyout = lwpoly_construct(poly->srid, NULL, poly->nrings, rings);
400  }
401  polyout->type = poly->type;
402  return polyout;
403 }
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
uint8_t type
Definition: liblwgeom.h:450
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:139
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
Definition: ptarray.c:1042
void * lwalloc(size_t size)
Definition: lwutil.c:227
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:405
Here is the call graph for this function:
Here is the caller graph for this function: