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:
Erica Fischer
2024-01-23 14:17:19 -08:00
committed by GitHub
parent 679a0d62f2
commit f957f30f90
8 changed files with 110 additions and 123 deletions
+25 -25
View File
@@ -241,24 +241,24 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
}
}
auto fk = layermap.find(layername);
if (fk == layermap.end()) {
auto ts = layermap.find(layername);
if (ts == layermap.end()) {
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
exit(EXIT_IMPOSSIBLE);
}
if (z < fk->second.minzoom) {
fk->second.minzoom = z;
if (z < ts->second.minzoom) {
ts->second.minzoom = z;
}
if (z > fk->second.maxzoom) {
fk->second.maxzoom = z;
if (z > ts->second.maxzoom) {
ts->second.maxzoom = z;
}
if (feature.type == mvt_point) {
fk->second.points++;
ts->second.points++;
} else if (feature.type == mvt_linestring) {
fk->second.lines++;
ts->second.lines++;
} else if (feature.type == mvt_polygon) {
fk->second.polygons++;
ts->second.polygons++;
}
for (size_t i = 0; i < properties->value.object.length; i++) {
@@ -274,11 +274,11 @@ std::vector<mvt_layer> parse_layers(int fd, int z, unsigned x, unsigned y, std::
mvt_value v = stringified_to_mvt_value(tp, s.c_str());
l->second.tag(feature, std::string(properties->value.object.keys[i]->value.string.string), v);
type_and_string attrib;
serial_val attrib;
attrib.type = tp;
attrib.string = s;
attrib.s = s;
add_to_file_keys(fk->second.file_keys, std::string(properties->value.object.keys[i]->value.string.string), attrib);
add_to_tilestats(ts->second.tilestats, std::string(properties->value.object.keys[i]->value.string.string), attrib);
}
}
@@ -478,27 +478,27 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
}
}
auto fk = layermap.find(layername);
if (fk == layermap.end()) {
auto ts = layermap.find(layername);
if (ts == layermap.end()) {
fprintf(stderr, "Internal error: layer %s not found\n", layername.c_str());
exit(EXIT_IMPOSSIBLE);
}
sf.layer = fk->second.id;
sf.layer = ts->second.id;
if (z < fk->second.minzoom) {
fk->second.minzoom = z;
if (z < ts->second.minzoom) {
ts->second.minzoom = z;
}
if (z > fk->second.maxzoom) {
fk->second.maxzoom = z;
if (z > ts->second.maxzoom) {
ts->second.maxzoom = z;
}
if (!postfilter) {
if (sf.t == mvt_point) {
fk->second.points++;
ts->second.points++;
} else if (sf.t == mvt_linestring) {
fk->second.lines++;
ts->second.lines++;
} else if (sf.t == mvt_polygon) {
fk->second.polygons++;
ts->second.polygons++;
}
}
@@ -515,12 +515,12 @@ serial_feature parse_feature(json_pull *jp, int z, unsigned x, unsigned y, std::
sf.full_keys.push_back(std::string(properties->value.object.keys[i]->value.string.string));
sf.full_values.push_back(v);
type_and_string attrib;
attrib.string = v.s;
serial_val attrib;
attrib.s = v.s;
attrib.type = v.type;
if (!postfilter) {
add_to_file_keys(fk->second.file_keys, std::string(properties->value.object.keys[i]->value.string.string), attrib);
add_to_tilestats(ts->second.tilestats, std::string(properties->value.object.keys[i]->value.string.string), attrib);
}
}
}