diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-06-29 12:52:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-13 11:53:27 -0700 |
commit | 8696db551b82601971676ab892afc2a479342f77 (patch) | |
tree | 3d856db5fc934256962a75808ec1a821c457aa02 /src/mbgl/style/function/identity_stops.cpp | |
parent | 1031e7c8bf936f05dd86e4570d4e86db5582ef16 (diff) | |
download | qtlocation-mapboxgl-upstream/function-conversion.tar.gz |
[core] Convert legacy functions directly to expressionsupstream/function-conversion
Diffstat (limited to 'src/mbgl/style/function/identity_stops.cpp')
-rw-r--r-- | src/mbgl/style/function/identity_stops.cpp | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/mbgl/style/function/identity_stops.cpp b/src/mbgl/style/function/identity_stops.cpp deleted file mode 100644 index 0ac6fda846..0000000000 --- a/src/mbgl/style/function/identity_stops.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include <mbgl/style/function/identity_stops.hpp> -#include <mbgl/style/types.hpp> -#include <mbgl/util/enum.hpp> -#include <mbgl/util/color.hpp> - -#include <array> - -namespace mbgl { -namespace style { - -template <> -optional<float> IdentityStops<float>::evaluate(const Value& value) const { - return numericValue<float>(value); -} - -template <> -optional<std::string> IdentityStops<std::string>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return value.get<std::string>(); -} - -template <> -optional<Color> IdentityStops<Color>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return Color::parse(value.get<std::string>()); -} - -template <> -optional<TextTransformType> IdentityStops<TextTransformType>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return Enum<TextTransformType>::toEnum(value.get<std::string>()); -} - -template <> -optional<TextJustifyType> IdentityStops<TextJustifyType>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return Enum<TextJustifyType>::toEnum(value.get<std::string>()); -} - -template <> -optional<SymbolAnchorType> IdentityStops<SymbolAnchorType>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return Enum<SymbolAnchorType>::toEnum(value.get<std::string>()); -} - -template <> -optional<LineJoinType> IdentityStops<LineJoinType>::evaluate(const Value& value) const { - if (!value.is<std::string>()) { - return {}; - } - - return Enum<LineJoinType>::toEnum(value.get<std::string>()); -} - -template <> -optional<std::array<float, 2>> IdentityStops<std::array<float, 2>>::evaluate(const Value& value) const { - if (!value.is<std::vector<Value>>()) { - return {}; - } - - const auto& vector = value.get<std::vector<Value>>(); - if (vector.size() != 2 || !numericValue<float>(vector[0]) || !numericValue<float>(vector[1])) { - return {}; - } - - std::array<float, 2> array {{ - *numericValue<float>(vector[0]), - *numericValue<float>(vector[1]) - }}; - return array; -} - -} // namespace style -} // namespace mbgl |