Remove coffeecatch
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,216 +0,0 @@
|
||||
diff --git a/coffeecatch.c b/coffeecatch.c
|
||||
index 448fe0f..f39fcdb 100644
|
||||
--- a/coffeecatch.c
|
||||
+++ b/coffeecatch.c
|
||||
@@ -43,10 +43,7 @@
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
-#if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
|
||||
- defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
|
||||
-#include <asm/sigcontext.h>
|
||||
-#endif
|
||||
+#include <sys/ucontext.h>
|
||||
#if (defined(USE_UNWIND) && !defined(USE_CORKSCREW))
|
||||
#include <unwind.h>
|
||||
#endif
|
||||
@@ -88,154 +85,34 @@ static const int native_sig_catch[SIG_CATCH_COUNT + 1]
|
||||
/* Maximum value of a caught signal. */
|
||||
#define SIG_NUMBER_MAX 32
|
||||
|
||||
-#if (defined(__ANDROID__) && (!defined(__BIONIC_HAVE_UCONTEXT_T)))
|
||||
-#ifndef ucontext_h_seen
|
||||
-#define ucontext_h_seen
|
||||
-
|
||||
-/* stack_t definition */
|
||||
-#include <asm/signal.h>
|
||||
-
|
||||
-#if defined(__arm__)
|
||||
-
|
||||
-/* Taken from richard.quirk's header file. (Android does not have it) */
|
||||
-
|
||||
-typedef struct ucontext {
|
||||
- unsigned long uc_flags;
|
||||
- struct ucontext *uc_link;
|
||||
- stack_t uc_stack;
|
||||
- struct sigcontext uc_mcontext;
|
||||
- unsigned long uc_sigmask;
|
||||
-} ucontext_t;
|
||||
-
|
||||
-#elif defined(__i386__)
|
||||
-
|
||||
-/* Taken from Google Breakpad. */
|
||||
-
|
||||
-/* 80-bit floating-point register */
|
||||
-struct _libc_fpreg {
|
||||
- unsigned short significand[4];
|
||||
- unsigned short exponent;
|
||||
-};
|
||||
-
|
||||
-/* Simple floating-point state, see FNSTENV instruction */
|
||||
-struct _libc_fpstate {
|
||||
- unsigned long cw;
|
||||
- unsigned long sw;
|
||||
- unsigned long tag;
|
||||
- unsigned long ipoff;
|
||||
- unsigned long cssel;
|
||||
- unsigned long dataoff;
|
||||
- unsigned long datasel;
|
||||
- struct _libc_fpreg _st[8];
|
||||
- unsigned long status;
|
||||
-};
|
||||
-
|
||||
-typedef uint32_t greg_t;
|
||||
-
|
||||
-typedef struct {
|
||||
- uint32_t gregs[19];
|
||||
- struct _libc_fpstate* fpregs;
|
||||
- uint32_t oldmask;
|
||||
- uint32_t cr2;
|
||||
-} mcontext_t;
|
||||
-
|
||||
-enum {
|
||||
- REG_GS = 0,
|
||||
- REG_FS,
|
||||
- REG_ES,
|
||||
- REG_DS,
|
||||
- REG_EDI,
|
||||
- REG_ESI,
|
||||
- REG_EBP,
|
||||
- REG_ESP,
|
||||
- REG_EBX,
|
||||
- REG_EDX,
|
||||
- REG_ECX,
|
||||
- REG_EAX,
|
||||
- REG_TRAPNO,
|
||||
- REG_ERR,
|
||||
- REG_EIP,
|
||||
- REG_CS,
|
||||
- REG_EFL,
|
||||
- REG_UESP,
|
||||
- REG_SS,
|
||||
-};
|
||||
-
|
||||
-typedef struct ucontext {
|
||||
- uint32_t uc_flags;
|
||||
- struct ucontext* uc_link;
|
||||
- stack_t uc_stack;
|
||||
- mcontext_t uc_mcontext;
|
||||
-} ucontext_t;
|
||||
-
|
||||
-#elif defined(__mips__)
|
||||
-
|
||||
-/* Taken from Google Breakpad. */
|
||||
-
|
||||
-typedef struct {
|
||||
- uint32_t regmask;
|
||||
- uint32_t status;
|
||||
- uint64_t pc;
|
||||
- uint64_t gregs[32];
|
||||
- uint64_t fpregs[32];
|
||||
- uint32_t acx;
|
||||
- uint32_t fpc_csr;
|
||||
- uint32_t fpc_eir;
|
||||
- uint32_t used_math;
|
||||
- uint32_t dsp;
|
||||
- uint64_t mdhi;
|
||||
- uint64_t mdlo;
|
||||
- uint32_t hi1;
|
||||
- uint32_t lo1;
|
||||
- uint32_t hi2;
|
||||
- uint32_t lo2;
|
||||
- uint32_t hi3;
|
||||
- uint32_t lo3;
|
||||
-} mcontext_t;
|
||||
-
|
||||
-typedef struct ucontext {
|
||||
- uint32_t uc_flags;
|
||||
- struct ucontext* uc_link;
|
||||
- stack_t uc_stack;
|
||||
- mcontext_t uc_mcontext;
|
||||
-} ucontext_t;
|
||||
-
|
||||
-#else
|
||||
-#error "Architecture is not supported (unknown ucontext layout)"
|
||||
-#endif
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
#ifdef USE_CORKSCREW
|
||||
typedef struct map_info_t map_info_t;
|
||||
/* Extracted from Android's include/corkscrew/backtrace.h */
|
||||
-typedef struct {
|
||||
- uintptr_t absolute_pc;
|
||||
- uintptr_t stack_top;
|
||||
- size_t stack_size;
|
||||
-} backtrace_frame_t;
|
||||
-typedef struct {
|
||||
- uintptr_t relative_pc;
|
||||
- uintptr_t relative_symbol_addr;
|
||||
- char* map_name;
|
||||
- char* symbol_name;
|
||||
- char* demangled_name;
|
||||
+typedef struct {
|
||||
+ uintptr_t absolute_pc;
|
||||
+ uintptr_t stack_top;
|
||||
+ size_t stack_size;
|
||||
+} backtrace_frame_t;
|
||||
+typedef struct {
|
||||
+ uintptr_t relative_pc;
|
||||
+ uintptr_t relative_symbol_addr;
|
||||
+ char* map_name;
|
||||
+ char* symbol_name;
|
||||
+ char* demangled_name;
|
||||
} backtrace_symbol_t;
|
||||
/* Extracted from Android's libcorkscrew/arch-arm/backtrace-arm.c */
|
||||
-typedef ssize_t (*t_unwind_backtrace_signal_arch)
|
||||
-(siginfo_t* si, void* sc, const map_info_t* lst, backtrace_frame_t* bt,
|
||||
-size_t ignore_depth, size_t max_depth);
|
||||
-typedef map_info_t* (*t_acquire_my_map_info_list)();
|
||||
-typedef void (*t_release_my_map_info_list)(map_info_t* milist);
|
||||
-typedef void (*t_get_backtrace_symbols)(const backtrace_frame_t* backtrace,
|
||||
+typedef ssize_t (*t_unwind_backtrace_signal_arch)
|
||||
+(siginfo_t* si, void* sc, const map_info_t* lst, backtrace_frame_t* bt,
|
||||
+size_t ignore_depth, size_t max_depth);
|
||||
+typedef map_info_t* (*t_acquire_my_map_info_list)();
|
||||
+typedef void (*t_release_my_map_info_list)(map_info_t* milist);
|
||||
+typedef void (*t_get_backtrace_symbols)(const backtrace_frame_t* backtrace,
|
||||
size_t frames,
|
||||
backtrace_symbol_t* symbols);
|
||||
typedef void (*t_free_backtrace_symbols)(backtrace_symbol_t* symbols,
|
||||
size_t frames);
|
||||
#endif
|
||||
|
||||
-#endif
|
||||
-
|
||||
/* Process-wide crash handler structure. */
|
||||
typedef struct native_code_global_struct {
|
||||
/* Initialized. */
|
||||
@@ -341,7 +218,7 @@ static ssize_t coffeecatch_backtrace_signal(siginfo_t* si, void* sc,
|
||||
&& acquire_my_map_info_list != NULL
|
||||
&& release_my_map_info_list != NULL) {
|
||||
map_info_t*const info = acquire_my_map_info_list();
|
||||
- const ssize_t size =
|
||||
+ const ssize_t size =
|
||||
unwind_backtrace_signal_arch(si, sc, info, frames, ignore_depth,
|
||||
max_depth);
|
||||
release_my_map_info_list(info);
|
||||
@@ -1073,12 +950,12 @@ static uintptr_t coffeecatch_get_pc_from_ucontext(const ucontext_t *uc) {
|
||||
return uc->uc_mcontext.regs->nip;
|
||||
#elif (defined(__hppa__))
|
||||
return uc->uc_mcontext.sc_iaoq[0] & ~0x3UL;
|
||||
-#elif (defined(__sparc__) && defined (__arch64__))
|
||||
- return uc->uc_mcontext.mc_gregs[MC_PC];
|
||||
-#elif (defined(__sparc__) && !defined (__arch64__))
|
||||
- return uc->uc_mcontext.gregs[REG_PC];
|
||||
-#elif (defined(__mips__))
|
||||
- return uc->uc_mcontext.gregs[31];
|
||||
+#elif (defined(__sparc__) && defined (__arch64__))
|
||||
+ return uc->uc_mcontext.mc_gregs[MC_PC];
|
||||
+#elif (defined(__sparc__) && !defined (__arch64__))
|
||||
+ return uc->uc_mcontext.gregs[REG_PC];
|
||||
+#elif (defined(__mips__))
|
||||
+ return uc->uc_mcontext.gregs[31];
|
||||
#else
|
||||
#error "Architecture is unknown, please report me!"
|
||||
#endif
|
||||
@@ -1,185 +0,0 @@
|
||||
/* CoffeeCatch, a tiny native signal handler/catcher for JNI code.
|
||||
* (especially for Android/Dalvik)
|
||||
*
|
||||
* Copyright (c) 2013, Xavier Roche (http://www.httrack.com/)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef COFFEECATCH_JNI_H
|
||||
#define COFFEECATCH_JNI_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <jni.h>
|
||||
#include <assert.h>
|
||||
#include <coffeecatch/coffeecatch.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct t_bt_fun {
|
||||
JNIEnv* env;
|
||||
jclass cls;
|
||||
jclass cls_ste;
|
||||
jmethodID cons_ste;
|
||||
jobjectArray elements;
|
||||
size_t size;
|
||||
size_t index;
|
||||
} t_bt_fun;
|
||||
|
||||
static char* bt_print(const char *function, uintptr_t offset) {
|
||||
if (function != NULL) {
|
||||
char buffer[256];
|
||||
snprintf(buffer, sizeof(buffer), "%s:%p", function, (void*) offset);
|
||||
return strdup(buffer);
|
||||
} else {
|
||||
return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
static char* bt_addr(uintptr_t addr) {
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%p", (void*) addr);
|
||||
return strdup(buffer);
|
||||
}
|
||||
|
||||
#define IS_VALID_CLASS_CHAR(C) ( \
|
||||
((C) >= 'a' && (C) <= 'z') \
|
||||
|| ((C) >= 'A' && (C) <= 'Z') \
|
||||
|| ((C) >= '0' && (C) <= '9') \
|
||||
|| (C) == '_' \
|
||||
)
|
||||
|
||||
static char* bt_module(const char *module) {
|
||||
if (module != NULL) {
|
||||
size_t i;
|
||||
char *copy;
|
||||
if (*module == '/') {
|
||||
module++;
|
||||
}
|
||||
copy = strdup(module);
|
||||
/* Pseudo-java-class. */
|
||||
for(i = 0; copy[i] != '\0'; i++) {
|
||||
if (copy[i] == '/') {
|
||||
copy[i] = '.';
|
||||
} else if (!IS_VALID_CLASS_CHAR(copy[i])) {
|
||||
copy[i] = '_';
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
} else {
|
||||
return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
static void bt_fun(void *arg, const char *module, uintptr_t addr,
|
||||
const char *function, uintptr_t offset) {
|
||||
t_bt_fun *const t = (t_bt_fun*) arg;
|
||||
JNIEnv*const env = t->env;
|
||||
jstring declaringClass = (*env)->NewStringUTF(env, bt_module(module));
|
||||
jstring methodName = (*env)->NewStringUTF(env, bt_addr(addr));
|
||||
jstring fileName = (*env)->NewStringUTF(env, bt_print(function, offset));
|
||||
const int lineNumber = function != NULL ? 0 : -2; /* "-2" is "inside JNI code" */
|
||||
jobject trace = (*env)->NewObject(env, t->cls_ste, t->cons_ste,
|
||||
declaringClass, methodName, fileName,
|
||||
lineNumber);
|
||||
if (t->index < t->size) {
|
||||
(*t->env)->SetObjectArrayElement(t->env, t->elements, t->index++, trace);
|
||||
}
|
||||
}
|
||||
|
||||
void coffeecatch_throw_exception(JNIEnv* env) {
|
||||
jclass cls = (*env)->FindClass(env, "java/lang/Error");
|
||||
jclass cls_ste = (*env)->FindClass(env, "java/lang/StackTraceElement");
|
||||
|
||||
jmethodID cons = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;)V");
|
||||
jmethodID cons_cause = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;Ljava/lang/Throwable;)V");
|
||||
jmethodID cons_ste = (*env)->GetMethodID(env, cls_ste, "<init>",
|
||||
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V");
|
||||
jmethodID meth_sste = (*env)->GetMethodID(env, cls, "setStackTrace",
|
||||
"([Ljava/lang/StackTraceElement;)V");
|
||||
|
||||
/* Exception message. */
|
||||
const char*const message = coffeecatch_get_message();
|
||||
jstring str = (*env)->NewStringUTF(env, strdup(message));
|
||||
|
||||
/* Final exception. */
|
||||
jthrowable exception;
|
||||
|
||||
/* Add pseudo-stack trace. */
|
||||
const ssize_t bt_size = coffeecatch_get_backtrace_size();
|
||||
|
||||
assert(cls != NULL);
|
||||
assert(cls_ste != NULL);
|
||||
assert(cons != NULL);
|
||||
assert(cons_cause != NULL);
|
||||
assert(cons_ste != NULL);
|
||||
assert(meth_sste != NULL);
|
||||
|
||||
assert(message != NULL);
|
||||
assert(str != NULL);
|
||||
|
||||
/* Can we produce a stack trace ? */
|
||||
if (bt_size > 0) {
|
||||
/* Create secondary exception. */
|
||||
jthrowable cause = (jthrowable) (*env)->NewObject(env, cls, cons, str);
|
||||
|
||||
/* Stack trace. */
|
||||
jobjectArray elements =
|
||||
(*env)->NewObjectArray(env, bt_size, cls_ste, NULL);
|
||||
if (elements != NULL) {
|
||||
t_bt_fun t;
|
||||
t.env = env;
|
||||
t.cls = cls;
|
||||
t.cls_ste = cls_ste;
|
||||
t.cons_ste = cons_ste;
|
||||
t.elements = elements;
|
||||
t.index = 0;
|
||||
t.size = bt_size;
|
||||
coffeecatch_get_backtrace_info(bt_fun, &t);
|
||||
(*env)->CallVoidMethod(env, cause, meth_sste, elements);
|
||||
}
|
||||
|
||||
/* Primary exception */
|
||||
exception = (jthrowable) (*env)->NewObject(env, cls, cons_cause, str, cause);
|
||||
} else {
|
||||
/* Simple exception */
|
||||
exception = (jthrowable) (*env)->NewObject(env, cls, cons, str);
|
||||
}
|
||||
|
||||
/* Throw exception. */
|
||||
if (exception != NULL) {
|
||||
(*env)->Throw(env, exception);
|
||||
} else {
|
||||
(*env)->ThrowNew(env, cls, strdup(message));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -12,8 +12,6 @@
|
||||
#include <android/native_window_jni.h>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#include <coffeecatch/coffeejni.h>
|
||||
|
||||
#include <mbgl/android/jni.hpp>
|
||||
#include <mbgl/android/native_map_view.hpp>
|
||||
#include <mbgl/map/map.hpp>
|
||||
@@ -23,16 +21,6 @@
|
||||
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
#define CPP_TRY_JNI(ENV, CODE) \
|
||||
try { \
|
||||
CODE; \
|
||||
} \
|
||||
catch (std::exception e) { \
|
||||
std::string msg("Unhandled C++ exception: "); \
|
||||
msg.append(e.what()); \
|
||||
throw_error(ENV, msg.c_str()); \
|
||||
}
|
||||
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
@@ -185,12 +173,7 @@ nativeCreate(JNIEnv *env, jobject obj, jstring cachePath_, jstring dataPath_, js
|
||||
cachePath = std_string_from_jstring(env, cachePath_);
|
||||
dataPath = std_string_from_jstring(env, dataPath_);
|
||||
apkPath = std_string_from_jstring(env, apkPath_);
|
||||
NativeMapView *nativeMapView = nullptr;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView = new NativeMapView(env, obj)));
|
||||
if (nativeMapView == nullptr) {
|
||||
throw_error(env, "Unable to create NativeMapView.");
|
||||
return 0;
|
||||
}
|
||||
NativeMapView *nativeMapView = new NativeMapView(env, obj);
|
||||
jlong mapViewPtr = reinterpret_cast<jlong>(nativeMapView);
|
||||
return mapViewPtr;
|
||||
}
|
||||
@@ -207,9 +190,7 @@ void JNICALL nativeInitializeDisplay(JNIEnv *env, jobject obj, jlong nativeMapVi
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeInitializeDisplay");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
bool ret = false;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->initializeDisplay()));
|
||||
if (!ret) {
|
||||
if (!nativeMapView->initializeDisplay()) {
|
||||
throw_error(env, "Unable to initialize GL display.");
|
||||
}
|
||||
}
|
||||
@@ -218,16 +199,14 @@ void JNICALL nativeTerminateDisplay(JNIEnv *env, jobject obj, jlong nativeMapVie
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminateDisplay");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->terminateDisplay()));
|
||||
nativeMapView->terminateDisplay();
|
||||
}
|
||||
|
||||
void JNICALL nativeInitializeContext(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeInitializeContext");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
bool ret = false;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->initializeContext()));
|
||||
if (!ret) {
|
||||
if (!nativeMapView->initializeContext()) {
|
||||
throw_error(env, "Unable to initialize GL context.");
|
||||
}
|
||||
}
|
||||
@@ -236,7 +215,7 @@ void JNICALL nativeTerminateContext(JNIEnv *env, jobject obj, jlong nativeMapVie
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminateContext");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->terminateContext()));
|
||||
nativeMapView->terminateContext();
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
@@ -244,10 +223,8 @@ nativeCreateSurface(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject su
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCreateSurface");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
bool ret = false;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->createSurface(
|
||||
ANativeWindow_fromSurface(env, surface))));
|
||||
if (!ret) {
|
||||
|
||||
if (!nativeMapView->createSurface(ANativeWindow_fromSurface(env, surface))) {
|
||||
throw_error(env, "Unable to create GL surface.");
|
||||
}
|
||||
}
|
||||
@@ -256,79 +233,77 @@ void JNICALL nativeDestroySurface(JNIEnv *env, jobject obj, jlong nativeMapViewP
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeDestroySurface");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->destroySurface()));
|
||||
nativeMapView->destroySurface();
|
||||
}
|
||||
|
||||
void JNICALL nativeStart(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStart");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->start()));
|
||||
nativeMapView->start();
|
||||
}
|
||||
|
||||
void JNICALL nativeStop(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStop");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->stop()));
|
||||
nativeMapView->stop();
|
||||
}
|
||||
|
||||
void JNICALL nativePause(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativePause");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->pause()));
|
||||
nativeMapView->pause();
|
||||
}
|
||||
|
||||
void JNICALL nativeResume(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResume");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->resume()));
|
||||
nativeMapView->resume();
|
||||
}
|
||||
|
||||
void JNICALL nativeRun(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRun");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().run()));
|
||||
nativeMapView->getMap().run();
|
||||
}
|
||||
|
||||
void JNICALL nativeRerender(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRerender");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().rerender()));
|
||||
nativeMapView->getMap().rerender();
|
||||
}
|
||||
|
||||
void JNICALL nativeUpdate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeUpdate");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().update()));
|
||||
nativeMapView->getMap().update();
|
||||
}
|
||||
|
||||
void JNICALL nativeTerminate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminate");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().terminate()));
|
||||
nativeMapView->getMap().terminate();
|
||||
}
|
||||
|
||||
jboolean JNICALL nativeNeedsSwap(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeNeedsSwap");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jboolean ret = false;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().needsSwap()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().needsSwap();
|
||||
}
|
||||
|
||||
void JNICALL nativeSwapped(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSwapped");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, (nativeMapView->getMap().swapped())));
|
||||
nativeMapView->getMap().swapped();
|
||||
}
|
||||
|
||||
void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height,
|
||||
@@ -340,7 +315,7 @@ void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint
|
||||
assert(width <= UINT16_MAX);
|
||||
assert(height <= UINT16_MAX);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().resize(width, height, ratio)));
|
||||
nativeMapView->getMap().resize(width, height, ratio);
|
||||
}
|
||||
|
||||
void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height,
|
||||
@@ -356,8 +331,7 @@ void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint
|
||||
assert(fbWidth <= UINT16_MAX);
|
||||
assert(fbHeight <= UINT16_MAX);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().resize(width, height, ratio,
|
||||
fbWidth, fbHeight)));
|
||||
nativeMapView->getMap().resize(width, height, ratio, fbWidth, fbHeight);
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
@@ -365,18 +339,14 @@ nativeSetAppliedClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobjec
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAppliedClasses");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setAppliedClasses(
|
||||
std_vector_string_from_jobject(env, classes))));
|
||||
nativeMapView->getMap().setAppliedClasses(std_vector_string_from_jobject(env, classes));
|
||||
}
|
||||
|
||||
jobject JNICALL nativeGetAppliedClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAppliedClasses");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jobject ret = nullptr;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = std_vector_string_to_jobject(
|
||||
env, nativeMapView->getMap().getAppliedClasses())));
|
||||
return ret;
|
||||
return std_vector_string_to_jobject(env, nativeMapView->getMap().getAppliedClasses());
|
||||
}
|
||||
|
||||
void JNICALL nativeSetDefaultTransitionDuration(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
|
||||
@@ -385,26 +355,21 @@ void JNICALL nativeSetDefaultTransitionDuration(JNIEnv *env, jobject obj, jlong
|
||||
assert(nativeMapViewPtr != 0);
|
||||
assert(milliseconds >= 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(
|
||||
env, CPP_TRY_JNI(env, nativeMapView->getMap().setDefaultTransitionDuration(milliseconds)));
|
||||
nativeMapView->getMap().setDefaultTransitionDuration(milliseconds);
|
||||
}
|
||||
|
||||
jlong JNICALL nativeGetDefaultTransitionDuration(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetDefaultTransitionDuration");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jlong ret = 0;
|
||||
COFFEE_TRY_JNI(env,
|
||||
CPP_TRY_JNI(env, ret = nativeMapView->getMap().getDefaultTransitionDuration()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getDefaultTransitionDuration();
|
||||
}
|
||||
|
||||
void JNICALL nativeSetStyleURL(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring url) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetStyleURL");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setStyleURL(
|
||||
std_string_from_jstring(env, url))));
|
||||
nativeMapView->getMap().setStyleURL(std_string_from_jstring(env, url));
|
||||
}
|
||||
|
||||
void JNICALL nativeSetStyleJSON(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
|
||||
@@ -412,19 +377,15 @@ void JNICALL nativeSetStyleJSON(JNIEnv *env, jobject obj, jlong nativeMapViewPtr
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetStyleJSON");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setStyleJSON(
|
||||
std_string_from_jstring(env, newStyleJson),
|
||||
std_string_from_jstring(env, base))));
|
||||
nativeMapView->getMap().setStyleJSON(std_string_from_jstring(env, newStyleJson),
|
||||
std_string_from_jstring(env, base));
|
||||
}
|
||||
|
||||
jstring JNICALL nativeGetStyleJSON(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetStyleJSON");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jstring ret = nullptr;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = std_string_to_jstring(
|
||||
env, nativeMapView->getMap().getStyleJSON())));
|
||||
return ret;
|
||||
return std_string_to_jstring(env, nativeMapView->getMap().getStyleJSON());
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
@@ -432,26 +393,21 @@ nativeSetAccessToken(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring a
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAccessToken");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getFileSource().setAccessToken(
|
||||
std_string_from_jstring(env, accessToken))));
|
||||
nativeMapView->getFileSource().setAccessToken(std_string_from_jstring(env, accessToken));
|
||||
}
|
||||
|
||||
jstring JNICALL nativeGetAccessToken(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAccessToken");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jstring ret = nullptr;
|
||||
COFFEE_TRY_JNI(env,
|
||||
CPP_TRY_JNI(env, ret = std_string_to_jstring(
|
||||
env, nativeMapView->getFileSource().getAccessToken())));
|
||||
return ret;
|
||||
return std_string_to_jstring(env, nativeMapView->getFileSource().getAccessToken());
|
||||
}
|
||||
|
||||
void JNICALL nativeCancelTransitions(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCancelTransitions");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().cancelTransitions()));
|
||||
nativeMapView->getMap().cancelTransitions();
|
||||
}
|
||||
|
||||
void JNICALL nativeMoveBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble dx, jdouble dy,
|
||||
@@ -459,7 +415,7 @@ void JNICALL nativeMoveBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdou
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeMoveBy");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().moveBy(dx, dy, duration)));
|
||||
nativeMapView->getMap().moveBy(dx, dy, duration);
|
||||
}
|
||||
|
||||
void JNICALL nativeSetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject lonLat,
|
||||
@@ -480,7 +436,7 @@ void JNICALL nativeSetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j
|
||||
return;
|
||||
}
|
||||
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setLonLat(lon, lat, duration)));
|
||||
nativeMapView->getMap().setLonLat(lon, lat, duration);
|
||||
}
|
||||
|
||||
jobject JNICALL nativeGetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
@@ -488,7 +444,7 @@ jobject JNICALL nativeGetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
double lon = 0.0, lat = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().getLonLat(lon, lat)));
|
||||
nativeMapView->getMap().getLonLat(lon, lat);
|
||||
|
||||
jobject ret = env->NewObject(lonLatClass, lonLatConstructorId, lon, lat);
|
||||
if (ret == nullptr) {
|
||||
@@ -503,21 +459,21 @@ void JNICALL nativeStartPanning(JNIEnv *env, jobject obj, jlong nativeMapViewPtr
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartPanning");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().startPanning()));
|
||||
nativeMapView->getMap().startPanning();
|
||||
}
|
||||
|
||||
void JNICALL nativeStopPanning(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopPanning");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().stopPanning()));
|
||||
nativeMapView->getMap().stopPanning();
|
||||
}
|
||||
|
||||
void JNICALL nativeResetPosition(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetPosition");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().resetPosition()));
|
||||
nativeMapView->getMap().resetPosition();
|
||||
}
|
||||
|
||||
void JNICALL nativeScaleBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble ds, jdouble cx,
|
||||
@@ -525,7 +481,7 @@ void JNICALL nativeScaleBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdo
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeScaleBy");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().scaleBy(ds, cx, cy, duration)));
|
||||
nativeMapView->getMap().scaleBy(ds, cx, cy, duration);
|
||||
}
|
||||
|
||||
void JNICALL nativeSetScale(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble scale,
|
||||
@@ -533,17 +489,14 @@ void JNICALL nativeSetScale(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jd
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetScale");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env,
|
||||
CPP_TRY_JNI(env, nativeMapView->getMap().setScale(scale, cx, cy, duration)));
|
||||
nativeMapView->getMap().setScale(scale, cx, cy, duration);
|
||||
}
|
||||
|
||||
jdouble JNICALL nativeGetScale(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetScale");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jdouble ret = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getScale()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getScale();
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
@@ -551,16 +504,14 @@ nativeSetZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble zoom, jd
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetZoom");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setZoom(zoom, duration)));
|
||||
nativeMapView->getMap().setZoom(zoom, duration);
|
||||
}
|
||||
|
||||
jdouble JNICALL nativeGetZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetZoom");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jdouble ret = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getZoom()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getZoom();
|
||||
}
|
||||
|
||||
void JNICALL nativeSetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
|
||||
@@ -587,8 +538,7 @@ void JNICALL nativeSetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPt
|
||||
return;
|
||||
}
|
||||
|
||||
COFFEE_TRY_JNI(
|
||||
env, CPP_TRY_JNI(env, nativeMapView->getMap().setLonLatZoom(lon, lat, zoom, duration)));
|
||||
nativeMapView->getMap().setLonLatZoom(lon, lat, zoom, duration);
|
||||
}
|
||||
|
||||
jobject JNICALL nativeGetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
@@ -596,7 +546,7 @@ jobject JNICALL nativeGetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapVie
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
double lon = 0.0, lat = 0.0, zoom = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().getLonLatZoom(lon, lat, zoom)));
|
||||
nativeMapView->getMap().getLonLatZoom(lon, lat, zoom);
|
||||
|
||||
jobject ret = env->NewObject(lonLatZoomClass, lonLatZoomConstructorId, lon, lat, zoom);
|
||||
if (ret == nullptr) {
|
||||
@@ -611,39 +561,35 @@ void JNICALL nativeResetZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetZoom");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().resetZoom()));
|
||||
nativeMapView->getMap().resetZoom();
|
||||
}
|
||||
|
||||
void JNICALL nativeStartScaling(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartScaling");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().startScaling()));
|
||||
nativeMapView->getMap().startScaling();
|
||||
}
|
||||
|
||||
void JNICALL nativeStopScaling(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopScaling");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().stopScaling()));
|
||||
return nativeMapView->getMap().stopScaling();
|
||||
}
|
||||
|
||||
jdouble JNICALL nativeGetMinZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetMinZoom");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jdouble ret = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getMinZoom()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getMinZoom();
|
||||
}
|
||||
|
||||
jdouble JNICALL nativeGetMaxZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetMaxZoom");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jdouble ret = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getMaxZoom()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getMaxZoom();
|
||||
}
|
||||
|
||||
void JNICALL nativeRotateBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble sx,
|
||||
@@ -651,8 +597,7 @@ void JNICALL nativeRotateBy(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jd
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRotateBy");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env,
|
||||
CPP_TRY_JNI(env, nativeMapView->getMap().rotateBy(sx, sy, ex, ey, duration)));
|
||||
nativeMapView->getMap().rotateBy(sx, sy, ex, ey, duration);
|
||||
}
|
||||
|
||||
void JNICALL nativeSetBearing(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble degrees,
|
||||
@@ -660,7 +605,7 @@ void JNICALL nativeSetBearing(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetBearing");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setBearing(degrees, duration)));
|
||||
nativeMapView->getMap().setBearing(degrees, duration);
|
||||
}
|
||||
|
||||
void JNICALL nativeSetBearing(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jdouble degrees,
|
||||
@@ -668,62 +613,58 @@ void JNICALL nativeSetBearing(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetBearing");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setBearing(degrees, cx, cy)));
|
||||
nativeMapView->getMap().setBearing(degrees, cx, cy);
|
||||
}
|
||||
|
||||
jdouble JNICALL nativeGetBearing(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetBearing");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jdouble ret = 0.0;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getBearing()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getBearing();
|
||||
}
|
||||
|
||||
void JNICALL nativeResetNorth(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetNorth");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().resetNorth()));
|
||||
nativeMapView->getMap().resetNorth();
|
||||
}
|
||||
|
||||
void JNICALL nativeStartRotating(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartRotating");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().startRotating()));
|
||||
nativeMapView->getMap().startRotating();
|
||||
}
|
||||
|
||||
void JNICALL nativeStopRotating(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopRotating");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().stopRotating()));
|
||||
nativeMapView->getMap().stopRotating();
|
||||
}
|
||||
|
||||
void JNICALL nativeSetDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean debug) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetDebug");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().setDebug(debug);
|
||||
nativeMapView->enableFps(debug)));
|
||||
nativeMapView->getMap().setDebug(debug);
|
||||
nativeMapView->enableFps(debug);
|
||||
}
|
||||
|
||||
void JNICALL nativeToggleDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeToggleDebug");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getMap().toggleDebug();
|
||||
nativeMapView->enableFps(nativeMapView->getMap().getDebug())));
|
||||
nativeMapView->getMap().toggleDebug();
|
||||
nativeMapView->enableFps(nativeMapView->getMap().getDebug());
|
||||
}
|
||||
|
||||
jboolean JNICALL nativeGetDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetDebug");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
jboolean ret = false;
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, ret = nativeMapView->getMap().getDebug()));
|
||||
return ret;
|
||||
return nativeMapView->getMap().getDebug();
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
@@ -731,7 +672,7 @@ nativeSetReachability(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetReachability");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
COFFEE_TRY_JNI(env, CPP_TRY_JNI(env, nativeMapView->getFileSource().setReachability(status)));
|
||||
nativeMapView->getFileSource().setReachability(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user