PostGIS 3.0.6dev-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 867 of file gserialized2.c.

868{
869 uint8_t *loc;
870 int ptsize;
871 size_t size;
872 int type = LINETYPE;
873
874 assert(line);
875 assert(buf);
876
877 LWDEBUGF(2, "%s (%p, %p) called", __func__, line, buf);
878
879 if (FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->flags))
880 lwerror("Dimensions mismatch in lwline");
881
882 ptsize = ptarray_point_size(line->points);
883
884 loc = buf;
885
886 /* Write in the type. */
887 memcpy(loc, &type, sizeof(uint32_t));
888 loc += sizeof(uint32_t);
889
890 /* Write in the npoints. */
891 memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
892 loc += sizeof(uint32_t);
893
894 LWDEBUGF(3, "%s added npoints (%d)", __func__, line->points->npoints);
895
896 /* Copy in the ordinates. */
897 if (line->points->npoints > 0)
898 {
899 size = line->points->npoints * ptsize;
900 memcpy(loc, getPoint_internal(line->points, 0), size);
901 loc += size;
902 }
903 LWDEBUGF(3, "%s copied serialized_pointlist (%d bytes)", __func__, ptsize * line->points->npoints);
904
905 return (size_t)(loc - buf);
906}
#define LINETYPE
Definition liblwgeom.h:117
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition lwinline.h:67
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition lwinline.h:48
lwflags_t flags
Definition liblwgeom.h:471
POINTARRAY * points
Definition liblwgeom.h:469
lwflags_t flags
Definition liblwgeom.h:417
uint32_t npoints
Definition liblwgeom.h:413

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: