PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwline_from_gserialized_buffer()

static LWLINE* lwline_from_gserialized_buffer ( uint8_t data_ptr,
uint8_t  g_flags,
size_t *  g_size 
)
static

Definition at line 1281 of file g_serialized.c.

1282 {
1283  uint8_t *start_ptr = data_ptr;
1284  LWLINE *line;
1285  uint32_t npoints = 0;
1286 
1287  assert(data_ptr);
1288 
1289  line = (LWLINE*)lwalloc(sizeof(LWLINE));
1290  line->srid = SRID_UNKNOWN; /* Default */
1291  line->bbox = NULL;
1292  line->type = LINETYPE;
1293  line->flags = g_flags;
1294 
1295  data_ptr += 4; /* Skip past the type. */
1296  npoints = gserialized_get_uint32_t(data_ptr); /* Zero => empty geometry */
1297  data_ptr += 4; /* Skip past the npoints. */
1298 
1299  if ( npoints > 0 )
1300  line->points = ptarray_construct_reference_data(FLAGS_GET_Z(g_flags), FLAGS_GET_M(g_flags), npoints, data_ptr);
1301 
1302  else
1303  line->points = ptarray_construct(FLAGS_GET_Z(g_flags), FLAGS_GET_M(g_flags), 0); /* Empty linestring */
1304 
1305  data_ptr += FLAGS_NDIMS(g_flags) * npoints * sizeof(double);
1306 
1307  if ( g_size )
1308  *g_size = data_ptr - start_ptr;
1309 
1310  return line;
1311 }
static uint32_t gserialized_get_uint32_t(const uint8_t *loc)
Definition: g_serialized.c:35
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:293
#define LINETYPE
Definition: liblwgeom.h:86
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:62
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
tuple g_size
Definition: genraster.py:41
GBOX * bbox
Definition: liblwgeom.h:423
uint8_t flags
Definition: liblwgeom.h:422
POINTARRAY * points
Definition: liblwgeom.h:425
uint8_t type
Definition: liblwgeom.h:421
int32_t srid
Definition: liblwgeom.h:424
unsigned int uint32_t
Definition: uthash.h:78
unsigned char uint8_t
Definition: uthash.h:79

References LWLINE::bbox, LWLINE::flags, FLAGS_GET_M, FLAGS_GET_Z, FLAGS_NDIMS, genraster::g_size, gserialized_get_uint32_t(), LINETYPE, lwalloc(), LWLINE::points, ptarray_construct(), ptarray_construct_reference_data(), LWLINE::srid, SRID_UNKNOWN, and LWLINE::type.

Referenced by lwgeom_from_gserialized_buffer().

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