From 881402112e50e390811939e272a7dfc6a8bc714d Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 14 Aug 2018 16:47:53 -0700 Subject: [PATCH] Move in the direction of supporting lists and hashes again --- mvt.cpp | 13 ++++++++++++- mvt.hpp | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mvt.cpp b/mvt.cpp index 8967f8c..1186298 100644 --- a/mvt.cpp +++ b/mvt.cpp @@ -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::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::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); } diff --git a/mvt.hpp b/mvt.hpp index efb2a68..fba4435 100644 --- a/mvt.hpp +++ b/mvt.hpp @@ -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 key_map{};