PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1095 of file mvt.c.

1096 {
1097  /* Fill out the tile slot, if it's not already filled. */
1098  /* We should only have a filled slot when all the work of building */
1099  /* out the data is complete, so after a serialize/deserialize cycle */
1100  /* or after a context combine */
1101  size_t len;
1102  bytea *ba;
1103 
1104  if (!ctx->tile)
1105  {
1106  ctx->tile = mvt_ctx_to_tile(ctx);
1107  }
1108 
1109  /* Zero features => empty bytea output */
1110  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1111  {
1112  bytea* ba_empty = palloc(VARHDRSZ);
1113  SET_VARSIZE(ba_empty, VARHDRSZ);
1114  return ba_empty;
1115  }
1116 
1117  /* Serialize the Tile */
1118  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1119  ba = palloc(len);
1120  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1121  SET_VARSIZE(ba, len);
1122  return ba;
1123 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1080
VectorTile__Tile__Layer * layer
Definition: mvt.h:76
VectorTile__Tile * tile
Definition: mvt.h:80

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

Referenced by mvt_agg_finalfn(), and mvt_ctx_serialize().

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