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

◆ encode_mpoint()

static Data__Geometry * encode_mpoint ( struct geobuf_agg_context ctx,
LWMPOINT lwmpoint 
)
static

Definition at line 208 of file geobuf.c.

210{
211 int i, ngeoms;
212 POINTARRAY *pa;
213 Data__Geometry *geometry;
214
215 geometry = galloc(DATA__GEOMETRY__TYPE__MULTIPOINT);
216
217 ngeoms = lwmpoint->ngeoms;
218
219 if (ngeoms == 0)
220 return geometry;
221
222 pa = ptarray_construct_empty(0, 0, ngeoms);
223
224 for (i = 0; i < ngeoms; i++) {
225 POINT4D pt;
226 getPoint4d_p(lwmpoint->geoms[i]->point, 0, &pt);
227 ptarray_append_point(pa, &pt, 0);
228 }
229
230 geometry->n_coords = (size_t)ngeoms * ctx->dimensions;
231 geometry->coords = encode_coords(ctx, pa, NULL, ngeoms, 0);
232
233 return geometry;
234}
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)
Definition geobuf.c:161
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition geobuf.c:36
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition lwgeom_api.c:125
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
Definition ptarray.c:147
uint32_t ngeoms
Definition liblwgeom.h:538
LWPOINT ** geoms
Definition liblwgeom.h:533
POINTARRAY * point
Definition liblwgeom.h:471
uint32_t dimensions
Definition geobuf.h:61

References geobuf_agg_context::dimensions, encode_coords(), galloc(), LWMPOINT::geoms, getPoint4d_p(), LWMPOINT::ngeoms, LWPOINT::point, ptarray_append_point(), and ptarray_construct_empty().

Referenced by encode_geometry().

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