mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Start tracking a list of the tiles at maxzoom
This commit is contained in:
+13
-9
@@ -379,14 +379,14 @@ double max(double a, double b) {
|
|||||||
struct reader {
|
struct reader {
|
||||||
long long zoom = 0;
|
long long zoom = 0;
|
||||||
long long x = 0;
|
long long x = 0;
|
||||||
long long sorty = 0;
|
|
||||||
long long y = 0;
|
long long y = 0;
|
||||||
int z_flag = 0;
|
int z_flag = 0;
|
||||||
int maxzoom_so_far = 0;
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
std::string data = "";
|
std::string data = "";
|
||||||
|
|
||||||
|
int maxzoom_so_far = -1;
|
||||||
|
std::set<std::pair<unsigned, unsigned>> tiles_at_maxzoom_so_far;
|
||||||
|
|
||||||
std::vector<zxy> dirtiles;
|
std::vector<zxy> dirtiles;
|
||||||
std::string dirbase;
|
std::string dirbase;
|
||||||
std::string name;
|
std::string name;
|
||||||
@@ -407,8 +407,8 @@ struct reader {
|
|||||||
if (sqlite3_step(stmt) == SQLITE_ROW) {
|
if (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||||
zoom = sqlite3_column_int(stmt, 0);
|
zoom = sqlite3_column_int(stmt, 0);
|
||||||
x = sqlite3_column_int(stmt, 1);
|
x = sqlite3_column_int(stmt, 1);
|
||||||
sorty = sqlite3_column_int(stmt, 2);
|
int tms_y = sqlite3_column_int(stmt, 2);
|
||||||
y = (1LL << zoom) - 1 - sorty;
|
y = (1LL << zoom) - 1 - tms_y;
|
||||||
const char *s = (const char *) sqlite3_column_blob(stmt, 3);
|
const char *s = (const char *) sqlite3_column_blob(stmt, 3);
|
||||||
size_t len = sqlite3_column_bytes(stmt, 3);
|
size_t len = sqlite3_column_bytes(stmt, 3);
|
||||||
|
|
||||||
@@ -425,7 +425,6 @@ struct reader {
|
|||||||
zoom = pmtiles_entries.back().z;
|
zoom = pmtiles_entries.back().z;
|
||||||
x = pmtiles_entries.back().x;
|
x = pmtiles_entries.back().x;
|
||||||
y = pmtiles_entries.back().y;
|
y = pmtiles_entries.back().y;
|
||||||
sorty = (1LL << zoom) - 1 - y;
|
|
||||||
data = std::string(pmtiles_map + pmtiles_entries.back().offset, pmtiles_entries.back().length);
|
data = std::string(pmtiles_map + pmtiles_entries.back().offset, pmtiles_entries.back().length);
|
||||||
|
|
||||||
pmtiles_entries.pop_back();
|
pmtiles_entries.pop_back();
|
||||||
@@ -438,7 +437,6 @@ struct reader {
|
|||||||
zoom = dirtiles[0].z;
|
zoom = dirtiles[0].z;
|
||||||
x = dirtiles[0].x;
|
x = dirtiles[0].x;
|
||||||
y = dirtiles[0].y;
|
y = dirtiles[0].y;
|
||||||
sorty = (1LL << zoom) - 1 - y;
|
|
||||||
data = dir_read_tile(dirbase, dirtiles[0]);
|
data = dir_read_tile(dirbase, dirtiles[0]);
|
||||||
|
|
||||||
dirtiles.erase(dirtiles.begin());
|
dirtiles.erase(dirtiles.begin());
|
||||||
@@ -447,7 +445,10 @@ struct reader {
|
|||||||
|
|
||||||
if (!done && zoom > maxzoom_so_far) {
|
if (!done && zoom > maxzoom_so_far) {
|
||||||
maxzoom_so_far = zoom;
|
maxzoom_so_far = zoom;
|
||||||
|
tiles_at_maxzoom_so_far.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tiles_at_maxzoom_so_far.insert(std::pair<unsigned, unsigned>(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_tile(zxy tile) {
|
std::string get_tile(zxy tile) {
|
||||||
@@ -502,10 +503,13 @@ struct reader {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sorty < r.sorty) {
|
int sorty = (1LL << zoom) - 1 - y;
|
||||||
|
int r_sorty = (1LL << r.zoom) - 1 - r.y;
|
||||||
|
|
||||||
|
if (sorty < r_sorty) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (sorty > r.sorty) {
|
if (sorty > r_sorty) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user