PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwline()

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

Definition at line 834 of file gserialized2.c.

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