PostGIS  2.3.7dev-r@@SVN_REVISION@@
static size_t gserialized_from_lwcircstring ( const LWCIRCSTRING curve,
uint8_t *  buf 
)
static

Definition at line 756 of file g_serialized.c.

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

Referenced by gserialized_from_lwgeom_any().

757 {
758  uint8_t *loc;
759  int ptsize;
760  size_t size;
761  int type = CIRCSTRINGTYPE;
762 
763  assert(curve);
764  assert(buf);
765 
766  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
767  lwerror("Dimensions mismatch in lwcircstring");
768 
769 
770  ptsize = ptarray_point_size(curve->points);
771  loc = buf;
772 
773  /* Write in the type. */
774  memcpy(loc, &type, sizeof(uint32_t));
775  loc += sizeof(uint32_t);
776 
777  /* Write in the npoints. */
778  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
779  loc += sizeof(uint32_t);
780 
781  /* Copy in the ordinates. */
782  if ( curve->points->npoints > 0 )
783  {
784  size = curve->points->npoints * ptsize;
785  memcpy(loc, getPoint_internal(curve->points, 0), size);
786  loc += size;
787  }
788 
789  return (size_t)(loc - buf);
790 }
uint8_t flags
Definition: liblwgeom.h:440
int npoints
Definition: liblwgeom.h:370
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
uint8_t flags
Definition: liblwgeom.h:368
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1706
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:54
POINTARRAY * points
Definition: liblwgeom.h:443
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102

Here is the call graph for this function:

Here is the caller graph for this function: