PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWPOLY* lwpoly_clone ( const LWPOLY lwgeom)

Definition at line 120 of file lwpoly.c.

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

Referenced by lwgeom_clone().

121 {
122  int i;
123  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
124  memcpy(ret, g, sizeof(LWPOLY));
125  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
126  for ( i = 0; i < g->nrings; i++ ) {
127  ret->rings[i] = ptarray_clone(g->rings[i]);
128  }
129  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
130  return ret;
131 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:362
POINTARRAY * ptarray_clone(const POINTARRAY *ptarray)
Clone a POINTARRAY object.
Definition: ptarray.c:643
GBOX * bbox
Definition: liblwgeom.h:409
POINTARRAY ** rings
Definition: liblwgeom.h:413
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: