PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ptarray_clone_deep()

POINTARRAY * ptarray_clone_deep ( const POINTARRAY ptarray)
extern

Deep clone a pointarray (also clones serialized pointlist)

Definition at line 643 of file ptarray.c.

644{
645 POINTARRAY *out = lwalloc(sizeof(POINTARRAY));
646
647 LWDEBUG(3, "ptarray_clone_deep called.");
648
649 out->flags = in->flags;
650 out->npoints = in->npoints;
651 out->maxpoints = in->npoints;
652
653 FLAGS_SET_READONLY(out->flags, 0);
654
655 if (!in->npoints)
656 {
657 // Avoid calling lwalloc of 0 bytes
658 out->serialized_pointlist = NULL;
659 }
660 else
661 {
662 size_t size = in->npoints * ptarray_point_size(in);
663 out->serialized_pointlist = lwalloc(size);
664 memcpy(out->serialized_pointlist, in->serialized_pointlist, size);
665 }
666
667 return out;
668}
void * lwalloc(size_t size)
Definition lwutil.c:227
#define FLAGS_SET_READONLY(flags, value)
Definition liblwgeom.h:176
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition lwinline.h:56
lwflags_t flags
Definition liblwgeom.h:431
uint32_t maxpoints
Definition liblwgeom.h:428
uint32_t npoints
Definition liblwgeom.h:427
uint8_t * serialized_pointlist
Definition liblwgeom.h:434

References POINTARRAY::flags, FLAGS_SET_READONLY, lwalloc(), LWDEBUG, POINTARRAY::maxpoints, POINTARRAY::npoints, ptarray_point_size(), and POINTARRAY::serialized_pointlist.

Referenced by _lwt_HealEdges(), _lwt_MakeRingShell(), _lwt_SnapEdge_checkMotion(), lwcurvepoly_construct_from_lwpoly(), lwcurvepoly_linearize(), lwgeom_boundary(), LWGEOM_dump_rings(), lwline_clone_deep(), lwmcurve_linearize(), lwmsurface_linearize(), lwpoly_clone_deep(), lwpoly_from_lwlines(), lwtriangle_from_lwline(), parse_kml_coordinates(), and ptarray_remove_repeated_points_minpoints().

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