PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwmultipoint_from_twkb_state()

static LWCOLLECTION* lwmultipoint_from_twkb_state ( twkb_parse_state s)
static

MULTIPOINT.

Definition at line 336 of file lwin_twkb.c.

337 {
338  int ngeoms, i;
339  LWGEOM *geom = NULL;
340  LWCOLLECTION *col = lwcollection_construct_empty(s->lwtype, SRID_UNKNOWN, s->has_z, s->has_m);
341 
342  LWDEBUG(2,"Entering lwmultipoint_from_twkb_state");
343 
344  if ( s->is_empty )
345  return col;
346 
347  /* Read number of geometries */
348  ngeoms = twkb_parse_state_uvarint(s);
349  LWDEBUGF(4,"Number of geometries %d", ngeoms);
350 
351  /* It has an idlist, we need to skip that */
352  if ( s->has_idlist )
353  {
354  for ( i = 0; i < ngeoms; i++ )
356  }
357 
358  for ( i = 0; i < ngeoms; i++ )
359  {
361  if ( lwcollection_add_lwgeom(col, geom) == NULL )
362  {
363  lwerror("Unable to add geometry (%p) to collection (%p)", geom, col);
364  return NULL;
365  }
366  }
367 
368  return col;
369 }
char * s
Definition: cu_in_wkt.c:23
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:326
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:188
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
#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 LWPOINT * lwpoint_from_twkb_state(twkb_parse_state *s)
POINT.
Definition: lwin_twkb.c:221
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(), lwpoint_as_lwgeom(), lwpoint_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: