PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized1_from_lwcircstring()

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

Definition at line 913 of file gserialized1.c.

914 {
915  uint8_t *loc;
916  int ptsize;
917  size_t size;
918  int type = CIRCSTRINGTYPE;
919 
920  assert(curve);
921  assert(buf);
922 
923  if (FLAGS_GET_ZM(curve->flags) != FLAGS_GET_ZM(curve->points->flags))
924  lwerror("Dimensions mismatch in lwcircstring");
925 
926 
927  ptsize = ptarray_point_size(curve->points);
928  loc = buf;
929 
930  /* Write in the type. */
931  memcpy(loc, &type, sizeof(uint32_t));
932  loc += sizeof(uint32_t);
933 
934  /* Write in the npoints. */
935  memcpy(loc, &curve->points->npoints, sizeof(uint32_t));
936  loc += sizeof(uint32_t);
937 
938  /* Copy in the ordinates. */
939  if ( curve->points->npoints > 0 )
940  {
941  size = curve->points->npoints * ptsize;
942  memcpy(loc, getPoint_internal(curve->points, 0), size);
943  loc += size;
944  }
945 
946  return (size_t)(loc - buf);
947 }
#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 gserialized1_from_lwgeom_any().

Here is the call graph for this function:
Here is the caller graph for this function: