From 14be3d2505a55e7614a04894a31d89db96c37b2c Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Wed, 21 Aug 2024 15:55:59 -0700 Subject: [PATCH] Starting to spell out the bin matching loop --- clip.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/clip.cpp b/clip.cpp index 28c8869b..91d28347 100644 --- a/clip.cpp +++ b/clip.cpp @@ -1149,6 +1149,52 @@ static struct preservecmp { } } preservecmp; +struct index_event { + unsigned long long where; + enum { + ENTER = 0, // new bin in is now active + CHECK, // point needs to be checked against active bins + EXIT // bin has ceased to be active + } kind; + size_t what; + + bool operator<(const index_event &ie) const { + if (where < ie.where) { + return true; + } else if (where == ie.where) { + if (kind < ie.kind) { + return true; + } else { + if (what < ie.what) { + return true; + } + } + } + + return false; + } +}; + +mvt_tile assign_to_bins(mvt_tile const &features, std::vector const &bins, int z, int x, int y) { + // Flatten bins, in the unlikely event that there are multiple layers of them + std::vector bin_features; + for (auto const &layer : bins) { + for (auto const &feature : layer.features) { + bin_features.push_back(feature); + } + } + + std::vector events; + + for (size_t i = 0; i < bin_features.size(); i++) { + index_event ie; + } + + // Add + + return features; +} + std::string overzoom(std::vector const &tiles, int nz, int nx, int ny, int detail, int buffer, std::set const &keep, bool do_compress, std::vector> *next_overzoomed_tiles, @@ -1380,6 +1426,10 @@ std::string overzoom(std::vector const &tiles, int nz, int nx, int } } + if (bins.size() > 0) { + outtile = assign_to_bins(outtile, bins, nz, nx, ny); + } + for (ssize_t i = outtile.layers.size() - 1; i >= 0; i--) { if (outtile.layers[i].features.size() == 0) { outtile.layers.erase(outtile.layers.begin() + i);