Drop or retain whole multiplier clusters when dropping as needed (#198)

* Prep to track conditions other than just "dropped" or "kept"

* Count up instead of down

* Drop or retain whole multiplier clusters based on their first feature

* Calculate a global feature dropping sequence

* Switch over to using the drop sequence for drop-fraction

* Remove unused arguments for the old drop-fraction implementation

* Fix copy-and-paste bugs, update tests

* Properly incorporate feature_minzoom into the drop sequence, I hope

* Rename drop_by to drop_sequence

* See if sorting within clusters fixes filter stability between zooms

* Remove very chatty debug print

* Update changelog and version

* Use named constants instead of numbers for feature dropping/keeping

* Add comment to explain purpose and method of bit reversal
This commit is contained in:
Erica Fischer
2024-02-12 10:58:49 -08:00
committed by GitHub
parent e2a7a409c7
commit 4e52cbd957
20 changed files with 7402 additions and 9064 deletions
+4 -3
View File
@@ -15,6 +15,7 @@
#include "write_json.hpp"
#include "milo/dtoa_milo.h"
#include "errors.hpp"
#include "serial.hpp"
void json_writer::json_adjust() {
if (state.size() == 0) {
@@ -267,7 +268,7 @@ void write_coords(json_writer &state, lonlat const &ll, double scale) {
}
}
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale) {
void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y, bool comma, bool name, bool zoom, bool write_dropped, unsigned long long index, long long sequence, long long extent, bool complain, json_writer &state, double scale) {
for (size_t f = 0; f < layer.features.size(); f++) {
mvt_feature const &feat = layer.features[f];
@@ -297,9 +298,9 @@ void layer_to_geojson(mvt_layer const &layer, unsigned z, unsigned x, unsigned y
state.json_write_unsigned(z);
}
if (dropped) {
if (write_dropped) {
state.json_write_string("dropped");
state.json_write_bool(feat.dropped);
state.json_write_bool(feat.dropped == FEATURE_DROPPED);
}
if (index != 0) {