[core] Remove Map::cycleDebugOptions

This commit is contained in:
Bruno de Oliveira Abinader
2019-12-04 09:46:50 +02:00
parent 27536631d0
commit 1e2cd1e086
9 changed files with 26 additions and 47 deletions

View File

@@ -120,7 +120,6 @@ public:
// Debug
void setDebug(MapDebugOptions);
void cycleDebugOptions();
MapDebugOptions getDebug() const;
bool isFullyLoaded() const;

View File

@@ -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"),

View File

@@ -151,8 +151,6 @@ public:
void setDebug(JNIEnv&, jni::jboolean);
void cycleDebugOptions(JNIEnv&);
jni::jboolean getDebug(JNIEnv&);
jni::jboolean isFullyLoaded(JNIEnv&);

View File

@@ -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);

View File

@@ -88,6 +88,7 @@ private:
void updateAnimatedAnnotations();
void toggleCustomSource();
void cycleDebugOptions();
void clearAnnotations();
void popAnnotation();

View File

@@ -400,9 +400,6 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
}
}
break;
case Qt::Key_Tab:
m_map->cycleDebugOptions();
break;
default:
break;
}

View File

@@ -153,8 +153,6 @@ public:
qreal pixelRatio = 1);
virtual ~QMapboxGL();
void cycleDebugOptions();
QString styleJson() const;
QString styleUrl() const;

View File

@@ -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.

View File

@@ -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;
}