[core] Added MapDebugOptions

Map debug options are now cycled up to all debug options enabled, then
back to none.
This commit is contained in:
Bruno de Oliveira Abinader
2015-11-26 22:38:14 +02:00
parent 044e92f5e8
commit 1f0820c8e8
23 changed files with 106 additions and 59 deletions

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ public:
MGLUserTrackingMode userTrackingMode = MGLUserTrackingModeNone;
bool showsUserLocation = false;
bool debug = false;
uint32_t debug = 0;
};
}

View File

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