PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwcircstring()

static size_t gserialized2_from_lwcircstring ( const LWCIRCSTRING curve,
uint8_t *  buf 
)
static

Definition at line 970 of file gserialized2.c.

971 {
972  uint8_t *loc;
973  int ptsize;
974  size_t size;
975  int type = CIRCSTRINGTYPE;
976 
977  assert(curve);
978  assert(buf);
979 
980  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
981  lwerror("Dimensions mismatch in lwcircstring");
982 
983 
984  ptsize = ptarray_point_size(curve->points);
985  loc = buf;
986 
987  /* Write in the type. */
988  memcpy(loc, &type, sizeof(uint32_t));
989  loc += sizeof(uint32_t);
990 
991  /* Write in the npoints. */
992  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
993  loc += sizeof(uint32_t);
994 
995  /* Copy in the ordinates. */
996  if (curve->points->npoints > 0)
997  {
998  size = curve->points->npoints * ptsize;
999  memcpy(loc, getPoint_internal(curve->points, 0), size);
1000  loc += size;
1001  }
1002 
1003  return (size_t)(loc - buf);
1004 }
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:194
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:495
POINTARRAY * points
Definition: liblwgeom.h:493
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t npoints
Definition: liblwgeom.h:413

References CIRCSTRINGTYPE, POINTARRAY::flags, LWCIRCSTRING::flags, FLAGS_GET_ZM, getPoint_internal(), lwerror(), POINTARRAY::npoints, LWCIRCSTRING::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: