PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_from_twkb_state()

static LWCOLLECTION* lwcollection_from_twkb_state ( twkb_parse_state s)
static

COLLECTION, MULTIPOINTTYPE, MULTILINETYPE, MULTIPOLYGONTYPE.

Definition at line 452 of file lwin_twkb.c.

453 {
454  int ngeoms, i;
455  LWGEOM *geom = NULL;
456  LWCOLLECTION *col = lwcollection_construct_empty(s->lwtype, SRID_UNKNOWN, s->has_z, s->has_m);
457 
458  LWDEBUG(2,"Entering lwcollection_from_twkb_state");
459 
460  if ( s->is_empty )
461  return col;
462 
463  /* Read number of geometries */
464  ngeoms = twkb_parse_state_uvarint(s);
465 
466  LWDEBUGF(4,"Number of geometries %d",ngeoms);
467 
468  /* It has an idlist, we need to skip that */
469  if ( s->has_idlist )
470  {
471  for ( i = 0; i < ngeoms; i++ )
473  }
474 
475  for ( i = 0; i < ngeoms; i++ )
476  {
477  geom = lwgeom_from_twkb_state(s);
478  if ( lwcollection_add_lwgeom(col, geom) == NULL )
479  {
480  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
481  return NULL;
482  }
483  }
484 
485 
486  return col;
487 }
char * s
Definition: cu_in_wkt.c:23
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
LWGEOM * lwgeom_from_twkb_state(twkb_parse_state *s)
Internal function declarations.
Definition: lwin_twkb.c:562
static uint64_t twkb_parse_state_uvarint(twkb_parse_state *s)
Definition: lwin_twkb.c:101

References lwcollection_add_lwgeom(), lwcollection_construct_empty(), LWDEBUG, LWDEBUGF, lwerror(), lwgeom_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: