PostGIS  2.4.9dev-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 636 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_free(), lwgeom_from_wkb_state(), wkb_parse_state::lwtype, POLYHEDRALSURFACETYPE, and wkb_parse_state::srid.

Referenced by lwgeom_from_wkb_state().

637 {
638  uint32_t ngeoms = integer_from_wkb_state(s);
640  LWGEOM *geom = NULL;
641  int i;
642 
643  LWDEBUGF(4,"Collection has %d components", ngeoms);
644 
645  /* Empty collection? */
646  if ( ngeoms == 0 )
647  return col;
648 
649  /* Be strict in polyhedral surface closures */
650  if ( s->lwtype == POLYHEDRALSURFACETYPE )
652 
653  for ( i = 0; i < ngeoms; i++ )
654  {
655  geom = lwgeom_from_wkb_state(s);
656  if ( lwcollection_add_lwgeom(col, geom) == NULL )
657  {
658  lwgeom_free(geom);
659  lwgeom_free((LWGEOM *)col);
660  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
661  return NULL;
662  }
663  }
664 
665  return col;
666 }
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:267
uint32_t lwtype
Definition: lwin_wkb.c:41
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
unsigned int uint32_t
Definition: uthash.h:78
#define LW_PARSER_CHECK_ZCLOSURE
Definition: liblwgeom.h:2011
LWGEOM * lwgeom_from_wkb_state(wkb_parse_state *s)
Internal function declarations.
Definition: lwin_wkb.c:676
uint32_t srid
Definition: lwin_wkb.c:42
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: