summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-01-28 22:08:53 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-01-28 22:23:07 -0800
commit6b3b3f3ff640e880c01aa5ac8a80eda4a309914b (patch)
tree03a1a7b625a2673bd6718179a0bd1a80ce3e625a /platform
parent8cdd02bc8fac9f6bd63b8b943119ebdb6f480ac9 (diff)
downloadqtlocation-mapboxgl-6b3b3f3ff640e880c01aa5ac8a80eda4a309914b.tar.gz
[ios] Debug mask
Ported MGLMapDebugMaskOptions from the OS X SDK. Deprecated debugActive and -cycleDebugOptions.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/src/MGLMapView.mm57
1 files changed, 50 insertions, 7 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 2851efecd3..c5abf5a600 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -219,7 +219,6 @@ public:
#pragma mark - Setup & Teardown -
-@dynamic debugActive;
mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
return std::chrono::duration_cast<mbgl::Duration>(std::chrono::duration<NSTimeInterval>(duration));
@@ -967,7 +966,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
self.glSnapshotView.image = self.glView.snapshot;
self.glSnapshotView.hidden = NO;
- if (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug && [self.glSnapshotView.subviews count] == 0)
+ if (self.debugMask && [self.glSnapshotView.subviews count] == 0)
{
UIView *snapshotTint = [[UIView alloc] initWithFrame:self.glSnapshotView.bounds];
snapshotTint.autoresizingMask = self.glSnapshotView.autoresizingMask;
@@ -1641,17 +1640,61 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
return [NSSet setWithObject:@"allowsTilting"];
}
+- (MGLMapDebugMaskOptions)debugMask
+{
+ mbgl::MapDebugOptions options = _mbglMap->getDebug();
+ MGLMapDebugMaskOptions mask = 0;
+ if (options & mbgl::MapDebugOptions::TileBorders)
+ {
+ mask |= MGLMapDebugTileBoundariesMask;
+ }
+ if (options & mbgl::MapDebugOptions::ParseStatus)
+ {
+ mask |= MGLMapDebugTileInfoMask;
+ }
+ if (options & mbgl::MapDebugOptions::Timestamps)
+ {
+ mask |= MGLMapDebugTimestampsMask;
+ }
+ if (options & mbgl::MapDebugOptions::Collision)
+ {
+ mask |= MGLMapDebugCollisionBoxesMask;
+ }
+ return mask;
+}
+
+- (void)setDebugMask:(MGLMapDebugMaskOptions)debugMask
+{
+ mbgl::MapDebugOptions options = mbgl::MapDebugOptions::NoDebug;
+ if (debugMask & MGLMapDebugTileBoundariesMask)
+ {
+ options |= mbgl::MapDebugOptions::TileBorders;
+ }
+ if (debugMask & MGLMapDebugTileInfoMask)
+ {
+ options |= mbgl::MapDebugOptions::ParseStatus;
+ }
+ if (debugMask & MGLMapDebugTimestampsMask)
+ {
+ options |= mbgl::MapDebugOptions::Timestamps;
+ }
+ if (debugMask & MGLMapDebugCollisionBoxesMask)
+ {
+ options |= mbgl::MapDebugOptions::Collision;
+ }
+ _mbglMap->setDebug(options);
+}
+
- (void)setDebugActive:(BOOL)debugActive
{
- _mbglMap->setDebug(debugActive ? mbgl::MapDebugOptions::TileBorders
- | mbgl::MapDebugOptions::ParseStatus
- | mbgl::MapDebugOptions::Collision
- : mbgl::MapDebugOptions::NoDebug);
+ self.debugMask = debugActive ? (MGLMapDebugTileBoundariesMask |
+ MGLMapDebugTileInfoMask |
+ MGLMapDebugCollisionBoxesMask) : 0;
}
- (BOOL)isDebugActive
{
- return (_mbglMap->getDebug() != mbgl::MapDebugOptions::NoDebug);
+ return self.debugMask;
}
- (void)resetNorth