From 2982b1bbe8b12c929f02df9e8723e2b5e10c068f Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Tue, 13 Feb 2024 14:49:38 -0800 Subject: [PATCH] Improve comments --- tile.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tile.cpp b/tile.cpp index b8675990..f093d74c 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1460,9 +1460,10 @@ return; } } +// This is the structure that the features from each layer are accumulated into struct layer_features { - std::vector features; - size_t multiplier_cluster_size = 0; + std::vector features; // The features of this layer, so far + size_t multiplier_cluster_size = 0; // The feature count of the current multiplier cluster }; long long write_tile(decompressor *geoms, std::atomic *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, int minzoom, int maxzoom, double todo, std::atomic *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic *running, double simplification, std::vector> *layermaps, std::vector> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy, bool compressed_input, node *shared_nodes_map, size_t nodepos) { @@ -1680,6 +1681,9 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch // that were dropped because the previous lead feature was dropped drop_rest = false; } else if (sf.dropped != FEATURE_DROPPED) { + // Does the current multiplier cluster already have too many features? + // If so, we have to drop this one, even if it would potentially qualify + // as a secondary feature to be exposed by filtering if (layer.multiplier_cluster_size >= (size_t) retain_points_multiplier) { sf.dropped = FEATURE_DROPPED; } @@ -1876,9 +1880,11 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch kept++; if (features.size() == 0) { - // first feature of the the tile is always kept. + // the first feature of the the tile is always kept. // it may not have been marked kept in next_feature - // if its geometry was clipped down to nothing + // if the previous feature was nominally the first + // but has already been lost because its geometry was + // clipped away sf.dropped = FEATURE_KEPT; }