PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcircstring()

static size_t gserialized_from_lwcircstring ( const LWCIRCSTRING curve,
uint8_t buf 
)
static

Definition at line 997 of file g_serialized.c.

References CIRCSTRINGTYPE, POINTARRAY::flags, LWCIRCSTRING::flags, FLAGS_GET_ZM, getPoint_internal(), lwerror(), POINTARRAY::npoints, LWCIRCSTRING::points, ptarray_point_size(), and ovdump::type.

Referenced by gserialized_from_lwgeom_any().

998 {
999  uint8_t *loc;
1000  int ptsize;
1001  size_t size;
1002  int type = CIRCSTRINGTYPE;
1003 
1004  assert(curve);
1005  assert(buf);
1006 
1007  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
1008  lwerror("Dimensions mismatch in lwcircstring");
1009 
1010 
1011  ptsize = ptarray_point_size(curve->points);
1012  loc = buf;
1013 
1014  /* Write in the type. */
1015  memcpy(loc, &type, sizeof(uint32_t));
1016  loc += sizeof(uint32_t);
1017 
1018  /* Write in the npoints. */
1019  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
1020  loc += sizeof(uint32_t);
1021 
1022  /* Copy in the ordinates. */
1023  if ( curve->points->npoints > 0 )
1024  {
1025  size = curve->points->npoints * ptsize;
1026  memcpy(loc, getPoint_internal(curve->points, 0), size);
1027  loc += size;
1028  }
1029 
1030  return (size_t)(loc - buf);
1031 }
size_t ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
uint8_t flags
Definition: liblwgeom.h:443
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
unsigned int uint32_t
Definition: uthash.h:78
uint8_t flags
Definition: liblwgeom.h:371
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1743
type
Definition: ovdump.py:41
POINTARRAY * points
Definition: liblwgeom.h:446
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
unsigned char uint8_t
Definition: uthash.h:79
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: