PostGIS  2.2.8dev-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 438 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(), lwgeom_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().

439 {
440  int ngeoms, i;
441  LWGEOM *geom = NULL;
443 
444  LWDEBUG(2,"Entering lwcollection_from_twkb_state");
445 
446  if ( s->is_empty )
447  return col;
448 
449  /* Read number of geometries */
450  ngeoms = twkb_parse_state_uvarint(s);
451 
452  LWDEBUGF(4,"Number of geometries %d",ngeoms);
453 
454  /* It has an idlist, we need to skip that */
455  if ( s->has_idlist )
456  {
457  for ( i = 0; i < ngeoms; i++ )
459  }
460 
461  for ( i = 0; i < ngeoms; i++ )
462  {
463  geom = lwgeom_from_twkb_state(s);
464  if ( lwcollection_add_lwgeom(col, geom) == NULL )
465  {
466  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
467  return NULL;
468  }
469  }
470 
471 
472  return col;
473 }
uint8_t has_z
Definition: lwin_twkb.c:35
uint8_t is_empty
Definition: lwin_twkb.c:37
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
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
LWGEOM * lwgeom_from_twkb_state(twkb_parse_state *s)
Internal function declarations.
Definition: lwin_twkb.c:548
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: