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

Definition at line 731 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().

732 {
733  uint8_t *loc;
734  int ptsize;
735  size_t size;
736  int type = CIRCSTRINGTYPE;
737 
738  assert(curve);
739  assert(buf);
740 
741  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
742  lwerror("Dimensions mismatch in lwcircstring");
743 
744 
745  ptsize = ptarray_point_size(curve->points);
746  loc = buf;
747 
748  /* Write in the type. */
749  memcpy(loc, &type, sizeof(uint32_t));
750  loc += sizeof(uint32_t);
751 
752  /* Write in the npoints. */
753  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
754  loc += sizeof(uint32_t);
755 
756  /* Copy in the ordinates. */
757  if ( curve->points->npoints > 0 )
758  {
759  size = curve->points->npoints * ptsize;
760  memcpy(loc, getPoint_internal(curve->points, 0), size);
761  loc += size;
762  }
763 
764  return (size_t)(loc - buf);
765 }
uint8_t flags
Definition: liblwgeom.h:397
int npoints
Definition: liblwgeom.h:327
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:119
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
uint8_t flags
Definition: liblwgeom.h:325
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1645
int ptarray_point_size(const POINTARRAY *pa)
Definition: ptarray.c:41
POINTARRAY * points
Definition: liblwgeom.h:400
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67

Here is the call graph for this function:

Here is the caller graph for this function: