Provision for different mvt_values to share a string pool

This commit is contained in:
Erica Fischer
2024-01-25 14:19:02 -08:00
parent 697b9d6e11
commit 7409d17f13
6 changed files with 58 additions and 31 deletions
+8 -8
View File
@@ -217,7 +217,7 @@ void decode_meta(std::vector<long long> const &metakeys, std::vector<long long>
mvt_value key = retrieve_string(metakeys[i], stringpool, NULL);
mvt_value value = retrieve_string(metavals[i], stringpool, &otype);
layer.tag(feature, *(key.string_value), value);
layer.tag(feature, key.get_string_value(), value);
}
}
@@ -227,9 +227,9 @@ static int metacmp(const std::vector<long long> &keys1, const std::vector<long l
mvt_value key1 = retrieve_string(keys1[i], stringpool1, NULL);
mvt_value key2 = retrieve_string(keys2[i], stringpool2, NULL);
if (*(key1.string_value) < *(key2.string_value)) {
if (key1.get_string_view() < key2.get_string_view()) {
return -1;
} else if (*(key1.string_value) > *(key2.string_value)) {
} else if (key1.get_string_view() > key2.get_string_view()) {
return 1;
}
@@ -259,7 +259,7 @@ static int metacmp(const std::vector<long long> &keys1, const std::vector<long l
}
}
static mvt_value find_attribute_value(const struct coalesce *c1, std::string key) {
static mvt_value find_attribute_value(const struct coalesce *c1, std::string const &key) {
if (key == ORDER_BY_SIZE) {
mvt_value v;
v.type = mvt_double;
@@ -273,7 +273,7 @@ static mvt_value find_attribute_value(const struct coalesce *c1, std::string key
for (size_t i = 0; i < keys1.size(); i++) {
mvt_value key1 = retrieve_string(keys1[i], stringpool1, NULL);
if (key == *(key1.string_value)) {
if (key == key1.get_string_value()) {
return retrieve_string(values1[i], stringpool1, NULL);
}
}
@@ -1628,11 +1628,11 @@ serial_feature next_feature(decompressor *geoms, std::atomic<long long> *geompos
v.type = mvt_string;
if (sf.t == mvt_point) {
v.string_value = "Point";
v.set_string_value("Point");
} else if (sf.t == mvt_linestring) {
v.string_value = "LineString";
v.set_string_value("LineString");
} else if (sf.t == mvt_polygon) {
v.string_value = "Polygon";
v.set_string_value("Polygon");
}
attributes.insert(std::pair<std::string, mvt_value>("$type", v));