summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-05-22 11:17:44 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-05-23 11:51:05 +0300
commit2865e7d35c92acc247937242821f7823599f623c (patch)
tree4bbccd7c8c6608756ab9319e92de55a89b33759d
parent7143408f69618828bb37b8f38d719d3ceeeec9c2 (diff)
downloadqtlocation-mapboxgl-2865e7d35c92acc247937242821f7823599f623c.tar.gz
[ios, osx] Added wireframe debugging mask
Added an option to MGLMapDebugMaskOptions for the new wireframe debugging mode and UI in the demo applications for toggling it.
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/app/MBXViewController.m25
-rw-r--r--platform/ios/src/MGLMapView.h3
-rw-r--r--platform/ios/src/MGLMapView.mm8
-rw-r--r--platform/osx/CHANGELOG.md1
-rw-r--r--platform/osx/app/Base.lproj/MainMenu.xib10
-rw-r--r--platform/osx/app/MapDocument.m9
-rw-r--r--platform/osx/src/MGLMapView.h4
-rw-r--r--platform/osx/src/MGLMapView.mm6
9 files changed, 56 insertions, 11 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index d931a09a06..2ede87f22c 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -28,6 +28,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Added `MGLCoordinateInCoordinateBounds()`, a function that tests whether or not a coordinate is in a given bounds. ([#5053](https://github.com/mapbox/mapbox-gl-native/pull/5053))
- An MGLAnnotationView can be repositioned in relation to the associated MGLAnnotation.coordinate by changing its `centerOffset` property. ([#5059](https://github.com/mapbox/mapbox-gl-native/issues/5059))
- An MGLAnnotationView can be rotated to match the rotation pitch of the associated map view.
+- Added a new option to `MGLMapDebugMaskOptions`, `MGLMapDebugWireframesMask`, that shows wireframes instead of the usual rendered output. ([#4359](https://github.com/mapbox/mapbox-gl-native/pull/4359))
## 3.2.2
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 02090eba3e..7236e7be9e 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -181,6 +181,9 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
((debugMask & MGLMapDebugCollisionBoxesMask)
? @"Hide Collision Boxes"
: @"Show Collision Boxes"),
+ ((debugMask & MGLMapDebugWireframesMask)
+ ? @"Hide Wireframes"
+ : @"Show Wireframes"),
@"Add 100 Points",
@"Add 1,000 Points",
@"Add 10,000 Points",
@@ -222,18 +225,22 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 5)
{
- [self parseFeaturesAddingCount:100];
+ self.mapView.debugMask ^= MGLMapDebugWireframesMask;
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 6)
{
- [self parseFeaturesAddingCount:1000];
+ [self parseFeaturesAddingCount:100];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 7)
{
- [self parseFeaturesAddingCount:10000];
+ [self parseFeaturesAddingCount:1000];
}
else if (buttonIndex == actionSheet.firstOtherButtonIndex + 8)
{
+ [self parseFeaturesAddingCount:10000];
+ }
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 9)
+ {
// PNW triangle
//
CLLocationCoordinate2D triangleCoordinates[3] =
@@ -299,19 +306,19 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
free(polygonCoordinates);
}
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 9)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 10)
{
[self startWorldTour:actionSheet];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 10)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 11)
{
[self presentAnnotationWithCustomCallout];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 11)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 12)
{
[self.mapView removeAnnotations:self.mapView.annotations];
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 12)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 13)
{
if (_isShowingCustomStyleLayer)
{
@@ -322,12 +329,12 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
[self insertCustomStyleLayer];
}
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 13)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14)
{
NSString *fileContents = [NSString stringWithContentsOfFile:[self telemetryDebugLogfilePath] encoding:NSUTF8StringEncoding error:nil];
NSLog(@"%@", fileContents);
}
- else if (buttonIndex == actionSheet.firstOtherButtonIndex + 14)
+ else if (buttonIndex == actionSheet.firstOtherButtonIndex + 15)
{
NSString *filePath = [self telemetryDebugLogfilePath];
if ([[NSFileManager defaultManager] isDeletableFileAtPath:filePath]) {
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index b6fd1c4ffd..3f54b07f41 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -42,6 +42,9 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of glyphs and symbols are shown as faint, green lines to help
diagnose collision and label placement issues. */
MGLMapDebugCollisionBoxesMask = 1 << 4,
+ /** Line widths, backgrounds, and fill colors are ignored to create a
+ wireframe effect. */
+ MGLMapDebugWireframesMask = 1 << 5,
};
/**
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 1b33e379af..dffc1add46 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1820,6 +1820,10 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
mask |= MGLMapDebugCollisionBoxesMask;
}
+ if (options & mbgl::MapDebugOptions::Wireframe)
+ {
+ mask |= MGLMapDebugWireframesMask;
+ }
return mask;
}
@@ -1842,6 +1846,10 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
options |= mbgl::MapDebugOptions::Collision;
}
+ if (debugMask & MGLMapDebugWireframesMask)
+ {
+ options |= mbgl::MapDebugOptions::Wireframe;
+ }
_mbglMap->setDebug(options);
}
diff --git a/platform/osx/CHANGELOG.md b/platform/osx/CHANGELOG.md
index d4b245b6c7..6dd7b5bb31 100644
--- a/platform/osx/CHANGELOG.md
+++ b/platform/osx/CHANGELOG.md
@@ -4,6 +4,7 @@
* Fixed an issue in which Mapbox.framework was nested inside another folder named Mapbox.framework. ([#4998](https://github.com/mapbox/mapbox-gl-native/pull/4998))
* Fixed a crash passing a mixture of point and shape annotations into `-[MGLMapView addAnnotations:]`. ([#5097](https://github.com/mapbox/mapbox-gl-native/pull/5097))
+* Added a new option to `MGLMapDebugMaskOptions`, `MGLMapDebugWireframesMask`, that shows wireframes instead of the usual rendered output. ([#4359](https://github.com/mapbox/mapbox-gl-native/pull/4359))
## 0.1.0
diff --git a/platform/osx/app/Base.lproj/MainMenu.xib b/platform/osx/app/Base.lproj/MainMenu.xib
index 1e11abb9ff..b37d1e154f 100644
--- a/platform/osx/app/Base.lproj/MainMenu.xib
+++ b/platform/osx/app/Base.lproj/MainMenu.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -461,6 +461,12 @@
<action selector="toggleCollisionBoxes:" target="-1" id="EYa-7n-iWZ"/>
</connections>
</menuItem>
+ <menuItem title="Show Wireframes" id="hSX-Be-8xC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleWireframes:" target="-1" id="usj-ug-upt"/>
+ </connections>
+ </menuItem>
<menuItem isSeparatorItem="YES" id="dYw-bb-tr1"/>
<menuItem title="Show Tooltips on Dropped Pins" id="uir-Rx-zmw">
<modifierMask key="keyEquivalentModifierMask"/>
diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m
index c75e1d68c7..df6aa98c33 100644
--- a/platform/osx/app/MapDocument.m
+++ b/platform/osx/app/MapDocument.m
@@ -244,6 +244,10 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
self.mapView.debugMask ^= MGLMapDebugCollisionBoxesMask;
}
+- (IBAction)toggleWireframes:(id)sender {
+ self.mapView.debugMask ^= MGLMapDebugWireframesMask;
+}
+
- (IBAction)toggleShowsToolTipsOnDroppedPins:(id)sender {
_showsToolTipsOnDroppedPins = !_showsToolTipsOnDroppedPins;
}
@@ -520,6 +524,11 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
menuItem.title = isShown ? @"Hide Collision Boxes" : @"Show Collision Boxes";
return YES;
}
+ if (menuItem.action == @selector(toggleWireframes:)) {
+ BOOL isShown = self.mapView.debugMask & MGLMapDebugWireframesMask;
+ menuItem.title = isShown ? @"Hide Wireframes" : @"Show Wireframes";
+ return YES;
+ }
if (menuItem.action == @selector(toggleShowsToolTipsOnDroppedPins:)) {
BOOL isShown = _showsToolTipsOnDroppedPins;
menuItem.title = isShown ? @"Hide Tooltips on Dropped Pins" : @"Show Tooltips on Dropped Pins";
diff --git a/platform/osx/src/MGLMapView.h b/platform/osx/src/MGLMapView.h
index 3a64dde7d5..a98853f6c2 100644
--- a/platform/osx/src/MGLMapView.h
+++ b/platform/osx/src/MGLMapView.h
@@ -20,6 +20,10 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of glyphs and symbols are shown as faint, green lines to help
diagnose collision and label placement issues. */
MGLMapDebugCollisionBoxesMask = 1 << 4,
+
+ /** Line widths, backgrounds, and fill colors are ignored to create a
+ wireframe effect. */
+ MGLMapDebugWireframesMask = 1 << 5,
};
@class MGLAnnotationImage;
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index 055512eb76..cdac60dd8e 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -2366,6 +2366,9 @@ public:
if (options & mbgl::MapDebugOptions::Collision) {
mask |= MGLMapDebugCollisionBoxesMask;
}
+ if (options & mbgl::MapDebugOptions::Wireframe) {
+ mask |= MGLMapDebugWireframesMask;
+ }
return mask;
}
@@ -2383,6 +2386,9 @@ public:
if (debugMask & MGLMapDebugCollisionBoxesMask) {
options |= mbgl::MapDebugOptions::Collision;
}
+ if (debugMask & MGLMapDebugWireframesMask) {
+ options |= mbgl::MapDebugOptions::Wireframe;
+ }
_mbglMap->setDebug(options);
}