diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-26 22:38:14 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-27 17:47:02 +0200 |
commit | 1f0820c8e82810fb957cb1cd17fb4327debfc0e5 (patch) | |
tree | 976533b4a2b03ab033143ebcd013199222c7a9ca /platform | |
parent | 044e92f5e8ff2049702aa9ff6bbf4eecf9d86fa7 (diff) | |
download | qtlocation-mapboxgl-1f0820c8e82810fb957cb1cd17fb4327debfc0e5.tar.gz |
[core] Added MapDebugOptions
Map debug options are now cycled up to all debug options enabled, then
back to none.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/jni.cpp | 12 | ||||
-rw-r--r-- | platform/default/glfw_view.cpp | 4 | ||||
-rw-r--r-- | platform/default/settings_json.cpp | 2 | ||||
-rw-r--r-- | platform/ios/MGLMapView.mm | 11 |
4 files changed, 17 insertions, 12 deletions
diff --git a/platform/android/jni.cpp b/platform/android/jni.cpp index 9b80013da2..f3181b2a83 100644 --- a/platform/android/jni.cpp +++ b/platform/android/jni.cpp @@ -375,6 +375,7 @@ std::pair<mbgl::AnnotationSegment, mbgl::ShapeAnnotation::Properties> annotation namespace { using namespace mbgl::android; +using DebugOptions = mbgl::MapDebugOptions; jlong JNICALL nativeCreate(JNIEnv *env, jobject obj, jstring cachePath_, jstring dataPath_, jstring apkPath_, jfloat pixelRatio, jint availableProcessors, jlong totalMemory) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeCreate"); @@ -1293,7 +1294,10 @@ void JNICALL nativeSetDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jb mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetDebug"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - nativeMapView->getMap().setDebug(debug); + + DebugOptions debugOptions = debug ? DebugOptions::TileBorders | DebugOptions::ParseStatus + : DebugOptions::NoDebug; + nativeMapView->getMap().setDebug(debugOptions); nativeMapView->enableFps(debug); } @@ -1301,15 +1305,15 @@ 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); - nativeMapView->getMap().toggleDebug(); - nativeMapView->enableFps(nativeMapView->getMap().getDebug()); + nativeMapView->getMap().cycleDebugOptions(); + nativeMapView->enableFps(nativeMapView->getMap().getDebug() != DebugOptions::NoDebug); } 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); - return nativeMapView->getMap().getDebug(); + return nativeMapView->getMap().getDebug() != DebugOptions::NoDebug; } void JNICALL nativeSetCollisionDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean debug) { diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index eae2c3610a..998eb64791 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -102,7 +102,7 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_) printf("- `Control` + mouse drag to rotate\n"); printf("- `Shift` + mouse drag to tilt\n"); printf("\n"); - printf("- Press `Tab` to toggle debug information\n"); + printf("- Press `Tab` to cycle through the map debug options\n"); printf("- Press `Esc` to quit\n"); printf("\n"); printf("================================================================================\n"); @@ -127,7 +127,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, glfwSetWindowShouldClose(window, true); break; case GLFW_KEY_TAB: - view->map->toggleDebug(); + view->map->cycleDebugOptions(); break; case GLFW_KEY_C: view->map->toggleCollisionDebug(); diff --git a/platform/default/settings_json.cpp b/platform/default/settings_json.cpp index 8c1c8ff739..2c1bb3d242 100644 --- a/platform/default/settings_json.cpp +++ b/platform/default/settings_json.cpp @@ -35,5 +35,5 @@ void Settings_JSON::clear() { zoom = 0; bearing = 0; pitch = 0; - debug = false; + debug = 0; } diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index c923adb160..d3faf8c099 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -747,7 +747,7 @@ std::chrono::steady_clock::duration durationInSeconds(float duration) self.glSnapshotView.image = self.glView.snapshot; self.glSnapshotView.hidden = NO; - if (_mbglMap->getDebug() && [self.glSnapshotView.subviews count] == 0) + if (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug && [self.glSnapshotView.subviews count] == 0) { UIView *snapshotTint = [[UIView alloc] initWithFrame:self.glSnapshotView.bounds]; snapshotTint.autoresizingMask = self.glSnapshotView.autoresizingMask; @@ -1502,13 +1502,14 @@ std::chrono::steady_clock::duration durationInSeconds(float duration) - (void)setDebugActive:(BOOL)debugActive { - _mbglMap->setDebug(debugActive); + _mbglMap->setDebug(debugActive ? mbgl::MapDebugOptions::TileBorders | mbgl::MapDebugOptions::ParseStatus + : mbgl::MapDebugOptions::NoDebug); _mbglMap->setCollisionDebug(debugActive); } - (BOOL)isDebugActive { - return (_mbglMap->getDebug() || _mbglMap->getCollisionDebug()); + return (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug || _mbglMap->getCollisionDebug()); } - (void)resetNorth @@ -1527,9 +1528,9 @@ std::chrono::steady_clock::duration durationInSeconds(float duration) _mbglMap->resetPosition(); } -- (void)toggleDebug +- (void)cycleDebugOptions { - _mbglMap->toggleDebug(); + _mbglMap->cycleDebugOptions(); _mbglMap->toggleCollisionDebug(); } |