PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcircstring_from_gserialized1_buffer()

static LWCIRCSTRING* lwcircstring_from_gserialized1_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size 
)
static

Definition at line 1314 of file gserialized1.c.

1315 {
1316  uint8_t *start_ptr = data_ptr;
1317  LWCIRCSTRING *circstring;
1318  uint32_t npoints = 0;
1319 
1320  assert(data_ptr);
1321 
1322  circstring = (LWCIRCSTRING*)lwalloc(sizeof(LWCIRCSTRING));
1323  circstring->srid = SRID_UNKNOWN; /* Default */
1324  circstring->bbox = NULL;
1325  circstring->type = CIRCSTRINGTYPE;
1326  circstring->flags = lwflags;
1327 
1328  data_ptr += 4; /* Skip past the circstringtype. */
1329  npoints = gserialized1_get_uint32_t(data_ptr); /* Zero => empty geometry */
1330  data_ptr += 4; /* Skip past the npoints. */
1331 
1332  if ( npoints > 0 )
1333  circstring->points = ptarray_construct_reference_data(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), npoints, data_ptr);
1334  else
1335  circstring->points = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty circularstring */
1336 
1337  data_ptr += FLAGS_NDIMS(lwflags) * npoints * sizeof(double);
1338 
1339  if ( size )
1340  *size = data_ptr - start_ptr;
1341 
1342  return circstring;
1343 }
static uint32_t gserialized1_get_uint32_t(const uint8_t *loc)
Definition: gserialized1.c:72
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:283
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
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
uint8_t type
Definition: liblwgeom.h:496
int32_t srid
Definition: liblwgeom.h:494
lwflags_t flags
Definition: liblwgeom.h:495
POINTARRAY * points
Definition: liblwgeom.h:493
GBOX * bbox
Definition: liblwgeom.h:492

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

Referenced by lwgeom_from_gserialized1_buffer().

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