PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1028 of file mvt.c.

References mvt_agg_context::layer, mvt_ctx_to_tile(), and mvt_agg_context::tile.

Referenced by mvt_agg_finalfn(), and mvt_ctx_serialize().

1029 {
1030  /* Fill out the file slot, if it's not already filled. */
1031  /* We should only have a filled slow when all the work of building */
1032  /* out the data is complete, so after a serialize/deserialize cycle */
1033  /* or after a context combine */
1034  size_t len;
1035  bytea *ba;
1036 
1037  if (!ctx->tile)
1038  {
1039  ctx->tile = mvt_ctx_to_tile(ctx);
1040  }
1041 
1042  /* Zero features => empty bytea output */
1043  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1044  {
1045  bytea *ba = palloc(VARHDRSZ);
1046  SET_VARSIZE(ba, VARHDRSZ);
1047  return ba;
1048  }
1049 
1050  /* Serialize the Tile */
1051  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1052  ba = palloc(len);
1053  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1054  SET_VARSIZE(ba, len);
1055  return ba;
1056 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1013
VectorTile__Tile * tile
Definition: mvt.h:67
VectorTile__Tile__Layer * layer
Definition: mvt.h:66
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: