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

◆ gserialized1_from_lwline()

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

Definition at line 777 of file gserialized1.c.

778{
779 uint8_t *loc;
780 int ptsize;
781 size_t size;
782 int type = LINETYPE;
783
784 assert(line);
785 assert(buf);
786
787 LWDEBUGF(2, "%s (%p, %p) called", __func__, line, buf);
788
789 if ( FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->flags) )
790 lwerror("Dimensions mismatch in lwline");
791
792 ptsize = ptarray_point_size(line->points);
793
794 loc = buf;
795
796 /* Write in the type. */
797 memcpy(loc, &type, sizeof(uint32_t));
798 loc += sizeof(uint32_t);
799
800 /* Write in the npoints. */
801 memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
802 loc += sizeof(uint32_t);
803
804 LWDEBUGF(3, "%s added npoints (%d)", __func__, line->points->npoints);
805
806 /* Copy in the ordinates. */
807 if ( line->points->npoints > 0 )
808 {
809 size = (size_t)line->points->npoints * ptsize;
810 memcpy(loc, getPoint_internal(line->points, 0), size);
811 loc += size;
812 }
813 LWDEBUGF(3, "%s copied serialized_pointlist (%d bytes)", __func__, ptsize * line->points->npoints);
814
815 return (size_t)(loc - buf);
816}
#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 gserialized1_from_lwgeom_any().

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