summaryrefslogtreecommitdiff
path: root/src/mbgl/style/conversion
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/conversion')
-rw-r--r--src/mbgl/style/conversion/constant.cpp18
-rw-r--r--src/mbgl/style/conversion/function.cpp4
-rw-r--r--src/mbgl/style/conversion/property_value.cpp1
3 files changed, 23 insertions, 0 deletions
diff --git a/src/mbgl/style/conversion/constant.cpp b/src/mbgl/style/conversion/constant.cpp
index 0fcaab433b..0ed5fad425 100644
--- a/src/mbgl/style/conversion/constant.cpp
+++ b/src/mbgl/style/conversion/constant.cpp
@@ -168,6 +168,24 @@ optional<std::vector<std::string>> Converter<std::vector<std::string>>::operator
return result;
}
+optional<RadialOffsetType> Converter<RadialOffsetType>::operator()(const Convertible& value, Error& error) const {
+ Converter<std::vector<float>> arrayConverter;
+ if (auto val = arrayConverter(value, error)) {
+ RadialOffsetType result = std::move(*val);
+ return result;
+ }
+
+ Converter<float> numberConverter;
+ if (auto val = numberConverter(value, error)) {
+ RadialOffsetType result(2, *val);
+ return result;
+ }
+
+ error.message = "value must be an array of numbers or a number";
+
+ return nullopt;
+}
+
} // namespace conversion
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/conversion/function.cpp b/src/mbgl/style/conversion/function.cpp
index 086bc4e277..ade5a5dc5e 100644
--- a/src/mbgl/style/conversion/function.cpp
+++ b/src/mbgl/style/conversion/function.cpp
@@ -153,6 +153,10 @@ template optional<PropertyExpression<TranslateAnchorType>>
template optional<PropertyExpression<Formatted>>
convertFunctionToExpression<Formatted>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<RadialOffsetType>>
+ convertFunctionToExpression<RadialOffsetType>(const Convertible&, Error&, bool);
+
+
// Ad-hoc Converters for double and int64_t. We should replace float with double wholesale,
// and promote the int64_t Converter to general use (and it should check that the input is
// an integer).
diff --git a/src/mbgl/style/conversion/property_value.cpp b/src/mbgl/style/conversion/property_value.cpp
index 6e1d747324..91e61ec5cb 100644
--- a/src/mbgl/style/conversion/property_value.cpp
+++ b/src/mbgl/style/conversion/property_value.cpp
@@ -80,6 +80,7 @@ template optional<PropertyValue<TextJustifyType>> Converter<PropertyValue<TextJu
template optional<PropertyValue<TextTransformType>> Converter<PropertyValue<TextTransformType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
template optional<PropertyValue<TranslateAnchorType>> Converter<PropertyValue<TranslateAnchorType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
template optional<PropertyValue<mbgl::style::expression::Formatted>> Converter<PropertyValue<mbgl::style::expression::Formatted>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<RadialOffsetType>> Converter<PropertyValue<RadialOffsetType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
} // namespace conversion
} // namespace style