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

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

730 {
731  uint8_t *loc;
732  int ptsize;
733  size_t size;
734  int type = CIRCSTRINGTYPE;
735 
736  assert(curve);
737  assert(buf);
738 
739  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
740  lwerror("Dimensions mismatch in lwcircstring");
741 
742 
743  ptsize = ptarray_point_size(curve->points);
744  loc = buf;
745 
746  /* Write in the type. */
747  memcpy(loc, &type, sizeof(uint32_t));
748  loc += sizeof(uint32_t);
749 
750  /* Write in the npoints. */
751  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
752  loc += sizeof(uint32_t);
753 
754  /* Copy in the ordinates. */
755  if ( curve->points->npoints > 0 )
756  {
757  size = curve->points->npoints * ptsize;
758  memcpy(loc, getPoint_internal(curve->points, 0), size);
759  loc += size;
760  }
761 
762  return (size_t)(loc - buf);
763 }
uint8_t flags
Definition: liblwgeom.h:425
int npoints
Definition: liblwgeom.h:355
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:137
uint8_t flags
Definition: liblwgeom.h:353
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:428
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: