Add coffeecatch

This commit is contained in:
Leith Bade
2014-11-16 19:32:51 +11:00
parent 583f8d6b61
commit 97dc28883e
10 changed files with 3437 additions and 68 deletions

View File

@@ -11,6 +11,8 @@
#include <android/native_window_jni.h>
#include <coffeecatch/coffeejni.h>
#include <mbgl/android/jni.hpp>
#include <mbgl/android/native_map_view.hpp>
#include <mbgl/map/map.hpp>
@@ -144,7 +146,8 @@ jlong JNICALL nativeCreate(JNIEnv* env, jobject obj, jstring cache_path_, jstrin
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCreate");
cache_path = std_string_from_jstring(env, cache_path_);
data_path = std_string_from_jstring(env, data_path_);
NativeMapView* native_map_view = new NativeMapView(env, obj);
NativeMapView* native_map_view = nullptr;
COFFEE_TRY_JNI(env, native_map_view = new NativeMapView(env, obj));
if (native_map_view == nullptr) {
throw_error(env, "Unable to create NativeMapView.");
return 0;
@@ -165,7 +168,9 @@ void JNICALL nativeInitializeDisplay(JNIEnv* env, jobject obj, jlong native_map_
mbgl::Log::Debug(mbgl::Event::JNI, "nativeInitializeDisplay");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
if (!native_map_view->initializeDisplay()) {
bool ret = false;
COFFEE_TRY_JNI(env, ret = native_map_view->initializeDisplay());
if (!ret) {
throw_error(env, "Unable to initialize GL display.");
}
}
@@ -174,14 +179,16 @@ void JNICALL nativeTerminateDisplay(JNIEnv* env, jobject obj, jlong native_map_v
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminateDisplay");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->terminateDisplay();
COFFEE_TRY_JNI(env, native_map_view->terminateDisplay());
}
void JNICALL nativeInitializeContext(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeInitializeContext");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
if (!native_map_view->initializeContext()) {
bool ret = false;
COFFEE_TRY_JNI(env, ret = native_map_view->initializeContext());
if (!ret) {
throw_error(env, "Unable to initialize GL context.");
}
}
@@ -190,14 +197,16 @@ void JNICALL nativeTerminateContext(JNIEnv* env, jobject obj, jlong native_map_v
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminateContext");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->terminateContext();
COFFEE_TRY_JNI(env, native_map_view->terminateContext());
}
void JNICALL nativeCreateSurface(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jobject surface) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCreateSurface");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
if (!native_map_view->createSurface(ANativeWindow_fromSurface(env, surface))) {
bool ret = false;
COFFEE_TRY_JNI(env, native_map_view->createSurface(ANativeWindow_fromSurface(env, surface)));
if (!ret) {
throw_error(env, "Unable to create GL surface.");
}
}
@@ -206,84 +215,86 @@ void JNICALL nativeDestroySurface(JNIEnv* env, jobject obj, jlong native_map_vie
mbgl::Log::Debug(mbgl::Event::JNI, "nativeDestroySurface");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->destroySurface();
COFFEE_TRY_JNI(env, native_map_view->destroySurface());
}
void JNICALL nativeStart(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStart");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->start();
COFFEE_TRY_JNI(env, native_map_view->start());
}
void JNICALL nativeStop(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStop");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->stop();
COFFEE_TRY_JNI(env, native_map_view->stop());
}
void JNICALL nativePause(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativePause");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->pause();
COFFEE_TRY_JNI(env, native_map_view->pause());
}
void JNICALL nativeResume(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResume");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->resume();
COFFEE_TRY_JNI(env, native_map_view->resume());
}
void JNICALL nativeRun(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRun");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().run();
COFFEE_TRY_JNI(env, native_map_view->getMap().run());
}
void JNICALL nativeRerender(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRerender");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().rerender();
COFFEE_TRY_JNI(env, native_map_view->getMap().rerender());
}
void JNICALL nativeUpdate(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeUpdate");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().update();
COFFEE_TRY_JNI(env, native_map_view->getMap().update());
}
void JNICALL nativeCleanup(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCleanup");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().cleanup();
COFFEE_TRY_JNI(env, native_map_view->getMap().cleanup());
}
void JNICALL nativeTerminate(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeTerminate");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().terminate();
COFFEE_TRY_JNI(env, native_map_view->getMap().terminate());
}
jboolean JNICALL nativeNeedsSwap(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeNeedsSwap");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().needsSwap();
jboolean ret = false;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().needsSwap());
return ret;
}
void JNICALL nativeSwapped(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSwapped");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().swapped();
COFFEE_TRY_JNI(env, (native_map_view->getMap().swapped()));
}
void JNICALL nativeResize(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jint width, jint height, jfloat ratio) {
@@ -294,7 +305,7 @@ void JNICALL nativeResize(JNIEnv* env, jobject obj, jlong native_map_view_ptr, j
assert(width <= UINT16_MAX);
assert(height <= UINT16_MAX);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().resize(width, height, ratio);
COFFEE_TRY_JNI(env, native_map_view->getMap().resize(width, height, ratio));
}
void JNICALL nativeResize(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jint width, jint height, jfloat ratio, jint fb_width, jint fb_height) {
@@ -309,21 +320,23 @@ void JNICALL nativeResize(JNIEnv* env, jobject obj, jlong native_map_view_ptr, j
assert(fb_width <= UINT16_MAX);
assert(fb_height <= UINT16_MAX);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().resize(width, height, ratio, fb_width, fb_height);
COFFEE_TRY_JNI(env, native_map_view->getMap().resize(width, height, ratio, fb_width, fb_height));
}
void JNICALL nativeSetAppliedClasses(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jobject classes) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAppliedClasses");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setAppliedClasses(std_vector_string_from_jobject(env, classes));
COFFEE_TRY_JNI(env, native_map_view->getMap().setAppliedClasses(std_vector_string_from_jobject(env, classes)));
}
jobject JNICALL nativeGetAppliedClasses(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAppliedClasses");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return std_vector_string_to_jobject(env, native_map_view->getMap().getAppliedClasses());
jobject ret = nullptr;
COFFEE_TRY_JNI(env, ret = std_vector_string_to_jobject(env, native_map_view->getMap().getAppliedClasses()));
return ret;
}
void JNICALL nativeSetDefaultTransitionDuration(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jlong duration_milliseconds) {
@@ -331,56 +344,60 @@ void JNICALL nativeSetDefaultTransitionDuration(JNIEnv* env, jobject obj, jlong
assert(native_map_view_ptr != 0);
assert(duration_milliseconds >= 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setDefaultTransitionDuration(duration_milliseconds);
COFFEE_TRY_JNI(env, native_map_view->getMap().setDefaultTransitionDuration(duration_milliseconds));
}
void JNICALL nativeSetStyleURL(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jstring url) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetStyleURL");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setStyleURL(std_string_from_jstring(env, url));
COFFEE_TRY_JNI(env, native_map_view->getMap().setStyleURL(std_string_from_jstring(env, url)));
}
void JNICALL nativeSetStyleJSON(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jstring new_style_json, jstring base) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetStyleJSON");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setStyleJSON(std_string_from_jstring(env, new_style_json), std_string_from_jstring(env, base));
COFFEE_TRY_JNI(env, native_map_view->getMap().setStyleJSON(std_string_from_jstring(env, new_style_json), std_string_from_jstring(env, base)));
}
jstring JNICALL nativeGetStyleJSON(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetStyleJSON");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return std_string_to_jstring(env, native_map_view->getMap().getStyleJSON());
jstring ret = nullptr;
COFFEE_TRY_JNI(env, ret = std_string_to_jstring(env, native_map_view->getMap().getStyleJSON()));
return ret;
}
void JNICALL nativeSetAccessToken(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jstring access_token) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAccessToken");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setAccessToken(std_string_from_jstring(env, access_token));
COFFEE_TRY_JNI(env, native_map_view->getMap().setAccessToken(std_string_from_jstring(env, access_token)));
}
jstring JNICALL nativeGetAccessToken(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAccessToken");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return std_string_to_jstring(env, native_map_view->getMap().getAccessToken());
jstring ret = nullptr;
COFFEE_TRY_JNI(env, ret = std_string_to_jstring(env, native_map_view->getMap().getAccessToken()));
return ret;
}
void JNICALL nativeCancelTransitions(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCancelTransitions");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().cancelTransitions();
COFFEE_TRY_JNI(env, native_map_view->getMap().cancelTransitions());
}
void JNICALL nativeMoveBy(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble dx, jdouble dy, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeMoveBy");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().moveBy(dx, dy, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().moveBy(dx, dy, duration));
}
void JNICALL nativeSetLonLat(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jobject lon_lat, jdouble duration) {
@@ -400,15 +417,15 @@ void JNICALL nativeSetLonLat(JNIEnv* env, jobject obj, jlong native_map_view_ptr
return;
}
native_map_view->getMap().setLonLat(lon, lat, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().setLonLat(lon, lat, duration));
}
jobject JNICALL nativeGetLonLat(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLonLat");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
double lon, lat;
native_map_view->getMap().getLonLat(lon, lat);
double lon = 0.0, lat = 0.0;
COFFEE_TRY_JNI(env, native_map_view->getMap().getLonLat(lon, lat));
jobject ret = env->NewObject(lon_lat_class, lon_lat_constructor_id, lon, lat);
if (ret == nullptr) {
@@ -423,56 +440,60 @@ void JNICALL nativeStartPanning(JNIEnv* env, jobject obj, jlong native_map_view_
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartPanning");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().startPanning();
COFFEE_TRY_JNI(env, native_map_view->getMap().startPanning());
}
void JNICALL nativeStopPanning(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopPanning");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().stopPanning();
COFFEE_TRY_JNI(env, native_map_view->getMap().stopPanning());
}
void JNICALL nativeResetPosition(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetPosition");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().resetPosition();
COFFEE_TRY_JNI(env, native_map_view->getMap().resetPosition());
}
void JNICALL nativeScaleBy(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble ds, jdouble cx, jdouble cy, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeScaleBy");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().scaleBy(ds, cx, cy, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().scaleBy(ds, cx, cy, duration));
}
void JNICALL nativeSetScale(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble scale, jdouble cx, jdouble cy, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetScale");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setScale(scale, cx, cy, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().setScale(scale, cx, cy, duration));
}
jdouble JNICALL nativeGetScale(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetScale");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getScale();
jdouble ret = 0.0;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getScale());
return ret;
}
void JNICALL nativeSetZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble zoom, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setZoom(zoom, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().setZoom(zoom, duration));
}
jdouble JNICALL nativeGetZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getZoom();
jdouble ret = 0.0;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getZoom());
return ret;
}
void JNICALL nativeSetLonLatZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jobject lon_lat_zoom, jdouble duration) {
@@ -498,15 +519,15 @@ void JNICALL nativeSetLonLatZoom(JNIEnv* env, jobject obj, jlong native_map_view
return;
}
native_map_view->getMap().setLonLatZoom(lon, lat, zoom, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().setLonLatZoom(lon, lat, zoom, duration));
}
jobject JNICALL nativeGetLonLatZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLonLatZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
double lon, lat, zoom;
native_map_view->getMap().getLonLatZoom(lon, lat, zoom);
double lon = 0.0, lat = 0.0, zoom = 0.0;
COFFEE_TRY_JNI(env, native_map_view->getMap().getLonLatZoom(lon, lat, zoom));
jobject ret = env->NewObject(lon_lat_zoom_class, lon_lat_zoom_constructor_id, lon, lat, zoom);
if (ret == nullptr) {
@@ -521,119 +542,129 @@ void JNICALL nativeResetZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().resetZoom();
COFFEE_TRY_JNI(env, native_map_view->getMap().resetZoom());
}
void JNICALL nativeStartScaling(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartScaling");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().startScaling();
COFFEE_TRY_JNI(env, native_map_view->getMap().startScaling());
}
void JNICALL nativeStopScaling(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopScaling");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().stopScaling();
COFFEE_TRY_JNI(env, native_map_view->getMap().stopScaling());
}
jdouble JNICALL nativeGetMinZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetMinZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getMinZoom();
jdouble ret = 0.0;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getMinZoom());
return ret;
}
jdouble JNICALL nativeGetMaxZoom(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetMaxZoom");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getMaxZoom();
jdouble ret = 0.0;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getMaxZoom());
return ret;
}
void JNICALL nativeRotateBy(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble sx, jdouble sy, jdouble ex, jdouble ey, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRotateBy");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().rotateBy(sx, sy, ex, ey, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().rotateBy(sx, sy, ex, ey, duration));
}
void JNICALL nativeSetBearing(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble degrees, jdouble duration) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetBearing");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setBearing(degrees, duration);
COFFEE_TRY_JNI(env, native_map_view->getMap().setBearing(degrees, duration));
}
void JNICALL nativeSetBearing(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jdouble degrees, jdouble cx, jdouble cy) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetBearing");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setBearing(degrees, cx, cy);
COFFEE_TRY_JNI(env, native_map_view->getMap().setBearing(degrees, cx, cy));
}
jdouble JNICALL nativeGetBearing(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetBearing");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getBearing();
jdouble ret = 0.0;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getBearing());
return ret;
}
void JNICALL nativeResetNorth(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeResetNorth");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().resetNorth();
COFFEE_TRY_JNI(env, native_map_view->getMap().resetNorth());
}
void JNICALL nativeStartRotating(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStartRotating");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().startRotating();
COFFEE_TRY_JNI(env, native_map_view->getMap().startRotating());
}
void JNICALL nativeStopRotating(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeStopRotating");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().stopRotating();
COFFEE_TRY_JNI(env, native_map_view->getMap().stopRotating());
}
jboolean JNICALL nativeCanRotate(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeCanRotate");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().canRotate();
jboolean ret = false;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().canRotate());
return ret;
}
void JNICALL nativeSetDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jboolean debug) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetDebug");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setDebug(debug);
COFFEE_TRY_JNI(env, native_map_view->getMap().setDebug(debug));
}
void JNICALL nativeToggleDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeToggleDebug");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().toggleDebug();
COFFEE_TRY_JNI(env, native_map_view->getMap().toggleDebug());
}
jboolean JNICALL nativeGetDebug(JNIEnv* env, jobject obj, jlong native_map_view_ptr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetDebug");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
return native_map_view->getMap().getDebug();
jboolean ret = false;
COFFEE_TRY_JNI(env, ret = native_map_view->getMap().getDebug());
return ret;
}
void JNICALL nativeSetReachability(JNIEnv* env, jobject obj, jlong native_map_view_ptr, jboolean status) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetReachability");
assert(native_map_view_ptr != 0);
NativeMapView* native_map_view = reinterpret_cast<NativeMapView*>(native_map_view_ptr);
native_map_view->getMap().setReachability(status);
COFFEE_TRY_JNI(env, native_map_view->getMap().setReachability(status));
}
}
@@ -645,7 +676,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
mbgl::Log::Debug(mbgl::Event::JNI, "JNI_OnLoad");
JNIEnv* env = nullptr;
JNIEnv* env = nullptr;
jint ret = vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
if (ret != JNI_OK) {
mbgl::Log::Error(mbgl::Event::JNI, "GetEnv() failed with %i", ret);