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

◆ 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 161 of file geobuf.c.

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