PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoly_clone()

LWPOLY* lwpoly_clone ( const LWPOLY lwgeom)

Definition at line 215 of file lwpoly.c.

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

Referenced by lwgeom_clone().

216 {
217  int i;
218  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
219  memcpy(ret, g, sizeof(LWPOLY));
220  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
221  for ( i = 0; i < g->nrings; i++ ) {
222  ret->rings[i] = ptarray_clone(g->rings[i]);
223  }
224  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
225  return ret;
226 }
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:661
GBOX * bbox
Definition: liblwgeom.h:453
POINTARRAY ** rings
Definition: liblwgeom.h:457
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: