PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ encode_mpoint()

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

Definition at line 215 of file geobuf.c.

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().

217 {
218  int i, ngeoms;
219  POINTARRAY *pa;
220  Data__Geometry *geometry;
221 
222  geometry = galloc(DATA__GEOMETRY__TYPE__MULTIPOINT);
223 
224  ngeoms = lwmpoint->ngeoms;
225 
226  if (ngeoms == 0)
227  return geometry;
228 
229  pa = ptarray_construct_empty(0, 0, ngeoms);
230 
231  for (i = 0; i < ngeoms; i++) {
232  POINT4D pt;
233  getPoint4d_p(lwmpoint->geoms[i]->point, 0, &pt);
234  ptarray_append_point(pa, &pt, 0);
235  }
236 
237  geometry->n_coords = ngeoms * ctx->dimensions;
238  geometry->coords = encode_coords(ctx, pa, NULL, ngeoms, 0);
239 
240  return geometry;
241 }
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:36
POINTARRAY * point
Definition: liblwgeom.h:411
uint32_t dimensions
Definition: geobuf.h:61
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, then a duplicate point will not be added.
Definition: ptarray.c:156
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)
Definition: geobuf.c:168
LWPOINT ** geoms
Definition: liblwgeom.h:470
int ngeoms
Definition: liblwgeom.h:468
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:122
Here is the call graph for this function:
Here is the caller graph for this function: