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

◆ lwpoint_from_gserialized1_buffer()

static LWPOINT * lwpoint_from_gserialized1_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size 
)
static

Definition at line 1163 of file gserialized1.c.

1164{
1165 uint8_t *start_ptr = data_ptr;
1166 LWPOINT *point;
1167 uint32_t npoints = 0;
1168
1169 assert(data_ptr);
1170
1171 point = (LWPOINT*)lwalloc(sizeof(LWPOINT));
1172 point->srid = SRID_UNKNOWN; /* Default */
1173 point->bbox = NULL;
1174 point->type = POINTTYPE;
1175 point->flags = lwflags;
1176
1177 data_ptr += 4; /* Skip past the type. */
1178 npoints = gserialized1_get_uint32_t(data_ptr); /* Zero => empty geometry */
1179 data_ptr += 4; /* Skip past the npoints. */
1180
1181 if ( npoints > 0 )
1183 else
1184 point->point = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty point */
1185
1186 data_ptr += npoints * FLAGS_NDIMS(lwflags) * sizeof(double);
1187
1188 if ( size )
1189 *size = data_ptr - start_ptr;
1190
1191 return point;
1192}
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 POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
void * lwalloc(size_t size)
Definition lwutil.c:227
#define FLAGS_NDIMS(flags)
Definition liblwgeom.h:193
#define FLAGS_GET_M(flags)
Definition liblwgeom.h:180
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
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
POINTARRAY * point
Definition liblwgeom.h:457
uint8_t type
Definition liblwgeom.h:460
lwflags_t flags
Definition liblwgeom.h:459
GBOX * bbox
Definition liblwgeom.h:456
int32_t srid
Definition liblwgeom.h:458

References LWPOINT::bbox, LWPOINT::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, gserialized1_get_uint32_t(), lwalloc(), lwflags(), LWPOINT::point, POINTTYPE, ptarray_construct(), ptarray_construct_reference_data(), LWPOINT::srid, SRID_UNKNOWN, and LWPOINT::type.

Referenced by lwgeom_from_gserialized1_buffer().

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