summaryrefslogtreecommitdiff
path: root/src/mbgl/style/function
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/function')
-rw-r--r--src/mbgl/style/function/categorical_stops.cpp41
-rw-r--r--src/mbgl/style/function/convert.cpp40
-rw-r--r--src/mbgl/style/function/identity_stops.cpp89
3 files changed, 0 insertions, 170 deletions
diff --git a/src/mbgl/style/function/categorical_stops.cpp b/src/mbgl/style/function/categorical_stops.cpp
deleted file mode 100644
index dd179f5376..0000000000
--- a/src/mbgl/style/function/categorical_stops.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <mbgl/style/function/categorical_stops.hpp>
-#include <mbgl/style/types.hpp>
-#include <mbgl/util/color.hpp>
-
-#include <array>
-
-namespace mbgl {
-namespace style {
-
-optional<CategoricalValue> categoricalValue(const Value& value) {
- return value.match(
- [] (bool t) { return optional<CategoricalValue>(t); },
- [] (uint64_t t) { return optional<CategoricalValue>(int64_t(t)); },
- [] (int64_t t) { return optional<CategoricalValue>(t); },
- [] (double t) { return optional<CategoricalValue>(int64_t(t)); },
- [] (const std::string& t) { return optional<CategoricalValue>(t); },
- [] (const auto&) { return optional<CategoricalValue>(); }
- );
-}
-
-template <class T>
-optional<T> CategoricalStops<T>::evaluate(const Value& value) const {
- auto v = categoricalValue(value);
- if (!v) {
- return {};
- }
- auto it = stops.find(*v);
- return it == stops.end() ? optional<T>() : it->second;
-}
-
-template class CategoricalStops<float>;
-template class CategoricalStops<Color>;
-template class CategoricalStops<std::array<float, 2>>;
-template class CategoricalStops<std::string>;
-template class CategoricalStops<TextTransformType>;
-template class CategoricalStops<TextJustifyType>;
-template class CategoricalStops<SymbolAnchorType>;
-template class CategoricalStops<LineJoinType>;
-
-} // namespace style
-} // namespace mbgl
diff --git a/src/mbgl/style/function/convert.cpp b/src/mbgl/style/function/convert.cpp
deleted file mode 100644
index a3b19f287b..0000000000
--- a/src/mbgl/style/function/convert.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <mbgl/style/function/convert.hpp>
-
-namespace mbgl {
-namespace style {
-namespace expression {
-
-std::unique_ptr<Expression> Convert::fromIdentityFunction(const std::string& property, type::Type type) {
- return type.match(
- [&] (const type::StringType&) {
- return makeGet(type::String, property);
- },
- [&] (const type::NumberType&) {
- return makeGet(type::Number, property);
- },
- [&] (const type::BooleanType&) {
- return makeGet(type::Boolean, property);
- },
- [&] (const type::ColorType&) {
- std::vector<std::unique_ptr<Expression>> args;
- args.push_back(makeGet(type::String, property));
- return std::make_unique<Coercion>(type::Color, std::move(args));
- },
- [&] (const type::Array& arr) {
- std::vector<std::unique_ptr<Expression>> getArgs;
- getArgs.push_back(makeLiteral(property));
- ParsingContext ctx;
- ParseResult get = createCompoundExpression("get", std::move(getArgs), ctx);
- assert(get);
- assert(ctx.getErrors().size() == 0);
- return std::make_unique<ArrayAssertion>(arr, std::move(*get));
- },
- [&] (const auto&) -> std::unique_ptr<Expression> {
- return makeLiteral(Null);
- }
- );
-}
-
-} // namespace expression
-} // namespace style
-} // namespace mbgl
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