PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ encode_mpoint()

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

Definition at line 209 of file geobuf.c.

211 {
212  int i, ngeoms;
213  POINTARRAY *pa;
214  Data__Geometry *geometry;
215 
216  geometry = galloc(DATA__GEOMETRY__TYPE__MULTIPOINT);
217 
218  ngeoms = lwmpoint->ngeoms;
219 
220  if (ngeoms == 0)
221  return geometry;
222 
223  pa = ptarray_construct_empty(0, 0, ngeoms);
224 
225  for (i = 0; i < ngeoms; i++) {
226  POINT4D pt;
227  getPoint4d_p(lwmpoint->geoms[i]->point, 0, &pt);
228  ptarray_append_point(pa, &pt, 0);
229  }
230 
231  geometry->n_coords = ngeoms * ctx->dimensions;
232  geometry->coords = encode_coords(ctx, pa, NULL, ngeoms, 0);
233 
234  return geometry;
235 }
static Data__Geometry * galloc(Data__Geometry__Type type)
Definition: geobuf.c:37
static int64_t * encode_coords(struct geobuf_agg_context *ctx, POINTARRAY *pa, int64_t *coords, int len, int offset)
Definition: geobuf.c:162
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:524
LWPOINT ** geoms
Definition: liblwgeom.h:519
POINTARRAY * point
Definition: liblwgeom.h:457
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: