PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwpoly_clone()

LWPOLY* lwpoly_clone ( const LWPOLY g)

Definition at line 213 of file lwpoly.c.

References LWPOLY::bbox, gbox_copy(), lwalloc(), LWPOLY::nrings, ptarray_clone(), and LWPOLY::rings.

Referenced by lwgeom_clone().

214 {
215  uint32_t i;
216  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
217  memcpy(ret, g, sizeof(LWPOLY));
218  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
219  for ( i = 0; i < g->nrings; i++ ) {
220  ret->rings[i] = ptarray_clone(g->rings[i]);
221  }
222  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
223  return ret;
224 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:433
POINTARRAY * ptarray_clone(const POINTARRAY *ptarray)
Clone a POINTARRAY object.
Definition: ptarray.c:652
GBOX * bbox
Definition: liblwgeom.h:455
uint32_t nrings
Definition: liblwgeom.h:457
unsigned int uint32_t
Definition: uthash.h:78
POINTARRAY ** rings
Definition: liblwgeom.h:459
void * lwalloc(size_t size)
Definition: lwutil.c:229
Here is the call graph for this function:
Here is the caller graph for this function: