Move in the direction of supporting lists and hashes again

This commit is contained in:
Eric Fischer 2018-08-14 16:47:53 -07:00
parent f31024d97e
commit 881402112e
2 changed files with 14 additions and 1 deletions

13
mvt.cpp
View File

@ -693,7 +693,7 @@ void mvt_layer::tag(mvt_feature &feature, std::string key, mvt_value value) {
}
}
void mvt_layer::tag_v3(mvt_feature &feature, std::string key, mvt_value value) {
size_t mvt_layer::tag_v3_key(std::string key) {
std::map<std::string, size_t>::iterator ki = key_map.find(key);
size_t ko;
@ -705,6 +705,10 @@ void mvt_layer::tag_v3(mvt_feature &feature, std::string key, mvt_value value) {
ko = ki->second;
}
return ko;
}
size_t mvt_layer::tag_v3_value(mvt_value value) {
std::map<mvt_value, unsigned long>::iterator vi = property_map.find(value);
unsigned long vo;
@ -761,6 +765,13 @@ void mvt_layer::tag_v3(mvt_feature &feature, std::string key, mvt_value value) {
vo = vi->second;
}
return vo;
}
void mvt_layer::tag_v3(mvt_feature &feature, std::string key, mvt_value value) {
size_t ko = tag_v3_key(key);
size_t vo = tag_v3_value(value);
feature.properties.push_back(ko);
feature.properties.push_back(vo);
}

View File

@ -121,6 +121,8 @@ struct mvt_layer {
void tag_v3(mvt_feature &feature, std::string key, mvt_value value);
size_t tag_value(mvt_value const &value);
size_t tag_key(std::string const &key);
size_t tag_v3_key(std::string key);
size_t tag_v3_value(mvt_value value);
// For tracking the key-value constants already used in this layer
std::map<std::string, size_t> key_map{};