PostGIS  2.1.10dev-r@@SVN_REVISION@@
static LWLINE* lwline_from_gserialized_buffer ( uint8_t *  data_ptr,
uint8_t  g_flags,
size_t *  g_size 
)
static

Definition at line 1011 of file g_serialized.c.

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

Referenced by lwgeom_from_gserialized_buffer().

1012 {
1013  uint8_t *start_ptr = data_ptr;
1014  LWLINE *line;
1015  uint32_t npoints = 0;
1016 
1017  assert(data_ptr);
1018 
1019  line = (LWLINE*)lwalloc(sizeof(LWLINE));
1020  line->srid = SRID_UNKNOWN; /* Default */
1021  line->bbox = NULL;
1022  line->type = LINETYPE;
1023  line->flags = g_flags;
1024 
1025  data_ptr += 4; /* Skip past the type. */
1026  npoints = lw_get_uint32_t(data_ptr); /* Zero => empty geometry */
1027  data_ptr += 4; /* Skip past the npoints. */
1028 
1029  if ( npoints > 0 )
1030  line->points = ptarray_construct_reference_data(FLAGS_GET_Z(g_flags), FLAGS_GET_M(g_flags), npoints, data_ptr);
1031 
1032  else
1033  line->points = ptarray_construct(FLAGS_GET_Z(g_flags), FLAGS_GET_M(g_flags), 0); /* Empty linestring */
1034 
1035  data_ptr += FLAGS_NDIMS(g_flags) * npoints * sizeof(double);
1036 
1037  if ( g_size )
1038  *g_size = data_ptr - start_ptr;
1039 
1040  return line;
1041 }
#define LINETYPE
Definition: liblwgeom.h:61
uint8_t type
Definition: liblwgeom.h:374
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:49
GBOX * bbox
Definition: liblwgeom.h:376
int32_t srid
Definition: liblwgeom.h:377
uint32_t lw_get_uint32_t(const uint8_t *loc)
Definition: lwgeom_api.c:534
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
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:280
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
tuple g_size
Definition: genraster.py:42
void * lwalloc(size_t size)
Definition: lwutil.c:175
uint8_t flags
Definition: liblwgeom.h:375
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:118
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: