From e51fafd4ebab154472e8d00a8b16a374728f0863 Mon Sep 17 00:00:00 2001 From: Juha Alanen Date: Tue, 3 Sep 2019 16:11:27 +0300 Subject: [core] Add new types for feature states --- include/mbgl/util/feature.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/mbgl/util') diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp index 9e2286018c..56db250de0 100644 --- a/include/mbgl/util/feature.hpp +++ b/include/mbgl/util/feature.hpp @@ -11,6 +11,9 @@ using NullValue = mapbox::feature::null_value_t; using PropertyMap = mapbox::feature::property_map; using FeatureIdentifier = mapbox::feature::identifier; using Feature = mapbox::feature::feature; +using FeatureState = PropertyMap; +using FeatureStates = std::unordered_map; // +using LayerFeatureStates = std::unordered_map; // template optional numericValue(const Value& value) { -- cgit v1.2.1 From 413278ca20de77f7025b5304493dca6d1863fbb3 Mon Sep 17 00:00:00 2001 From: Juha Alanen Date: Wed, 21 Aug 2019 16:03:36 +0300 Subject: [core] Add feature state support to bucket classes --- include/mbgl/util/feature.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/mbgl/util') diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp index 56db250de0..d2a23cc5b0 100644 --- a/include/mbgl/util/feature.hpp +++ b/include/mbgl/util/feature.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -32,4 +33,27 @@ optional numericValue(const Value& value) { }); } +inline optional featureIDtoString(const FeatureIdentifier& id) { + if (id.is()) { + return nullopt; + } + + return id.match( + [] (const std::string& value_) { + return value_; + }, + [] (uint64_t value_) { + return util::toString(value_); + }, + [] (int64_t value_) { + return util::toString(value_); + }, + [] (double value_) { + return util::toString(value_); + }, + [] (const auto&) -> optional { + return nullopt; + }); +} + } // namespace mbgl -- cgit v1.2.1 From 6b13c42314f28e3b27111367c4f3296c3c3c1248 Mon Sep 17 00:00:00 2001 From: Juha Alanen Date: Tue, 17 Sep 2019 15:40:01 +0300 Subject: [build] Fix clang format and tidy checks --- include/mbgl/util/feature.hpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'include/mbgl/util') diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp index d2a23cc5b0..390cc65720 100644 --- a/include/mbgl/util/feature.hpp +++ b/include/mbgl/util/feature.hpp @@ -13,7 +13,7 @@ using PropertyMap = mapbox::feature::property_map; using FeatureIdentifier = mapbox::feature::identifier; using Feature = mapbox::feature::feature; using FeatureState = PropertyMap; -using FeatureStates = std::unordered_map; // +using FeatureStates = std::unordered_map; // using LayerFeatureStates = std::unordered_map; // template @@ -39,21 +39,9 @@ inline optional featureIDtoString(const FeatureIdentifier& id) { } return id.match( - [] (const std::string& value_) { - return value_; - }, - [] (uint64_t value_) { - return util::toString(value_); - }, - [] (int64_t value_) { - return util::toString(value_); - }, - [] (double value_) { - return util::toString(value_); - }, - [] (const auto&) -> optional { - return nullopt; - }); + [](const std::string& value_) { return value_; }, [](uint64_t value_) { return util::toString(value_); }, + [](int64_t value_) { return util::toString(value_); }, [](double value_) { return util::toString(value_); }, + [](const auto&) -> optional { return nullopt; }); } } // namespace mbgl -- cgit v1.2.1