PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwpoly_force_dims()

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

Definition at line 394 of file lwpoly.c.

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

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: