diff options
author | Jason Wray <jason@mapbox.com> | 2018-07-16 12:18:43 -0400 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2018-08-16 16:46:54 -0400 |
commit | 790b9f5c827101a47fd06fbfa944d36e3f0b285c (patch) | |
tree | 6c9b13cdd9ae36b03146c7010980355fd5efea32 /platform/ios/app | |
parent | 19325b0293dc99a641311ebabd55c9554d0ee38e (diff) | |
download | qtlocation-mapboxgl-790b9f5c827101a47fd06fbfa944d36e3f0b285c.tar.gz |
[ios] Add experimental frame rate measurements to MGLMapView
Includes: average frame rate, average frame render duration, and instantaneous frame render duration.
Diffstat (limited to 'platform/ios/app')
-rw-r--r-- | platform/ios/app/MBXViewController.m | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 71bad66aee..259c1191bc 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -9,6 +9,7 @@ #import "MBXEmbeddedMapViewController.h" #import <Mapbox/Mapbox.h> +#import "../src/MGLMapView_Experimental.h" #import <objc/runtime.h> @@ -195,7 +196,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { @property (nonatomic) BOOL customUserLocationAnnnotationEnabled; @property (nonatomic, getter=isLocalizingLabels) BOOL localizingLabels; @property (nonatomic) BOOL reuseQueueStatsEnabled; -@property (nonatomic) BOOL showZoomLevelEnabled; +@property (nonatomic) BOOL mapInfoHUDEnabled; @property (nonatomic) BOOL shouldLimitCameraChanges; @property (nonatomic) BOOL randomWalk; @end @@ -280,7 +281,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { [defaults setInteger:self.mapView.userTrackingMode forKey:@"MBXUserTrackingMode"]; [defaults setBool:self.mapView.showsUserLocation forKey:@"MBXShowsUserLocation"]; [defaults setInteger:self.mapView.debugMask forKey:@"MBXDebugMask"]; - [defaults setBool:self.showZoomLevelEnabled forKey:@"MBXShowsZoomLevelHUD"]; + [defaults setBool:self.mapInfoHUDEnabled forKey:@"MBXShowsZoomLevelHUD"]; [defaults synchronize]; } @@ -308,7 +309,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { } if ([defaults boolForKey:@"MBXShowsZoomLevelHUD"]) { - self.showZoomLevelEnabled = YES; + self.mapInfoHUDEnabled = YES; [self updateHUD]; } } @@ -439,7 +440,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { [NSString stringWithFormat:@"%@ Reuse Queue Stats", (_reuseQueueStatsEnabled ? @"Hide" :@"Show")], @"Start World Tour", @"Random Tour", - [NSString stringWithFormat:@"%@ Zoom/Pitch/Direction Label", (_showZoomLevelEnabled ? @"Hide" :@"Show")], + [NSString stringWithFormat:@"%@ Map Info HUD", (_mapInfoHUDEnabled ? @"Hide" :@"Show")], @"Embedded Map View", [NSString stringWithFormat:@"%@ Second Map", ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")], [NSString stringWithFormat:@"Show Labels in %@", (_localizingLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], @@ -657,14 +658,14 @@ CLLocationCoordinate2D randomWorldCoordinate() { { self.reuseQueueStatsEnabled = !self.reuseQueueStatsEnabled; self.hudLabel.hidden = !self.reuseQueueStatsEnabled; - self.showZoomLevelEnabled = NO; + self.mapInfoHUDEnabled = NO; [self updateHUD]; break; } case MBXSettingsMiscellaneousShowZoomLevel: { - self.showZoomLevelEnabled = !self.showZoomLevelEnabled; - self.hudLabel.hidden = !self.showZoomLevelEnabled; + self.mapInfoHUDEnabled = !self.mapInfoHUDEnabled; + self.hudLabel.hidden = !self.mapInfoHUDEnabled; self.reuseQueueStatsEnabled = NO; [self updateHUD]; break; @@ -2191,7 +2192,7 @@ CLLocationCoordinate2D randomWorldCoordinate() { } - (void)updateHUD { - if (!self.reuseQueueStatsEnabled && !self.showZoomLevelEnabled) return; + if (!self.reuseQueueStatsEnabled && !self.mapInfoHUDEnabled) return; if (self.hudLabel.hidden) self.hudLabel.hidden = NO; @@ -2203,8 +2204,11 @@ CLLocationCoordinate2D randomWorldCoordinate() { queuedAnnotations += queue.count; } hudString = [NSString stringWithFormat:@"Visible: %ld Queued: %ld", (unsigned long)self.mapView.visibleAnnotations.count, (unsigned long)queuedAnnotations]; - } else if (self.showZoomLevelEnabled) { - hudString = [NSString stringWithFormat:@"%.2f ∕ ↕\U0000FE0E%.f° ∕ %.f°", self.mapView.zoomLevel, self.mapView.camera.pitch, self.mapView.direction]; + } else if (self.mapInfoHUDEnabled) { + if (!self.mapView.experimental_enableFrameRateMeasurement) self.mapView.experimental_enableFrameRateMeasurement = YES; + hudString = [NSString stringWithFormat:@"%.f FPS (%.1fms) ∕ %.2f ∕ ↕\U0000FE0E%.f° ∕ %.f°", + roundf(self.mapView.averageFrameRate), self.mapView.averageFrameTime, + self.mapView.zoomLevel, self.mapView.camera.pitch, self.mapView.direction]; } [self.hudLabel setTitle:hudString forState:UIControlStateNormal]; |