[postgis-tickets] r16090 - Strip out MVT changes accidentally included

Paul Ramsey pramsey at cleverelephant.ca
Fri Nov 3 07:57:27 PDT 2017


Author: pramsey
Date: 2017-11-03 07:57:27 -0700 (Fri, 03 Nov 2017)
New Revision: 16090

Modified:
   trunk/postgis/mvt.c
   trunk/postgis/mvt.h
Log:
Strip out MVT changes accidentally included


Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c	2017-11-03 14:31:46 UTC (rev 16089)
+++ trunk/postgis/mvt.c	2017-11-03 14:57:27 UTC (rev 16090)
@@ -845,68 +845,45 @@
 	parse_values(ctx);
 }
 
-static bytea *mvt_ctx_to_bytea(struct mvt_agg_context *ctx)
+/**
+ * Finalize aggregation.
+ *
+ * Encode keys and values and put the aggregated Layer message into
+ * a Tile message and returns it packed as a bytea.
+ */
+uint8_t *mvt_agg_finalfn(struct mvt_agg_context *ctx)
 {
-	/* Fill out the file slot, if it's not already filled. */
-	/* We should only have a filled slow when all the work of building */
-	/* out the data is complete, so after a serialize/deserialize cycle */
-	/* or after a context combine */
-	if (!ctx->tile)
-	{
-		VectorTile__Tile__Layer **layers = ;
-		VectorTile__Tile tile = VECTOR_TILE__TILE__INIT;
+	VectorTile__Tile__Layer *layers[1];
+	VectorTile__Tile tile = VECTOR_TILE__TILE__INIT;
+	size_t len;
+	uint8_t *buf;
 
-		POSTGIS_DEBUG(2, "mvt_agg_finalfn called");
-		POSTGIS_DEBUGF(2, "mvt_agg_finalfn n_features == %zd", ctx->layer->n_features);
+	POSTGIS_DEBUG(2, "mvt_agg_finalfn called");
+	POSTGIS_DEBUGF(2, "mvt_agg_finalfn n_features == %zd", ctx->layer->n_features);
 
-		/* Zero features => empty bytea output */
-		if (ctx->layer->n_features == 0)
-		{
-			buf = palloc(VARHDRSZ);
-			SET_VARSIZE(buf, VARHDRSZ);
-			return buf;
-		}
-
-		encode_keys(ctx);
-		encode_values(ctx);
-
-		int n_layers = 1;
-		ctx->tile = palloc(sizeof(VectorTile__Tile));
-		vector_tile__tile__init(ctx->tile);
-		ctx->tile->layers = palloc(sizeof(VectorTile__Tile__Layer*) * n_layers);
-		ctx->tile->layers[0] = ctx->layer;
-		ctx->tile->n_layers = n_layers;
+	/* Zero features => empty bytea output */
+	if (ctx->layer->n_features == 0)
+	{
+		buf = palloc(VARHDRSZ);
+		SET_VARSIZE(buf, VARHDRSZ);
+		return buf;
 	}
 
-	/* Serialize the Tile */
-	size_t len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
-	bytea *ba = palloc(len);
-	vector_tile__tile__pack(ctx->tile, VARDATA(ba));
-	SET_VARSIZE(ba, len);
-	return ba;
-}
+	encode_keys(ctx);
+	encode_values(ctx);
 
+	layers[0] = ctx->layer;
 
-bytea *mvt_ctx_serialize(struct mvt_agg_context *ctx)
-{
-	return mvt_ctx_to_bytea(ctx);
-}
+	tile.n_layers = 1;
+	tile.layers = layers;
 
-mvt_agg_context * mvt_ctx_deserialize(const bytea *ba)
-{
+	len = vector_tile__tile__get_packed_size(&tile);
+	buf = palloc(sizeof(*buf) * (len + VARHDRSZ));
+	vector_tile__tile__pack(&tile, buf + VARHDRSZ);
 
-}
+	SET_VARSIZE(buf, VARHDRSZ + len);
 
-/**
- * Finalize aggregation.
- *
- * Encode keys and values and put the aggregated Layer message into
- * a Tile message and returns it packed as a bytea.
- */
-bytea *mvt_agg_finalfn(struct mvt_agg_context *ctx)
-{
-	return mvt_ctx_to_bytea(ctx);
+	return buf;
 }
 
-
 #endif

Modified: trunk/postgis/mvt.h
===================================================================
--- trunk/postgis/mvt.h	2017-11-03 14:31:46 UTC (rev 16089)
+++ trunk/postgis/mvt.h	2017-11-03 14:57:27 UTC (rev 16090)
@@ -54,7 +54,6 @@
 	HeapTupleHeader row;
 	VectorTile__Tile__Feature *feature;
 	VectorTile__Tile__Layer *layer;
-	VectorTile__Tile *tile;
 	size_t features_capacity;
 	struct mvt_kv_key *keys_hash;
 	struct mvt_kv_string_value *string_values_hash;



More information about the postgis-tickets mailing list