PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ lwline_from_gserialized1_buffer()

static LWLINE* lwline_from_gserialized1_buffer ( uint8_t *  data_ptr,
lwflags_t  lwflags,
size_t *  size 
)
static

Definition at line 1195 of file gserialized1.c.

1196 {
1197  uint8_t *start_ptr = data_ptr;
1198  LWLINE *line;
1199  uint32_t npoints = 0;
1200 
1201  assert(data_ptr);
1202 
1203  line = (LWLINE*)lwalloc(sizeof(LWLINE));
1204  line->srid = SRID_UNKNOWN; /* Default */
1205  line->bbox = NULL;
1206  line->type = LINETYPE;
1207  line->flags = lwflags;
1208 
1209  data_ptr += 4; /* Skip past the type. */
1210  npoints = gserialized1_get_uint32_t(data_ptr); /* Zero => empty geometry */
1211  data_ptr += 4; /* Skip past the npoints. */
1212 
1213  if ( npoints > 0 )
1215 
1216  else
1217  line->points = ptarray_construct(FLAGS_GET_Z(lwflags), FLAGS_GET_M(lwflags), 0); /* Empty linestring */
1218 
1219  data_ptr += FLAGS_NDIMS(lwflags) * npoints * sizeof(double);
1220 
1221  if ( size )
1222  *size = data_ptr - start_ptr;
1223 
1224  return line;
1225 }
static uint32_t gserialized1_get_uint32_t(const uint8_t *loc)
Definition: gserialized1.c:74
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
#define LINETYPE
Definition: liblwgeom.h:103
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:165
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:166
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:215
lwflags_t flags
Definition: liblwgeom.h:485
GBOX * bbox
Definition: liblwgeom.h:482
POINTARRAY * points
Definition: liblwgeom.h:483
uint8_t type
Definition: liblwgeom.h:486
int32_t srid
Definition: liblwgeom.h:484

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

Referenced by lwgeom_from_gserialized1_buffer().

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