PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwcircstring()

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

Definition at line 973 of file gserialized2.c.

974 {
975  uint8_t *loc;
976  int ptsize;
977  size_t size;
978  int type = CIRCSTRINGTYPE;
979 
980  assert(curve);
981  assert(buf);
982 
983  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
984  lwerror("Dimensions mismatch in lwcircstring");
985 
986 
987  ptsize = ptarray_point_size(curve->points);
988  loc = buf;
989 
990  /* Write in the type. */
991  memcpy(loc, &type, sizeof(uint32_t));
992  loc += sizeof(uint32_t);
993 
994  /* Write in the npoints. */
995  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
996  loc += sizeof(uint32_t);
997 
998  /* Copy in the ordinates. */
999  if (curve->points->npoints > 0)
1000  {
1001  size = (size_t)curve->points->npoints * ptsize;
1002  memcpy(loc, getPoint_internal(curve->points, 0), size);
1003  loc += size;
1004  }
1005 
1006  return (size_t)(loc - buf);
1007 }
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:109
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:180
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static size_t ptarray_point_size(const POINTARRAY *pa)
Definition: lwinline.h:56
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:75
type
Definition: ovdump.py:42
lwflags_t flags
Definition: liblwgeom.h:509
POINTARRAY * points
Definition: liblwgeom.h:507
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t npoints
Definition: liblwgeom.h:427

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: