summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java9
-rw-r--r--android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java18
-rw-r--r--include/mbgl/map/map.hpp3
-rw-r--r--include/mbgl/map/mode.hpp1
-rw-r--r--platform/android/jni.cpp26
-rw-r--r--platform/default/glfw_view.cpp4
-rw-r--r--platform/ios/MGLMapView.mm9
-rw-r--r--src/mbgl/map/map.cpp14
-rw-r--r--src/mbgl/map/map_data.hpp15
-rw-r--r--src/mbgl/map/source.cpp4
10 files changed, 16 insertions, 87 deletions
diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
index dba17ece6a..cad1ede048 100644
--- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
+++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
@@ -1306,7 +1306,7 @@ public final class MapView extends FrameLayout {
*/
@UiThread
public boolean isDebugActive() {
- return mNativeMapView.getDebug() || mNativeMapView.getCollisionDebug();
+ return mNativeMapView.getDebug();
}
/**
@@ -1319,20 +1319,19 @@ public final class MapView extends FrameLayout {
@UiThread
public void setDebugActive(boolean debugActive) {
mNativeMapView.setDebug(debugActive);
- mNativeMapView.setCollisionDebug(debugActive);
}
/**
- * Toggles whether the map debug information is shown.
+ * Cycles through the map debug options.
* <p/>
- * The value of {@link MapView#isDebugActive()} is toggled.
+ * The value of {@link MapView#isDebugActive()} reflects whether there are
+ * any map debug options enabled or disabled.
*
* @see MapView#isDebugActive()
*/
@UiThread
public void cycleDebugOptions() {
mNativeMapView.cycleDebugOptions();
- mNativeMapView.toggleCollisionDebug();
}
// True if map has finished loading the view
diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java
index d75b83cf8d..6f34ecc843 100644
--- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java
+++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java
@@ -409,18 +409,6 @@ final class NativeMapView {
return nativeGetDebug(mNativeMapViewPtr);
}
- public void setCollisionDebug(boolean debug) {
- nativeSetCollisionDebug(mNativeMapViewPtr, debug);
- }
-
- public void toggleCollisionDebug() {
- nativeToggleCollisionDebug(mNativeMapViewPtr);
- }
-
- public boolean getCollisionDebug() {
- return nativeGetCollisionDebug(mNativeMapViewPtr);
- }
-
public boolean isFullyLoaded() {
return nativeIsFullyLoaded(mNativeMapViewPtr);
}
@@ -614,12 +602,6 @@ final class NativeMapView {
private native boolean nativeGetDebug(long nativeMapViewPtr);
- private native void nativeSetCollisionDebug(long nativeMapViewPtr, boolean debug);
-
- private native void nativeToggleCollisionDebug(long nativeMapViewPtr);
-
- private native boolean nativeGetCollisionDebug(long nativeMapViewPtr);
-
private native boolean nativeIsFullyLoaded(long nativeMapViewPtr);
private native void nativeSetReachability(long nativeMapViewPtr, boolean status);
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 43c3b1452e..8401976e15 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -171,9 +171,6 @@ public:
void setDebug(MapDebugOptions);
void cycleDebugOptions();
MapDebugOptions getDebug() const;
- void setCollisionDebug(bool value);
- void toggleCollisionDebug();
- bool getCollisionDebug() const;
bool isFullyLoaded() const;
void dumpDebugLogs() const;
diff --git a/include/mbgl/map/mode.hpp b/include/mbgl/map/mode.hpp
index 0fe2c46dd8..c197b28589 100644
--- a/include/mbgl/map/mode.hpp
+++ b/include/mbgl/map/mode.hpp
@@ -33,6 +33,7 @@ enum class MapDebugOptions : EnumType {
TileBorders = 1 << 1,
ParseStatus = 1 << 2,
Timestamps = 1 << 3,
+ Collision = 1 << 4,
};
inline MapDebugOptions operator| (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
diff --git a/platform/android/jni.cpp b/platform/android/jni.cpp
index f3181b2a83..79281a0ade 100644
--- a/platform/android/jni.cpp
+++ b/platform/android/jni.cpp
@@ -1295,7 +1295,7 @@ void JNICALL nativeSetDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jb
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- DebugOptions debugOptions = debug ? DebugOptions::TileBorders | DebugOptions::ParseStatus
+ DebugOptions debugOptions = debug ? DebugOptions::TileBorders | DebugOptions::ParseStatus | DebugOptions::Collision
: DebugOptions::NoDebug;
nativeMapView->getMap().setDebug(debugOptions);
nativeMapView->enableFps(debug);
@@ -1316,27 +1316,6 @@ jboolean JNICALL nativeGetDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr
return nativeMapView->getMap().getDebug() != DebugOptions::NoDebug;
}
-void JNICALL nativeSetCollisionDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean debug) {
- mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetCollisionDebug");
- assert(nativeMapViewPtr != 0);
- NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- nativeMapView->getMap().setCollisionDebug(debug);
-}
-
-void JNICALL nativeToggleCollisionDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
- mbgl::Log::Debug(mbgl::Event::JNI, "nativeToggleCollisionDebug");
- assert(nativeMapViewPtr != 0);
- NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- nativeMapView->getMap().toggleCollisionDebug();
-}
-
-jboolean JNICALL nativeGetCollisionDebug(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
- mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetCollisionDebug");
- assert(nativeMapViewPtr != 0);
- NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- return nativeMapView->getMap().getCollisionDebug();
-}
-
jboolean JNICALL nativeIsFullyLoaded(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeIsFullyLoaded");
assert(nativeMapViewPtr != 0);
@@ -1955,9 +1934,6 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
{"nativeSetDebug", "(JZ)V", reinterpret_cast<void *>(&nativeSetDebug)},
{"nativeToggleDebug", "(J)V", reinterpret_cast<void *>(&nativeToggleDebug)},
{"nativeGetDebug", "(J)Z", reinterpret_cast<void *>(&nativeGetDebug)},
- {"nativeSetCollisionDebug", "(JZ)V", reinterpret_cast<void *>(&nativeSetCollisionDebug)},
- {"nativeToggleCollisionDebug", "(J)V", reinterpret_cast<void *>(&nativeToggleCollisionDebug)},
- {"nativeGetCollisionDebug", "(J)Z", reinterpret_cast<void *>(&nativeGetCollisionDebug)},
{"nativeIsFullyLoaded", "(J)Z", reinterpret_cast<void *>(&nativeIsFullyLoaded)},
{"nativeSetReachability", "(JZ)V", reinterpret_cast<void *>(&nativeSetReachability)},
{"nativeGetMetersPerPixelAtLatitude", "(JDD)D", reinterpret_cast<void *>(&nativeGetMetersPerPixelAtLatitude)},
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 998eb64791..4e00722e21 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -89,7 +89,6 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_)
printf("- Press `S` to cycle through bundled styles\n");
printf("- Press `X` to reset the transform\n");
printf("- Press `N` to reset north\n");
- printf("- Press `C` to toggle symbol collision debug boxes\n");
printf("- Press `R` to toggle any available `night` style class\n");
printf("\n");
printf("- Press `1` through `6` to add increasing numbers of point annotations for testing\n");
@@ -129,9 +128,6 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
case GLFW_KEY_TAB:
view->map->cycleDebugOptions();
break;
- case GLFW_KEY_C:
- view->map->toggleCollisionDebug();
- break;
case GLFW_KEY_X:
if (!mods)
view->map->resetPosition();
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index d3faf8c099..ad9a7e37e8 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -12,6 +12,7 @@
#include <mbgl/annotation/shape_annotation.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/map/camera.hpp>
+#include <mbgl/map/mode.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/platform/darwin/reachability.h>
#include <mbgl/storage/sqlite_cache.hpp>
@@ -1502,14 +1503,15 @@ std::chrono::steady_clock::duration durationInSeconds(float duration)
- (void)setDebugActive:(BOOL)debugActive
{
- _mbglMap->setDebug(debugActive ? mbgl::MapDebugOptions::TileBorders | mbgl::MapDebugOptions::ParseStatus
+ _mbglMap->setDebug(debugActive ? mbgl::MapDebugOptions::TileBorders
+ | mbgl::MapDebugOptions::ParseStatus
+ | mbgl::MapDebugOptions::Collision
: mbgl::MapDebugOptions::NoDebug);
- _mbglMap->setCollisionDebug(debugActive);
}
- (BOOL)isDebugActive
{
- return (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug || _mbglMap->getCollisionDebug());
+ return (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug);
}
- (void)resetNorth
@@ -1531,7 +1533,6 @@ std::chrono::steady_clock::duration durationInSeconds(float duration)
- (void)cycleDebugOptions
{
_mbglMap->cycleDebugOptions();
- _mbglMap->toggleCollisionDebug();
}
- (void)emptyMemoryCache
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 573500fd65..57f8c3e7f3 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -434,20 +434,6 @@ MapDebugOptions Map::getDebug() const {
return data->getDebug();
}
-void Map::setCollisionDebug(bool value) {
- data->setCollisionDebug(value);
- update(Update::Repaint);
-}
-
-void Map::toggleCollisionDebug() {
- data->toggleCollisionDebug();
- update(Update::Repaint);
-}
-
-bool Map::getCollisionDebug() const {
- return data->getCollisionDebug();
-}
-
bool Map::isFullyLoaded() const {
return context->invokeSync<bool>(&MapContext::isLoaded);
}
diff --git a/src/mbgl/map/map_data.hpp b/src/mbgl/map/map_data.hpp
index 9b02d372de..d8c1e5cb0d 100644
--- a/src/mbgl/map/map_data.hpp
+++ b/src/mbgl/map/map_data.hpp
@@ -55,8 +55,10 @@ public:
}
inline void cycleDebugOptions() {
- if (debugOptions & MapDebugOptions::Timestamps)
+ if (debugOptions & MapDebugOptions::Collision)
debugOptions = MapDebugOptions::NoDebug;
+ else if (debugOptions & MapDebugOptions::Timestamps)
+ debugOptions = debugOptions | MapDebugOptions::Collision;
else if (debugOptions & MapDebugOptions::ParseStatus)
debugOptions = debugOptions | MapDebugOptions::Timestamps;
else if (debugOptions & MapDebugOptions::TileBorders)
@@ -69,16 +71,6 @@ public:
debugOptions = debugOptions_;
}
- inline bool getCollisionDebug() const {
- return collisionDebug;
- }
- inline bool toggleCollisionDebug() {
- return collisionDebug ^= 1u;
- }
- inline void setCollisionDebug(bool value) {
- collisionDebug = value;
- }
-
inline TimePoint getAnimationTime() const {
// We're casting the TimePoint to and from a Duration because libstdc++
// has a bug that doesn't allow TimePoints to be atomic.
@@ -147,7 +139,6 @@ private:
std::vector<std::string> classes;
std::atomic<MapDebugOptions> debugOptions { MapDebugOptions::NoDebug };
- std::atomic<uint8_t> collisionDebug { false };
std::atomic<Duration> animationTime;
std::atomic<Duration> defaultFadeDuration;
std::atomic<Duration> defaultTransitionDuration;
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index 62014bd05d..4e8e60de51 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -519,7 +519,7 @@ bool Source::update(const TransformState& transformState,
for (auto& tilePtr : tilePtrs) {
tilePtr->data->redoPlacement(
- { transformState.getAngle(), transformState.getPitch(), data.getCollisionDebug() });
+ { transformState.getAngle(), transformState.getPitch(), data.getDebug() & MapDebugOptions::Collision });
}
updated = data.getAnimationTime();
@@ -562,7 +562,7 @@ void Source::tileLoadingCompleteCallback(const TileID& normalized_id, const Tran
return;
}
- tileData->redoPlacement({ transformState.getAngle(), transformState.getPitch(), data.getCollisionDebug() });
+ tileData->redoPlacement({ transformState.getAngle(), transformState.getPitch(), data.getDebug() & MapDebugOptions::Collision});
emitTileLoaded(true);
}