PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwmultiline_from_twkb_state()

static LWCOLLECTION* lwmultiline_from_twkb_state ( twkb_parse_state s)
static

MULTILINESTRING.

Definition at line 360 of file lwin_twkb.c.

References twkb_parse_state::has_idlist, twkb_parse_state::has_m, twkb_parse_state::has_z, twkb_parse_state::is_empty, lwcollection_add_lwgeom(), lwcollection_construct_empty(), LWDEBUG, LWDEBUGF, lwerror(), lwline_as_lwgeom(), lwline_from_twkb_state(), twkb_parse_state::lwtype, SRID_UNKNOWN, twkb_parse_state_uvarint(), and twkb_parse_state_varint_skip().

Referenced by lwgeom_from_twkb_state().

361 {
362  int ngeoms, i;
363  LWGEOM *geom = NULL;
365 
366  LWDEBUG(2,"Entering lwmultilinestring_from_twkb_state");
367 
368  if ( s->is_empty )
369  return col;
370 
371  /* Read number of geometries */
372  ngeoms = twkb_parse_state_uvarint(s);
373 
374  LWDEBUGF(4,"Number of geometries %d",ngeoms);
375 
376  /* It has an idlist, we need to skip that */
377  if ( s->has_idlist )
378  {
379  for ( i = 0; i < ngeoms; i++ )
381  }
382 
383  for ( i = 0; i < ngeoms; i++ )
384  {
386  if ( lwcollection_add_lwgeom(col, geom) == NULL )
387  {
388  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
389  return NULL;
390  }
391  }
392 
393  return col;
394 }
uint8_t has_z
Definition: lwin_twkb.c:35
uint8_t is_empty
Definition: lwin_twkb.c:37
static LWLINE * lwline_from_twkb_state(twkb_parse_state *s)
LINESTRING.
Definition: lwin_twkb.c:224
uint8_t has_m
Definition: lwin_twkb.c:36
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
uint8_t has_idlist
Definition: lwin_twkb.c:34
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:249
uint32_t lwtype
Definition: lwin_twkb.c:30
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
static uint64_t twkb_parse_state_uvarint(twkb_parse_state *s)
Definition: lwin_twkb.c:87
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:174
static void twkb_parse_state_varint_skip(twkb_parse_state *s)
Definition: lwin_twkb.c:103
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: