mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Factor out code for enumerating the tiles in a directory
This commit is contained in:
+36
-2
@@ -1,12 +1,46 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef DIRTILES_HPP
|
||||
#define DIRTILES_HPP
|
||||
|
||||
std::string dir_read_tile(std::string pbfPath);
|
||||
|
||||
void dir_write_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf);
|
||||
|
||||
void check_dir(const char *d, bool force, bool forcetable);
|
||||
|
||||
struct zxy {
|
||||
long long z;
|
||||
long long x;
|
||||
long long y;
|
||||
|
||||
zxy(int _z, int _x, int _y)
|
||||
: z(_z), x(_x), y(_y) {
|
||||
}
|
||||
|
||||
bool operator<(const zxy &other) const {
|
||||
if (z < other.z) {
|
||||
return true;
|
||||
}
|
||||
if (z == other.z) {
|
||||
if (x < other.x) {
|
||||
return true;
|
||||
}
|
||||
if (x == other.x) {
|
||||
if (y > other.y) {
|
||||
return true; // reversed for TMS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string path() {
|
||||
return std::to_string(z) + "/" + std::to_string(x) + "/" + std::to_string(y) + ".pbf";
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<zxy> enumerate_dirtiles(const char *fname);
|
||||
std::string dir_read_tile(std::string pbfPath, struct zxy tile);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user