PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmultiline_from_twkb_state()

static LWCOLLECTION* lwmultiline_from_twkb_state ( twkb_parse_state s)
static

MULTILINESTRING.

Definition at line 374 of file lwin_twkb.c.

375 {
376  int ngeoms, i;
377  LWGEOM *geom = NULL;
378  LWCOLLECTION *col = lwcollection_construct_empty(s->lwtype, SRID_UNKNOWN, s->has_z, s->has_m);
379 
380  LWDEBUG(2,"Entering lwmultilinestring_from_twkb_state");
381 
382  if ( s->is_empty )
383  return col;
384 
385  /* Read number of geometries */
386  ngeoms = twkb_parse_state_uvarint(s);
387 
388  LWDEBUGF(4,"Number of geometries %d",ngeoms);
389 
390  /* It has an idlist, we need to skip that */
391  if ( s->has_idlist )
392  {
393  for ( i = 0; i < ngeoms; i++ )
395  }
396 
397  for ( i = 0; i < ngeoms; i++ )
398  {
400  if ( lwcollection_add_lwgeom(col, geom) == NULL )
401  {
402  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
403  return NULL;
404  }
405  }
406 
407  return col;
408 }
char * s
Definition: cu_in_wkt.c:23
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
Definition: lwgeom.c:330
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static void twkb_parse_state_varint_skip(twkb_parse_state *s)
Definition: lwin_twkb.c:117
static uint64_t twkb_parse_state_uvarint(twkb_parse_state *s)
Definition: lwin_twkb.c:101
static LWLINE * lwline_from_twkb_state(twkb_parse_state *s)
LINESTRING.
Definition: lwin_twkb.c:238

References lwcollection_add_lwgeom(), lwcollection_construct_empty(), LWDEBUG, LWDEBUGF, lwerror(), lwline_as_lwgeom(), lwline_from_twkb_state(), s, SRID_UNKNOWN, twkb_parse_state_uvarint(), and twkb_parse_state_varint_skip().

Referenced by lwgeom_from_twkb_state().

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