From 07ebc0f131a8500136da8baef559323623f8e414 Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Tue, 23 Jan 2024 09:19:37 -0800 Subject: [PATCH] Add comments --- clip.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/clip.cpp b/clip.cpp index aa4b7339..4a704be2 100644 --- a/clip.cpp +++ b/clip.cpp @@ -805,9 +805,10 @@ static void feature_out(std::vector const &features, mvt_layer &ou outfeature.seq = features[0].seq; if (attribute_accum.size() > 0) { - // accumulate whatever attributes are specified to be accumulated - // onto the feature that will survive into the output, from the - // features that will not + // convert the attributes of the output feature + // from mvt_value to serial_val so they can have + // attributes from the other features of the + // multiplier cluster accumulated onto them std::map attribute_accum_state; std::vector full_keys; @@ -818,6 +819,10 @@ static void feature_out(std::vector const &features, mvt_layer &ou full_values.push_back(mvt_value_to_serial_val(features[0].layer->values[features[0].tags[i + 1]])); } + // accumulate whatever attributes are specified to be accumulated + // onto the feature that will survive into the output, from the + // features that will not + for (size_t i = 1; i < features.size(); i++) { for (size_t j = 0; j + 1 < features[i].tags.size(); j += 2) { std::string key = features[i].layer->keys[features[i].tags[j]]; @@ -830,6 +835,9 @@ static void feature_out(std::vector const &features, mvt_layer &ou } } + // convert the final attributes back to mvt_value + // and tag them onto the output feature + for (size_t i = 0; i < full_keys.size(); i++) { if (keep.size() == 0 || keep.find(full_keys[i]) != keep.end()) { outlayer.tag(outfeature, full_keys[i], stringified_to_mvt_value(full_values[i].type, full_values[i].s.c_str()));