PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_from_wkb_state()

static LWCOLLECTION* lwcollection_from_wkb_state ( wkb_parse_state s)
static

POLYHEDRALSURFACETYPE.

COLLECTION, MULTIPOINTTYPE, MULTILINETYPE, MULTIPOLYGONTYPE, COMPOUNDTYPE, MULTICURVETYPE, MULTISURFACETYPE, TINTYPE

Definition at line 620 of file lwin_wkb.c.

References wkb_parse_state::check, wkb_parse_state::has_m, wkb_parse_state::has_z, integer_from_wkb_state(), LW_PARSER_CHECK_ZCLOSURE, lwcollection_add_lwgeom(), lwcollection_construct_empty(), LWDEBUGF, lwerror(), lwgeom_from_wkb_state(), wkb_parse_state::lwtype, POLYHEDRALSURFACETYPE, and wkb_parse_state::srid.

Referenced by lwgeom_from_wkb_state().

621 {
622  uint32_t ngeoms = integer_from_wkb_state(s);
624  LWGEOM *geom = NULL;
625  int i;
626 
627  LWDEBUGF(4,"Collection has %d components", ngeoms);
628 
629  /* Empty collection? */
630  if ( ngeoms == 0 )
631  return col;
632 
633  /* Be strict in polyhedral surface closures */
634  if ( s->lwtype == POLYHEDRALSURFACETYPE )
636 
637  for ( i = 0; i < ngeoms; i++ )
638  {
639  geom = lwgeom_from_wkb_state(s);
640  if ( lwcollection_add_lwgeom(col, geom) == NULL )
641  {
642  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
643  return NULL;
644  }
645  }
646 
647  return col;
648 }
static uint32_t integer_from_wkb_state(wkb_parse_state *s)
Int32 Read 4-byte integer and advance the parse state forward.
Definition: lwin_wkb.c:253
uint32_t lwtype
Definition: lwin_wkb.c:27
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
#define LW_PARSER_CHECK_ZCLOSURE
Definition: liblwgeom.h:1867
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:658
uint32_t srid
Definition: lwin_wkb.c:28
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
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: