PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwpoly_clone_deep()

LWPOLY* lwpoly_clone_deep ( const LWPOLY g)

Definition at line 228 of file lwpoly.c.

229 {
230  uint32_t i;
231  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
232  memcpy(ret, g, sizeof(LWPOLY));
233  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
234  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
235  for ( i = 0; i < ret->nrings; i++ )
236  {
237  ret->rings[i] = ptarray_clone_deep(g->rings[i]);
238  }
239  FLAGS_SET_READONLY(ret->flags,0);
240  return ret;
241 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: gbox.c:426
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:626
void * lwalloc(size_t size)
Definition: lwutil.c:227
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:190
POINTARRAY ** rings
Definition: liblwgeom.h:505
uint32_t nrings
Definition: liblwgeom.h:510
GBOX * bbox
Definition: liblwgeom.h:504
lwflags_t flags
Definition: liblwgeom.h:507

References LWPOLY::bbox, LWPOLY::flags, FLAGS_SET_READONLY, gbox_copy(), lwalloc(), LWPOLY::nrings, ptarray_clone_deep(), and LWPOLY::rings.

Referenced by lwgeom_clone_deep().

Here is the call graph for this function:
Here is the caller graph for this function: