PostGIS  2.5.0dev-r@@SVN_REVISION@@
static Data__Geometry* encode_collection ( struct geobuf_agg_context ctx,
LWCOLLECTION lwcollection 
)
static

Definition at line 387 of file geobuf.c.

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

Referenced by encode_geometry().

389 {
390  int i, ngeoms;
391  Data__Geometry *geometry, **geometries;
392 
393  geometry = galloc(DATA__GEOMETRY__TYPE__GEOMETRYCOLLECTION);
394 
395  ngeoms = lwcollection->ngeoms;
396 
397  if (ngeoms == 0)
398  return geometry;
399 
400  geometries = palloc (sizeof (Data__Geometry *) * ngeoms);
401  for (i = 0; i < ngeoms; i++) {
402  LWGEOM *lwgeom = lwcollection->geoms[i];
403  Data__Geometry *geom = encode_geometry(ctx, lwgeom);
404  geometries[i] = geom;
405  }
406 
407  geometry->n_geometries = ngeoms;
408  geometry->geometries = geometries;
409 
410  return geometry;
411 }
static Data__Geometry * encode_geometry(struct geobuf_agg_context *ctx, LWGEOM *lwgeom)
Definition: geobuf.c:413
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:36
uint32_t ngeoms
Definition: liblwgeom.h:506
LWGEOM ** geoms
Definition: liblwgeom.h:508

Here is the call graph for this function:

Here is the caller graph for this function: