PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ lwline_from_gserialized2_buffer()

static LWLINE* lwline_from_gserialized2_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size,
int32_t  srid 
)
static

Definition at line 1245 of file gserialized2.c.

1246 {
1247  uint8_t *start_ptr = data_ptr;
1248  LWLINE *line;
1249  uint32_t npoints = 0;
1250 
1251  assert(data_ptr);
1252 
1253  line = (LWLINE*)lwalloc(sizeof(LWLINE));
1254  line->srid = srid;
1255  line->bbox = NULL;
1256  line->type = LINETYPE;
1257  line->flags = lwflags;
1258 
1259  data_ptr += 4; /* Skip past the type. */
1260  npoints = gserialized2_get_uint32_t(data_ptr); /* Zero => empty geometry */
1261  data_ptr += 4; /* Skip past the npoints. */
1262 
1263  if (npoints > 0)
1265 
1266  else
1267  line->points = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty linestring */
1268 
1269  data_ptr += FLAGS_NDIMS(lwflags) * npoints * sizeof(double);
1270 
1271  if (size)
1272  *size = data_ptr - start_ptr;
1273 
1274  return line;
1275 }
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
#define LINETYPE
Definition: liblwgeom.h:118
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:180
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:194
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:181
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
lwflags_t flags
Definition: liblwgeom.h:500
GBOX * bbox
Definition: liblwgeom.h:497
POINTARRAY * points
Definition: liblwgeom.h:498
uint8_t type
Definition: liblwgeom.h:501
int32_t srid
Definition: liblwgeom.h:499

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

Referenced by lwgeom_from_gserialized2_buffer().

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