summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-26 22:38:14 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-27 17:47:02 +0200
commit1f0820c8e82810fb957cb1cd17fb4327debfc0e5 (patch)
tree976533b4a2b03ab033143ebcd013199222c7a9ca /include
parent044e92f5e8ff2049702aa9ff6bbf4eecf9d86fa7 (diff)
downloadqtlocation-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 'include')
-rw-r--r--include/mbgl/ios/MGLMapView.h4
-rw-r--r--include/mbgl/map/map.hpp7
-rw-r--r--include/mbgl/map/mode.hpp28
-rw-r--r--include/mbgl/platform/darwin/settings_nsuserdefaults.hpp2
-rw-r--r--include/mbgl/platform/default/settings_json.hpp4
5 files changed, 35 insertions, 10 deletions
diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h
index edc3ca53f3..ff13ae3a2c 100644
--- a/include/mbgl/ios/MGLMapView.h
+++ b/include/mbgl/ios/MGLMapView.h
@@ -405,8 +405,8 @@ IB_DESIGNABLE
* The default value of this property is `NO`. */
@property (nonatomic, getter=isDebugActive) BOOL debugActive;
-/** Toggle the current value of debugActive. */
-- (void)toggleDebug;
+/** Cycle map debug options. */
+- (void)cycleDebugOptions;
/** Empties the in-memory tile cache. */
- (void)emptyMemoryCache;
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 35895660f2..43c3b1452e 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -168,12 +168,13 @@ public:
void onLowMemory();
// Debug
- void setDebug(bool value);
- void toggleDebug();
- bool getDebug() const;
+ 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 8b65baf99f..0fe2c46dd8 100644
--- a/include/mbgl/map/mode.hpp
+++ b/include/mbgl/map/mode.hpp
@@ -5,7 +5,9 @@
namespace mbgl {
-enum class MapMode : uint8_t {
+using EnumType = uint32_t;
+
+enum class MapMode : EnumType {
Continuous, // continually updating map
Still, // a once-off still image
};
@@ -14,18 +16,38 @@ enum class MapMode : uint8_t {
// being shared. In a shared GL context case, we need to make sure that the
// correct GL configurations are in use - they might have changed between render
// calls.
-enum class GLContextMode : uint8_t {
+enum class GLContextMode : EnumType {
Unique,
Shared,
};
// We can choose to constrain the map both horizontally or vertically, or only
// vertically e.g. while panning.
-enum class ConstrainMode : uint8_t {
+enum class ConstrainMode : EnumType {
HeightOnly,
WidthAndHeight,
};
+enum class MapDebugOptions : EnumType {
+ NoDebug = 0,
+ TileBorders = 1 << 1,
+ ParseStatus = 1 << 2,
+ Timestamps = 1 << 3,
+};
+
+inline MapDebugOptions operator| (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
+ return MapDebugOptions(static_cast<EnumType>(lhs) | static_cast<EnumType>(rhs));
+}
+
+inline MapDebugOptions& operator|=(MapDebugOptions& lhs, const MapDebugOptions& rhs) {
+ lhs = lhs | rhs;
+ return lhs;
+}
+
+inline bool operator& (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
+ return static_cast<EnumType>(lhs) & static_cast<EnumType>(rhs);
+}
+
} // namespace mbgl
#endif // MBGL_MAP_MODE
diff --git a/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp b/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp
index 615320ee55..6364f249dd 100644
--- a/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp
+++ b/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp
@@ -22,7 +22,7 @@ public:
MGLUserTrackingMode userTrackingMode = MGLUserTrackingModeNone;
bool showsUserLocation = false;
- bool debug = false;
+ uint32_t debug = 0;
};
}
diff --git a/include/mbgl/platform/default/settings_json.hpp b/include/mbgl/platform/default/settings_json.hpp
index 154a7e3769..ceec1e7fde 100644
--- a/include/mbgl/platform/default/settings_json.hpp
+++ b/include/mbgl/platform/default/settings_json.hpp
@@ -1,6 +1,8 @@
#ifndef MBGL_JSON_SETTINGS
#define MBGL_JSON_SETTINGS
+#include <mbgl/map/mode.hpp>
+
namespace mbgl {
class Settings_JSON {
@@ -17,7 +19,7 @@ public:
double bearing = 0;
double pitch = 0;
- bool debug = false;
+ EnumType debug = 0;
};
}