Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Remove Map::cycleDebugOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Dec 4, 2019
1 parent 2753663 commit da1d89a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 47 deletions.
1 change: 0 additions & 1 deletion include/mbgl/map/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Map : private util::noncopyable {

// Debug
void setDebug(MapDebugOptions);
void cycleDebugOptions();
MapDebugOptions getDebug() const;

bool isFullyLoaded() const;
Expand Down
5 changes: 0 additions & 5 deletions platform/android/src/native_map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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"),
Expand Down
2 changes: 0 additions & 2 deletions platform/android/src/native_map_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ class NativeMapView : public MapObserver {

void setDebug(JNIEnv&, jni::jboolean);

void cycleDebugOptions(JNIEnv&);

jni::jboolean getDebug(JNIEnv&);

jni::jboolean isFullyLoaded(JNIEnv&);
Expand Down
26 changes: 25 additions & 1 deletion platform/glfw/glfw_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions platform/glfw/glfw_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class GLFWView : public mbgl::MapObserver {
void updateAnimatedAnnotations();
void toggleCustomSource();

void cycleDebugOptions();
void clearAnnotations();
void popAnnotation();

Expand Down
3 changes: 0 additions & 3 deletions platform/qt/app/mapwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
}
}
break;
case Qt::Key_Tab:
m_map->cycleDebugOptions();
break;
default:
break;
}
Expand Down
2 changes: 0 additions & 2 deletions platform/qt/include/qmapboxgl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ class Q_MAPBOXGL_EXPORT QMapboxGL : public QObject
qreal pixelRatio = 1);
virtual ~QMapboxGL();

void cycleDebugOptions();

QString styleJson() const;
QString styleUrl() const;

Expand Down
9 changes: 0 additions & 9 deletions platform/qt/src/qmapboxgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 0 additions & 24 deletions src/mbgl/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit da1d89a

Please sign in to comment.