PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwpoly_clone()

LWPOLY* lwpoly_clone ( const LWPOLY lwgeom)

Definition at line 193 of file lwpoly.c.

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

Referenced by lwgeom_clone().

194 {
195  int i;
196  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
197  memcpy(ret, g, sizeof(LWPOLY));
198  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
199  for ( i = 0; i < g->nrings; i++ ) {
200  ret->rings[i] = ptarray_clone(g->rings[i]);
201  }
202  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
203  return ret;
204 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:438
POINTARRAY * ptarray_clone(const POINTARRAY *ptarray)
Clone a POINTARRAY object.
Definition: ptarray.c:658
GBOX * bbox
Definition: liblwgeom.h:452
POINTARRAY ** rings
Definition: liblwgeom.h:456
void * lwalloc(size_t size)
Definition: lwutil.c:227
Here is the call graph for this function:
Here is the caller graph for this function: