PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ encode_mline()

static Data__Geometry* encode_mline ( struct geobuf_agg_context ctx,
LWMLINE lwmline 
)
static

Definition at line 272 of file geobuf.c.

274 {
275  int i, offset, ngeoms;
276  POINTARRAY *pa;
277  Data__Geometry *geometry;
278  uint32_t *lengths;
279  int64_t *coords = NULL;
280 
281  geometry = galloc(DATA__GEOMETRY__TYPE__MULTILINESTRING);
282 
283  ngeoms = lwmline->ngeoms;
284 
285  if (ngeoms == 0)
286  return geometry;
287 
288  lengths = palloc (sizeof (uint32_t) * ngeoms);
289 
290  offset = 0;
291  for (i = 0; i < ngeoms; i++) {
292  pa = lwmline->geoms[i]->points;
293  coords = encode_coords(ctx, pa, coords, pa->npoints, offset);
294  offset += pa->npoints * ctx->dimensions;
295  lengths[i] = pa->npoints;
296  }
297 
298  if (ngeoms > 1) {
299  geometry->n_lengths = ngeoms;
300  geometry->lengths = lengths;
301  }
302 
303  geometry->n_coords = offset;
304  geometry->coords = coords;
305 
306  return geometry;
307 }
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:36
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)
Definition: geobuf.c:161
POINTARRAY * points
Definition: liblwgeom.h:483
LWLINE ** geoms
Definition: liblwgeom.h:547
uint32_t ngeoms
Definition: liblwgeom.h:552
uint32_t npoints
Definition: liblwgeom.h:427
uint32_t dimensions
Definition: geobuf.h:61

References geobuf_agg_context::dimensions, encode_coords(), galloc(), LWMLINE::geoms, LWMLINE::ngeoms, POINTARRAY::npoints, and LWLINE::points.

Referenced by encode_geometry().

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