diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-13 18:14:12 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-20 11:56:30 -0700 |
commit | c8edbb0500cbf4baf1d5fdb0e63679539e166585 (patch) | |
tree | 750f3b72b9e3b1c91ddbc0541cfc64d7d80ffe71 /platform/android | |
parent | 6d7072162b764c2432c010cd463a5a2c0093d606 (diff) | |
download | qtlocation-mapboxgl-c8edbb0500cbf4baf1d5fdb0e63679539e166585.tar.gz |
[core] Replace {Source,Camera,Composite}Function with PropertyExpression
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/config.cmake | 2 | ||||
-rw-r--r-- | platform/android/src/style/conversion/function.hpp | 51 | ||||
-rw-r--r-- | platform/android/src/style/conversion/property_expression.hpp | 31 | ||||
-rw-r--r-- | platform/android/src/style/conversion/property_value.hpp | 14 |
4 files changed, 35 insertions, 63 deletions
diff --git a/platform/android/config.cmake b/platform/android/config.cmake index 88130dc104..21ec6a9e0c 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -129,7 +129,7 @@ add_library(mbgl-android STATIC # Conversion C++ -> Java platform/android/src/conversion/constant.hpp platform/android/src/conversion/conversion.hpp - platform/android/src/style/conversion/function.hpp + platform/android/src/style/conversion/property_expression.hpp platform/android/src/style/conversion/property_value.hpp platform/android/src/style/conversion/types.hpp platform/android/src/style/conversion/types_string_values.hpp diff --git a/platform/android/src/style/conversion/function.hpp b/platform/android/src/style/conversion/function.hpp deleted file mode 100644 index d6669b4508..0000000000 --- a/platform/android/src/style/conversion/function.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include <mbgl/style/property_value.hpp> -#include "../../conversion/conversion.hpp" -#include "../../conversion/constant.hpp" -#include "types.hpp" -#include "../../java/lang.hpp" - -#include <jni/jni.hpp> -#include "../../gson/json_element.hpp" - -#include <tuple> -#include <map> - -namespace mbgl { -namespace android { -namespace conversion { - -template <class T> -struct Converter<jni::Object<android::gson::JsonElement>, mbgl::style::CameraFunction<T>> { - - Result<jni::Object<android::gson::JsonElement>> operator()(jni::JNIEnv& env, const mbgl::style::CameraFunction<T>& value) const { - // Convert expressions - mbgl::Value expressionValue = value.getExpression().serialize(); - return gson::JsonElement::New(env, expressionValue); - } -}; - -template <class T> -struct Converter<jni::Object<android::gson::JsonElement>, mbgl::style::SourceFunction<T>> { - - Result<jni::Object<android::gson::JsonElement>> operator()(jni::JNIEnv& env, const mbgl::style::SourceFunction<T>& value) const { - // Convert expressions - mbgl::Value expressionValue = value.getExpression().serialize(); - return gson::JsonElement::New(env, expressionValue); - } -}; - -template <class T> -struct Converter<jni::Object<android::gson::JsonElement>, mbgl::style::CompositeFunction<T>> { - - Result<jni::Object<android::gson::JsonElement>> operator()(jni::JNIEnv& env, const mbgl::style::CompositeFunction<T>& value) const { - // Convert expressions - mbgl::Value expressionValue = value.getExpression().serialize(); - return gson::JsonElement::New(env, expressionValue); - } -}; - -} // namespace conversion -} // namespace android -} // namespace mbgl diff --git a/platform/android/src/style/conversion/property_expression.hpp b/platform/android/src/style/conversion/property_expression.hpp new file mode 100644 index 0000000000..ae9d4ea41c --- /dev/null +++ b/platform/android/src/style/conversion/property_expression.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include <mbgl/style/property_value.hpp> +#include "../../conversion/conversion.hpp" +#include "../../conversion/constant.hpp" +#include "types.hpp" +#include "../../java/lang.hpp" + +#include <jni/jni.hpp> +#include "../../gson/json_element.hpp" + +#include <tuple> +#include <map> + +namespace mbgl { +namespace android { +namespace conversion { + +template <class T> +struct Converter<jni::Object<android::gson::JsonElement>, mbgl::style::PropertyExpression<T>> { + + Result<jni::Object<android::gson::JsonElement>> operator()(jni::JNIEnv& env, const mbgl::style::PropertyExpression<T>& value) const { + // Convert expressions + mbgl::Value expressionValue = value.getExpression().serialize(); + return gson::JsonElement::New(env, expressionValue); + } +}; + +} // namespace conversion +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/conversion/property_value.hpp b/platform/android/src/style/conversion/property_value.hpp index e6fbe42179..feed38b673 100644 --- a/platform/android/src/style/conversion/property_value.hpp +++ b/platform/android/src/style/conversion/property_value.hpp @@ -5,8 +5,8 @@ #include <mbgl/style/property_value.hpp> #include "../../conversion/conversion.hpp" #include "../../conversion/constant.hpp" +#include "property_expression.hpp" #include "types.hpp" -#include "function.hpp" namespace mbgl { namespace android { @@ -30,16 +30,8 @@ public: return *result; } - jni::jobject* operator()(const mbgl::style::CameraFunction<T> &value) const { - return *convert<jni::Object<android::gson::JsonElement>, mbgl::style::CameraFunction<T>>(env, value); - } - - jni::jobject* operator()(const mbgl::style::SourceFunction<T> &value) const { - return *convert<jni::Object<android::gson::JsonElement>, mbgl::style::SourceFunction<T>>(env, value); - } - - jni::jobject* operator()(const mbgl::style::CompositeFunction<T> &value) const { - return *convert<jni::Object<android::gson::JsonElement>, mbgl::style::CompositeFunction<T>>(env, value); + jni::jobject* operator()(const mbgl::style::PropertyExpression<T> &value) const { + return *convert<jni::Object<android::gson::JsonElement>, mbgl::style::PropertyExpression<T>>(env, value); } private: |