PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ encode_mline()

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

Definition at line 262 of file geobuf.c.

264 {
265  int i, offset, ngeoms;
266  POINTARRAY *pa;
267  Data__Geometry *geometry;
268  uint32_t *lengths;
269  int64_t *coords = NULL;
270 
271  geometry = galloc(DATA__GEOMETRY__TYPE__MULTILINESTRING);
272 
273  ngeoms = lwmline->ngeoms;
274 
275  if (ngeoms == 0)
276  return geometry;
277 
278  lengths = palloc (sizeof (uint32_t) * ngeoms);
279 
280  offset = 0;
281  for (i = 0; i < ngeoms; i++) {
282  pa = lwmline->geoms[i]->points;
283  coords = encode_coords(ctx, pa, coords, pa->npoints, offset);
284  offset += pa->npoints * ctx->dimensions;
285  lengths[i] = pa->npoints;
286  }
287 
288  if (ngeoms > 1) {
289  geometry->n_lengths = ngeoms;
290  geometry->lengths = lengths;
291  }
292 
293  geometry->n_coords = offset;
294  geometry->coords = coords;
295 
296  return geometry;
297 }
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:168
POINTARRAY * points
Definition: liblwgeom.h:425
LWLINE ** geoms
Definition: liblwgeom.h:486
uint32_t ngeoms
Definition: liblwgeom.h:484
uint32_t npoints
Definition: liblwgeom.h:374
uint32_t dimensions
Definition: geobuf.h:61
unsigned int uint32_t
Definition: uthash.h:78

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: