PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWPOLY* lwpoly_force_dims ( const LWPOLY poly,
int  hasz,
int  hasm 
)

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

304 {
305  LWPOLY *polyout;
306 
307  /* Return 2D empty */
308  if( lwpoly_is_empty(poly) )
309  {
310  polyout = lwpoly_construct_empty(poly->srid, hasz, hasm);
311  }
312  else
313  {
314  POINTARRAY **rings = NULL;
315  int i;
316  rings = lwalloc(sizeof(POINTARRAY*) * poly->nrings);
317  for( i = 0; i < poly->nrings; i++ )
318  {
319  rings[i] = ptarray_force_dims(poly->rings[i], hasz, hasm);
320  }
321  polyout = lwpoly_construct(poly->srid, NULL, poly->nrings, rings);
322  }
323  polyout->type = poly->type;
324  return polyout;
325 }
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
Definition: lwpoly.c:29
uint8_t type
Definition: liblwgeom.h:407
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
Definition: lwpoly.c:66
POINTARRAY ** rings
Definition: liblwgeom.h:413
POINTARRAY * ptarray_force_dims(const POINTARRAY *pa, int hasz, int hasm)
Definition: ptarray.c:999
int nrings
Definition: liblwgeom.h:411
int32_t srid
Definition: liblwgeom.h:410
void * lwalloc(size_t size)
Definition: lwutil.c:175
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:327

Here is the call graph for this function:

Here is the caller graph for this function: