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

◆ gserialized2_from_lwline()

static size_t gserialized2_from_lwline ( const LWLINE line,
uint8_t *  buf 
)
static

Definition at line 837 of file gserialized2.c.

838{
839 uint8_t *loc;
840 int ptsize;
841 size_t size;
842 int type = LINETYPE;
843
844 assert(line);
845 assert(buf);
846
847 LWDEBUGF(2, "%s (%p, %p) called", __func__, line, buf);
848
849 if (FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->flags))
850 lwerror("Dimensions mismatch in lwline");
851
852 ptsize = ptarray_point_size(line->points);
853
854 loc = buf;
855
856 /* Write in the type. */
857 memcpy(loc, &type, sizeof(uint32_t));
858 loc += sizeof(uint32_t);
859
860 /* Write in the npoints. */
861 memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
862 loc += sizeof(uint32_t);
863
864 LWDEBUGF(3, "%s added npoints (%d)", __func__, line->points->npoints);
865
866 /* Copy in the ordinates. */
867 if (line->points->npoints > 0)
868 {
869 size = (size_t)line->points->npoints * ptsize;
870 memcpy(loc, getPoint_internal(line->points, 0), size);
871 loc += size;
872 }
873 LWDEBUGF(3, "%s copied serialized_pointlist (%d bytes)", __func__, ptsize * line->points->npoints);
874
875 return (size_t)(loc - buf);
876}
#define LINETYPE
Definition liblwgeom.h:103
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition lwinline.h:75
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition lwinline.h:56
lwflags_t flags
Definition liblwgeom.h:485
POINTARRAY * points
Definition liblwgeom.h:483
lwflags_t flags
Definition liblwgeom.h:431
uint32_t npoints
Definition liblwgeom.h:427

References POINTARRAY::flags, LWLINE::flags, FLAGS_GET_Z, getPoint_internal(), LINETYPE, LWDEBUGF, lwerror(), POINTARRAY::npoints, LWLINE::points, and ptarray_point_size().

Referenced by gserialized2_from_lwgeom_any().

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