diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-10-30 14:34:51 -0700 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-11-13 15:56:40 -0800 |
commit | 37c7d6ad87b2558cc3d916d6c21826cf13e59db9 (patch) | |
tree | 5d94c0af230e207fb29c37dacfaff74a42cae1ea | |
parent | ed11bba888c7b1911f397b06fff4dbf33239d531 (diff) | |
download | qtlocation-mapboxgl-37c7d6ad87b2558cc3d916d6c21826cf13e59db9.tar.gz |
[ios, macos] Add tracing logs.
-rw-r--r-- | platform/darwin/src/MGLGeometry_Private.h | 6 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 16 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 122 |
3 files changed, 133 insertions, 11 deletions
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h index 12640857f5..ae1b2c2fba 100644 --- a/platform/darwin/src/MGLGeometry_Private.h +++ b/platform/darwin/src/MGLGeometry_Private.h @@ -23,12 +23,6 @@ NS_INLINE NSString *NSStringFromCLLocationCoordinate2D(CLLocationCoordinate2D co return [NSString stringWithFormat:@"(lat: %f, lon: %f)", coordinate.latitude, coordinate.longitude]; } -NS_INLINE NSString *NSStringFromMGLCoordinateBounds(MGLCoordinateBounds bounds) { - return [NSString stringWithFormat:@"{SW%@, NE%@}", - NSStringFromCLLocationCoordinate2D(bounds.sw), - NSStringFromCLLocationCoordinate2D(bounds.ne)]; -} - /** Creates a new `MGLRadianCoordinate2D` from the given latitudinal and longitudinal. */ diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 437da3fd4f..7a5d6c1c64 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -25,6 +25,7 @@ #import "MGLImageSource.h" #import "MGLAttributionInfo_Private.h" +#import "MGLLoggingConfiguration_Private.h" #include <mbgl/map/map.hpp> #include <mbgl/util/default_styles.hpp> @@ -129,10 +130,12 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (instancetype)initWithRawStyle:(mbgl::style::Style *)rawStyle mapView:(MGLMapView *)mapView { if (self = [super init]) { + MGLLogInfo(@"Initializing %@", NSStringFromClass([self class])); _mapView = mapView; _rawStyle = rawStyle; _openGLLayers = [NSMutableDictionary dictionary]; _localizedLayersByIdentifier = [NSMutableDictionary dictionary]; + MGLLogDebug(@"Initializing with style name: %@ mapView: %@", self.name, mapView); } return self; } @@ -159,6 +162,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } - (void)setSources:(NSSet<__kindof MGLSource *> *)sources { + MGLLogDebug(@"Setting: %lu sources", sources.count); for (MGLSource *source in self.sources) { [self removeSource:source]; } @@ -177,6 +181,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (MGLSource *)sourceWithIdentifier:(NSString *)identifier { + MGLLogDebug(@"Querying source with identifier: %@", identifier); auto rawSource = self.rawStyle->getSource(identifier.UTF8String); return rawSource ? [self sourceFromMBGLSource:rawSource] : nil; @@ -206,6 +211,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)addSource:(MGLSource *)source { + MGLLogDebug(@"Adding source: %@", source); if (!source.rawSource) { [NSException raise:NSInvalidArgumentException format: @"The source %@ cannot be added to the style. " @@ -222,6 +228,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)removeSource:(MGLSource *)source { + MGLLogDebug(@"Removing source: %@", source); if (!source.rawSource) { [NSException raise:NSInvalidArgumentException format: @"The source %@ cannot be removed from the style. " @@ -263,6 +270,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } - (void)setLayers:(NSArray<__kindof MGLStyleLayer *> *)layers { + MGLLogDebug(@"Setting: %lu layers", layers.count); for (MGLStyleLayer *layer in self.layers) { [self removeLayer:layer]; } @@ -379,12 +387,14 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (MGLStyleLayer *)layerWithIdentifier:(NSString *)identifier { + MGLLogDebug(@"Querying layerWithIdentifier: %@", identifier); auto mbglLayer = self.rawStyle->getLayer(identifier.UTF8String); return mbglLayer ? [self layerFromMBGLLayer:mbglLayer] : nil; } - (void)removeLayer:(MGLStyleLayer *)layer { + MGLLogDebug(@"Removing layer: %@", layer); if (!layer.rawLayer) { [NSException raise:NSInvalidArgumentException format: @"The style layer %@ cannot be removed from the style. " @@ -398,6 +408,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)addLayer:(MGLStyleLayer *)layer { + MGLLogDebug(@"Adding layer: %@", layer); if (!layer.rawLayer) { [NSException raise:NSInvalidArgumentException format: @"The style layer %@ cannot be added to the style. " @@ -419,6 +430,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)insertLayer:(MGLStyleLayer *)layer belowLayer:(MGLStyleLayer *)sibling { + MGLLogDebug(@"Inseting layer: %@ belowLayer: %@", layer, sibling); if (!layer.rawLayer) { [NSException raise:NSInvalidArgumentException format: @@ -443,6 +455,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, } - (void)insertLayer:(MGLStyleLayer *)layer aboveLayer:(MGLStyleLayer *)sibling { + MGLLogDebug(@"Inseting layer: %@ aboveLayer: %@", layer, sibling); if (!layer.rawLayer) { [NSException raise:NSInvalidArgumentException format: @@ -496,6 +509,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)setImage:(MGLImage *)image forName:(NSString *)name { + MGLLogDebug(@"Setting image: %@ forName: %@", image, name); if (!image) { [NSException raise:NSInvalidArgumentException format:@"Cannot assign nil image to “%@”.", name]; @@ -510,6 +524,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (void)removeImageForName:(NSString *)name { + MGLLogDebug(@"Removing imageForName: %@", name); if (!name) { [NSException raise:NSInvalidArgumentException format:@"Cannot remove image with nil name."]; @@ -520,6 +535,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, - (MGLImage *)imageForName:(NSString *)name { + MGLLogDebug(@"Querying imageForName: %@", name); if (!name) { [NSException raise:NSInvalidArgumentException format:@"Cannot get image with nil name."]; diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index a7046e2505..a8b524c094 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -318,8 +318,11 @@ public: { if (self = [super initWithFrame:frame]) { + MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class])); + MGLLogDebug(@"Initializing frame: %@", NSStringFromCGRect(frame)); [self commonInit]; self.styleURL = nil; + MGLLogInfo(@"Finalizing %@ initialization.", NSStringFromClass([self class])); } return self; } @@ -328,8 +331,11 @@ public: { if (self = [super initWithFrame:frame]) { + MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class])); + MGLLogDebug(@"Initializing frame: %@ styleURL: %@", NSStringFromCGRect(frame), styleURL); [self commonInit]; self.styleURL = styleURL; + MGLLogInfo(@"Finalizing %@ initialization.", NSStringFromClass([self class])); } return self; } @@ -338,8 +344,10 @@ public: { if (self = [super initWithCoder:decoder]) { + MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class])); [self commonInit]; self.styleURL = nil; + MGLLogInfo(@"Finalizing %@ initialization.", NSStringFromClass([self class])); } return self; } @@ -384,6 +392,7 @@ public: } - (IBAction)reloadStyle:(__unused id)sender { + MGLLogInfo(@"Reloading style."); NSURL *styleURL = self.styleURL; _mbglMap->getStyle().loadURL(""); self.styleURL = styleURL; @@ -401,7 +410,6 @@ public: - (void)commonInit { - MGLLogInfo(@"Initializing."); _isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent; _opaque = NO; @@ -601,8 +609,6 @@ public: [MGLMapboxEvents pushEvent:MMEEventTypeMapLoad withAttributes:@{}]; } - MGLLogInfo(@"Initialization completed."); - } - (mbgl::Size)size @@ -729,11 +735,12 @@ public: [_locationManager stopUpdatingLocation]; [_locationManager stopUpdatingHeading]; _locationManager.delegate = nil; - + MGLLogInfo(@"Deallocating MGLMapView."); } - (void)setDelegate:(nullable id<MGLMapViewDelegate>)delegate { + MGLLogDebug(@"Setting delegate: %@", delegate); if (_delegate == delegate) return; _delegate = delegate; @@ -1260,6 +1267,7 @@ public: - (void)sleepGL:(__unused NSNotification *)notification { + MGLLogInfo(@"Entering background."); MGLAssertIsMainThread(); // Ideally we would wait until we actually received a memory warning but the bulk of the memory @@ -1304,6 +1312,7 @@ public: - (void)wakeGL:(__unused NSNotification *)notification { + MGLLogInfo(@"Entering foreground."); MGLAssertIsMainThread(); if (self.dormant && [UIApplication sharedApplication].applicationState != UIApplicationStateBackground) @@ -2389,6 +2398,7 @@ public: - (void)resetNorth { + MGLLogInfo(@"Resetting the map rotation to a northern heading — a direction of 0 degrees."); [self resetNorthAnimated:YES]; } @@ -2399,6 +2409,7 @@ public: - (void)resetPosition { + MGLLogInfo(@"Resetting the map to the current style’s default viewport."); auto camera = _mbglMap->getStyle().getDefaultCamera(); CGFloat pitch = *camera.pitch; CLLocationDirection heading = mbgl::util::wrap(*camera.angle, 0., 360.); @@ -2411,6 +2422,7 @@ public: - (void)setZoomEnabled:(BOOL)zoomEnabled { + MGLLogDebug(@"Setting zoomEnabled: %@", NSStringFromBOOL(zoomEnabled)); _zoomEnabled = zoomEnabled; self.pinch.enabled = zoomEnabled; self.doubleTap.enabled = zoomEnabled; @@ -2420,24 +2432,28 @@ public: - (void)setScrollEnabled:(BOOL)scrollEnabled { + MGLLogDebug(@"Setting scrollEnabled: %@", NSStringFromBOOL(scrollEnabled)); _scrollEnabled = scrollEnabled; self.pan.enabled = scrollEnabled; } - (void)setRotateEnabled:(BOOL)rotateEnabled { + MGLLogDebug(@"Setting rotateEnabled: %@", NSStringFromBOOL(rotateEnabled)); _rotateEnabled = rotateEnabled; self.rotate.enabled = rotateEnabled; } - (void)setPitchEnabled:(BOOL)pitchEnabled { + MGLLogDebug(@"Setting pitchEnabled: %@", NSStringFromBOOL(pitchEnabled)); _pitchEnabled = pitchEnabled; self.twoFingerDrag.enabled = pitchEnabled; } - (void)setShowsScale:(BOOL)showsScale { + MGLLogDebug(@"Setting showsScale: %@", NSStringFromBOOL(showsScale)); _showsScale = showsScale; self.scaleBar.hidden = !showsScale; @@ -2983,11 +2999,13 @@ public: - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated { + MGLLogDebug(@"Setting centerCoordinate: %@ animated: %@", NSStringFromCLLocationCoordinate2D(coordinate), NSStringFromBOOL(animated)); [self setCenterCoordinate:coordinate zoomLevel:self.zoomLevel animated:animated]; } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate { + MGLLogDebug(@"Setting centerCoordinate: %@", NSStringFromCLLocationCoordinate2D(centerCoordinate)); [self setCenterCoordinate:centerCoordinate animated:NO]; } @@ -2999,15 +3017,31 @@ public: - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated { + MGLLogDebug(@"Setting centerCoordinate: %@ zoomLevel: %f animated: %@", + NSStringFromCLLocationCoordinate2D(centerCoordinate), + zoomLevel, + NSStringFromBOOL(animated)); [self setCenterCoordinate:centerCoordinate zoomLevel:zoomLevel direction:self.direction animated:animated]; } -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated { +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated +{ + MGLLogDebug(@"Setting centerCoordinate: %@ zoomLevel: %f direction: %f animated: %@", + NSStringFromCLLocationCoordinate2D(centerCoordinate), + zoomLevel, + direction, + NSStringFromBOOL(animated)); [self setCenterCoordinate:centerCoordinate zoomLevel:zoomLevel direction:direction animated:animated completionHandler:NULL]; } - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting centerCoordinate: %@ zoomLevel: %f direction: %f animated: %@ completionHandler: %@", + NSStringFromCLLocationCoordinate2D(centerCoordinate), + zoomLevel, + direction, + NSStringFromBOOL(animated), + completion); self.userTrackingMode = MGLUserTrackingModeNone; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonProgrammatic; @@ -3079,11 +3113,13 @@ public: - (void)setZoomLevel:(double)zoomLevel { + MGLLogDebug(@"Setting zoomLevel: %f", zoomLevel); [self setZoomLevel:zoomLevel animated:NO]; } - (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated { + MGLLogDebug(@"Setting zoomLevel: %f animated: %@", zoomLevel, NSStringFromBOOL(animated)); if (zoomLevel == self.zoomLevel) return; [self cancelTransitions]; @@ -3098,6 +3134,7 @@ public: - (void)setMinimumZoomLevel:(double)minimumZoomLevel { + MGLLogDebug(@"Setting minimumZoomLevel: %f", minimumZoomLevel); _mbglMap->setMinZoom(minimumZoomLevel); } @@ -3108,6 +3145,7 @@ public: - (void)setMaximumZoomLevel:(double)maximumZoomLevel { + MGLLogDebug(@"Setting maximumZoomLevel: %f", maximumZoomLevel); _mbglMap->setMaxZoom(maximumZoomLevel); } @@ -3123,16 +3161,22 @@ public: - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds { + MGLLogDebug(@"Setting visibleCoordinateBounds: %@", MGLStringFromCoordinateBounds(bounds)); [self setVisibleCoordinateBounds:bounds animated:NO]; } - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated { + MGLLogDebug(@"Setting visibleCoordinateBounds: %@ animated: %@", MGLStringFromCoordinateBounds(bounds), NSStringFromBOOL(animated)); [self setVisibleCoordinateBounds:bounds edgePadding:UIEdgeInsetsZero animated:animated]; } - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated { + MGLLogDebug(@"Setting visibleCoordinateBounds: %@ edgePadding: %@ animated: %@", + MGLStringFromCoordinateBounds(bounds), + NSStringFromUIEdgeInsets(insets), + NSStringFromBOOL(animated)); CLLocationCoordinate2D coordinates[] = { {bounds.ne.latitude, bounds.sw.longitude}, bounds.sw, @@ -3147,6 +3191,11 @@ public: - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction animated:(BOOL)animated { + MGLLogDebug(@"Setting visibleCoordinateBounds: %@ edgePadding: %@ direction: %f animated: %@", + MGLStringFromCoordinateBounds(bounds), + NSStringFromUIEdgeInsets(insets), + direction, + NSStringFromBOOL(animated)); CLLocationCoordinate2D coordinates[] = { {bounds.ne.latitude, bounds.sw.longitude}, bounds.sw, @@ -3162,20 +3211,42 @@ public: - (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated { + MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ animated: %@", + count, + NSStringFromUIEdgeInsets(insets), + NSStringFromBOOL(animated)); [self setVisibleCoordinates:coordinates count:count edgePadding:insets direction:self.direction animated:animated]; } - (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction animated:(BOOL)animated { + MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ direction: %f animated: %@", + count, + NSStringFromUIEdgeInsets(insets), + direction, + NSStringFromBOOL(animated)); [self setVisibleCoordinates:coordinates count:count edgePadding:insets direction:direction duration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil]; } - (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function { + MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ direction: %f duration: %f animationTimingFunction: %@", + count, + NSStringFromUIEdgeInsets(insets), + direction, + duration, + function); [self setVisibleCoordinates:coordinates count:count edgePadding:insets direction:direction duration:duration animationTimingFunction:function completionHandler:NULL]; } - (void)setVisibleCoordinates:(const CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting: %lu coordinates edgePadding: %@ direction: %f duration: %f animationTimingFunction: %@ completionHandler: %@", + count, + NSStringFromUIEdgeInsets(insets), + direction, + duration, + function, + completion); self.userTrackingMode = MGLUserTrackingModeNone; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonProgrammatic; @@ -3248,6 +3319,7 @@ public: - (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated { + MGLLogDebug(@"Setting direction: %f animated: %@", direction, NSStringFromBOOL(animated)); if ( ! animated && ! self.rotationAllowed) return; if (self.userTrackingMode == MGLUserTrackingModeFollowWithHeading) @@ -3283,6 +3355,7 @@ public: - (void)setDirection:(CLLocationDirection)direction { + MGLLogDebug(@"Setting direction: %f", direction); [self setDirection:direction animated:NO]; } @@ -3304,25 +3377,30 @@ public: - (void)setCamera:(MGLMapCamera *)camera { + MGLLogDebug(@"Setting camera: %@", camera); [self setCamera:camera animated:NO]; } - (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated { + MGLLogDebug(@"Setting camera: %@ animated: %@", camera, NSStringFromBOOL(animated)); [self setCamera:camera withDuration:animated ? MGLAnimationDuration : 0 animationTimingFunction:nil]; } - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function { + MGLLogDebug(@"Setting camera: %@ duration: %f animationTimingFunction: %@", camera, duration, function); [self setCamera:camera withDuration:duration animationTimingFunction:function completionHandler:NULL]; } - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting camera: %@ duration: %f animationTimingFunction: %@ completionHandler: %@", camera, duration, function, completion); [self setCamera:camera withDuration:duration animationTimingFunction:function edgePadding:self.contentInset completionHandler:completion]; } - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function edgePadding:(UIEdgeInsets)edgePadding completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting camera: %@ duration: %f animationTimingFunction: %@ edgePadding: %@ completionHandler: %@", camera, duration, function, NSStringFromUIEdgeInsets(edgePadding), completion); mbgl::AnimationOptions animationOptions; if (duration > 0) { @@ -3361,16 +3439,19 @@ public: - (void)flyToCamera:(MGLMapCamera *)camera completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting flyToCamera: %@ completionHandler: %@", camera, completion); [self flyToCamera:camera withDuration:-1 completionHandler:completion]; } - (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting flyToCamera: %@ withDuration: %f completionHandler: %@", camera, duration, completion); [self flyToCamera:camera withDuration:duration peakAltitude:-1 completionHandler:completion]; } - (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion { + MGLLogDebug(@"Setting flyToCamera: %@ withDuration: %f peakAltitude: %f completionHandler: %@", camera, duration, peakAltitude, completion); [self _flyToCamera:camera edgePadding:self.contentInset withDuration:duration peakAltitude:peakAltitude completionHandler:completion]; } @@ -3706,6 +3787,7 @@ public: - (void)addAnnotation:(id <MGLAnnotation>)annotation { + MGLLogDebug(@"Adding annotation: %@", annotation); if ( ! annotation) return; // The core bulk add API is efficient with respect to indexing and @@ -3716,6 +3798,7 @@ public: - (void)addAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { + MGLLogDebug(@"Adding: %lu annotations", annotations.count); if ( ! annotations) return; [self willChangeValueForKey:@"annotations"]; @@ -3939,6 +4022,7 @@ public: - (nullable MGLAnnotationView *)viewForAnnotation:(id<MGLAnnotation>)annotation { + MGLLogDebug(@"Retrieving the annotation view for: %@", annotation); if (annotation == self.userLocation) { return self.userLocationAnnotationView; @@ -4005,6 +4089,7 @@ public: - (void)removeAnnotation:(id <MGLAnnotation>)annotation { + MGLLogDebug(@"Removing annotation: %@", annotation); if ( ! annotation) return; // The core bulk deletion API is efficient with respect to indexing @@ -4016,6 +4101,7 @@ public: - (void)removeAnnotations:(NSArray<id <MGLAnnotation>> *)annotations { + MGLLogDebug(@"Removing: %lu annotations", annotations.count); if ( ! annotations) return; [self willChangeValueForKey:@"annotations"]; @@ -4093,11 +4179,13 @@ public: - (void)addOverlay:(id <MGLOverlay>)overlay { + MGLLogDebug(@"Adding overlay: %@", overlay); [self addOverlays:@[ overlay ]]; } - (void)addOverlays:(NSArray<id <MGLOverlay>> *)overlays { + MGLLogDebug(@"Adding: %lu overlays", overlays.count); #if DEBUG for (id <MGLOverlay> overlay in overlays) { @@ -4110,11 +4198,13 @@ public: - (void)removeOverlay:(id <MGLOverlay>)overlay { + MGLLogDebug(@"Removing overlay: %@", overlay); [self removeOverlays:@[ overlay ]]; } - (void)removeOverlays:(NSArray<id <MGLOverlay>> *)overlays { + MGLLogDebug(@"Removing: %lu overlays", overlays.count); #if DEBUG for (id <MGLOverlay> overlay in overlays) { @@ -4349,6 +4439,7 @@ public: - (void)setSelectedAnnotation:(id <MGLAnnotation>)annotation { + MGLLogDebug(@"Selecting annotation: %@", annotation); [self willChangeValueForKey:@"selectedAnnotations"]; _selectedAnnotationTag = [self annotationTagForAnnotation:annotation]; _userLocationAnnotationIsSelected = annotation && annotation == self.userLocation; @@ -4363,6 +4454,7 @@ public: - (void)setSelectedAnnotations:(NSArray<id <MGLAnnotation>> *)selectedAnnotations { + MGLLogDebug(@"Selecting: %lu annotations", selectedAnnotations.count); if ( ! selectedAnnotations.count) return; id <MGLAnnotation> firstAnnotation = selectedAnnotations[0]; @@ -4376,6 +4468,7 @@ public: - (void)selectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated { + MGLLogDebug(@"Selecting annotation: %@ animated: %@", annotation, NSStringFromBOOL(animated)); CGRect positioningRect = [self positioningRectForAnnotation:annotation defaultCalloutPoint:CGPointZero]; [self selectAnnotation:annotation moveOnscreen:animated animateSelection:YES calloutPositioningRect:positioningRect]; } @@ -4656,6 +4749,7 @@ public: - (void)deselectAnnotation:(id <MGLAnnotation>)annotation animated:(BOOL)animated { + MGLLogDebug(@"Deselecting annotation: %@ animated: %@", annotation, NSStringFromBOOL(animated)); if ( ! annotation) return; if (self.selectedAnnotation == annotation) @@ -4730,6 +4824,7 @@ public: - (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations animated:(BOOL)animated { + MGLLogDebug(@"Showing: %lu annotations animated: %@", annotations.count, NSStringFromBOOL(animated)); CGFloat maximumPadding = 100; CGFloat yPadding = (self.frame.size.height / 5 <= maximumPadding) ? (self.frame.size.height / 5) : maximumPadding; CGFloat xPadding = (self.frame.size.width / 5 <= maximumPadding) ? (self.frame.size.width / 5) : maximumPadding; @@ -4741,6 +4836,7 @@ public: - (void)showAnnotations:(NSArray<id <MGLAnnotation>> *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated { + MGLLogDebug(@"Showing: %lu annotations edgePadding: %@ animated: %@", annotations.count, NSStringFromUIEdgeInsets(insets), NSStringFromBOOL(animated)); if ( ! annotations || ! annotations.count) return; mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); @@ -4815,6 +4911,7 @@ public: - (void)setLocationManager:(nullable id<MGLLocationManager>)locationManager { + MGLLogDebug(@"Setting locationManager: %@", locationManager); if (!locationManager) { locationManager = [[MGLCLLocationManager alloc] init]; } @@ -4877,6 +4974,7 @@ public: - (void)setShowsUserLocation:(BOOL)showsUserLocation { + MGLLogDebug(@"Setting showsUserLocation: %@", NSStringFromBOOL(showsUserLocation)); if (showsUserLocation == _showsUserLocation || _isTargetingInterfaceBuilder) return; _showsUserLocation = showsUserLocation; @@ -4960,11 +5058,13 @@ public: - (void)setUserTrackingMode:(MGLUserTrackingMode)mode { + MGLLogDebug(@"Setting userTrackingMode: %lu", mode); [self setUserTrackingMode:mode animated:YES]; } - (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated { + MGLLogDebug(@"Setting userTrackingMode: %lu animated: %@", mode, NSStringFromBOOL(animated)); if (mode == _userTrackingMode) return; if ((mode == MGLUserTrackingModeFollowWithHeading || mode == MGLUserTrackingModeFollowWithCourse) && @@ -5077,6 +5177,7 @@ public: - (void)setShowsUserHeadingIndicator:(BOOL)showsUserHeadingIndicator { + MGLLogDebug(@"Setting showsUserHeadingIndicator: %@", NSStringFromBOOL(showsUserHeadingIndicator)); _showsUserHeadingIndicator = showsUserHeadingIndicator; if (_showsUserHeadingIndicator) @@ -5442,15 +5543,18 @@ public: - (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point { + MGLLogDebug(@"Querying visibleFeaturesAtPoint: %@", NSStringFromCGPoint(point)); return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:nil]; } - (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { + MGLLogDebug(@"Querying visibleFeaturesAtPoint: %@ inStyleLayersWithIdentifiers: %@", NSStringFromCGPoint(point), styleLayerIdentifiers); return [self visibleFeaturesAtPoint:point inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } - (NSArray<id <MGLFeature>> *)visibleFeaturesAtPoint:(CGPoint)point inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { + MGLLogDebug(@"Querying visibleFeaturesAtPoint: %@ inStyleLayersWithIdentifiers: %@ predicate: %@", NSStringFromCGPoint(point), styleLayerIdentifiers, predicate); mbgl::ScreenCoordinate screenCoordinate = { point.x, point.y }; mbgl::optional<std::vector<std::string>> optionalLayerIDs; @@ -5475,14 +5579,17 @@ public: } - (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect { + MGLLogDebug(@"Querying visibleFeaturesInRect: %@", NSStringFromCGRect(rect)); return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:nil]; } - (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers { + MGLLogDebug(@"Querying visibleFeaturesInRect: %@ inStyleLayersWithIdentifiers: %@", NSStringFromCGRect(rect), styleLayerIdentifiers); return [self visibleFeaturesInRect:rect inStyleLayersWithIdentifiers:styleLayerIdentifiers predicate:nil]; } - (NSArray<id <MGLFeature>> *)visibleFeaturesInRect:(CGRect)rect inStyleLayersWithIdentifiers:(NSSet<NSString *> *)styleLayerIdentifiers predicate:(NSPredicate *)predicate { + MGLLogDebug(@"Querying visibleFeaturesInRect: %@ inStyleLayersWithIdentifiers: %@ predicate: %@", NSStringFromCGRect(rect), styleLayerIdentifiers, predicate); mbgl::ScreenBox screenBox = { { CGRectGetMinX(rect), CGRectGetMinY(rect) }, { CGRectGetMaxX(rect), CGRectGetMaxY(rect) }, @@ -6456,6 +6563,7 @@ private: - (void)setAllowsZooming:(BOOL)allowsZooming { + MGLLogDebug(@"Setting allowsZooming: %@", NSStringFromBOOL(allowsZooming)); self.zoomEnabled = allowsZooming; } @@ -6471,6 +6579,7 @@ private: - (void)setAllowsScrolling:(BOOL)allowsScrolling { + MGLLogDebug(@"Setting allowsScrolling: %@", NSStringFromBOOL(allowsScrolling)); self.scrollEnabled = allowsScrolling; } @@ -6486,6 +6595,7 @@ private: - (void)setAllowsRotating:(BOOL)allowsRotating { + MGLLogDebug(@"Setting allowsRotating: %@", NSStringFromBOOL(allowsRotating)); self.rotateEnabled = allowsRotating; } @@ -6501,6 +6611,7 @@ private: - (void)setAllowsTilting:(BOOL)allowsTilting { + MGLLogDebug(@"Setting allowsTilting: %@", NSStringFromBOOL(allowsTilting)); self.pitchEnabled = allowsTilting; } @@ -6516,6 +6627,7 @@ private: - (void)setShowsHeading:(BOOL)showsHeading { + MGLLogDebug(@"Setting showsHeading: %@", NSStringFromBOOL(showsHeading)); self.showsUserHeadingIndicator = showsHeading; } |