PostGIS  2.3.7dev-r@@SVN_REVISION@@
LWPOLY* lwpoly_clone_deep ( const LWPOLY g)

Definition at line 206 of file lwpoly.c.

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

Referenced by lwgeom_clone_deep().

207 {
208  int i;
209  LWPOLY *ret = lwalloc(sizeof(LWPOLY));
210  memcpy(ret, g, sizeof(LWPOLY));
211  if ( g->bbox ) ret->bbox = gbox_copy(g->bbox);
212  ret->rings = lwalloc(sizeof(POINTARRAY *)*g->nrings);
213  for ( i = 0; i < ret->nrings; i++ )
214  {
215  ret->rings[i] = ptarray_clone_deep(g->rings[i]);
216  }
217  FLAGS_SET_READONLY(ret->flags,0);
218  return ret;
219 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:438
GBOX * bbox
Definition: liblwgeom.h:452
POINTARRAY ** rings
Definition: liblwgeom.h:456
POINTARRAY * ptarray_clone_deep(const POINTARRAY *ptarray)
Deep clone a pointarray (also clones serialized pointlist)
Definition: ptarray.c:634
int nrings
Definition: liblwgeom.h:454
uint8_t flags
Definition: liblwgeom.h:451
void * lwalloc(size_t size)
Definition: lwutil.c:227
#define FLAGS_SET_READONLY(flags, value)
Definition: liblwgeom.h:149

Here is the call graph for this function:

Here is the caller graph for this function: