mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Clean up internal naming related to tilestats (#190)
* Get rid of the type_and_string near-synonym for serial_val
* Rename file_keys to the more familiar tilestats
* "tas" (type_and_string) => "sv" (serial_val)
* "fk" (tile_keys) => "ts" (tilestats)
* Revert ""tas" (type_and_string) => "sv" (serial_val)"
This reverts commit 4854c57e22.
* More carefully this time: "tas" (type_and_string) => "sv" (serial_val)
This commit is contained in:
+22
-22
@@ -149,7 +149,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
}
|
||||
}
|
||||
|
||||
auto file_keys = layermap.find(layer.name);
|
||||
auto tilestats = layermap.find(layer.name);
|
||||
|
||||
for (size_t f = 0; f < layer.features.size(); f++) {
|
||||
mvt_feature feat = layer.features[f];
|
||||
@@ -167,7 +167,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
outfeature.id = feat.id;
|
||||
}
|
||||
|
||||
std::map<std::string, std::pair<mvt_value, type_and_string>> attributes;
|
||||
std::map<std::string, std::pair<mvt_value, serial_val>> attributes;
|
||||
std::vector<std::string> key_order;
|
||||
|
||||
for (size_t t = 0; t + 1 < feat.tags.size(); t += 2) {
|
||||
@@ -206,11 +206,11 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
}
|
||||
|
||||
if (include.count(std::string(key)) || (!exclude_all && exclude.count(std::string(key)) == 0 && exclude_attributes.count(std::string(key)) == 0)) {
|
||||
type_and_string tas;
|
||||
tas.type = type;
|
||||
tas.string = value;
|
||||
serial_val sv;
|
||||
sv.type = type;
|
||||
sv.s = value;
|
||||
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, type_and_string>>(key, std::pair<mvt_value, type_and_string>(val, tas)));
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(key, std::pair<mvt_value, serial_val>(val, sv)));
|
||||
key_order.push_back(key);
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
attributes.erase(fa);
|
||||
}
|
||||
|
||||
type_and_string tas;
|
||||
tas.type = outval.type;
|
||||
tas.string = joinval;
|
||||
serial_val sv;
|
||||
sv.type = outval.type;
|
||||
sv.s = joinval;
|
||||
|
||||
// Convert from double to int if the joined attribute is an integer
|
||||
outval = stringified_to_mvt_value(outval.type, joinval.c_str());
|
||||
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, type_and_string>>(joinkey, std::pair<mvt_value, type_and_string>(outval, tas)));
|
||||
attributes.insert(std::pair<std::string, std::pair<mvt_value, serial_val>>(joinkey, std::pair<mvt_value, serial_val>(outval, sv)));
|
||||
key_order.push_back(joinkey);
|
||||
}
|
||||
}
|
||||
@@ -269,11 +269,11 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
}
|
||||
|
||||
if (matched || !ifmatched) {
|
||||
if (file_keys == layermap.end()) {
|
||||
if (tilestats == layermap.end()) {
|
||||
layermap.insert(std::pair<std::string, layermap_entry>(layer.name, layermap_entry(layermap.size())));
|
||||
file_keys = layermap.find(layer.name);
|
||||
file_keys->second.minzoom = z;
|
||||
file_keys->second.maxzoom = z;
|
||||
tilestats = layermap.find(layer.name);
|
||||
tilestats->second.minzoom = z;
|
||||
tilestats->second.maxzoom = z;
|
||||
}
|
||||
|
||||
// To keep attributes in their original order instead of alphabetical
|
||||
@@ -282,7 +282,7 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
|
||||
if (fa != attributes.end()) {
|
||||
outlayer.tag(outfeature, k, fa->second.first);
|
||||
add_to_file_keys(file_keys->second.file_keys, k, fa->second.second);
|
||||
add_to_tilestats(tilestats->second.tilestats, k, fa->second.second);
|
||||
attributes.erase(fa);
|
||||
}
|
||||
}
|
||||
@@ -300,19 +300,19 @@ void append_tile(std::string message, int z, unsigned x, unsigned y, std::map<st
|
||||
features_added++;
|
||||
outlayer.features.push_back(outfeature);
|
||||
|
||||
if (z < file_keys->second.minzoom) {
|
||||
file_keys->second.minzoom = z;
|
||||
if (z < tilestats->second.minzoom) {
|
||||
tilestats->second.minzoom = z;
|
||||
}
|
||||
if (z > file_keys->second.maxzoom) {
|
||||
file_keys->second.maxzoom = z;
|
||||
if (z > tilestats->second.maxzoom) {
|
||||
tilestats->second.maxzoom = z;
|
||||
}
|
||||
|
||||
if (feat.type == mvt_point) {
|
||||
file_keys->second.points++;
|
||||
tilestats->second.points++;
|
||||
} else if (feat.type == mvt_linestring) {
|
||||
file_keys->second.lines++;
|
||||
tilestats->second.lines++;
|
||||
} else if (feat.type == mvt_polygon) {
|
||||
file_keys->second.polygons++;
|
||||
tilestats->second.polygons++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user