Skip to content

Commit

Permalink
Starting to spell out the bin matching loop
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Aug 21, 2024
1 parent 7917d8b commit 14be3d2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<mvt_layer> const &bins, int z, int x, int y) {
// Flatten bins, in the unlikely event that there are multiple layers of them
std::vector<mvt_feature> bin_features;
for (auto const &layer : bins) {
for (auto const &feature : layer.features) {
bin_features.push_back(feature);
}
}

std::vector<index_event> events;

for (size_t i = 0; i < bin_features.size(); i++) {
index_event ie;
}

// Add

return features;
}

std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int ny,
int detail, int buffer, std::set<std::string> const &keep, bool do_compress,
std::vector<std::pair<unsigned, unsigned>> *next_overzoomed_tiles,
Expand Down Expand Up @@ -1380,6 +1426,10 @@ std::string overzoom(std::vector<source_tile> 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);
Expand Down

0 comments on commit 14be3d2

Please sign in to comment.