Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Document -mapViewDidFailLoadingMap:withError: (#6145)
Browse files Browse the repository at this point in the history
* [macos] Implement -mapViewDidFailLoadingMap:withError:

* [ios] Documented -mapViewDidFailLoadingMap:withError:
  • Loading branch information
1ec5 authored Aug 24, 2016
1 parent 4579fa0 commit 5836738
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* The `icon-text-fit` and `icon-text-fit-padding` properties are now supported in stylesheets, allowing the background of a shield to automatically resize to fit the shield’s text. ([#5334](https://github.com/mapbox/mapbox-gl-native/pull/5334))
* The `circle-pitch-scale` property is now supported in stylesheets, allowing circle features in a tilted base map to scale or remain the same size as the viewing distance changes. ([#5576](https://github.com/mapbox/mapbox-gl-native/pull/5576))
* The `identifier` property of an MGLFeature may now be either a number or string. ([#5514](https://github.com/mapbox/mapbox-gl-native/pull/5514))
* If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145))
* Fixed crashes that could occur when loading a malformed stylesheet. ([#5736](https://github.com/mapbox/mapbox-gl-native/pull/5736))

### User location
Expand Down
12 changes: 11 additions & 1 deletion platform/ios/src/MGLMapViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView;

// TODO
/**
Tells the delegate that the map view was unable to load data needed for
displaying the map.
This method may be called for a variety of reasons, including a network
connection failure or a failure to fetch the style from the server. You can use
the given error message to notify the user that map data is unavailable.
@param mapView The map view that is unable to load the data.
@param error The reason the data could not be loaded.
*/
- (void)mapViewDidFailLoadingMap:(MGLMapView *)mapView withError:(NSError *)error;

// TODO
Expand Down
1 change: 1 addition & 0 deletions platform/macos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Fixed rendering artifacts and missing glyphs that occurred after viewing a large number of CJK characters on the map. ([#5908](https://github.com/mapbox/mapbox-gl-native/pull/5908))
* Improved the precision of annotations at zoom levels greater than 18. ([#5517](https://github.com/mapbox/mapbox-gl-native/pull/5517))
* Fixed an issue where the style zoom levels were not respected when deciding when to render a layer. ([#5811](https://github.com/mapbox/mapbox-gl-native/issues/5811))
* If MGLMapView is unable to obtain or parse a style, it now calls its delegate’s `-mapViewDidFailLoadingMap:withError:` method. ([#6145](https://github.com/mapbox/mapbox-gl-native/pull/6145))
* Fixed crashes that could occur when loading a malformed stylesheet. ([#5736](https://github.com/mapbox/mapbox-gl-native/pull/5736))
* Fixed a typo in the documentation for the MGLCompassDirectionFormatter class. ([#5879](https://github.com/mapbox/mapbox-gl-native/pull/5879))

Expand Down
5 changes: 4 additions & 1 deletion platform/macos/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,10 @@ - (void)notifyMapChange:(mbgl::MapChange)change {
}
case mbgl::MapChangeDidFailLoadingMap:
{
// Not yet implemented.
if ([self.delegate respondsToSelector:@selector(mapViewDidFailLoadingMap:withError:)]) {
NSError *error = [NSError errorWithDomain:MGLErrorDomain code:0 userInfo:nil];
[self.delegate mapViewDidFailLoadingMap:self withError:error];
}
break;
}
case mbgl::MapChangeWillStartRenderingMap:
Expand Down
13 changes: 13 additions & 0 deletions platform/macos/src/MGLMapViewDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView;

/**
Tells the delegate that the map view was unable to load data needed for
displaying the map.
This method may be called for a variety of reasons, including a network
connection failure or a failure to fetch the style from the server. You can use
the given error message to notify the user that map data is unavailable.
@param mapView The map view that is unable to load the data.
@param error The reason the data could not be loaded.
*/
- (void)mapViewDidFailLoadingMap:(MGLMapView *)mapView withError:(NSError *)error;

- (void)mapViewWillStartRenderingMap:(MGLMapView *)mapView;
- (void)mapViewDidFinishRenderingMap:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered;

Expand Down

0 comments on commit 5836738

Please sign in to comment.