PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ encode_mline()

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

Definition at line 273 of file geobuf.c.

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