PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwpoly_force_dims()

LWPOLY* lwpoly_force_dims ( const LWPOLY lwpoly,
int  hasz,
int  hasm,
double  zval,
double  mval 
)

Definition at line 393 of file lwpoly.c.

394 {
395  LWPOLY *polyout;
396 
397  /* Return 2D empty */
398  if( lwpoly_is_empty(poly) )
399  {
400  polyout = lwpoly_construct_empty(poly->srid, hasz, hasm);
401  }
402  else
403  {
404  POINTARRAY **rings = NULL;
405  uint32_t i;
406  rings = lwalloc(sizeof(POINTARRAY*) * poly->nrings);
407  for( i = 0; i < poly->nrings; i++ )
408  {
409  rings[i] = ptarray_force_dims(poly->rings[i], hasz, hasm, zval, mval);
410  }
411  polyout = lwpoly_construct(poly->srid, NULL, poly->nrings, rings);
412  }
413  polyout->type = poly->type;
414  return polyout;
415 }
void * lwalloc(size_t size)
Definition: lwutil.c:227
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm, double zval, double mval)
Definition: ptarray.c:1188
int lwpoly_is_empty(const LWPOLY *poly)
LWPOLY * lwpoly_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwpoly.c:161
LWPOLY * lwpoly_construct(int32_t srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:43
uint8_t type
Definition: liblwgeom.h:522

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

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