PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ encode_mpoly()

static void encode_mpoly ( struct mvt_agg_context ctx,
LWMPOLY lwmpoly 
)
static

Definition at line 232 of file mvt.c.

References encode_ptarray(), mvt_agg_context::feature, LWMPOLY::geoms, MVT_RING, LWMPOLY::ngeoms, POINTARRAY::npoints, LWPOLY::nrings, and LWPOLY::rings.

Referenced by encode_geometry().

233 {
234  uint32_t i, j;
235  int32_t px = 0, py = 0;
236  size_t c = 0, offset = 0;
237  LWPOLY *poly;
238  VectorTile__Tile__Feature *feature = ctx->feature;
239  feature->type = VECTOR_TILE__TILE__GEOM_TYPE__POLYGON;
240  feature->has_type = 1;
241  for (i = 0; i < lwmpoly->ngeoms; i++)
242  for (j = 0; poly = lwmpoly->geoms[i], j < poly->nrings; j++)
243  c += 3 + ((poly->rings[j]->npoints - 1) * 2);
244  feature->geometry = palloc(sizeof(*feature->geometry) * c);
245  for (i = 0; i < lwmpoly->ngeoms; i++)
246  for (j = 0; poly = lwmpoly->geoms[i], j < poly->nrings; j++)
247  offset += encode_ptarray(ctx, MVT_RING,
248  poly->rings[j], feature->geometry + offset,
249  &px, &py);
250  feature->n_geometry = offset;
251 }
int npoints
Definition: liblwgeom.h:371
unsigned int uint32_t
Definition: uthash.h:78
Definition: mvt.c:51
LWPOLY ** geoms
Definition: liblwgeom.h:496
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
int ngeoms
Definition: liblwgeom.h:494
static uint32_t encode_ptarray(struct mvt_agg_context *ctx, enum mvt_type type, POINTARRAY *pa, uint32_t *buffer, int32_t *px, int32_t *py)
Definition: mvt.c:106
VectorTile__Tile__Feature * feature
Definition: mvt.h:55
Here is the call graph for this function:
Here is the caller graph for this function: