PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ lwcircstring_from_gserialized2_buffer()

static LWCIRCSTRING* lwcircstring_from_gserialized2_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size,
int32_t  srid 
)
static

Definition at line 1368 of file gserialized2.c.

1369 {
1370  uint8_t *start_ptr = data_ptr;
1371  LWCIRCSTRING *circstring;
1372  uint32_t npoints = 0;
1373 
1374  assert(data_ptr);
1375 
1376  circstring = (LWCIRCSTRING*)lwalloc(sizeof(LWCIRCSTRING));
1377  circstring->srid = srid;
1378  circstring->bbox = NULL;
1379  circstring->type = CIRCSTRINGTYPE;
1380  circstring->flags = lwflags;
1381 
1382  data_ptr += 4; /* Skip past the circstringtype. */
1383  npoints = gserialized2_get_uint32_t(data_ptr); /* Zero => empty geometry */
1384  data_ptr += 4; /* Skip past the npoints. */
1385 
1386  if (npoints > 0)
1387  circstring->points = ptarray_construct_reference_data(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), npoints, data_ptr);
1388  else
1389  circstring->points = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty circularstring */
1390 
1391  data_ptr += FLAGS_NDIMS(lwflags) * npoints * sizeof(double);
1392 
1393  if (size)
1394  *size = data_ptr - start_ptr;
1395 
1396  return circstring;
1397 }
static uint32_t gserialized2_get_uint32_t(const uint8_t *loc)
Definition: gserialized2.c:131
POINTARRAY * ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist)
Construct a new POINTARRAY, referencing to the data from ptlist.
Definition: ptarray.c:291
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:51
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:193
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:180
void * lwalloc(size_t size)
Definition: lwutil.c:227
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition: lwutil.c:471
uint8_t type
Definition: liblwgeom.h:524
int32_t srid
Definition: liblwgeom.h:522
lwflags_t flags
Definition: liblwgeom.h:523
POINTARRAY * points
Definition: liblwgeom.h:521
GBOX * bbox
Definition: liblwgeom.h:520

References LWCIRCSTRING::bbox, CIRCSTRINGTYPE, LWCIRCSTRING::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, gserialized2_get_uint32_t(), lwalloc(), lwflags(), LWCIRCSTRING::points, ptarray_construct(), ptarray_construct_reference_data(), LWCIRCSTRING::srid, and LWCIRCSTRING::type.

Referenced by lwgeom_from_gserialized2_buffer().

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