mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Remove unnecessary sort (and make indent)
This commit is contained in:
+1
-1
@@ -294,7 +294,7 @@ void decode(char *fname, int z, unsigned x, unsigned y, std::set<std::string> co
|
|||||||
exit(EXIT_CLOSE);
|
exit(EXIT_CLOSE);
|
||||||
}
|
}
|
||||||
db = pmtilesmeta2tmp(fname, pmtiles_map);
|
db = pmtilesmeta2tmp(fname, pmtiles_map);
|
||||||
entries = pmtiles_entries_zxy(pmtiles_map, minzoom, maxzoom);
|
entries = pmtiles_entries_tms(pmtiles_map, minzoom, maxzoom);
|
||||||
is_pmtiles = true;
|
is_pmtiles = true;
|
||||||
} else {
|
} else {
|
||||||
if (sqlite3_open(fname, &db) != SQLITE_OK) {
|
if (sqlite3_open(fname, &db) != SQLITE_OK) {
|
||||||
|
|||||||
+1
-2
@@ -309,8 +309,7 @@ void dir_write_metadata(const char *outdir, const metadata &m) {
|
|||||||
out(state, "minzoom", std::to_string(m.minzoom));
|
out(state, "minzoom", std::to_string(m.minzoom));
|
||||||
out(state, "maxzoom", std::to_string(m.maxzoom));
|
out(state, "maxzoom", std::to_string(m.maxzoom));
|
||||||
out(state, "center", std::to_string(m.center_lon) + "," + std::to_string(m.center_lat) + "," + std::to_string(m.center_z));
|
out(state, "center", std::to_string(m.center_lon) + "," + std::to_string(m.center_lat) + "," + std::to_string(m.center_z));
|
||||||
out(state, "bounds", std::to_string(m.minlon) + "," + std::to_string(m.minlat) + "," +
|
out(state, "bounds", std::to_string(m.minlon) + "," + std::to_string(m.minlat) + "," + std::to_string(m.maxlon) + "," + std::to_string(m.maxlat));
|
||||||
std::to_string(m.maxlon) + "," + std::to_string(m.maxlat));
|
|
||||||
out(state, "type", m.type);
|
out(state, "type", m.type);
|
||||||
if (m.attribution.size() > 0) {
|
if (m.attribution.size() > 0) {
|
||||||
out(state, "attribution", m.attribution);
|
out(state, "attribution", m.attribution);
|
||||||
|
|||||||
+1
-1
@@ -1622,7 +1622,7 @@ drawvec checkerboard_anchors(drawvec const &geom, int tx, int ty, int z, unsigne
|
|||||||
// upper left of tile in world coordinates
|
// upper left of tile in world coordinates
|
||||||
long long tx1 = 0, ty1 = 0;
|
long long tx1 = 0, ty1 = 0;
|
||||||
// lower right of tile in world coordinates;
|
// lower right of tile in world coordinates;
|
||||||
long long tx2 = 1LL << 32; // , ty2 = 1LL << 32;
|
long long tx2 = 1LL << 32; // , ty2 = 1LL << 32;
|
||||||
if (z != 0) {
|
if (z != 0) {
|
||||||
tx1 = (long long) tx << (32 - z);
|
tx1 = (long long) tx << (32 - z);
|
||||||
ty1 = (long long) ty << (32 - z);
|
ty1 = (long long) ty << (32 - z);
|
||||||
|
|||||||
+2
-2
@@ -56,12 +56,12 @@ struct metadata {
|
|||||||
double center_lon, center_lat;
|
double center_lon, center_lat;
|
||||||
int center_z;
|
int center_z;
|
||||||
|
|
||||||
std::string attribution; // not written if empty
|
std::string attribution; // not written if empty
|
||||||
|
|
||||||
std::string generator;
|
std::string generator;
|
||||||
std::string generator_options;
|
std::string generator_options;
|
||||||
|
|
||||||
std::string strategies_json; // not written if empty
|
std::string strategies_json; // not written if empty
|
||||||
|
|
||||||
std::string vector_layers_json;
|
std::string vector_layers_json;
|
||||||
std::string tilestats_json;
|
std::string tilestats_json;
|
||||||
|
|||||||
@@ -67,34 +67,6 @@ std::vector<pmtiles::entry_zxy> pmtiles_entries_tms(const char *pmtiles_map, int
|
|||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct zxycmp {
|
|
||||||
bool operator()(const pmtiles::entry_zxy &a, const pmtiles::entry_zxy &b) {
|
|
||||||
if (a.z < b.z) {
|
|
||||||
return true;
|
|
||||||
} else if (a.z == b.z) {
|
|
||||||
if (a.x < b.x) {
|
|
||||||
return true;
|
|
||||||
} else if (a.x == b.x) {
|
|
||||||
// reversed because the mbtiles SELECT
|
|
||||||
// orders by tile_row, which is TMS
|
|
||||||
if (a.y > b.y) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} zxycmp;
|
|
||||||
|
|
||||||
std::vector<pmtiles::entry_zxy> pmtiles_entries_zxy(const char *pmtiles_map, int minzoom, int maxzoom) {
|
|
||||||
std::vector<pmtiles::entry_zxy> filtered;
|
|
||||||
auto all_entries = pmtiles::entries_tms(&decompress_fn, pmtiles_map);
|
|
||||||
std::copy_if(all_entries.begin(), all_entries.end(), std::back_inserter(filtered), [minzoom, maxzoom](pmtiles::entry_zxy e) { return e.z >= minzoom && e.z <= maxzoom; });
|
|
||||||
std::sort(filtered.begin(), filtered.end(), zxycmp);
|
|
||||||
return filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y) {
|
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y) {
|
||||||
return pmtiles::get_tile(&decompress_fn, pmtiles_map, z, x, y);
|
return pmtiles::get_tile(&decompress_fn, pmtiles_map, z, x, y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ void check_pmtiles(const char *filename, char **argv);
|
|||||||
void mbtiles_map_image_to_pmtiles(char *dbname, metadata m, bool tile_compression, bool quiet, bool quiet_progress);
|
void mbtiles_map_image_to_pmtiles(char *dbname, metadata m, bool tile_compression, bool quiet, bool quiet_progress);
|
||||||
|
|
||||||
std::vector<pmtiles::entry_zxy> pmtiles_entries_tms(const char *pmtiles_map, int minzoom, int maxzoom);
|
std::vector<pmtiles::entry_zxy> pmtiles_entries_tms(const char *pmtiles_map, int minzoom, int maxzoom);
|
||||||
std::vector<pmtiles::entry_zxy> pmtiles_entries_zxy(const char *pmtiles_map, int minzoom, int maxzoom);
|
|
||||||
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y);
|
std::pair<uint64_t, uint32_t> pmtiles_get_tile(const char *pmtiles_map, int z, int x, int y);
|
||||||
sqlite3 *pmtilesmeta2tmp(const char *fname, const char *pmtiles_map);
|
sqlite3 *pmtilesmeta2tmp(const char *fname, const char *pmtiles_map);
|
||||||
|
|
||||||
|
|||||||
@@ -1998,7 +1998,7 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
|||||||
prefilter_jp = json_begin_file(prefilter_read_fp);
|
prefilter_jp = json_begin_file(prefilter_read_fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t seq = 0; ; seq++) {
|
for (size_t seq = 0;; seq++) {
|
||||||
serial_feature sf;
|
serial_feature sf;
|
||||||
ssize_t which_partial = -1;
|
ssize_t which_partial = -1;
|
||||||
|
|
||||||
@@ -3040,7 +3040,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
|||||||
size_t zoom_tile_size = 0;
|
size_t zoom_tile_size = 0;
|
||||||
size_t zoom_feature_count = 0;
|
size_t zoom_feature_count = 0;
|
||||||
|
|
||||||
for (size_t pass = 0; ; pass++) {
|
for (size_t pass = 0;; pass++) {
|
||||||
pthread_t pthreads[threads];
|
pthread_t pthreads[threads];
|
||||||
std::vector<write_tile_args> args;
|
std::vector<write_tile_args> args;
|
||||||
args.resize(threads);
|
args.resize(threads);
|
||||||
|
|||||||
Reference in New Issue
Block a user