diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 4757bb398c5..a3794962c6c 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -120,7 +120,6 @@ class Map : private util::noncopyable { // Debug void setDebug(MapDebugOptions); - void cycleDebugOptions(); MapDebugOptions getDebug() const; bool isFullyLoaded() const; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 2b0971599d7..d475d9b0d39 100644 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -595,10 +595,6 @@ void NativeMapView::setDebug(JNIEnv&, jni::jboolean debug) { map->setDebug(debugOptions); } -void NativeMapView::cycleDebugOptions(JNIEnv&) { - map->cycleDebugOptions(); -} - jni::jboolean NativeMapView::getDebug(JNIEnv&) { return map->getDebug() != DebugOptions::NoDebug; } @@ -1120,7 +1116,6 @@ void NativeMapView::registerNative(jni::JNIEnv& env) { METHOD(&NativeMapView::updateMarker, "nativeUpdateMarker"), METHOD(&NativeMapView::addMarkers, "nativeAddMarkers"), METHOD(&NativeMapView::setDebug, "nativeSetDebug"), - METHOD(&NativeMapView::cycleDebugOptions, "nativeCycleDebugOptions"), METHOD(&NativeMapView::getDebug, "nativeGetDebug"), METHOD(&NativeMapView::isFullyLoaded, "nativeIsFullyLoaded"), METHOD(&NativeMapView::onLowMemory, "nativeOnLowMemory"), diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 5a340d12875..11676981a2c 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -151,8 +151,6 @@ class NativeMapView : public MapObserver { void setDebug(JNIEnv&, jni::jboolean); - void cycleDebugOptions(JNIEnv&); - jni::jboolean getDebug(JNIEnv&); jni::jboolean isFullyLoaded(JNIEnv&); diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 9a2fefaadeb..74dda734c05 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -180,7 +180,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, glfwSetWindowShouldClose(window, true); break; case GLFW_KEY_TAB: - view->map->cycleDebugOptions(); + view->cycleDebugOptions(); break; case GLFW_KEY_X: if (!mods) @@ -496,6 +496,30 @@ void GLFWView::updateAnimatedAnnotations() { } } +void GLFWView::cycleDebugOptions() { + auto debug = map->getDebug(); +#if not MBGL_USE_GLES2 + if (debug & mbgl::MapDebugOptions::StencilClip) + debug = mbgl::MapDebugOptions::NoDebug; + else if (debug & mbgl::MapDebugOptions::Overdraw) + debug = mbgl::MapDebugOptions::StencilClip; +#else + if (debug & mbgl::MapDebugOptions::Overdraw) debug = mbgl::MapDebugOptions::NoDebug; +#endif // MBGL_USE_GLES2 + else if (debug & mbgl::MapDebugOptions::Collision) + debug = mbgl::MapDebugOptions::Overdraw; + else if (debug & mbgl::MapDebugOptions::Timestamps) + debug = debug | mbgl::MapDebugOptions::Collision; + else if (debug & mbgl::MapDebugOptions::ParseStatus) + debug = debug | mbgl::MapDebugOptions::Timestamps; + else if (debug & mbgl::MapDebugOptions::TileBorders) + debug = debug | mbgl::MapDebugOptions::ParseStatus; + else + debug = mbgl::MapDebugOptions::TileBorders; + + map->setDebug(debug); +} + void GLFWView::clearAnnotations() { for (const auto& id : annotationIDs) { map->removeAnnotation(id); diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp index dbe6ceb0463..9233bddfb97 100644 --- a/platform/glfw/glfw_view.hpp +++ b/platform/glfw/glfw_view.hpp @@ -88,6 +88,7 @@ class GLFWView : public mbgl::MapObserver { void updateAnimatedAnnotations(); void toggleCustomSource(); + void cycleDebugOptions(); void clearAnnotations(); void popAnnotation(); diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index 6171c8bf350..0a143280d30 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -400,9 +400,6 @@ void MapWindow::keyPressEvent(QKeyEvent *ev) } } break; - case Qt::Key_Tab: - m_map->cycleDebugOptions(); - break; default: break; } diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index 7441b1aa181..337991aa1c1 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -153,8 +153,6 @@ class Q_MAPBOXGL_EXPORT QMapboxGL : public QObject qreal pixelRatio = 1); virtual ~QMapboxGL(); - void cycleDebugOptions(); - QString styleJson() const; QString styleUrl() const; diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 1fdfb6ef3af..a4cadf81000 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -582,15 +582,6 @@ QMapboxGL::~QMapboxGL() delete d_ptr; } -/*! - Cycles through several debug options like showing the tile borders, - tile numbers, expiration time and wireframe. -*/ -void QMapboxGL::cycleDebugOptions() -{ - d_ptr->mapObj->cycleDebugOptions(); -} - /*! \property QMapboxGL::styleJson \brief the map style JSON. diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 3ea2fc43c6e..2e585c3effd 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -434,30 +434,6 @@ void Map::setDebug(MapDebugOptions debugOptions) { impl->onUpdate(); } -void Map::cycleDebugOptions() { -#if not MBGL_USE_GLES2 - if (impl->debugOptions & MapDebugOptions::StencilClip) - impl->debugOptions = MapDebugOptions::NoDebug; - else if (impl->debugOptions & MapDebugOptions::Overdraw) - impl->debugOptions = MapDebugOptions::StencilClip; -#else - if (impl->debugOptions & MapDebugOptions::Overdraw) - impl->debugOptions = MapDebugOptions::NoDebug; -#endif // MBGL_USE_GLES2 - else if (impl->debugOptions & MapDebugOptions::Collision) - impl->debugOptions = MapDebugOptions::Overdraw; - else if (impl->debugOptions & MapDebugOptions::Timestamps) - impl->debugOptions = impl->debugOptions | MapDebugOptions::Collision; - else if (impl->debugOptions & MapDebugOptions::ParseStatus) - impl->debugOptions = impl->debugOptions | MapDebugOptions::Timestamps; - else if (impl->debugOptions & MapDebugOptions::TileBorders) - impl->debugOptions = impl->debugOptions | MapDebugOptions::ParseStatus; - else - impl->debugOptions = MapDebugOptions::TileBorders; - - impl->onUpdate(); -} - MapDebugOptions Map::getDebug() const { return impl->debugOptions; }