PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmultipoly_from_twkb_state()

static LWCOLLECTION* lwmultipoly_from_twkb_state ( twkb_parse_state s)
static

MULTIPOLYGON.

Definition at line 413 of file lwin_twkb.c.

414 {
415  int ngeoms, i;
416  LWGEOM *geom = NULL;
417  LWCOLLECTION *col = lwcollection_construct_empty(s->lwtype, SRID_UNKNOWN, s->has_z, s->has_m);
418 
419  LWDEBUG(2,"Entering lwmultipolygon_from_twkb_state");
420 
421  if ( s->is_empty )
422  return col;
423 
424  /* Read number of geometries */
425  ngeoms = twkb_parse_state_uvarint(s);
426  LWDEBUGF(4,"Number of geometries %d",ngeoms);
427 
428  /* It has an idlist, we need to skip that */
429  if ( s->has_idlist )
430  {
431  for ( i = 0; i < ngeoms; i++ )
433  }
434 
435  for ( i = 0; i < ngeoms; i++ )
436  {
438  if ( lwcollection_add_lwgeom(col, geom) == NULL )
439  {
440  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
441  return NULL;
442  }
443  }
444 
445  return col;
446 }
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
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:320
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 LWPOLY * lwpoly_from_twkb_state(twkb_parse_state *s)
POLYGON.
Definition: lwin_twkb.c:272
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(), lwpoly_as_lwgeom(), lwpoly_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: