diff options
-rw-r--r-- | platform/android/core-files.json | 2 | ||||
-rw-r--r-- | platform/android/src/gson/json_element.cpp | 11 | ||||
-rwxr-xr-x | platform/android/src/jni.cpp | 2 | ||||
-rw-r--r-- | platform/android/src/math/math.cpp | 13 | ||||
-rw-r--r-- | platform/android/src/math/math.hpp | 26 | ||||
-rw-r--r-- | platform/android/src/style/sources/geojson_source.cpp | 3 |
6 files changed, 4 insertions, 53 deletions
diff --git a/platform/android/core-files.json b/platform/android/core-files.json index 3f78329c7c..c1dc9e8429 100644 --- a/platform/android/core-files.json +++ b/platform/android/core-files.json @@ -36,7 +36,6 @@ "platform/android/src/gson/json_primitive.cpp", "platform/android/src/image.cpp", "platform/android/src/java/util.cpp", - "platform/android/src/math/math.cpp", "platform/android/src/java_types.cpp", "platform/android/src/jni.cpp", "platform/android/src/logger.cpp", @@ -142,7 +141,6 @@ "gson/json_object.hpp": "platform/android/src/gson/json_object.hpp", "gson/json_primitive.hpp": "platform/android/src/gson/json_primitive.hpp", "java/util.hpp": "platform/android/src/java/util.hpp", - "math/math.hpp": "platform/android/src/math/math.hpp", "java_types.hpp": "platform/android/src/java_types.hpp", "jni.hpp": "platform/android/src/jni.hpp", "logger.hpp": "platform/android/src/logger.hpp", diff --git a/platform/android/src/gson/json_element.cpp b/platform/android/src/gson/json_element.cpp index 405efe71ca..ba22304d07 100644 --- a/platform/android/src/gson/json_element.cpp +++ b/platform/android/src/gson/json_element.cpp @@ -2,7 +2,6 @@ #include "json_array.hpp" #include "json_object.hpp" #include "json_primitive.hpp" -#include "../math/math.hpp" namespace mbgl { namespace android { @@ -59,21 +58,13 @@ mbgl::Value JsonElement::convert(jni::JNIEnv &env, const jni::Object<JsonElement static auto getAsBoolean = primitiveClass.GetMethod<jni::jboolean ()>(env, "getAsBoolean"); static auto getAsString = primitiveClass.GetMethod<jni::String ()>(env, "getAsString"); static auto getAsDouble = primitiveClass.GetMethod<jni::jdouble ()>(env, "getAsDouble"); - static auto getAsInteger = primitiveClass.GetMethod<jni::jint ()>(env, "getAsInt"); if (jsonElement.Call(env, isJsonPrimitive)) { auto primitive = jni::Cast(env, primitiveClass, jsonElement); if (primitive.Call(env, isBoolean)) { return bool(primitive.Call(env, getAsBoolean)); } else if (primitive.Call(env, isNumber)) { - auto value = primitive.Call(env, getAsDouble); - if (value == math::Math::rint(env, value)) { - // uint64_t - return static_cast<uint64_t>(primitive.Call(env, getAsInteger)); - } else { - // double - return value; - } + return primitive.Call(env, getAsDouble); } else if (primitive.Call(env, isString)) { return jni::Make<std::string>(env, primitive.Call(env, getAsString)); } else { diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 5f162fd53e..410c962384 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -55,7 +55,6 @@ #include "text/collator_jni.hpp" #include "text/local_glyph_rasterizer_jni.hpp" #include "logger.hpp" -#include "math/math.hpp" namespace mbgl { namespace android { @@ -119,7 +118,6 @@ void registerNatives(JavaVM *vm) { // Basic types java::registerNatives(env); java::util::registerNative(env); - math::registerNative(env); PointF::registerNative(env); RectF::registerNative(env); diff --git a/platform/android/src/math/math.cpp b/platform/android/src/math/math.cpp deleted file mode 100644 index 17d34caacb..0000000000 --- a/platform/android/src/math/math.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "math.hpp" - -namespace mbgl { -namespace android { -namespace math { - -void registerNative(jni::JNIEnv& env) { - jni::Class<Math>::Singleton(env); -} - -} // namespace math -} // namespace android -} // namespace mbgl
\ No newline at end of file diff --git a/platform/android/src/math/math.hpp b/platform/android/src/math/math.hpp deleted file mode 100644 index c6a8549f10..0000000000 --- a/platform/android/src/math/math.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include <mbgl/util/noncopyable.hpp> - -#include <jni/jni.hpp> - -namespace mbgl { -namespace android { -namespace math { - -class Math : private mbgl::util::noncopyable { -public: - static constexpr auto Name() { return "java/lang/Math"; }; - - static jni::jdouble rint(jni::JNIEnv& env, const jni::jdouble value) { - static auto& javaClass = jni::Class<Math>::Singleton(env); - static auto method = javaClass.GetStaticMethod<jni::jdouble (jni::jdouble)>(env, "rint"); - return javaClass.Call(env, method, value); - }; -}; - -void registerNative(jni::JNIEnv&); - -} // namespace math -} // namespace android -} // namespace mbgl
\ No newline at end of file diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp index f213cbbad8..a9307afe67 100644 --- a/platform/android/src/style/sources/geojson_source.cpp +++ b/platform/android/src/style/sources/geojson_source.cpp @@ -114,6 +114,7 @@ namespace android { if (rendererFrontend) { mbgl::Feature _feature = Feature::convert(env, feature); + _feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>()); const auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "children", {}); if (featureExtension.is<mbgl::FeatureCollection>()) { return Feature::convert(env, featureExtension.get<mbgl::FeatureCollection>()); @@ -128,6 +129,7 @@ namespace android { if (rendererFrontend) { mbgl::Feature _feature = Feature::convert(env, feature); + _feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>()); const std::map<std::string, mbgl::Value> options = { {"limit", static_cast<uint64_t>(limit)}, {"offset", static_cast<uint64_t>(offset)} }; auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "leaves", options); @@ -144,6 +146,7 @@ namespace android { if (rendererFrontend) { mbgl::Feature _feature = Feature::convert(env, feature); + _feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>()); auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "expansion-zoom", {}); if (featureExtension.is<mbgl::Value>()) { auto value = featureExtension.get<mbgl::Value>(); |