PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ encode_coords()

static int64_t* encode_coords ( struct geobuf_agg_context ctx,
POINTARRAY pa,
int64_t *  coords,
int  len,
int  offset 
)
static

Definition at line 162 of file geobuf.c.

164 {
165  int i, c;
166  POINT4D pt;
167  int64_t sum[] = { 0, 0, 0, 0 };
168 
169  if (offset == 0)
170  coords = palloc(sizeof (int64_t) * len * ctx->dimensions);
171  else
172  coords = repalloc(coords, sizeof (int64_t) *
173  ((len * ctx->dimensions) + offset));
174 
175  c = offset;
176  for (i = 0; i < len; i++) {
177  getPoint4d_p(pa, i, &pt);
178  sum[0] += coords[c++] = (int64_t) (ceil(pt.x * ctx->e) - sum[0]);
179  sum[1] += coords[c++] = (int64_t) (ceil(pt.y * ctx->e) - sum[1]);
180  if (ctx->dimensions == 3)
181  sum[2] += coords[c++] = (int64_t) (ceil(pt.z * ctx->e) - sum[2]);
182  else if (ctx->dimensions == 4)
183  sum[3] += coords[c++] = (int64_t) (ceil(pt.m * ctx->e) - sum[3]);
184  }
185  return coords;
186 }
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:125
double m
Definition: liblwgeom.h:400
double x
Definition: liblwgeom.h:400
double z
Definition: liblwgeom.h:400
double y
Definition: liblwgeom.h:400
uint32_t e
Definition: geobuf.h:57
uint32_t dimensions
Definition: geobuf.h:61

References geobuf_agg_context::dimensions, geobuf_agg_context::e, getPoint4d_p(), POINT4D::m, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by encode_line(), encode_mline(), encode_mpoint(), encode_mpoly(), encode_point(), encode_poly(), and encode_triangle().

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