PostGIS  2.5.0dev-r@@SVN_REVISION@@
static Data__Geometry* encode_mline ( struct geobuf_agg_context ctx,
LWMLINE lwmline 
)
static

Definition at line 261 of file geobuf.c.

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

Referenced by encode_geometry().

263 {
264  int i, offset, ngeoms;
265  POINTARRAY *pa;
266  Data__Geometry *geometry;
267  uint32_t *lengths;
268  int64_t *coords = NULL;
269 
270  geometry = galloc(DATA__GEOMETRY__TYPE__MULTILINESTRING);
271 
272  ngeoms = lwmline->ngeoms;
273 
274  if (ngeoms == 0)
275  return geometry;
276 
277  lengths = palloc (sizeof (uint32_t) * ngeoms);
278 
279  offset = 0;
280  for (i = 0; i < ngeoms; i++) {
281  pa = lwmline->geoms[i]->points;
282  coords = encode_coords(ctx, pa, coords, pa->npoints, offset);
283  offset += pa->npoints * ctx->dimensions;
284  lengths[i] = pa->npoints;
285  }
286 
287  if (ngeoms > 1) {
288  geometry->n_lengths = ngeoms;
289  geometry->lengths = lengths;
290  }
291 
292  geometry->n_coords = offset;
293  geometry->coords = coords;
294 
295  return geometry;
296 }
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:36
uint32_t dimensions
Definition: geobuf.h:61
unsigned int uint32_t
Definition: uthash.h:78
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)
Definition: geobuf.c:167
uint32_t ngeoms
Definition: liblwgeom.h:480
LWLINE ** geoms
Definition: liblwgeom.h:482
POINTARRAY * points
Definition: liblwgeom.h:421
uint32_t npoints
Definition: liblwgeom.h:370

Here is the call graph for this function:

Here is the caller graph for this function: