PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwtriangle_from_gserialized1_buffer()

static LWTRIANGLE * lwtriangle_from_gserialized1_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size 
)
static

Definition at line 1284 of file gserialized1.c.

1285{
1286 uint8_t *start_ptr = data_ptr;
1287 LWTRIANGLE *triangle;
1288 uint32_t npoints = 0;
1289
1290 assert(data_ptr);
1291
1292 triangle = (LWTRIANGLE*)lwalloc(sizeof(LWTRIANGLE));
1293 triangle->srid = SRID_UNKNOWN; /* Default */
1294 triangle->bbox = NULL;
1295 triangle->type = TRIANGLETYPE;
1296 triangle->flags = lwflags;
1297
1298 data_ptr += 4; /* Skip past the type. */
1299 npoints = gserialized1_get_uint32_t(data_ptr); /* Zero => empty geometry */
1300 data_ptr += 4; /* Skip past the npoints. */
1301
1302 if ( npoints > 0 )
1304 else
1305 triangle->points = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty triangle */
1306
1307 data_ptr += sizeof(double) * FLAGS_NDIMS(lwflags) * npoints;
1308
1309 if ( size )
1310 *size = data_ptr - start_ptr;
1311
1312 return triangle;
1313}
static uint32_t gserialized1_get_uint32_t(const uint8_t *loc)
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
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:165
void * lwalloc(size_t size)
Definition lwutil.c:227
#define FLAGS_NDIMS(flags)
Definition liblwgeom.h:179
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:166
#define TRIANGLETYPE
Definition liblwgeom.h:115
lwflags_t lwflags(int hasz, int hasm, int geodetic)
Construct a new flags bitmask.
Definition lwutil.c:477
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215
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
int32_t srid
Definition liblwgeom.h:496
uint8_t type
Definition liblwgeom.h:498
GBOX * bbox
Definition liblwgeom.h:494
lwflags_t flags
Definition liblwgeom.h:497
POINTARRAY * points
Definition liblwgeom.h:495

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

Referenced by lwgeom_from_gserialized1_buffer().

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