diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index d931a09a0..2ede87f22 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 02090eba3..7236e7be9 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,17 +225,21 @@ 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 // @@ -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 b6fd1c4ff..3f54b07f4 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 1b33e379a..dffc1add4 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 d4b245b6c..6dd7b5bb3 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 1e11abb9f..b37d1e154 100644 --- a/platform/osx/app/Base.lproj/MainMenu.xib +++ b/platform/osx/app/Base.lproj/MainMenu.xib @@ -1,7 +1,7 @@ - + - + @@ -461,6 +461,12 @@ + + + + + + diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index c75e1d68c..df6aa98c3 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 3a64dde7d..a98853f6c 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 055512eb7..cdac60dd8 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); }