PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwcircstring()

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

Definition at line 972 of file gserialized2.c.

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