PostGIS 3.0.6dev-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 776 of file gserialized1.c.

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

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