PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwline()

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

Definition at line 836 of file gserialized2.c.

837 {
838  uint8_t *loc;
839  int ptsize;
840  size_t size;
841  int type = LINETYPE;
842 
843  assert(line);
844  assert(buf);
845 
846  LWDEBUGF(2, "%s (%p, %p) called", __func__, line, buf);
847 
848  if (FLAGS_GET_Z(line->flags) != FLAGS_GET_Z(line->points->flags))
849  lwerror("Dimensions mismatch in lwline");
850 
851  ptsize = ptarray_point_size(line->points);
852 
853  loc = buf;
854 
855  /* Write in the type. */
856  memcpy(loc, &type, sizeof(uint32_t));
857  loc += sizeof(uint32_t);
858 
859  /* Write in the npoints. */
860  memcpy(loc, &(line->points->npoints), sizeof(uint32_t));
861  loc += sizeof(uint32_t);
862 
863  LWDEBUGF(3, "%s added npoints (%d)", __func__, line->points->npoints);
864 
865  /* Copy in the ordinates. */
866  if (line->points->npoints > 0)
867  {
868  size = line->points->npoints * ptsize;
869  memcpy(loc, getPoint_internal(line->points, 0), size);
870  loc += size;
871  }
872  LWDEBUGF(3, "%s copied serialized_pointlist (%d bytes)", __func__, ptsize * line->points->npoints);
873 
874  return (size_t)(loc - buf);
875 }
#define LINETYPE
Definition: liblwgeom.h:103
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:165
#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 size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:58
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
type
Definition: ovdump.py:42
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, ptarray_point_size(), and ovdump::type.

Referenced by gserialized2_from_lwgeom_any().

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