mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user