PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ encode_collection()

static Data__Geometry* encode_collection ( struct geobuf_agg_context ctx,
LWCOLLECTION lwcollection 
)
static

Definition at line 399 of file geobuf.c.

401 {
402  int i, ngeoms;
403  Data__Geometry *geometry, **geometries;
404 
405  geometry = galloc(DATA__GEOMETRY__TYPE__GEOMETRYCOLLECTION);
406 
407  ngeoms = lwcollection->ngeoms;
408 
409  if (ngeoms == 0)
410  return geometry;
411 
412  geometries = palloc (sizeof (Data__Geometry *) * ngeoms);
413  for (i = 0; i < ngeoms; i++) {
414  LWGEOM *lwgeom = lwcollection->geoms[i];
415  Data__Geometry *geom = encode_geometry(ctx, lwgeom);
416  geometries[i] = geom;
417  }
418 
419  geometry->n_geometries = ngeoms;
420  geometry->geometries = geometries;
421 
422  return geometry;
423 }
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:37
static Data__Geometry * encode_geometry(struct geobuf_agg_context *ctx, LWGEOM *lwgeom)
Definition: geobuf.c:425
uint32_t ngeoms
Definition: liblwgeom.h:566
LWGEOM ** geoms
Definition: liblwgeom.h:561

References encode_geometry(), galloc(), LWCOLLECTION::geoms, and LWCOLLECTION::ngeoms.

Referenced by encode_geometry().

Here is the call graph for this function:
Here is the caller graph for this function: