From 3e22369f27ba4a0b1273c8934bfb0f59d9aa96c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sat, 23 Apr 2016 10:35:59 -0700 Subject: [ios, osx] Eliminated platform/{ios,osx}/include Also updated various project references to be group-relative, so Xcode chooses the right directory by default when adding a new file. Fixes #4770. --- platform/darwin/include/MGLAccountManager.h | 50 - platform/darwin/include/MGLAnnotation.h | 48 - .../darwin/include/MGLClockDirectionFormatter.h | 52 - .../darwin/include/MGLCompassDirectionFormatter.h | 42 - platform/darwin/include/MGLCoordinateFormatter.h | 31 - platform/darwin/include/MGLGeometry.h | 105 -- platform/darwin/include/MGLMapCamera.h | 53 - platform/darwin/include/MGLMultiPoint.h | 26 - platform/darwin/include/MGLOfflinePack.h | 180 --- platform/darwin/include/MGLOfflineRegion.h | 17 - platform/darwin/include/MGLOfflineStorage.h | 222 ---- platform/darwin/include/MGLOverlay.h | 46 - platform/darwin/include/MGLPointAnnotation.h | 18 - platform/darwin/include/MGLPolygon.h | 26 - platform/darwin/include/MGLPolyline.h | 26 - platform/darwin/include/MGLShape.h | 27 - platform/darwin/include/MGLStyle.h | 56 - .../darwin/include/MGLTilePyramidOfflineRegion.h | 78 -- platform/darwin/include/MGLTypes.h | 64 - platform/darwin/include/NSValue+MGLAdditions.h | 75 -- platform/darwin/src/MGLAccountManager.h | 50 + platform/darwin/src/MGLAnnotation.h | 48 + platform/darwin/src/MGLClockDirectionFormatter.h | 52 + platform/darwin/src/MGLCompassDirectionFormatter.h | 42 + platform/darwin/src/MGLCoordinateFormatter.h | 31 + platform/darwin/src/MGLGeometry.h | 105 ++ platform/darwin/src/MGLMapCamera.h | 53 + platform/darwin/src/MGLMultiPoint.h | 26 + platform/darwin/src/MGLOfflinePack.h | 180 +++ platform/darwin/src/MGLOfflineRegion.h | 17 + platform/darwin/src/MGLOfflineStorage.h | 222 ++++ platform/darwin/src/MGLOverlay.h | 46 + platform/darwin/src/MGLPointAnnotation.h | 18 + platform/darwin/src/MGLPolygon.h | 26 + platform/darwin/src/MGLPolyline.h | 26 + platform/darwin/src/MGLShape.h | 27 + platform/darwin/src/MGLStyle.h | 56 + platform/darwin/src/MGLTilePyramidOfflineRegion.h | 78 ++ platform/darwin/src/MGLTypes.h | 64 + platform/darwin/src/NSValue+MGLAdditions.h | 75 ++ platform/ios/include/MGLAnnotationImage.h | 44 - platform/ios/include/MGLCalloutView.h | 72 -- platform/ios/include/MGLMapView+IBAdditions.h | 49 - .../MGLMapView+MGLCustomStyleLayerAdditions.h | 26 - platform/ios/include/MGLMapView.h | 1296 -------------------- platform/ios/include/MGLUserLocation.h | 42 - platform/ios/include/Mapbox.h | 34 - platform/ios/ios.xcodeproj/project.pbxproj | 159 +-- platform/ios/src/MGLAnnotationImage.h | 44 + platform/ios/src/MGLCalloutView.h | 72 ++ platform/ios/src/MGLMapView+IBAdditions.h | 49 + .../src/MGLMapView+MGLCustomStyleLayerAdditions.h | 26 + platform/ios/src/MGLMapView.h | 1296 ++++++++++++++++++++ platform/ios/src/MGLUserLocation.h | 42 + platform/ios/src/Mapbox.h | 34 + platform/osx/include/MGLAnnotationImage.h | 58 - platform/osx/include/MGLMapView+IBAdditions.h | 68 - platform/osx/include/MGLMapView.h | 675 ---------- platform/osx/include/MGLMapViewDelegate.h | 199 --- platform/osx/include/Mapbox.h | 32 - platform/osx/osx.xcodeproj/project.pbxproj | 139 +-- platform/osx/src/MGLAnnotationImage.h | 58 + platform/osx/src/MGLMapView+IBAdditions.h | 68 + platform/osx/src/MGLMapView.h | 675 ++++++++++ platform/osx/src/MGLMapViewDelegate.h | 199 +++ platform/osx/src/Mapbox.h | 32 + 66 files changed, 3987 insertions(+), 3985 deletions(-) delete mode 100644 platform/darwin/include/MGLAccountManager.h delete mode 100644 platform/darwin/include/MGLAnnotation.h delete mode 100644 platform/darwin/include/MGLClockDirectionFormatter.h delete mode 100644 platform/darwin/include/MGLCompassDirectionFormatter.h delete mode 100644 platform/darwin/include/MGLCoordinateFormatter.h delete mode 100644 platform/darwin/include/MGLGeometry.h delete mode 100644 platform/darwin/include/MGLMapCamera.h delete mode 100644 platform/darwin/include/MGLMultiPoint.h delete mode 100644 platform/darwin/include/MGLOfflinePack.h delete mode 100644 platform/darwin/include/MGLOfflineRegion.h delete mode 100644 platform/darwin/include/MGLOfflineStorage.h delete mode 100644 platform/darwin/include/MGLOverlay.h delete mode 100644 platform/darwin/include/MGLPointAnnotation.h delete mode 100644 platform/darwin/include/MGLPolygon.h delete mode 100644 platform/darwin/include/MGLPolyline.h delete mode 100644 platform/darwin/include/MGLShape.h delete mode 100644 platform/darwin/include/MGLStyle.h delete mode 100644 platform/darwin/include/MGLTilePyramidOfflineRegion.h delete mode 100644 platform/darwin/include/MGLTypes.h delete mode 100644 platform/darwin/include/NSValue+MGLAdditions.h create mode 100644 platform/darwin/src/MGLAccountManager.h create mode 100644 platform/darwin/src/MGLAnnotation.h create mode 100644 platform/darwin/src/MGLClockDirectionFormatter.h create mode 100644 platform/darwin/src/MGLCompassDirectionFormatter.h create mode 100644 platform/darwin/src/MGLCoordinateFormatter.h create mode 100644 platform/darwin/src/MGLGeometry.h create mode 100644 platform/darwin/src/MGLMapCamera.h create mode 100644 platform/darwin/src/MGLMultiPoint.h create mode 100644 platform/darwin/src/MGLOfflinePack.h create mode 100644 platform/darwin/src/MGLOfflineRegion.h create mode 100644 platform/darwin/src/MGLOfflineStorage.h create mode 100644 platform/darwin/src/MGLOverlay.h create mode 100644 platform/darwin/src/MGLPointAnnotation.h create mode 100644 platform/darwin/src/MGLPolygon.h create mode 100644 platform/darwin/src/MGLPolyline.h create mode 100644 platform/darwin/src/MGLShape.h create mode 100644 platform/darwin/src/MGLStyle.h create mode 100644 platform/darwin/src/MGLTilePyramidOfflineRegion.h create mode 100644 platform/darwin/src/MGLTypes.h create mode 100644 platform/darwin/src/NSValue+MGLAdditions.h delete mode 100644 platform/ios/include/MGLAnnotationImage.h delete mode 100644 platform/ios/include/MGLCalloutView.h delete mode 100644 platform/ios/include/MGLMapView+IBAdditions.h delete mode 100644 platform/ios/include/MGLMapView+MGLCustomStyleLayerAdditions.h delete mode 100644 platform/ios/include/MGLMapView.h delete mode 100644 platform/ios/include/MGLUserLocation.h delete mode 100644 platform/ios/include/Mapbox.h create mode 100644 platform/ios/src/MGLAnnotationImage.h create mode 100644 platform/ios/src/MGLCalloutView.h create mode 100644 platform/ios/src/MGLMapView+IBAdditions.h create mode 100644 platform/ios/src/MGLMapView+MGLCustomStyleLayerAdditions.h create mode 100644 platform/ios/src/MGLMapView.h create mode 100644 platform/ios/src/MGLUserLocation.h create mode 100644 platform/ios/src/Mapbox.h delete mode 100644 platform/osx/include/MGLAnnotationImage.h delete mode 100644 platform/osx/include/MGLMapView+IBAdditions.h delete mode 100644 platform/osx/include/MGLMapView.h delete mode 100644 platform/osx/include/MGLMapViewDelegate.h delete mode 100644 platform/osx/include/Mapbox.h create mode 100644 platform/osx/src/MGLAnnotationImage.h create mode 100644 platform/osx/src/MGLMapView+IBAdditions.h create mode 100644 platform/osx/src/MGLMapView.h create mode 100644 platform/osx/src/MGLMapViewDelegate.h create mode 100644 platform/osx/src/Mapbox.h (limited to 'platform') diff --git a/platform/darwin/include/MGLAccountManager.h b/platform/darwin/include/MGLAccountManager.h deleted file mode 100644 index 63440046f7..0000000000 --- a/platform/darwin/include/MGLAccountManager.h +++ /dev/null @@ -1,50 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The MGLAccountManager object provides a global way to set a Mapbox API access - token, as well as other settings used framework-wide. - */ -@interface MGLAccountManager : NSObject - -#pragma mark Authorizing Access - -/** - Set the - Mapbox access token - to be used by all instances of MGLMapView in the current application. - - Mapbox-hosted vector tiles and styles require an API access token, which you - can obtain from the - Mapbox account page. - Access tokens associate requests to Mapbox’s vector tile and style APIs with - your Mapbox account. They also deter other developers from using your styles - without your permission. - - @param accessToken A Mapbox access token. Calling this method with a value of - `nil` has no effect. - - @note You must set the access token before attempting to load any Mapbox-hosted - style. Therefore, you should generally set it before creating an instance of - MGLMapView. The recommended way to set an access token is to add an entry to - your application’s Info.plist file with the key `MGLMapboxAccessToken` and - the type String. Alternatively, you may call this method from your - application delegate’s `-applicationDidFinishLaunching:` method. - */ -+ (void)setAccessToken:(nullable NSString *)accessToken; - -/** - Returns the - Mapbox access token - in use by instances of MGLMapView in the current application. - */ -+ (nullable NSString *)accessToken; - -+ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu."))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLAnnotation.h b/platform/darwin/include/MGLAnnotation.h deleted file mode 100644 index e4726f9503..0000000000 --- a/platform/darwin/include/MGLAnnotation.h +++ /dev/null @@ -1,48 +0,0 @@ -#import -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The `MGLAnnotation` protocol is used to provide annotation-related information to a map view. To use this protocol, you adopt it in any custom objects that store or represent annotation data. Each object then serves as the source of information about a single map annotation and provides critical information, such as the annotation’s location on the map. Annotation objects do not provide the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate objects to handle the display. - - An object that adopts this protocol must implement the `coordinate` property. The other methods of this protocol are optional. - */ -@protocol MGLAnnotation - -#pragma mark Position Attributes - -/** The center point (specified as a map coordinate) of the annotation. (required) (read-only) */ -@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; - -@optional - -#pragma mark Title Attributes - -/** - The string containing the annotation’s title. - - Although this property is optional, if you support the selection of annotations in your map view, you are expected to provide this property. This string is displayed in the callout for the associated annotation. - */ -@property (nonatomic, readonly, copy, nullable) NSString *title; - -/** - The string containing the annotation’s subtitle. - - This string is displayed in the callout for the associated annotation. - */ -@property (nonatomic, readonly, copy, nullable) NSString *subtitle; - -#if !TARGET_OS_IPHONE - -/** The string containing the annotation’s tooltip. */ -@property (nonatomic, readonly, copy, nullable) NSString *toolTip; - -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLClockDirectionFormatter.h b/platform/darwin/include/MGLClockDirectionFormatter.h deleted file mode 100644 index e748a15847..0000000000 --- a/platform/darwin/include/MGLClockDirectionFormatter.h +++ /dev/null @@ -1,52 +0,0 @@ -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The `MGLClockDirectionFormatter` class provides properly formatted descriptions - of headings relative to the user, known as clock positions. For - example, a value of `90` may be formatted as “3 o’clock”, depending on the - locale. - - Use this class to create localized heading strings when displaying directions - relative to the user’s current location and heading. To format a direction - irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` - instead. - */ -@interface MGLClockDirectionFormatter : NSFormatter - -/** - The unit style used by this formatter. - - This property defaults to `NSFormattingUnitStyleMedium`. - */ -@property (nonatomic) NSFormattingUnitStyle unitStyle; - -/** - The locale of the receiver. - - The locale determines the output language and numeral system of the output. - */ -@property (copy) NSLocale *locale; - -/** - Returns a clock position string for the provided value. - - @param direction The heading, measured in degrees, where 0° means “straight - ahead” and 90° means “directly to your right”. - @return The clock position string appropriately formatted for the receiver’s - locale. - */ -- (NSString *)stringFromDirection:(CLLocationDirection)direction; - -/** - This method is not supported for the `MGLDirectionFormatter` class. - */ -- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLCompassDirectionFormatter.h b/platform/darwin/include/MGLCompassDirectionFormatter.h deleted file mode 100644 index d7c3113291..0000000000 --- a/platform/darwin/include/MGLCompassDirectionFormatter.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The `MGLCompassDirectionFormatter` class provides properly formatted - descriptions of absolute headings. For example, a value of `90` may be - formatted as “east”, depending on the locale. - - Use this class to create localized heading strings when displaying directions - irrespective of the user’s current location. To format a direction relative to - the user’s current location, use `MGLCompassDirectionFormatter` instead. - */ -@interface MGLCompassDirectionFormatter : NSFormatter - -/** - The unit style used by this formatter. - - This property defaults to `NSFormattingUnitStyleMedium`. - */ -@property (nonatomic) NSFormattingUnitStyle unitStyle; - -/** - Returns a heading string for the provided value. - - @param direction The heading, measured in degrees, where 0° means “due north” - and 90° means “due east”. - @return The heading string appropriately formatted for the formatter’s locale. - */ -- (NSString *)stringFromDirection:(CLLocationDirection)direction; - -/** - This method is not supported for the `MGLDirectionFormatter` class. - */ -- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLCoordinateFormatter.h b/platform/darwin/include/MGLCoordinateFormatter.h deleted file mode 100644 index 885471c36e..0000000000 --- a/platform/darwin/include/MGLCoordinateFormatter.h +++ /dev/null @@ -1,31 +0,0 @@ -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The `MGLCoordinateFormatter` class provides properly formatted descriptions of - geographic coordinate pairs. Use this class to create localized coordinate - strings when displaying location information to users. - */ -@interface MGLCoordinateFormatter : NSFormatter - -/** - Returns a coordinate string for the provided value. - - @param coordinate The coordinate’s value. - @return The coordinate string appropriately formatted for the formatter’s - locale. - */ -- (NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate; - -/** - This method is not supported for the `MGLCoordinateFormatter` class. - */ -- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLGeometry.h b/platform/darwin/include/MGLGeometry.h deleted file mode 100644 index 7ad5140400..0000000000 --- a/platform/darwin/include/MGLGeometry.h +++ /dev/null @@ -1,105 +0,0 @@ -#import -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** Defines the area spanned by an `MGLCoordinateBounds`. */ -typedef struct MGLCoordinateSpan { - /** Latitudes spanned by an `MGLCoordinateBounds`. */ - CLLocationDegrees latitudeDelta; - /** Longitudes spanned by an `MGLCoordinateBounds`. */ - CLLocationDegrees longitudeDelta; -} MGLCoordinateSpan; - -/** Creates a new `MGLCoordinateSpan` from the given latitudinal and longitudinal deltas. */ -NS_INLINE MGLCoordinateSpan MGLCoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) { - MGLCoordinateSpan span; - span.latitudeDelta = latitudeDelta; - span.longitudeDelta = longitudeDelta; - return span; -} - -/** Returns `YES` if the two coordinate spans represent the same latitudinal change and the same longitudinal change. */ -NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, MGLCoordinateSpan span2) { - return (span1.latitudeDelta == span2.latitudeDelta && - span1.longitudeDelta == span2.longitudeDelta); -} - -/** An area of zero width and zero height. */ -extern const MGLCoordinateSpan MGLCoordinateSpanZero; - -/** A rectangular area as measured on a two-dimensional map projection. */ -typedef struct MGLCoordinateBounds { - /** Coordinate at the southwest corner. */ - CLLocationCoordinate2D sw; - /** Coordinate at the northeast corner. */ - CLLocationCoordinate2D ne; -} MGLCoordinateBounds; - -/** Creates a new `MGLCoordinateBounds` structure from the given southwest and northeast coordinates. */ -NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsMake(CLLocationCoordinate2D sw, CLLocationCoordinate2D ne) { - MGLCoordinateBounds bounds; - bounds.sw = sw; - bounds.ne = ne; - return bounds; -} - -/** Returns `YES` if the two coordinate bounds are equal to each other. */ -NS_INLINE BOOL MGLCoordinateBoundsEqualToCoordinateBounds(MGLCoordinateBounds bounds1, MGLCoordinateBounds bounds2) { - return (bounds1.sw.latitude == bounds2.sw.latitude && - bounds1.sw.longitude == bounds2.sw.longitude && - bounds1.ne.latitude == bounds2.ne.latitude && - bounds1.ne.longitude == bounds2.ne.longitude); -} - -/** Returns the area spanned by the coordinate bounds. */ -NS_INLINE MGLCoordinateSpan MGLCoordinateBoundsGetCoordinateSpan(MGLCoordinateBounds bounds) { - return MGLCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude, - bounds.ne.longitude - bounds.sw.longitude); -} - -/** Returns a coordinate bounds with southwest and northeast coordinates that are offset from those of the source bounds. */ -NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsOffset(MGLCoordinateBounds bounds, MGLCoordinateSpan offset) { - MGLCoordinateBounds offsetBounds = bounds; - offsetBounds.sw.latitude += offset.latitudeDelta; - offsetBounds.sw.longitude += offset.longitudeDelta; - offsetBounds.ne.latitude += offset.latitudeDelta; - offsetBounds.ne.longitude += offset.longitudeDelta; - return offsetBounds; -} - -/** Returns `YES` if the coordinate bounds covers no area. - Note that a bounds may be empty but have a non-zero coordinate span (e.g., when its northeast point lies due north of its southwest point). */ -NS_INLINE BOOL MGLCoordinateBoundsIsEmpty(MGLCoordinateBounds bounds) { - MGLCoordinateSpan span = MGLCoordinateBoundsGetCoordinateSpan(bounds); - return span.latitudeDelta == 0 || span.longitudeDelta == 0; -} - -/** Returns a formatted string for the given coordinate bounds. */ -NS_INLINE NSString *MGLStringFromCoordinateBounds(MGLCoordinateBounds bounds) { - return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}", - bounds.sw.latitude, bounds.sw.longitude, - bounds.ne.latitude, bounds.ne.longitude]; -} - -/** Returns radians, converted from degrees. */ -NS_INLINE CGFloat MGLRadiansFromDegrees(CLLocationDegrees degrees) { - return (CGFloat)(degrees * M_PI) / 180; -} - -/** Returns degrees, converted from radians. */ -NS_INLINE CLLocationDegrees MGLDegreesFromRadians(CGFloat radians) { - return radians * 180 / M_PI; -} - -/** - Methods for round-tripping Mapbox geometry structure values. - */ -@interface NSValue (MGLGeometryAdditions) - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLMapCamera.h b/platform/darwin/include/MGLMapCamera.h deleted file mode 100644 index 3cb902ba52..0000000000 --- a/platform/darwin/include/MGLMapCamera.h +++ /dev/null @@ -1,53 +0,0 @@ -#import -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** An `MGLMapCamera` object represents a viewpoint from which the user observes some point on an `MGLMapView`. */ -@interface MGLMapCamera : NSObject - -/** Coordinate at the center of the map view. */ -@property (nonatomic) CLLocationCoordinate2D centerCoordinate; - -/** Heading measured in degrees clockwise from true north. */ -@property (nonatomic) CLLocationDirection heading; - -/** Pitch toward the horizon measured in degrees, with 0 degrees resulting in a two-dimensional map. */ -@property (nonatomic) CGFloat pitch; - -/** Meters above ground level. */ -@property (nonatomic) CLLocationDistance altitude; - -/** Returns a new camera with all properties set to 0. */ -+ (instancetype)camera; - -/** - Returns a new camera using based on information about the camera’s viewpoint and focus point. - - @param centerCoordinate The geographic coordinate on which the map should be centered. - @param eyeCoordinate The geometric coordinate at which the camera should be situated. - @param eyeAltitude The altitude (measured in meters) above the map at which the camera should be situated. The altitude may be less than the distance from the camera’s viewpoint to the camera’s focus point. - */ -+ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate - fromEyeCoordinate:(CLLocationCoordinate2D)eyeCoordinate - eyeAltitude:(CLLocationDistance)eyeAltitude; - -/** - Returns a new camera with the given distance, pitch, and heading. - - @param centerCoordinate The geographic coordinate on which the map should be centered. - @param distance The straight-line distance from the viewpoint to the `centerCoordinate`. - @param pitch The viewing angle of the camera, measured in degrees. A value of `0` results in a camera pointed straight down at the map. Angles greater than `0` result in a camera angled toward the horizon. - @param heading The camera’s heading, measured in degrees clockwise from true north. A value of `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. - */ -+ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate - fromDistance:(CLLocationDistance)distance - pitch:(CGFloat)pitch - heading:(CLLocationDirection)heading; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLMultiPoint.h b/platform/darwin/include/MGLMultiPoint.h deleted file mode 100644 index ad9db1e681..0000000000 --- a/platform/darwin/include/MGLMultiPoint.h +++ /dev/null @@ -1,26 +0,0 @@ -#import -#import - -#import "MGLShape.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The `MGLMultiPoint` class is an abstract superclass used to define shapes composed of multiple points. You should not create instances of this class directly. Instead, you should create instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use the method and properties of this class to access information about the specific points associated with the line or polygon. */ -@interface MGLMultiPoint : MGLShape - -/** The number of points associated with the shape. (read-only) */ -@property (nonatomic, readonly) NSUInteger pointCount; - -/** - Retrieves one or more coordinates associated with the shape. - - @param coords On input, you must provide a C array of structures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data. - @param range The range of points you want. The `location` field indicates the first point you are requesting, with `0` being the first point, `1` being the second point, and so on. The `length` field indicates the number of points you want. The array in _`coords`_ must be large enough to accommodate the number of requested coordinates. - */ -- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOfflinePack.h b/platform/darwin/include/MGLOfflinePack.h deleted file mode 100644 index 083e050ddd..0000000000 --- a/platform/darwin/include/MGLOfflinePack.h +++ /dev/null @@ -1,180 +0,0 @@ -#import - -#import "MGLOfflineRegion.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The state an offline pack is currently in. - */ -typedef NS_ENUM (NSInteger, MGLOfflinePackState) { - /** - It is unknown whether the pack is inactive, active, or complete. - - This is the initial state of a pack. The state of a pack becomes known by - the time the shared `MGLOfflineStorage` object sends the first - `MGLOfflinePackProgressChangedNotification` about the pack. For inactive - packs, you must explicitly request a progress update using the - `-[MGLOfflinePack requestProgress]` method. - - An invalid pack always has a state of `MGLOfflinePackStateInvalid`, never - `MGLOfflinePackStateUnknown`. - */ - MGLOfflinePackStateUnknown = 0, - /** - The pack is incomplete and is not currently downloading. - - This is the initial state of a pack that is created using the - `-[MGLOfflinePack addPackForRegion:withContext:completionHandler:]` method, - as well as after the `-[MGLOfflinePack suspend]` method is - called. - */ - MGLOfflinePackStateInactive = 1, - /** - The pack is incomplete and is currently downloading. - - This is the state of a pack after the `-[MGLOfflinePack resume]` method is - called. - */ - MGLOfflinePackStateActive = 2, - /** - The pack has downloaded to completion. - */ - MGLOfflinePackStateComplete = 3, - /** - The pack has been removed using the - `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. Sending - any message to the pack will raise an exception. - */ - MGLOfflinePackStateInvalid = 4, -}; - -/** - A structure containing information about an offline pack’s current download - progress. - */ -typedef struct MGLOfflinePackProgress { - /** - The number of resources that have been completely downloaded and are ready - to use offline. - */ - uint64_t countOfResourcesCompleted; - /** - The cumulative size of the downloaded resources on disk, measured in bytes. - */ - uint64_t countOfBytesCompleted; - /** - The minimum number of resources that must be downloaded in order to view - the pack’s full region without any omissions. - - At the beginning of a download, this count is a lower bound; the number of - expected resources may increase as the download progresses. - */ - uint64_t countOfResourcesExpected; - /** - The maximum number of resources that must be downloaded in order to view - the pack’s full region without any omissions. - - At the beginning of a download, when the exact number of required resources - is unknown, this field is set to `UINT64_MAX`. Thus this count is always an - upper bound. - */ - uint64_t maximumResourcesExpected; -} MGLOfflinePackProgress; - -/** - An `MGLOfflinePack` represents a collection of resources necessary for viewing - a region offline to a local database. - - To create an instance of `MGLOfflinePack`, use the - `+[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method. - A pack created using `-[MGLOfflinePack init]` is immediately invalid. - */ -@interface MGLOfflinePack : NSObject - -/** - The region for which the pack manages resources. - */ -@property (nonatomic, readonly) id region; - -/** - Arbitrary data stored alongside the downloaded resources. - - The context typically holds application-specific information for identifying - the pack, such as a user-selected name. - */ -@property (nonatomic, readonly) NSData *context; - -/** - The pack’s current state. - - The state of an inactive or completed pack is computed lazily and is set to - `MGLOfflinePackStateUnknown` by default. To request the pack’s status, use the - `-requestProgress` method. To get notified when the state becomes known and - when it changes, observe KVO change notifications on this pack’s `state` key - path. Alternatively, you can add an observer for - `MGLOfflinePackProgressChangedNotification`s about this pack that come from the - default notification center. - */ -@property (nonatomic, readonly) MGLOfflinePackState state; - -/** - The pack’s current progress. - - The progress of an inactive or completed pack is computed lazily, and all its - fields are set to 0 by default. To request the pack’s progress, use the - `-requestProgress` method. To get notified when the progress becomes - known and when it changes, observe KVO change notifications on this pack’s - `state` key path. Alternatively, you can add an observer for - `MGLOfflinePackProgressChangedNotification`s about this pack that come from the - default notification center. - */ -@property (nonatomic, readonly) MGLOfflinePackProgress progress; - -/** - Resumes downloading if the pack is inactive. - - A pack resumes asynchronously. To get notified when this pack resumes, observe - KVO change notifications on this pack’s `state` key path. Alternatively, you - can add an observer for `MGLOfflinePackProgressChangedNotification`s about this - pack that come from the default notification center. - - When a pack resumes after being suspended, it may begin by iterating over the - already downloaded resources. As a result, the `progress` structure’s - `countOfResourcesCompleted` field may revert to 0 before rapidly returning to - the level of progress at the time the pack was suspended. - - To temporarily suspend downloading, call the `-suspend` method. - */ -- (void)resume; - -/** - Temporarily stops downloading if the pack is active. - - A pack suspends asynchronously. To get notified when this pack resumes, observe - KVO change notifications on this pack’s `state` key path. Alternatively, you - can add an observer for `MGLOfflinePackProgressChangedNotification` about this - pack that come from the default notification center. - - If the pack previously reached a higher level of progress before being - suspended, it may wait to suspend until it returns to that level. - - To resume downloading, call the `-resume` method. - */ -- (void)suspend; - -/** - Request an asynchronous update to the pack’s `state` and `progress` properties. - - The state and progress of an inactive or completed pack are computed lazily. If - you need the state or progress of a pack whose `state` property is currently - set to `MGLOfflinePackStateUnknown`, observe KVO change notifications on this - pack’s `state` key path, then call this method. Alternatively, you can add an - observer for `MGLOfflinePackProgressChangedNotification` about this pack that - come from the default notification center. - */ -- (void)requestProgress; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOfflineRegion.h b/platform/darwin/include/MGLOfflineRegion.h deleted file mode 100644 index cf98e253bd..0000000000 --- a/platform/darwin/include/MGLOfflineRegion.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - An object conforming to the `MGLOfflineRegion` protocol determines which - resources are required by an `MGLOfflinePack` object. At present, only - instances of `MGLTilePyramidOfflineRegion` may be used as `MGLOfflinePack` - regions, but additional conforming implementations may be added in the future. - */ -@protocol MGLOfflineRegion - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOfflineStorage.h b/platform/darwin/include/MGLOfflineStorage.h deleted file mode 100644 index 20cc521f2e..0000000000 --- a/platform/darwin/include/MGLOfflineStorage.h +++ /dev/null @@ -1,222 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -@class MGLOfflinePack; -@protocol MGLOfflineRegion; - -/** - Posted by the shared `MGLOfflineStorage` object when an `MGLOfflinePack` - object’s progress changes. The progress may change due to a resource being - downloaded or because the pack discovers during the download that more - resources are required for offline viewing. This notification is posted - whenever any field in the `progress` property changes. - - The `object` is the `MGLOfflinePack` object whose progress changed. The - `userInfo` dictionary contains the pack’s current state in the - `MGLOfflinePackStateUserInfoKey` key and details about the pack’s current - progress in the `MGLOfflinePackProgressUserInfoKey` key. You may also consult - the pack’s `state` and `progress` properties, which provide the same values. - - If you only need to observe changes in a particular pack’s progress, you can - alternatively observe KVO change notifications to the pack’s `progress` key - path. - */ -extern NSString * const MGLOfflinePackProgressChangedNotification; - -/** - Posted by the shared `MGLOfflineStorage` object whenever an `MGLOfflinePack` - object encounters an error while downloading. The error may be recoverable and - may not warrant the user’s attention. For example, the pack’s implementation - may attempt to re-request failed resources based on an exponential backoff - strategy or upon the restoration of network access. - - The `object` is the `MGLOfflinePack` object that encountered the error. The - `userInfo` dictionary contains the error object in the - `MGLOfflinePackErrorUserInfoKey` key. - */ -extern NSString * const MGLOfflinePackErrorNotification; - -/** - Posted by the shared `MGLOfflineStorage` object when the maximum number of - Mapbox-hosted tiles has been downloaded and stored on the current device. - - The `object` is the `MGLOfflinePack` object that reached the tile limit in the - course of downloading. The `userInfo` dictionary contains the tile limit in the - `MGLOfflinePackMaximumCountUserInfoKey` key. - - Once this limit is reached, no instance of `MGLOfflinePack` can download - additional tiles from Mapbox APIs until already downloaded tiles are removed by - calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. - Contact your Mapbox sales representative to have the limit raised. - */ -extern NSString * const MGLOfflinePackMaximumMapboxTilesReachedNotification; - -/** - The key for an `NSNumber` object that indicates an offline pack’s current - state. This key is used in the `userInfo` dictionary of an - `MGLOfflinePackProgressChangedNotification` notification. Call `-integerValue` - on the object to receive the `MGLOfflinePackState`-typed state. - */ -extern NSString * const MGLOfflinePackStateUserInfoKey; - -/** - The key for an `NSValue` object that indicates an offline pack’s current - progress. This key is used in the `userInfo` dictionary of an - `MGLOfflinePackProgressChangedNotification` notification. Call - `-MGLOfflinePackProgressValue` on the object to receive the - `MGLOfflinePackProgress`-typed progress. - */ -extern NSString * const MGLOfflinePackProgressUserInfoKey; - -/** - The key for an `NSError` object that is encountered in the course of - downloading an offline pack. This key is used in the `userInfo` dictionary of - an `MGLOfflinePackErrorNotification` notification. The error’s domain is - `MGLErrorDomain`. See `MGLErrorCode` for possible error codes. - */ -extern NSString * const MGLOfflinePackErrorUserInfoKey; - -/** - The key for an `NSNumber` object that indicates the maximum number of - Mapbox-hosted tiles that may be downloaded and stored on the current device. - This key is used in the `userInfo` dictionary of an - `MGLOfflinePackMaximumMapboxTilesReachedNotification` notification. Call - `-unsignedLongLongValue` on the object to receive the `uint64_t`-typed tile - limit. - */ -extern NSString * const MGLOfflinePackMaximumCountUserInfoKey; - -/** - A block to be called once an offline pack has been completely created and - added. - - An application typically calls the `-resume` method on the pack inside this - completion handler to begin the download. - - @param pack Contains a pointer to the newly added pack, or `nil` if there was - an error creating or adding the pack. - @param error Contains a pointer to an error object (if any) indicating why the - pack could not be created or added. - */ -typedef void (^MGLOfflinePackAdditionCompletionHandler)(MGLOfflinePack * _Nullable pack, NSError * _Nullable error); - -/** - A block to be called once an offline pack has been completely invalidated and - removed. - - Avoid any references to the pack inside this completion handler: by the time - this completion handler is executed, the pack has become invalid, and any - messages passed to it will raise an exception. - - @param error Contains a pointer to an error object (if any) indicating why the - pack could not be invalidated or removed. - */ -typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error); - -/** - MGLOfflineStorage implements a singleton (shared object) that manages offline - packs. All of this class’s instance methods are asynchronous, reflecting the - fact that offline resources are stored in a database. The shared object - maintains a canonical collection of offline packs in its `packs` property. - */ -@interface MGLOfflineStorage : NSObject - -/** - Returns the shared offline storage object. - */ -+ (instancetype)sharedOfflineStorage; - -/** - An array of all known offline packs, in the order in which they were created. - - This property is set to `nil`, indicating that the receiver does not yet know - the existing packs, for an undefined amount of time starting from the moment - the shared offline storage object is initialized until the packs are fetched - from the database. After that point, this property is always non-nil, but it - may be empty to indicate that no packs are present. - - To detect when the shared offline storage object has finished loading its - `packs` property, observe KVO change notifications on the `packs` key path. - The initial load results in an `NSKeyValueChangeSetting` change. - */ -@property (nonatomic, strong, readonly, nullable) NS_ARRAY_OF(MGLOfflinePack *) *packs; - -/** - Creates and registers an offline pack that downloads the resources needed to - use the given region offline. - - The resulting pack is added to the shared offline storage object’s `packs` - property, then the `completion` block is executed with that pack passed in. - - The pack has an initial state of `MGLOfflinePackStateInactive`. To begin - downloading resources, call `-[MGLOfflinePack resume]` on the pack from within - the completion handler. To monitor download progress, add an observer for - `MGLOfflinePackProgressChangedNotification`s about that pack. - - To detect when any call to this method results in a new pack, observe KVO - change notifications on the shared offline storage object’s `packs` key path. - Additions to that array result in an `NSKeyValueChangeInsertion` change. - - @param region A region to download. - @param context Arbitrary data to store alongside the downloaded resources. - @param completion The completion handler to call once the pack has been added. - This handler is executed asynchronously on the main queue. - */ -- (void)addPackForRegion:(id )region withContext:(NSData *)context completionHandler:(nullable MGLOfflinePackAdditionCompletionHandler)completion; - -/** - Unregisters the given offline pack and frees any resources that are no longer - required by any remaining packs. - - As soon as this method is called on a pack, the pack becomes invalid; any - attempt to send it a message will result in an exception being thrown. If an - error occurs and the pack cannot be removed, do not attempt to reuse the pack - object. Instead, if you need continued access to the pack, suspend all packs - and use the `-reloadPacks` method to obtain valid pointers to all the packs. - - To detect when any call to this method results in a pack being removed, observe - KVO change notifications on the shared offline storage object’s `packs` key - path. Removals from that array result in an `NSKeyValueChangeRemoval` change. - - @param pack The offline pack to remove. - @param completion The completion handler to call once the pack has been - removed. This handler is executed asynchronously on the main queue. - */ -- (void)removePack:(MGLOfflinePack *)pack withCompletionHandler:(nullable MGLOfflinePackRemovalCompletionHandler)completion; - -/** - Forcibly, asynchronously reloads the `packs` property. At some point after this - method is called, the pointer values of the `MGLOfflinePack` objects in the - `packs` property change, even if the underlying data for these packs has not - changed. If this method is called while a pack is actively downloading, the - behavior is undefined. - - You typically do not need to call this method. - - To detect when the shared offline storage object has finished reloading its - `packs` property, observe KVO change notifications on the `packs` key path. - A reload results in an `NSKeyValueChangeSetting` change. - */ -- (void)reloadPacks; - -/** - Sets the maximum number of Mapbox-hosted tiles that may be downloaded and - stored on the current device. - - Once this limit is reached, an - `MGLOfflinePackMaximumMapboxTilesReachedNotification` is posted for every - attempt to download additional tiles until already downloaded tiles are removed - by calling the `-removePack:withCompletionHandler:` method. - - @note The Mapbox Terms of Service - prohibits changing or bypassing this limit without permission from Mapbox. - Contact your Mapbox sales representative to have the limit raised. - */ -- (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOverlay.h b/platform/darwin/include/MGLOverlay.h deleted file mode 100644 index aa80fe3900..0000000000 --- a/platform/darwin/include/MGLOverlay.h +++ /dev/null @@ -1,46 +0,0 @@ -#import -#import - -#import "MGLAnnotation.h" -#import "MGLGeometry.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - The `MGLOverlay` protocol defines a specific type of annotation that represents both a point and an area on a map. Overlay objects are essentially data objects that contain the geographic data needed to represent the map area. For example, overlays can take the form of common shapes such as rectangles and circles. They can also describe polygons and other complex shapes. - - You use overlays to layer more sophisticated content on top of a map view. For example, you could use an overlay to show the boundaries of a national park or trace a bus route along city streets. The Mapbox iOS SDK defines several concrete classes that conform to this protocol and define standard shapes. - - Because overlays are also annotations, they have similar usage pattern to annotations. When added to a map view using the `-addOverlay:` method, that view detects whenever the overlay’s defined region intersects the visible portion of the map. At that point, the map view asks its delegate to provide a special overlay view to draw the visual representation of the overlay. If you add an overlay to a map view as an annotation instead, it is treated as an annotation with a single point. - */ -@protocol MGLOverlay - -/** - The approximate center point of the overlay area. (required) (read-only) - - This point is typically set to the center point of the map’s bounding rectangle. It is used as the anchor point for any callouts displayed for the annotation. - */ -@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; - -/** - The cooordinate rectangle that encompasses the overlay. (required) (read-only) - - This property contains the smallest rectangle that completely encompasses the overlay. Implementers of this protocol must set this area when implementing their overlay class, and after setting it, you must not change it. - */ -@property (nonatomic, readonly) MGLCoordinateBounds overlayBounds; - -/** - Returns a Boolean indicating whether the specified rectangle intersects the receiver’s shape. - - You can implement this method to provide more specific bounds checking for an overlay. If you do not implement it, the bounding rectangle is used to detect intersections. - - @param overlayBounds The rectangle to intersect with the receiver’s area. - @return `YES` if any part of the map rectangle intersects the receiver’s shape or `NO` if it does not. - */ -- (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLPointAnnotation.h b/platform/darwin/include/MGLPointAnnotation.h deleted file mode 100644 index d186cbff18..0000000000 --- a/platform/darwin/include/MGLPointAnnotation.h +++ /dev/null @@ -1,18 +0,0 @@ -#import -#import - -#import "MGLShape.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The `MGLPointAnnotation` class defines a concrete annotation object located at a specified point. You can use this class, rather than define your own, in situations where all you want to do is associate a point on the map with a title. */ -@interface MGLPointAnnotation : MGLShape - -/** The coordinate point of the annotation, specified as a latitude and longitude. */ -@property (nonatomic, assign) CLLocationCoordinate2D coordinate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLPolygon.h b/platform/darwin/include/MGLPolygon.h deleted file mode 100644 index c5480264fb..0000000000 --- a/platform/darwin/include/MGLPolygon.h +++ /dev/null @@ -1,26 +0,0 @@ -#import -#import - -#import "MGLMultiPoint.h" -#import "MGLOverlay.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The `MGLPolygon` class represents a shape consisting of one or more points that define a closed polygon. The points are connected end-to-end in the order they are provided. The first and last points are connected to each other to create the closed shape. */ -@interface MGLPolygon : MGLMultiPoint - -/** - Creates and returns an `MGLPolygon` object from the specified set of coordinates. - - @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. - @param count The number of items in the `coords` array. - @return A new polygon object. - */ -+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords - count:(NSUInteger)count; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLPolyline.h b/platform/darwin/include/MGLPolyline.h deleted file mode 100644 index c28299c7e0..0000000000 --- a/platform/darwin/include/MGLPolyline.h +++ /dev/null @@ -1,26 +0,0 @@ -#import -#import - -#import "MGLMultiPoint.h" -#import "MGLOverlay.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The `MGLPolyline` class represents a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other. */ -@interface MGLPolyline : MGLMultiPoint - -/** - Creates and returns an `MGLPolyline` object from the specified set of coordinates. - - @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. - @param count The number of items in the `coords` array. - @return A new polyline object. - */ -+ (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords - count:(NSUInteger)count; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLShape.h b/platform/darwin/include/MGLShape.h deleted file mode 100644 index c1b84816f2..0000000000 --- a/platform/darwin/include/MGLShape.h +++ /dev/null @@ -1,27 +0,0 @@ -#import - -#import "MGLAnnotation.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The `MGLShape` class is an abstract class that defines the basic properties for all shape-based annotation objects. This class must be subclassed and cannot be used as is. Subclasses are responsible for defining the geometry of the shape and providing an appropriate value for the coordinate property inherited from the `MGLAnnotation` protocol. */ -@interface MGLShape : NSObject - -/** The title of the shape annotation. The default value of this property is `nil`. */ -@property (nonatomic, copy, nullable) NSString *title; - -/** The subtitle of the shape annotation. The default value of this property is `nil`. */ -@property (nonatomic, copy, nullable) NSString *subtitle; - -#if !TARGET_OS_IPHONE - -/** The tooltip of the shape annotation. The default value of this property is `nil`. */ -@property (nonatomic, copy, nullable) NSString *toolTip; - -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLStyle.h b/platform/darwin/include/MGLStyle.h deleted file mode 100644 index e5b2de877c..0000000000 --- a/platform/darwin/include/MGLStyle.h +++ /dev/null @@ -1,56 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** A collection of convenience methods for creating style URLs of default styles provided by Mapbox. These instances of NSURL are cached. */ -@interface MGLStyle : NSObject - -/** - Returns the Streets style URL. - - Mapbox Streets is a complete base map, perfect for incorporating your own data. - */ -+ (NSURL *)streetsStyleURL; - -/** - Returns the Emerald style URL. - - Emerald is a versatile style with emphasis on road networks and public transportation. - */ -+ (NSURL *)emeraldStyleURL; - -/** - Returns the Light style URL. - - Light is a subtle, light-colored backdrop for data visualizations. - */ -+ (NSURL *)lightStyleURL; - -/** - Returns the Dark style URL. - - Dark is a subtle, dark-colored backdrop for data visualizations. - */ -+ (NSURL *)darkStyleURL; - -/** - Returns the Satellite style URL. - - Mapbox Satellite is a beautiful global satellite and aerial imagery layer. - */ -+ (NSURL *)satelliteStyleURL; - -/** - Returns the Hybrid style URL. - - Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels. - */ -+ (NSURL *)hybridStyleURL; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLTilePyramidOfflineRegion.h b/platform/darwin/include/MGLTilePyramidOfflineRegion.h deleted file mode 100644 index 4e9f394e74..0000000000 --- a/platform/darwin/include/MGLTilePyramidOfflineRegion.h +++ /dev/null @@ -1,78 +0,0 @@ -#import - -#import "MGLOfflineRegion.h" -#import "MGLGeometry.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - An offline region defined by a style URL, geographic coordinate bounds, and - range of zoom levels. - */ -@interface MGLTilePyramidOfflineRegion : NSObject - -/** - URL of the style whose resources are required for offline viewing. - - In addition to the JSON stylesheet, different styles may require different font - glyphs, sprite sheets, and other resources. - - The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s - map ID (`mapbox://styles/{user}/{style}`). - */ -@property (nonatomic, readonly) NSURL *styleURL; - -/** - The coordinate bounds for the geographic region covered by the downloaded - tiles. - */ -@property (nonatomic, readonly) MGLCoordinateBounds bounds; - -/** - The minimum zoom level for which to download tiles and other resources. - - For more information about zoom levels, `-[MGLMapView zoomLevel]`. - */ -@property (nonatomic, readonly) double minimumZoomLevel; - -/** - The maximum zoom level for which to download tiles and other resources. - - For more information about zoom levels, `-[MGLMapView zoomLevel]`. - */ -@property (nonatomic, readonly) double maximumZoomLevel; - -- (instancetype)init NS_UNAVAILABLE; - -/** - Initializes a newly created offline region with the given style URL, geographic - coordinate bounds, and range of zoom levels. - - This is the designated initializer for `MGLTilePyramidOfflineRegion`. - - @param styleURL URL of the map style for which to download resources. The URL - may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map - ID (`mapbox://styles/{user}/{style}`). Specify `nil` for the default style. - Relative file URLs cannot be used as offline style URLs. To download the - online resources required by a local style, specify a URL to an online copy - of the style. - @param bounds The coordinate bounds for the geographic region to be covered by - the downloaded tiles. - @param minimumZoomLevel The minimum zoom level to be covered by the downloaded - tiles. This parameter should be set to at least 0 but no greater than the - value of the `maximumZoomLevel` parameter. For each required tile source, if - this parameter is set to a value less than the tile source’s minimum zoom - level, the download covers zoom levels down to the tile source’s minimum - zoom level. - @param maximumZoomLevel The maximum zoom level to be covered by the downloaded - tiles. This parameter should be set to at least the value of the - `minimumZoomLevel` parameter. For each required tile source, if this - parameter is set to a value greater than the tile source’s minimum zoom - level, the download covers zoom levels up to the tile source’s maximum zoom - level. - */ -- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL bounds:(MGLCoordinateBounds)bounds fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLTypes.h b/platform/darwin/include/MGLTypes.h deleted file mode 100644 index 746cb686c0..0000000000 --- a/platform/darwin/include/MGLTypes.h +++ /dev/null @@ -1,64 +0,0 @@ -#import - -#pragma once - -#if !__has_feature(nullability) - #define NS_ASSUME_NONNULL_BEGIN - #define NS_ASSUME_NONNULL_END - #define nullable - #define nonnull - #define null_resettable - #define _Nullable - #define _Nonnull -#endif - -NS_ASSUME_NONNULL_BEGIN - -/** Indicates an error occurred in the Mapbox SDK. */ -extern NSString * const MGLErrorDomain; - -/** Error constants for the Mapbox SDK. */ -typedef NS_ENUM(NSInteger, MGLErrorCode) { - /** An unknown error occurred. */ - MGLErrorCodeUnknown = -1, - /** The resource could not be found. */ - MGLErrorCodeNotFound = 1, - /** The connection received an invalid server response. */ - MGLErrorCodeBadServerResponse = 2, - /** An attempt to establish a connection failed. */ - MGLErrorCodeConnectionFailed = 3, -}; - -/** The mode used to track the user location on the map. */ -typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) { - /** The map does not follow the user location. */ - MGLUserTrackingModeNone = 0, - /** The map follows the user location. */ - MGLUserTrackingModeFollow, - /** The map follows the user location and rotates when the heading changes. */ - MGLUserTrackingModeFollowWithHeading, - /** The map follows the user location and rotates when the course changes. */ - MGLUserTrackingModeFollowWithCourse, -}; - -NS_ASSUME_NONNULL_END - -#ifndef NS_ARRAY_OF - // Foundation collection classes adopted lightweight generics in iOS 9.0 and OS X 10.11 SDKs. - #if __has_feature(objc_generics) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) - /** Inserts a type specifier for a pointer to a lightweight generic with the given collection and object classes. Use a `*` for any non-`id` object classes but no `*` for the collection class. */ - #define NS_ARRAY_OF(ObjectClass...) NSArray - #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray - #define NS_SET_OF(ObjectClass...) NSSet - #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet - #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary - #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary - #else - #define NS_ARRAY_OF(ObjectClass...) NSArray - #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray - #define NS_SET_OF(ObjectClass...) NSSet - #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet - #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary - #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary - #endif -#endif diff --git a/platform/darwin/include/NSValue+MGLAdditions.h b/platform/darwin/include/NSValue+MGLAdditions.h deleted file mode 100644 index 4a97c8e115..0000000000 --- a/platform/darwin/include/NSValue+MGLAdditions.h +++ /dev/null @@ -1,75 +0,0 @@ -#import - -#import "MGLGeometry.h" -#import "MGLOfflinePack.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - Methods for round-tripping values for Mapbox-defined types. - */ -@interface NSValue (MGLAdditions) - -#pragma mark Working with Geographic Coordinate Values - -/** - Creates a new value object containing the specified Core Location geographic - coordinate structure. - - @param coordinate The value for the new object. - @return A new value object that contains the geographic coordinate information. - */ -+ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate; - -/** - The Core Location geographic coordinate structure representation of the value. - */ -@property (readonly) CLLocationCoordinate2D MGLCoordinateValue; - -/** - Creates a new value object containing the specified Mapbox coordinate span - structure. - - @param span The value for the new object. - @return A new value object that contains the coordinate span information. - */ -+ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span; - -/** - The Mapbox coordinate span structure representation of the value. - */ -@property (readonly) MGLCoordinateSpan MGLCoordinateSpanValue; - -/** - Creates a new value object containing the specified Mapbox coordinate bounds - structure. - - @param bounds The value for the new object. - @return A new value object that contains the coordinate bounds information. - */ -+ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds; - -/** - The Mapbox coordinate bounds structure representation of the value. - */ -@property (readonly) MGLCoordinateBounds MGLCoordinateBoundsValue; - -#pragma mark Working with Offline Map Values - -/** - Creates a new value object containing the given `MGLOfflinePackProgress` - structure. - - @param progress The value for the new object. - @return A new value object that contains the offline pack progress information. - */ -+ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress; - -/** - The `MGLOfflinePackProgress` structure representation of the value. - */ -@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h new file mode 100644 index 0000000000..63440046f7 --- /dev/null +++ b/platform/darwin/src/MGLAccountManager.h @@ -0,0 +1,50 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The MGLAccountManager object provides a global way to set a Mapbox API access + token, as well as other settings used framework-wide. + */ +@interface MGLAccountManager : NSObject + +#pragma mark Authorizing Access + +/** + Set the + Mapbox access token + to be used by all instances of MGLMapView in the current application. + + Mapbox-hosted vector tiles and styles require an API access token, which you + can obtain from the + Mapbox account page. + Access tokens associate requests to Mapbox’s vector tile and style APIs with + your Mapbox account. They also deter other developers from using your styles + without your permission. + + @param accessToken A Mapbox access token. Calling this method with a value of + `nil` has no effect. + + @note You must set the access token before attempting to load any Mapbox-hosted + style. Therefore, you should generally set it before creating an instance of + MGLMapView. The recommended way to set an access token is to add an entry to + your application’s Info.plist file with the key `MGLMapboxAccessToken` and + the type String. Alternatively, you may call this method from your + application delegate’s `-applicationDidFinishLaunching:` method. + */ ++ (void)setAccessToken:(nullable NSString *)accessToken; + +/** + Returns the + Mapbox access token + in use by instances of MGLMapView in the current application. + */ ++ (nullable NSString *)accessToken; + ++ (BOOL)mapboxMetricsEnabledSettingShownInApp __attribute__((deprecated("Telemetry settings are now always shown in the ℹ️ menu."))); + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLAnnotation.h b/platform/darwin/src/MGLAnnotation.h new file mode 100644 index 0000000000..e4726f9503 --- /dev/null +++ b/platform/darwin/src/MGLAnnotation.h @@ -0,0 +1,48 @@ +#import +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLAnnotation` protocol is used to provide annotation-related information to a map view. To use this protocol, you adopt it in any custom objects that store or represent annotation data. Each object then serves as the source of information about a single map annotation and provides critical information, such as the annotation’s location on the map. Annotation objects do not provide the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate objects to handle the display. + + An object that adopts this protocol must implement the `coordinate` property. The other methods of this protocol are optional. + */ +@protocol MGLAnnotation + +#pragma mark Position Attributes + +/** The center point (specified as a map coordinate) of the annotation. (required) (read-only) */ +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; + +@optional + +#pragma mark Title Attributes + +/** + The string containing the annotation’s title. + + Although this property is optional, if you support the selection of annotations in your map view, you are expected to provide this property. This string is displayed in the callout for the associated annotation. + */ +@property (nonatomic, readonly, copy, nullable) NSString *title; + +/** + The string containing the annotation’s subtitle. + + This string is displayed in the callout for the associated annotation. + */ +@property (nonatomic, readonly, copy, nullable) NSString *subtitle; + +#if !TARGET_OS_IPHONE + +/** The string containing the annotation’s tooltip. */ +@property (nonatomic, readonly, copy, nullable) NSString *toolTip; + +#endif + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLClockDirectionFormatter.h b/platform/darwin/src/MGLClockDirectionFormatter.h new file mode 100644 index 0000000000..e748a15847 --- /dev/null +++ b/platform/darwin/src/MGLClockDirectionFormatter.h @@ -0,0 +1,52 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLClockDirectionFormatter` class provides properly formatted descriptions + of headings relative to the user, known as clock positions. For + example, a value of `90` may be formatted as “3 o’clock”, depending on the + locale. + + Use this class to create localized heading strings when displaying directions + relative to the user’s current location and heading. To format a direction + irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` + instead. + */ +@interface MGLClockDirectionFormatter : NSFormatter + +/** + The unit style used by this formatter. + + This property defaults to `NSFormattingUnitStyleMedium`. + */ +@property (nonatomic) NSFormattingUnitStyle unitStyle; + +/** + The locale of the receiver. + + The locale determines the output language and numeral system of the output. + */ +@property (copy) NSLocale *locale; + +/** + Returns a clock position string for the provided value. + + @param direction The heading, measured in degrees, where 0° means “straight + ahead” and 90° means “directly to your right”. + @return The clock position string appropriately formatted for the receiver’s + locale. + */ +- (NSString *)stringFromDirection:(CLLocationDirection)direction; + +/** + This method is not supported for the `MGLDirectionFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.h b/platform/darwin/src/MGLCompassDirectionFormatter.h new file mode 100644 index 0000000000..d7c3113291 --- /dev/null +++ b/platform/darwin/src/MGLCompassDirectionFormatter.h @@ -0,0 +1,42 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLCompassDirectionFormatter` class provides properly formatted + descriptions of absolute headings. For example, a value of `90` may be + formatted as “east”, depending on the locale. + + Use this class to create localized heading strings when displaying directions + irrespective of the user’s current location. To format a direction relative to + the user’s current location, use `MGLCompassDirectionFormatter` instead. + */ +@interface MGLCompassDirectionFormatter : NSFormatter + +/** + The unit style used by this formatter. + + This property defaults to `NSFormattingUnitStyleMedium`. + */ +@property (nonatomic) NSFormattingUnitStyle unitStyle; + +/** + Returns a heading string for the provided value. + + @param direction The heading, measured in degrees, where 0° means “due north” + and 90° means “due east”. + @return The heading string appropriately formatted for the formatter’s locale. + */ +- (NSString *)stringFromDirection:(CLLocationDirection)direction; + +/** + This method is not supported for the `MGLDirectionFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLCoordinateFormatter.h b/platform/darwin/src/MGLCoordinateFormatter.h new file mode 100644 index 0000000000..885471c36e --- /dev/null +++ b/platform/darwin/src/MGLCoordinateFormatter.h @@ -0,0 +1,31 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLCoordinateFormatter` class provides properly formatted descriptions of + geographic coordinate pairs. Use this class to create localized coordinate + strings when displaying location information to users. + */ +@interface MGLCoordinateFormatter : NSFormatter + +/** + Returns a coordinate string for the provided value. + + @param coordinate The coordinate’s value. + @return The coordinate string appropriately formatted for the formatter’s + locale. + */ +- (NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate; + +/** + This method is not supported for the `MGLCoordinateFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h new file mode 100644 index 0000000000..7ad5140400 --- /dev/null +++ b/platform/darwin/src/MGLGeometry.h @@ -0,0 +1,105 @@ +#import +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** Defines the area spanned by an `MGLCoordinateBounds`. */ +typedef struct MGLCoordinateSpan { + /** Latitudes spanned by an `MGLCoordinateBounds`. */ + CLLocationDegrees latitudeDelta; + /** Longitudes spanned by an `MGLCoordinateBounds`. */ + CLLocationDegrees longitudeDelta; +} MGLCoordinateSpan; + +/** Creates a new `MGLCoordinateSpan` from the given latitudinal and longitudinal deltas. */ +NS_INLINE MGLCoordinateSpan MGLCoordinateSpanMake(CLLocationDegrees latitudeDelta, CLLocationDegrees longitudeDelta) { + MGLCoordinateSpan span; + span.latitudeDelta = latitudeDelta; + span.longitudeDelta = longitudeDelta; + return span; +} + +/** Returns `YES` if the two coordinate spans represent the same latitudinal change and the same longitudinal change. */ +NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, MGLCoordinateSpan span2) { + return (span1.latitudeDelta == span2.latitudeDelta && + span1.longitudeDelta == span2.longitudeDelta); +} + +/** An area of zero width and zero height. */ +extern const MGLCoordinateSpan MGLCoordinateSpanZero; + +/** A rectangular area as measured on a two-dimensional map projection. */ +typedef struct MGLCoordinateBounds { + /** Coordinate at the southwest corner. */ + CLLocationCoordinate2D sw; + /** Coordinate at the northeast corner. */ + CLLocationCoordinate2D ne; +} MGLCoordinateBounds; + +/** Creates a new `MGLCoordinateBounds` structure from the given southwest and northeast coordinates. */ +NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsMake(CLLocationCoordinate2D sw, CLLocationCoordinate2D ne) { + MGLCoordinateBounds bounds; + bounds.sw = sw; + bounds.ne = ne; + return bounds; +} + +/** Returns `YES` if the two coordinate bounds are equal to each other. */ +NS_INLINE BOOL MGLCoordinateBoundsEqualToCoordinateBounds(MGLCoordinateBounds bounds1, MGLCoordinateBounds bounds2) { + return (bounds1.sw.latitude == bounds2.sw.latitude && + bounds1.sw.longitude == bounds2.sw.longitude && + bounds1.ne.latitude == bounds2.ne.latitude && + bounds1.ne.longitude == bounds2.ne.longitude); +} + +/** Returns the area spanned by the coordinate bounds. */ +NS_INLINE MGLCoordinateSpan MGLCoordinateBoundsGetCoordinateSpan(MGLCoordinateBounds bounds) { + return MGLCoordinateSpanMake(bounds.ne.latitude - bounds.sw.latitude, + bounds.ne.longitude - bounds.sw.longitude); +} + +/** Returns a coordinate bounds with southwest and northeast coordinates that are offset from those of the source bounds. */ +NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsOffset(MGLCoordinateBounds bounds, MGLCoordinateSpan offset) { + MGLCoordinateBounds offsetBounds = bounds; + offsetBounds.sw.latitude += offset.latitudeDelta; + offsetBounds.sw.longitude += offset.longitudeDelta; + offsetBounds.ne.latitude += offset.latitudeDelta; + offsetBounds.ne.longitude += offset.longitudeDelta; + return offsetBounds; +} + +/** Returns `YES` if the coordinate bounds covers no area. + Note that a bounds may be empty but have a non-zero coordinate span (e.g., when its northeast point lies due north of its southwest point). */ +NS_INLINE BOOL MGLCoordinateBoundsIsEmpty(MGLCoordinateBounds bounds) { + MGLCoordinateSpan span = MGLCoordinateBoundsGetCoordinateSpan(bounds); + return span.latitudeDelta == 0 || span.longitudeDelta == 0; +} + +/** Returns a formatted string for the given coordinate bounds. */ +NS_INLINE NSString *MGLStringFromCoordinateBounds(MGLCoordinateBounds bounds) { + return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}", + bounds.sw.latitude, bounds.sw.longitude, + bounds.ne.latitude, bounds.ne.longitude]; +} + +/** Returns radians, converted from degrees. */ +NS_INLINE CGFloat MGLRadiansFromDegrees(CLLocationDegrees degrees) { + return (CGFloat)(degrees * M_PI) / 180; +} + +/** Returns degrees, converted from radians. */ +NS_INLINE CLLocationDegrees MGLDegreesFromRadians(CGFloat radians) { + return radians * 180 / M_PI; +} + +/** + Methods for round-tripping Mapbox geometry structure values. + */ +@interface NSValue (MGLGeometryAdditions) + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLMapCamera.h b/platform/darwin/src/MGLMapCamera.h new file mode 100644 index 0000000000..3cb902ba52 --- /dev/null +++ b/platform/darwin/src/MGLMapCamera.h @@ -0,0 +1,53 @@ +#import +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** An `MGLMapCamera` object represents a viewpoint from which the user observes some point on an `MGLMapView`. */ +@interface MGLMapCamera : NSObject + +/** Coordinate at the center of the map view. */ +@property (nonatomic) CLLocationCoordinate2D centerCoordinate; + +/** Heading measured in degrees clockwise from true north. */ +@property (nonatomic) CLLocationDirection heading; + +/** Pitch toward the horizon measured in degrees, with 0 degrees resulting in a two-dimensional map. */ +@property (nonatomic) CGFloat pitch; + +/** Meters above ground level. */ +@property (nonatomic) CLLocationDistance altitude; + +/** Returns a new camera with all properties set to 0. */ ++ (instancetype)camera; + +/** + Returns a new camera using based on information about the camera’s viewpoint and focus point. + + @param centerCoordinate The geographic coordinate on which the map should be centered. + @param eyeCoordinate The geometric coordinate at which the camera should be situated. + @param eyeAltitude The altitude (measured in meters) above the map at which the camera should be situated. The altitude may be less than the distance from the camera’s viewpoint to the camera’s focus point. + */ ++ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate + fromEyeCoordinate:(CLLocationCoordinate2D)eyeCoordinate + eyeAltitude:(CLLocationDistance)eyeAltitude; + +/** + Returns a new camera with the given distance, pitch, and heading. + + @param centerCoordinate The geographic coordinate on which the map should be centered. + @param distance The straight-line distance from the viewpoint to the `centerCoordinate`. + @param pitch The viewing angle of the camera, measured in degrees. A value of `0` results in a camera pointed straight down at the map. Angles greater than `0` result in a camera angled toward the horizon. + @param heading The camera’s heading, measured in degrees clockwise from true north. A value of `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. + */ ++ (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate + fromDistance:(CLLocationDistance)distance + pitch:(CGFloat)pitch + heading:(CLLocationDirection)heading; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h new file mode 100644 index 0000000000..ad9db1e681 --- /dev/null +++ b/platform/darwin/src/MGLMultiPoint.h @@ -0,0 +1,26 @@ +#import +#import + +#import "MGLShape.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The `MGLMultiPoint` class is an abstract superclass used to define shapes composed of multiple points. You should not create instances of this class directly. Instead, you should create instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use the method and properties of this class to access information about the specific points associated with the line or polygon. */ +@interface MGLMultiPoint : MGLShape + +/** The number of points associated with the shape. (read-only) */ +@property (nonatomic, readonly) NSUInteger pointCount; + +/** + Retrieves one or more coordinates associated with the shape. + + @param coords On input, you must provide a C array of structures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data. + @param range The range of points you want. The `location` field indicates the first point you are requesting, with `0` being the first point, `1` being the second point, and so on. The `length` field indicates the number of points you want. The array in _`coords`_ must be large enough to accommodate the number of requested coordinates. + */ +- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLOfflinePack.h b/platform/darwin/src/MGLOfflinePack.h new file mode 100644 index 0000000000..083e050ddd --- /dev/null +++ b/platform/darwin/src/MGLOfflinePack.h @@ -0,0 +1,180 @@ +#import + +#import "MGLOfflineRegion.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The state an offline pack is currently in. + */ +typedef NS_ENUM (NSInteger, MGLOfflinePackState) { + /** + It is unknown whether the pack is inactive, active, or complete. + + This is the initial state of a pack. The state of a pack becomes known by + the time the shared `MGLOfflineStorage` object sends the first + `MGLOfflinePackProgressChangedNotification` about the pack. For inactive + packs, you must explicitly request a progress update using the + `-[MGLOfflinePack requestProgress]` method. + + An invalid pack always has a state of `MGLOfflinePackStateInvalid`, never + `MGLOfflinePackStateUnknown`. + */ + MGLOfflinePackStateUnknown = 0, + /** + The pack is incomplete and is not currently downloading. + + This is the initial state of a pack that is created using the + `-[MGLOfflinePack addPackForRegion:withContext:completionHandler:]` method, + as well as after the `-[MGLOfflinePack suspend]` method is + called. + */ + MGLOfflinePackStateInactive = 1, + /** + The pack is incomplete and is currently downloading. + + This is the state of a pack after the `-[MGLOfflinePack resume]` method is + called. + */ + MGLOfflinePackStateActive = 2, + /** + The pack has downloaded to completion. + */ + MGLOfflinePackStateComplete = 3, + /** + The pack has been removed using the + `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. Sending + any message to the pack will raise an exception. + */ + MGLOfflinePackStateInvalid = 4, +}; + +/** + A structure containing information about an offline pack’s current download + progress. + */ +typedef struct MGLOfflinePackProgress { + /** + The number of resources that have been completely downloaded and are ready + to use offline. + */ + uint64_t countOfResourcesCompleted; + /** + The cumulative size of the downloaded resources on disk, measured in bytes. + */ + uint64_t countOfBytesCompleted; + /** + The minimum number of resources that must be downloaded in order to view + the pack’s full region without any omissions. + + At the beginning of a download, this count is a lower bound; the number of + expected resources may increase as the download progresses. + */ + uint64_t countOfResourcesExpected; + /** + The maximum number of resources that must be downloaded in order to view + the pack’s full region without any omissions. + + At the beginning of a download, when the exact number of required resources + is unknown, this field is set to `UINT64_MAX`. Thus this count is always an + upper bound. + */ + uint64_t maximumResourcesExpected; +} MGLOfflinePackProgress; + +/** + An `MGLOfflinePack` represents a collection of resources necessary for viewing + a region offline to a local database. + + To create an instance of `MGLOfflinePack`, use the + `+[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method. + A pack created using `-[MGLOfflinePack init]` is immediately invalid. + */ +@interface MGLOfflinePack : NSObject + +/** + The region for which the pack manages resources. + */ +@property (nonatomic, readonly) id region; + +/** + Arbitrary data stored alongside the downloaded resources. + + The context typically holds application-specific information for identifying + the pack, such as a user-selected name. + */ +@property (nonatomic, readonly) NSData *context; + +/** + The pack’s current state. + + The state of an inactive or completed pack is computed lazily and is set to + `MGLOfflinePackStateUnknown` by default. To request the pack’s status, use the + `-requestProgress` method. To get notified when the state becomes known and + when it changes, observe KVO change notifications on this pack’s `state` key + path. Alternatively, you can add an observer for + `MGLOfflinePackProgressChangedNotification`s about this pack that come from the + default notification center. + */ +@property (nonatomic, readonly) MGLOfflinePackState state; + +/** + The pack’s current progress. + + The progress of an inactive or completed pack is computed lazily, and all its + fields are set to 0 by default. To request the pack’s progress, use the + `-requestProgress` method. To get notified when the progress becomes + known and when it changes, observe KVO change notifications on this pack’s + `state` key path. Alternatively, you can add an observer for + `MGLOfflinePackProgressChangedNotification`s about this pack that come from the + default notification center. + */ +@property (nonatomic, readonly) MGLOfflinePackProgress progress; + +/** + Resumes downloading if the pack is inactive. + + A pack resumes asynchronously. To get notified when this pack resumes, observe + KVO change notifications on this pack’s `state` key path. Alternatively, you + can add an observer for `MGLOfflinePackProgressChangedNotification`s about this + pack that come from the default notification center. + + When a pack resumes after being suspended, it may begin by iterating over the + already downloaded resources. As a result, the `progress` structure’s + `countOfResourcesCompleted` field may revert to 0 before rapidly returning to + the level of progress at the time the pack was suspended. + + To temporarily suspend downloading, call the `-suspend` method. + */ +- (void)resume; + +/** + Temporarily stops downloading if the pack is active. + + A pack suspends asynchronously. To get notified when this pack resumes, observe + KVO change notifications on this pack’s `state` key path. Alternatively, you + can add an observer for `MGLOfflinePackProgressChangedNotification` about this + pack that come from the default notification center. + + If the pack previously reached a higher level of progress before being + suspended, it may wait to suspend until it returns to that level. + + To resume downloading, call the `-resume` method. + */ +- (void)suspend; + +/** + Request an asynchronous update to the pack’s `state` and `progress` properties. + + The state and progress of an inactive or completed pack are computed lazily. If + you need the state or progress of a pack whose `state` property is currently + set to `MGLOfflinePackStateUnknown`, observe KVO change notifications on this + pack’s `state` key path, then call this method. Alternatively, you can add an + observer for `MGLOfflinePackProgressChangedNotification` about this pack that + come from the default notification center. + */ +- (void)requestProgress; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLOfflineRegion.h b/platform/darwin/src/MGLOfflineRegion.h new file mode 100644 index 0000000000..cf98e253bd --- /dev/null +++ b/platform/darwin/src/MGLOfflineRegion.h @@ -0,0 +1,17 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + An object conforming to the `MGLOfflineRegion` protocol determines which + resources are required by an `MGLOfflinePack` object. At present, only + instances of `MGLTilePyramidOfflineRegion` may be used as `MGLOfflinePack` + regions, but additional conforming implementations may be added in the future. + */ +@protocol MGLOfflineRegion + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h new file mode 100644 index 0000000000..20cc521f2e --- /dev/null +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -0,0 +1,222 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@class MGLOfflinePack; +@protocol MGLOfflineRegion; + +/** + Posted by the shared `MGLOfflineStorage` object when an `MGLOfflinePack` + object’s progress changes. The progress may change due to a resource being + downloaded or because the pack discovers during the download that more + resources are required for offline viewing. This notification is posted + whenever any field in the `progress` property changes. + + The `object` is the `MGLOfflinePack` object whose progress changed. The + `userInfo` dictionary contains the pack’s current state in the + `MGLOfflinePackStateUserInfoKey` key and details about the pack’s current + progress in the `MGLOfflinePackProgressUserInfoKey` key. You may also consult + the pack’s `state` and `progress` properties, which provide the same values. + + If you only need to observe changes in a particular pack’s progress, you can + alternatively observe KVO change notifications to the pack’s `progress` key + path. + */ +extern NSString * const MGLOfflinePackProgressChangedNotification; + +/** + Posted by the shared `MGLOfflineStorage` object whenever an `MGLOfflinePack` + object encounters an error while downloading. The error may be recoverable and + may not warrant the user’s attention. For example, the pack’s implementation + may attempt to re-request failed resources based on an exponential backoff + strategy or upon the restoration of network access. + + The `object` is the `MGLOfflinePack` object that encountered the error. The + `userInfo` dictionary contains the error object in the + `MGLOfflinePackErrorUserInfoKey` key. + */ +extern NSString * const MGLOfflinePackErrorNotification; + +/** + Posted by the shared `MGLOfflineStorage` object when the maximum number of + Mapbox-hosted tiles has been downloaded and stored on the current device. + + The `object` is the `MGLOfflinePack` object that reached the tile limit in the + course of downloading. The `userInfo` dictionary contains the tile limit in the + `MGLOfflinePackMaximumCountUserInfoKey` key. + + Once this limit is reached, no instance of `MGLOfflinePack` can download + additional tiles from Mapbox APIs until already downloaded tiles are removed by + calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. + Contact your Mapbox sales representative to have the limit raised. + */ +extern NSString * const MGLOfflinePackMaximumMapboxTilesReachedNotification; + +/** + The key for an `NSNumber` object that indicates an offline pack’s current + state. This key is used in the `userInfo` dictionary of an + `MGLOfflinePackProgressChangedNotification` notification. Call `-integerValue` + on the object to receive the `MGLOfflinePackState`-typed state. + */ +extern NSString * const MGLOfflinePackStateUserInfoKey; + +/** + The key for an `NSValue` object that indicates an offline pack’s current + progress. This key is used in the `userInfo` dictionary of an + `MGLOfflinePackProgressChangedNotification` notification. Call + `-MGLOfflinePackProgressValue` on the object to receive the + `MGLOfflinePackProgress`-typed progress. + */ +extern NSString * const MGLOfflinePackProgressUserInfoKey; + +/** + The key for an `NSError` object that is encountered in the course of + downloading an offline pack. This key is used in the `userInfo` dictionary of + an `MGLOfflinePackErrorNotification` notification. The error’s domain is + `MGLErrorDomain`. See `MGLErrorCode` for possible error codes. + */ +extern NSString * const MGLOfflinePackErrorUserInfoKey; + +/** + The key for an `NSNumber` object that indicates the maximum number of + Mapbox-hosted tiles that may be downloaded and stored on the current device. + This key is used in the `userInfo` dictionary of an + `MGLOfflinePackMaximumMapboxTilesReachedNotification` notification. Call + `-unsignedLongLongValue` on the object to receive the `uint64_t`-typed tile + limit. + */ +extern NSString * const MGLOfflinePackMaximumCountUserInfoKey; + +/** + A block to be called once an offline pack has been completely created and + added. + + An application typically calls the `-resume` method on the pack inside this + completion handler to begin the download. + + @param pack Contains a pointer to the newly added pack, or `nil` if there was + an error creating or adding the pack. + @param error Contains a pointer to an error object (if any) indicating why the + pack could not be created or added. + */ +typedef void (^MGLOfflinePackAdditionCompletionHandler)(MGLOfflinePack * _Nullable pack, NSError * _Nullable error); + +/** + A block to be called once an offline pack has been completely invalidated and + removed. + + Avoid any references to the pack inside this completion handler: by the time + this completion handler is executed, the pack has become invalid, and any + messages passed to it will raise an exception. + + @param error Contains a pointer to an error object (if any) indicating why the + pack could not be invalidated or removed. + */ +typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error); + +/** + MGLOfflineStorage implements a singleton (shared object) that manages offline + packs. All of this class’s instance methods are asynchronous, reflecting the + fact that offline resources are stored in a database. The shared object + maintains a canonical collection of offline packs in its `packs` property. + */ +@interface MGLOfflineStorage : NSObject + +/** + Returns the shared offline storage object. + */ ++ (instancetype)sharedOfflineStorage; + +/** + An array of all known offline packs, in the order in which they were created. + + This property is set to `nil`, indicating that the receiver does not yet know + the existing packs, for an undefined amount of time starting from the moment + the shared offline storage object is initialized until the packs are fetched + from the database. After that point, this property is always non-nil, but it + may be empty to indicate that no packs are present. + + To detect when the shared offline storage object has finished loading its + `packs` property, observe KVO change notifications on the `packs` key path. + The initial load results in an `NSKeyValueChangeSetting` change. + */ +@property (nonatomic, strong, readonly, nullable) NS_ARRAY_OF(MGLOfflinePack *) *packs; + +/** + Creates and registers an offline pack that downloads the resources needed to + use the given region offline. + + The resulting pack is added to the shared offline storage object’s `packs` + property, then the `completion` block is executed with that pack passed in. + + The pack has an initial state of `MGLOfflinePackStateInactive`. To begin + downloading resources, call `-[MGLOfflinePack resume]` on the pack from within + the completion handler. To monitor download progress, add an observer for + `MGLOfflinePackProgressChangedNotification`s about that pack. + + To detect when any call to this method results in a new pack, observe KVO + change notifications on the shared offline storage object’s `packs` key path. + Additions to that array result in an `NSKeyValueChangeInsertion` change. + + @param region A region to download. + @param context Arbitrary data to store alongside the downloaded resources. + @param completion The completion handler to call once the pack has been added. + This handler is executed asynchronously on the main queue. + */ +- (void)addPackForRegion:(id )region withContext:(NSData *)context completionHandler:(nullable MGLOfflinePackAdditionCompletionHandler)completion; + +/** + Unregisters the given offline pack and frees any resources that are no longer + required by any remaining packs. + + As soon as this method is called on a pack, the pack becomes invalid; any + attempt to send it a message will result in an exception being thrown. If an + error occurs and the pack cannot be removed, do not attempt to reuse the pack + object. Instead, if you need continued access to the pack, suspend all packs + and use the `-reloadPacks` method to obtain valid pointers to all the packs. + + To detect when any call to this method results in a pack being removed, observe + KVO change notifications on the shared offline storage object’s `packs` key + path. Removals from that array result in an `NSKeyValueChangeRemoval` change. + + @param pack The offline pack to remove. + @param completion The completion handler to call once the pack has been + removed. This handler is executed asynchronously on the main queue. + */ +- (void)removePack:(MGLOfflinePack *)pack withCompletionHandler:(nullable MGLOfflinePackRemovalCompletionHandler)completion; + +/** + Forcibly, asynchronously reloads the `packs` property. At some point after this + method is called, the pointer values of the `MGLOfflinePack` objects in the + `packs` property change, even if the underlying data for these packs has not + changed. If this method is called while a pack is actively downloading, the + behavior is undefined. + + You typically do not need to call this method. + + To detect when the shared offline storage object has finished reloading its + `packs` property, observe KVO change notifications on the `packs` key path. + A reload results in an `NSKeyValueChangeSetting` change. + */ +- (void)reloadPacks; + +/** + Sets the maximum number of Mapbox-hosted tiles that may be downloaded and + stored on the current device. + + Once this limit is reached, an + `MGLOfflinePackMaximumMapboxTilesReachedNotification` is posted for every + attempt to download additional tiles until already downloaded tiles are removed + by calling the `-removePack:withCompletionHandler:` method. + + @note The Mapbox Terms of Service + prohibits changing or bypassing this limit without permission from Mapbox. + Contact your Mapbox sales representative to have the limit raised. + */ +- (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLOverlay.h b/platform/darwin/src/MGLOverlay.h new file mode 100644 index 0000000000..aa80fe3900 --- /dev/null +++ b/platform/darwin/src/MGLOverlay.h @@ -0,0 +1,46 @@ +#import +#import + +#import "MGLAnnotation.h" +#import "MGLGeometry.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLOverlay` protocol defines a specific type of annotation that represents both a point and an area on a map. Overlay objects are essentially data objects that contain the geographic data needed to represent the map area. For example, overlays can take the form of common shapes such as rectangles and circles. They can also describe polygons and other complex shapes. + + You use overlays to layer more sophisticated content on top of a map view. For example, you could use an overlay to show the boundaries of a national park or trace a bus route along city streets. The Mapbox iOS SDK defines several concrete classes that conform to this protocol and define standard shapes. + + Because overlays are also annotations, they have similar usage pattern to annotations. When added to a map view using the `-addOverlay:` method, that view detects whenever the overlay’s defined region intersects the visible portion of the map. At that point, the map view asks its delegate to provide a special overlay view to draw the visual representation of the overlay. If you add an overlay to a map view as an annotation instead, it is treated as an annotation with a single point. + */ +@protocol MGLOverlay + +/** + The approximate center point of the overlay area. (required) (read-only) + + This point is typically set to the center point of the map’s bounding rectangle. It is used as the anchor point for any callouts displayed for the annotation. + */ +@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; + +/** + The cooordinate rectangle that encompasses the overlay. (required) (read-only) + + This property contains the smallest rectangle that completely encompasses the overlay. Implementers of this protocol must set this area when implementing their overlay class, and after setting it, you must not change it. + */ +@property (nonatomic, readonly) MGLCoordinateBounds overlayBounds; + +/** + Returns a Boolean indicating whether the specified rectangle intersects the receiver’s shape. + + You can implement this method to provide more specific bounds checking for an overlay. If you do not implement it, the bounding rectangle is used to detect intersections. + + @param overlayBounds The rectangle to intersect with the receiver’s area. + @return `YES` if any part of the map rectangle intersects the receiver’s shape or `NO` if it does not. + */ +- (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h new file mode 100644 index 0000000000..d186cbff18 --- /dev/null +++ b/platform/darwin/src/MGLPointAnnotation.h @@ -0,0 +1,18 @@ +#import +#import + +#import "MGLShape.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The `MGLPointAnnotation` class defines a concrete annotation object located at a specified point. You can use this class, rather than define your own, in situations where all you want to do is associate a point on the map with a title. */ +@interface MGLPointAnnotation : MGLShape + +/** The coordinate point of the annotation, specified as a latitude and longitude. */ +@property (nonatomic, assign) CLLocationCoordinate2D coordinate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h new file mode 100644 index 0000000000..c5480264fb --- /dev/null +++ b/platform/darwin/src/MGLPolygon.h @@ -0,0 +1,26 @@ +#import +#import + +#import "MGLMultiPoint.h" +#import "MGLOverlay.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The `MGLPolygon` class represents a shape consisting of one or more points that define a closed polygon. The points are connected end-to-end in the order they are provided. The first and last points are connected to each other to create the closed shape. */ +@interface MGLPolygon : MGLMultiPoint + +/** + Creates and returns an `MGLPolygon` object from the specified set of coordinates. + + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. + @param count The number of items in the `coords` array. + @return A new polygon object. + */ ++ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords + count:(NSUInteger)count; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h new file mode 100644 index 0000000000..c28299c7e0 --- /dev/null +++ b/platform/darwin/src/MGLPolyline.h @@ -0,0 +1,26 @@ +#import +#import + +#import "MGLMultiPoint.h" +#import "MGLOverlay.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The `MGLPolyline` class represents a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other. */ +@interface MGLPolyline : MGLMultiPoint + +/** + Creates and returns an `MGLPolyline` object from the specified set of coordinates. + + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. + @param count The number of items in the `coords` array. + @return A new polyline object. + */ ++ (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords + count:(NSUInteger)count; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h new file mode 100644 index 0000000000..c1b84816f2 --- /dev/null +++ b/platform/darwin/src/MGLShape.h @@ -0,0 +1,27 @@ +#import + +#import "MGLAnnotation.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The `MGLShape` class is an abstract class that defines the basic properties for all shape-based annotation objects. This class must be subclassed and cannot be used as is. Subclasses are responsible for defining the geometry of the shape and providing an appropriate value for the coordinate property inherited from the `MGLAnnotation` protocol. */ +@interface MGLShape : NSObject + +/** The title of the shape annotation. The default value of this property is `nil`. */ +@property (nonatomic, copy, nullable) NSString *title; + +/** The subtitle of the shape annotation. The default value of this property is `nil`. */ +@property (nonatomic, copy, nullable) NSString *subtitle; + +#if !TARGET_OS_IPHONE + +/** The tooltip of the shape annotation. The default value of this property is `nil`. */ +@property (nonatomic, copy, nullable) NSString *toolTip; + +#endif + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h new file mode 100644 index 0000000000..e5b2de877c --- /dev/null +++ b/platform/darwin/src/MGLStyle.h @@ -0,0 +1,56 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** A collection of convenience methods for creating style URLs of default styles provided by Mapbox. These instances of NSURL are cached. */ +@interface MGLStyle : NSObject + +/** + Returns the Streets style URL. + + Mapbox Streets is a complete base map, perfect for incorporating your own data. + */ ++ (NSURL *)streetsStyleURL; + +/** + Returns the Emerald style URL. + + Emerald is a versatile style with emphasis on road networks and public transportation. + */ ++ (NSURL *)emeraldStyleURL; + +/** + Returns the Light style URL. + + Light is a subtle, light-colored backdrop for data visualizations. + */ ++ (NSURL *)lightStyleURL; + +/** + Returns the Dark style URL. + + Dark is a subtle, dark-colored backdrop for data visualizations. + */ ++ (NSURL *)darkStyleURL; + +/** + Returns the Satellite style URL. + + Mapbox Satellite is a beautiful global satellite and aerial imagery layer. + */ ++ (NSURL *)satelliteStyleURL; + +/** + Returns the Hybrid style URL. + + Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels. + */ ++ (NSURL *)hybridStyleURL; + +- (instancetype)init NS_UNAVAILABLE; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.h b/platform/darwin/src/MGLTilePyramidOfflineRegion.h new file mode 100644 index 0000000000..4e9f394e74 --- /dev/null +++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.h @@ -0,0 +1,78 @@ +#import + +#import "MGLOfflineRegion.h" +#import "MGLGeometry.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + An offline region defined by a style URL, geographic coordinate bounds, and + range of zoom levels. + */ +@interface MGLTilePyramidOfflineRegion : NSObject + +/** + URL of the style whose resources are required for offline viewing. + + In addition to the JSON stylesheet, different styles may require different font + glyphs, sprite sheets, and other resources. + + The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s + map ID (`mapbox://styles/{user}/{style}`). + */ +@property (nonatomic, readonly) NSURL *styleURL; + +/** + The coordinate bounds for the geographic region covered by the downloaded + tiles. + */ +@property (nonatomic, readonly) MGLCoordinateBounds bounds; + +/** + The minimum zoom level for which to download tiles and other resources. + + For more information about zoom levels, `-[MGLMapView zoomLevel]`. + */ +@property (nonatomic, readonly) double minimumZoomLevel; + +/** + The maximum zoom level for which to download tiles and other resources. + + For more information about zoom levels, `-[MGLMapView zoomLevel]`. + */ +@property (nonatomic, readonly) double maximumZoomLevel; + +- (instancetype)init NS_UNAVAILABLE; + +/** + Initializes a newly created offline region with the given style URL, geographic + coordinate bounds, and range of zoom levels. + + This is the designated initializer for `MGLTilePyramidOfflineRegion`. + + @param styleURL URL of the map style for which to download resources. The URL + may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map + ID (`mapbox://styles/{user}/{style}`). Specify `nil` for the default style. + Relative file URLs cannot be used as offline style URLs. To download the + online resources required by a local style, specify a URL to an online copy + of the style. + @param bounds The coordinate bounds for the geographic region to be covered by + the downloaded tiles. + @param minimumZoomLevel The minimum zoom level to be covered by the downloaded + tiles. This parameter should be set to at least 0 but no greater than the + value of the `maximumZoomLevel` parameter. For each required tile source, if + this parameter is set to a value less than the tile source’s minimum zoom + level, the download covers zoom levels down to the tile source’s minimum + zoom level. + @param maximumZoomLevel The maximum zoom level to be covered by the downloaded + tiles. This parameter should be set to at least the value of the + `minimumZoomLevel` parameter. For each required tile source, if this + parameter is set to a value greater than the tile source’s minimum zoom + level, the download covers zoom levels up to the tile source’s maximum zoom + level. + */ +- (instancetype)initWithStyleURL:(nullable NSURL *)styleURL bounds:(MGLCoordinateBounds)bounds fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h new file mode 100644 index 0000000000..746cb686c0 --- /dev/null +++ b/platform/darwin/src/MGLTypes.h @@ -0,0 +1,64 @@ +#import + +#pragma once + +#if !__has_feature(nullability) + #define NS_ASSUME_NONNULL_BEGIN + #define NS_ASSUME_NONNULL_END + #define nullable + #define nonnull + #define null_resettable + #define _Nullable + #define _Nonnull +#endif + +NS_ASSUME_NONNULL_BEGIN + +/** Indicates an error occurred in the Mapbox SDK. */ +extern NSString * const MGLErrorDomain; + +/** Error constants for the Mapbox SDK. */ +typedef NS_ENUM(NSInteger, MGLErrorCode) { + /** An unknown error occurred. */ + MGLErrorCodeUnknown = -1, + /** The resource could not be found. */ + MGLErrorCodeNotFound = 1, + /** The connection received an invalid server response. */ + MGLErrorCodeBadServerResponse = 2, + /** An attempt to establish a connection failed. */ + MGLErrorCodeConnectionFailed = 3, +}; + +/** The mode used to track the user location on the map. */ +typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) { + /** The map does not follow the user location. */ + MGLUserTrackingModeNone = 0, + /** The map follows the user location. */ + MGLUserTrackingModeFollow, + /** The map follows the user location and rotates when the heading changes. */ + MGLUserTrackingModeFollowWithHeading, + /** The map follows the user location and rotates when the course changes. */ + MGLUserTrackingModeFollowWithCourse, +}; + +NS_ASSUME_NONNULL_END + +#ifndef NS_ARRAY_OF + // Foundation collection classes adopted lightweight generics in iOS 9.0 and OS X 10.11 SDKs. + #if __has_feature(objc_generics) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) + /** Inserts a type specifier for a pointer to a lightweight generic with the given collection and object classes. Use a `*` for any non-`id` object classes but no `*` for the collection class. */ + #define NS_ARRAY_OF(ObjectClass...) NSArray + #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray + #define NS_SET_OF(ObjectClass...) NSSet + #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet + #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary + #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary + #else + #define NS_ARRAY_OF(ObjectClass...) NSArray + #define NS_MUTABLE_ARRAY_OF(ObjectClass...) NSMutableArray + #define NS_SET_OF(ObjectClass...) NSSet + #define NS_MUTABLE_SET_OF(ObjectClass...) NSMutableSet + #define NS_DICTIONARY_OF(ObjectClass...) NSDictionary + #define NS_MUTABLE_DICTIONARY_OF(ObjectClass...) NSMutableDictionary + #endif +#endif diff --git a/platform/darwin/src/NSValue+MGLAdditions.h b/platform/darwin/src/NSValue+MGLAdditions.h new file mode 100644 index 0000000000..4a97c8e115 --- /dev/null +++ b/platform/darwin/src/NSValue+MGLAdditions.h @@ -0,0 +1,75 @@ +#import + +#import "MGLGeometry.h" +#import "MGLOfflinePack.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Methods for round-tripping values for Mapbox-defined types. + */ +@interface NSValue (MGLAdditions) + +#pragma mark Working with Geographic Coordinate Values + +/** + Creates a new value object containing the specified Core Location geographic + coordinate structure. + + @param coordinate The value for the new object. + @return A new value object that contains the geographic coordinate information. + */ ++ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate; + +/** + The Core Location geographic coordinate structure representation of the value. + */ +@property (readonly) CLLocationCoordinate2D MGLCoordinateValue; + +/** + Creates a new value object containing the specified Mapbox coordinate span + structure. + + @param span The value for the new object. + @return A new value object that contains the coordinate span information. + */ ++ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span; + +/** + The Mapbox coordinate span structure representation of the value. + */ +@property (readonly) MGLCoordinateSpan MGLCoordinateSpanValue; + +/** + Creates a new value object containing the specified Mapbox coordinate bounds + structure. + + @param bounds The value for the new object. + @return A new value object that contains the coordinate bounds information. + */ ++ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds; + +/** + The Mapbox coordinate bounds structure representation of the value. + */ +@property (readonly) MGLCoordinateBounds MGLCoordinateBoundsValue; + +#pragma mark Working with Offline Map Values + +/** + Creates a new value object containing the given `MGLOfflinePackProgress` + structure. + + @param progress The value for the new object. + @return A new value object that contains the offline pack progress information. + */ ++ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress; + +/** + The `MGLOfflinePackProgress` structure representation of the value. + */ +@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/MGLAnnotationImage.h b/platform/ios/include/MGLAnnotationImage.h deleted file mode 100644 index fa2adb3830..0000000000 --- a/platform/ios/include/MGLAnnotationImage.h +++ /dev/null @@ -1,44 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view. */ -@interface MGLAnnotationImage : NSObject - -#pragma mark Initializing and Preparing the Image Object - -/** - Initializes and returns a new annotation image object. - - @param image The image to be displayed for the annotation. - @param reuseIdentifier The string that identifies that this annotation image is reusable. - @return The initialized annotation image object or `nil` if there was a problem initializing the object. - */ -+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier; - -#pragma mark Getting and Setting Attributes - -/** The image to be displayed for the annotation. */ -@property (nonatomic, strong, nullable) UIImage *image; - -/** - The string that identifies that this annotation image is reusable. (read-only) - - You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen. - - If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one. - */ -@property (nonatomic, readonly) NSString *reuseIdentifier; - -/** - A Boolean value indicating whether the annotation is enabled. - - The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected. - */ -@property (nonatomic, getter=isEnabled) BOOL enabled; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/MGLCalloutView.h b/platform/ios/include/MGLCalloutView.h deleted file mode 100644 index 59f52adb6d..0000000000 --- a/platform/ios/include/MGLCalloutView.h +++ /dev/null @@ -1,72 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol MGLCalloutViewDelegate; -@protocol MGLAnnotation; - -/** - A protocol for a `UIView` subclass that displays information about a selected annotation near that annotation. - */ -@protocol MGLCalloutView - -/** - An object conforming to the `MGLAnnotation` protocol whose details this callout view displays. - */ -@property (nonatomic, strong) id representedObject; - -/** - A view that the user may tap to perform an action. This view is conventionally positioned on the left side of the callout view. - */ -@property (nonatomic, strong) UIView *leftAccessoryView; - -/** - A view that the user may tap to perform an action. This view is conventionally positioned on the right side of the callout view. - */ -@property (nonatomic, strong) UIView *rightAccessoryView; - -/** - An object conforming to the `MGLCalloutViewDelegate` method that receives messages related to the callout view’s interactive subviews. - */ -@property (nonatomic, weak) id delegate; - -/** - Presents a callout view by adding it to `inView` and pointing at the given rect of `inView`’s bounds. Constrains the callout to the bounds of the given view. - */ -- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated; - -/** - Dismisses the callout view. - */ -- (void)dismissCalloutAnimated:(BOOL)animated; - -@end - -/** - The MGLCalloutViewDelegate protocol defines a set of optional methods that you can use to receive messages from an object that conforms to the MGLCalloutView protocol. The callout view uses these methods to inform the delegate that the user has interacted with the the callout view. - */ -@protocol MGLCalloutViewDelegate - -@optional -/** - Returns a Boolean value indicating whether the entire callout view “highlights” when tapped. The default value is `YES`, which means the callout view highlights when tapped. - - The return value of this method is ignored unless the delegate also responds to the `-calloutViewTapped` method. - */ -- (BOOL)calloutViewShouldHighlight:(UIView *)calloutView; - -/** - Tells the delegate that the callout view has been tapped. - */ -- (void)calloutViewTapped:(UIView *)calloutView; - -/** - Called before the callout view appears on screen, or before the appearance animation will start. - */ -- (void)calloutViewWillAppear:(UIView *)calloutView; - -@end - -NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/platform/ios/include/MGLMapView+IBAdditions.h b/platform/ios/include/MGLMapView+IBAdditions.h deleted file mode 100644 index f18df56e01..0000000000 --- a/platform/ios/include/MGLMapView+IBAdditions.h +++ /dev/null @@ -1,49 +0,0 @@ -#import - -#import "MGLTypes.h" - -@class MGLMapView; - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLMapView (IBAdditions) - -// Core properties that can be manipulated in the Attributes inspector in -// Interface Builder. These redeclarations merely add the IBInspectable keyword. -// They appear here to ensure that they appear above the convenience properties; -// inspectables declared in MGLMapView.h are always sorted before those in -// MGLMapView+IBAdditions.h, due to ASCII sort order. - -#if TARGET_INTERFACE_BUILDER - -// HACK: We want this property to look like a URL bar in the Attributes -// inspector, but just calling it styleURL would violate Cocoa naming -// conventions and conflict with the existing NSURL property. Fortunately, IB -// strips out the two underscores for display. -@property (nonatomic, nullable) IBInspectable NSString *styleURL__; - -#endif // TARGET_INTERFACE_BUILDER - -// Convenience properties related to the initial viewport. These properties -// are not meant to be used outside of Interface Builder. latitude and longitude -// are backed by properties of type CLLocationDegrees, but these declarations -// must use the type double because Interface Builder is unaware that -// CLLocationDegrees is a typedef for double. - -@property (nonatomic) IBInspectable double latitude; -@property (nonatomic) IBInspectable double longitude; -@property (nonatomic) IBInspectable double zoomLevel; - -// Renamed properties. Interface Builder derives the display name of each -// inspectable from the runtime name, but runtime names don’t always make sense -// in UI. - -@property (nonatomic) IBInspectable BOOL allowsZooming; -@property (nonatomic) IBInspectable BOOL allowsScrolling; -@property (nonatomic) IBInspectable BOOL allowsRotating; -@property (nonatomic) IBInspectable BOOL allowsTilting; -@property (nonatomic) IBInspectable BOOL showsUserLocation; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/MGLMapView+MGLCustomStyleLayerAdditions.h b/platform/ios/include/MGLMapView+MGLCustomStyleLayerAdditions.h deleted file mode 100644 index de4dc01f99..0000000000 --- a/platform/ios/include/MGLMapView+MGLCustomStyleLayerAdditions.h +++ /dev/null @@ -1,26 +0,0 @@ -#import "MGLMapView.h" - -NS_ASSUME_NONNULL_BEGIN - -typedef void (^MGLCustomStyleLayerPreparationHandler)(void); - -typedef void (^MGLCustomStyleLayerDrawingHandler)(CGSize size, - CLLocationCoordinate2D centerCoordinate, - double zoomLevel, - CLLocationDirection direction, - CGFloat pitch, - CGFloat perspectiveSkew); - -typedef void (^MGLCustomStyleLayerCompletionHandler)(void); - -@interface MGLMapView (MGLCustomStyleLayerAdditions) - -- (void)insertCustomStyleLayerWithIdentifier:(NSString *)identifier preparationHandler:(MGLCustomStyleLayerPreparationHandler)preparation drawingHandler:(MGLCustomStyleLayerDrawingHandler)drawing completionHandler:(MGLCustomStyleLayerCompletionHandler)completion belowStyleLayerWithIdentifier:(nullable NSString *)otherIdentifier; - -- (void)removeCustomStyleLayerWithIdentifier:(NSString *)identifier; - -- (void)setCustomStyleLayersNeedDisplay; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/MGLMapView.h b/platform/ios/include/MGLMapView.h deleted file mode 100644 index 0339a5457b..0000000000 --- a/platform/ios/include/MGLMapView.h +++ /dev/null @@ -1,1296 +0,0 @@ -#import "MGLGeometry.h" -#import "MGLMapCamera.h" - -#import -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -@class MGLAnnotationImage; -@class MGLUserLocation; -@class MGLPolyline; -@class MGLPolygon; -@class MGLShape; - -@protocol MGLMapViewDelegate; -@protocol MGLAnnotation; -@protocol MGLOverlay; -@protocol MGLCalloutView; - -/** The vertical alignment of an annotation within a map view. */ -typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) { - /** Aligns the annotation vertically in the center of the map view. */ - MGLAnnotationVerticalAlignmentCenter = 0, - /** Aligns the annotation vertically at the top of the map view. */ - MGLAnnotationVerticalAlignmentTop, - /** Aligns the annotation vertically at the bottom of the map view. */ - MGLAnnotationVerticalAlignmentBottom, -}; - -/** Options for enabling debugging features in an MGLMapView instance. */ -typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) { - /** Edges of tile boundaries are shown as thick, red lines to help diagnose - tile clipping issues. */ - MGLMapDebugTileBoundariesMask = 1 << 1, - /** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */ - MGLMapDebugTileInfoMask = 1 << 2, - /** Each tile shows a timestamp indicating when it was loaded. */ - MGLMapDebugTimestampsMask = 1 << 3, - /** Edges of glyphs and symbols are shown as faint, green lines to help - diagnose collision and label placement issues. */ - MGLMapDebugCollisionBoxesMask = 1 << 4, -}; - -/** - An interactive, customizable map view with an interface similar to the one - provided by Apple's MapKit. - - Using `MGLMapView`, you can embed the map inside a view, allow users to - manipulate it with standard gestures, animate the map between different - viewpoints, and present information in the form of annotations and overlays. - - The map view loads scalable vector tiles that conform to the - Mapbox Vector Tile Specification. - It styles them with a style that conforms to the - Mapbox GL style specification. - Such styles can be designed in - Mapbox Studio and hosted on - mapbox.com. - - A collection of Mapbox-hosted styles is available through the `MGLStyle` - class. These basic styles use - Mapbox Streets - or Mapbox Satellite data - sources, but you can specify a custom style that makes use of your own data. - - Mapbox-hosted vector tiles and styles require an API access token, which you - can obtain from the - Mapbox account page. - Access tokens associate requests to Mapbox's vector tile and style APIs with - your Mapbox account. They also deter other developers from using your styles - without your permission. - - @note You are responsible for getting permission to use the map data and for - ensuring that your use adheres to the relevant terms of use. - */ -IB_DESIGNABLE -@interface MGLMapView : UIView - -#pragma mark Creating Instances - -/** - Initializes and returns a newly allocated map view with the specified frame - and the default style. - - @param frame The frame for the view, measured in points. - @return An initialized map view. - */ -- (instancetype)initWithFrame:(CGRect)frame; - -/** - Initializes and returns a newly allocated map view with the specified frame - and style URL. - - @param frame The frame for the view, measured in points. - @param styleURL URL of the map style to display. The URL may be a full HTTP - or HTTPS URL, a Mapbox URL indicating the style's map ID - (`mapbox://styles/{user}/{style}`), or a path to a local file relative - to the application's resource path. Specify `nil` for the default style. - @return An initialized map view. - */ -- (instancetype)initWithFrame:(CGRect)frame styleURL:(nullable NSURL *)styleURL; - -#pragma mark Accessing the Delegate - -/** - The receiver's delegate. - - A map view sends messages to its delegate to notify it of changes to its - contents or the viewpoint. The delegate also provides information about - annotations displayed on the map, such as the styles to apply to individual - annotations. - */ -@property(nonatomic, weak, nullable) IBOutlet id delegate; - -#pragma mark Configuring the Map's Appearance - -/** - URLs of the styles bundled with the library. - - @deprecated Call the relevant class method of `MGLStyle` for the URL of a - particular default style. - */ -@property (nonatomic, readonly) NS_ARRAY_OF(NSURL *) *bundledStyleURLs __attribute__((deprecated("Call the relevant class method of MGLStyle for the URL of a particular default style."))); - -/** - URL of the style currently displayed in the receiver. - - The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style's - map ID (`mapbox://styles/{user}/{style}`), or a path to a local file - relative to the application's resource path. - - If you set this property to `nil`, the receiver will use the default style - and this property will automatically be set to that style's URL. - */ -@property (nonatomic, null_resettable) NSURL *styleURL; - -/** - Reloads the style. - - You do not normally need to call this method. The map view automatically - responds to changes in network connectivity by reloading the style. You may - need to call this method if you change the access token after a style has - loaded but before loading a style associated with a different Mapbox account. - - This method does not bust the cache. Even if the style has recently changed on - the server, calling this method does not necessarily ensure that the map view - reflects those changes. - */ -- (IBAction)reloadStyle:(id)sender; - -/** - A control indicating the map's direction and allowing the user to manipulate - the direction, positioned in the upper-right corner. - */ -@property (nonatomic, readonly) UIImageView *compassView; - -/** - The Mapbox logo, positioned in the lower-left corner. - - @note The Mapbox terms of service, which governs the use of Mapbox-hosted - vector tiles and styles, - requires most Mapbox - customers to display the Mapbox logo. If this applies to you, do not - hide this view or change its contents. - */ -@property (nonatomic, readonly) UIImageView *logoView; - -/** - A view showing legally required copyright notices and telemetry settings, - positioned at the bottom-right of the map view. - - @note The Mapbox terms of service, which governs the use of Mapbox-hosted - vector tiles and styles, - requires these - copyright notices to accompany any map that features Mapbox-designed styles, - OpenStreetMap data, or other Mapbox data such as satellite or terrain - data. If that applies to this map view, do not hide this view or remove - any notices from it. - - @note You are additionally - required - to provide users with the option to disable anonymous usage and location - sharing (telemetry). If this view is hidden, you must implement this - setting elsewhere in your app or via `Settings.bundle`. See our - website for - implementation help. - */ -@property (nonatomic, readonly) UIButton *attributionButton; - -/** - Currently active style classes, represented as an array of string identifiers. - */ -@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses; - -/** - Returns a Boolean value indicating whether the style class with the given - identifier is currently active. - - @param styleClass The style class to query for. - @return Whether the style class is currently active. - */ -- (BOOL)hasStyleClass:(NSString *)styleClass; - -/** - Activates the style class with the given identifier. - - @param styleClass The style class to activate. - */ -- (void)addStyleClass:(NSString *)styleClass; - -/** - Deactivates the style class with the given identifier. - - @param styleClass The style class to deactivate. - */ -- (void)removeStyleClass:(NSString *)styleClass; - -#pragma mark Displaying the User's Location - -/** - A Boolean value indicating whether the map may display the user location. - - Setting this property to `YES` causes the map view to use the Core Location - framework to find the current location. As long as this property is `YES`, the - map view continues to track the user's location and update it periodically. - - This property does not indicate whether the user's position is actually visible - on the map, only whether the map view is allowed to display it. To determine - whether the user's position is visible, use the `userLocationVisible` property. - The default value of this property is `NO`. - - On iOS 8 and above, your app must specify a value for - `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` in - its `Info.plist` to satisfy the requirements of the underlying Core Location - framework when enabling this property. - */ -@property (nonatomic, assign) BOOL showsUserLocation; - -/** - A Boolean value indicating whether the device's current location is visible in - the map view. - - Use `showsUserLocation` to control the visibility of the on-screen user - location annotation. - */ -@property (nonatomic, assign, readonly, getter=isUserLocationVisible) BOOL userLocationVisible; - -/** - Returns the annotation object indicating the user's current location. - */ -@property (nonatomic, readonly, nullable) MGLUserLocation *userLocation; - -/** - The mode used to track the user location. The default value is - `MGLUserTrackingModeNone`. - - Changing the value of this property updates the map view with an animated - transition. If you don’t want to animate the change, use the - `-setUserTrackingMode:animated:` method instead. - */ -@property (nonatomic, assign) MGLUserTrackingMode userTrackingMode; - -/** - Sets the mode used to track the user location, with an optional transition. - - @param mode The mode used to track the user location. - @param animated If `YES`, there is an animated transition from the current - viewport to a viewport that results from the change to `mode`. If `NO`, the - map view instantaneously changes to the new viewport. This parameter only - affects the initial transition; subsequent changes to the user location or - heading are always animated. - */ -- (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated; - -/** - The vertical alignment of the user location annotation within the receiver. The - default value is `MGLAnnotationVerticalAlignmentCenter`. - - Changing the value of this property updates the map view with an animated - transition. If you don’t want to animate the change, use the - `-setUserLocationVerticalAlignment:animated:` method instead. - */ -@property (nonatomic, assign) MGLAnnotationVerticalAlignment userLocationVerticalAlignment; - -/** - Sets the vertical alignment of the user location annotation within the - receiver, with an optional transition. - - @param alignment The vertical alignment of the user location annotation. - @param animated If `YES`, the user location annotation animates to its new - position within the map view. If `NO`, the user location annotation - instantaneously moves to its new position. - */ -- (void)setUserLocationVerticalAlignment:(MGLAnnotationVerticalAlignment)alignment animated:(BOOL)animated; - -/** - Whether the map view should display a heading calibration alert when necessary. - The default value is `YES`. - */ -@property (nonatomic, assign) BOOL displayHeadingCalibration; - -/** - The geographic coordinate that is the subject of observation as the user - location is being tracked. - - By default, this property is set to an invalid coordinate, indicating that - there is no target. In course tracking mode, the target forms one of two foci - in the viewport, the other being the user location annotation. Typically, this - property is set to a destination or waypoint in a real-time navigation scene. - As the user annotation moves toward the target, the map automatically zooms in - to fit both foci optimally within the viewport. - - This property has no effect if the `userTrackingMode` property is set to a - value other than `MGLUserTrackingModeFollowWithCourse`. - - Changing the value of this property updates the map view with an animated - transition. If you don’t want to animate the change, use the - `-setTargetCoordinate:animated:` method instead. - */ -@property (nonatomic, assign) CLLocationCoordinate2D targetCoordinate; - -/** - Sets the geographic coordinate that is the subject of observation as the user - location is being tracked, with an optional transition animation. - - By default, the target coordinate is set to an invalid coordinate, indicating - that there is no target. In course tracking mode, the target forms one of two - foci in the viewport, the other being the user location annotation. Typically, - the target is set to a destination or waypoint in a real-time navigation scene. - As the user annotation moves toward the target, the map automatically zooms in - to fit both foci optimally within the viewport. - - This method has no effect if the `userTrackingMode` property is set to a value - other than `MGLUserTrackingModeFollowWithCourse`. - - @param targetCoordinate The target coordinate to fit within the viewport. - @param animated If `YES`, the map animates to fit the target within the map - view. If `NO`, the map fits the target instantaneously. - */ -- (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate animated:(BOOL)animated; - -#pragma mark Configuring How the User Interacts with the Map - -/** - A Boolean value that determines whether the user may zoom the map in and - out, changing the zoom level. - - When this property is set to `YES`, the default, the user may zoom the map - in and out by pinching two fingers or by double tapping, holding, and moving - the finger up and down. - - This property controls only user interactions with the map. If you set the - value of this property to `NO`, you may still change the map zoom - programmatically. - */ -@property(nonatomic, getter=isZoomEnabled) BOOL zoomEnabled; - -/** - A Boolean value that determines whether the user may scroll around the map, - changing the center coordinate. - - When this property is set to `YES`, the default, the user may scroll the map - by dragging or swiping with one finger. - - This property controls only user interactions with the map. If you set the - value of this property to `NO`, you may still change the map location - programmatically. - */ -@property(nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; - -/** - A Boolean value that determines whether the user may rotate the map, - changing the direction. - - When this property is set to `YES`, the default, the user may rotate the map - by moving two fingers in a circular motion. - - This property controls only user interactions with the map. If you set the - value of this property to `NO`, you may still rotate the map - programmatically. - */ -@property(nonatomic, getter=isRotateEnabled) BOOL rotateEnabled; - -/** - A Boolean value that determines whether the user may change the pitch (tilt) of - the map. - - When this property is set to `YES`, the default, the user may tilt the map by - vertically dragging two fingers. - - This property controls only user interactions with the map. If you set the - value of this property to `NO`, you may still change the pitch of the map - programmatically. - - The default value of this property is `YES`. - */ -@property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled; - -#pragma mark Manipulating the Viewpoint - -/** - The geographic coordinate at the center of the map view. - - Changing the value of this property centers the map on the new coordinate - without changing the current zoom level. - - Changing the value of this property updates the map view immediately. If you - want to animate the change, use the `-setCenterCoordinate:animated:` method - instead. - */ -@property (nonatomic) CLLocationCoordinate2D centerCoordinate; - -/** - Changes the center coordinate of the map and optionally animates the change. - - Changing the center coordinate centers the map on the new coordinate without - changing the current zoom level. - - @param coordinate The new center coordinate for the map. - @param animated Specify `YES` if you want the map view to scroll to the new - location or `NO` if you want the map to display the new location - immediately. - */ -- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated; - -/** - Changes the center coordinate and zoom level of the map and optionally animates - the change. - - @param centerCoordinate The new center coordinate for the map. - @param zoomLevel The new zoom level for the map. - @param animated Specify `YES` if you want the map view to animate scrolling and - zooming to the new location or `NO` if you want the map to display the new - location immediately. - */ -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated; - -/** - Changes the center coordinate, zoom level, and direction of the map and - optionally animates the change. - - @param centerCoordinate The new center coordinate for the map. - @param zoomLevel The new zoom level for the map. - @param direction The new direction for the map, measured in degrees relative to - true north. - @param animated Specify `YES` if you want the map view to animate scrolling, - zooming, and rotating to the new location or `NO` if you want the map to - display the new location immediately. - */ -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated; - -/** - Changes the center coordinate, zoom level, and direction of the map, calling a - completion handler at the end of an optional animation. - - @param centerCoordinate The new center coordinate for the map. - @param zoomLevel The new zoom level for the map. - @param direction The new direction for the map, measured in degrees relative to - true north. - @param animated Specify `YES` if you want the map view to animate scrolling, - zooming, and rotating to the new location or `NO` if you want the map to - display the new location immediately. - @param completion The block executed after the animation finishes. - */ -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion; - -/** The zoom level of the receiver. - - In addition to affecting the visual size and detail of features on the map, - the zoom level affects the size of the vector tiles that are loaded. At zoom - level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ - of the world; at zoom level 2, 116 of the world, and - so on. - - Changing the value of this property updates the map view immediately. If you - want to animate the change, use the `-setZoomLevel:animated:` method instead. - */ -@property (nonatomic) double zoomLevel; - -/** - Changes the zoom level of the map and optionally animates the change. - - Changing the zoom level scales the map without changing the current center - coordinate. - - @param zoomLevel The new zoom level for the map. - @param animated Specify `YES` if you want the map view to animate the change - to the new zoom level or `NO` if you want the map to display the new - zoom level immediately. - */ -- (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated; - -/** - * The minimum zoom level at which the map can be shown. - * - * Depending on the map view’s aspect ratio, the map view may be prevented - * from reaching the minimum zoom level, in order to keep the map from - * repeating within the current viewport. - * - * If the value of this property is greater than that of the - * maximumZoomLevel property, the behavior is undefined. - * - * The default minimumZoomLevel is 0. - */ -@property (nonatomic) double minimumZoomLevel; - -/** - * The maximum zoom level the map can be shown at. - * - * If the value of this property is smaller than that of the - * minimumZoomLevel property, the behavior is undefined. - * - * The default maximumZoomLevel is 20. - */ -@property (nonatomic) double maximumZoomLevel; - -/** - The heading of the map, measured in degrees clockwise from true north. - - The value `0` means that the top edge of the map view corresponds to true - north. The value `90` means the top of the map is pointing due east. The - value `180` means the top of the map points due south, and so on. - - Changing the value of this property updates the map view immediately. If you - want to animate the change, use the `-setDirection:animated:` method instead. - */ -@property (nonatomic) CLLocationDirection direction; - -/** - Changes the heading of the map and optionally animates the change. - - @param direction The heading of the map, measured in degrees clockwise from - true north. - @param animated Specify `YES` if you want the map view to animate the change - to the new heading or `NO` if you want the map to display the new - heading immediately. - - Changing the heading rotates the map without changing the current center - coordinate or zoom level. - */ -- (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated; - -/** - Resets the map rotation to a northern heading — a `direction` of `0` degrees. - */ -- (IBAction)resetNorth; - -/** - The coordinate bounds visible in the receiver's viewport. - - Changing the value of this property updates the receiver immediately. If you - want to animate the change, call `-setVisibleCoordinateBounds:animated:` - instead. - */ -@property (nonatomic) MGLCoordinateBounds visibleCoordinateBounds; - -/** - Changes the receiver’s viewport to fit the given coordinate bounds, - optionally animating the change. - - @param bounds The bounds that the viewport will show in its entirety. - @param animated Specify `YES` to animate the change by smoothly scrolling - and zooming or `NO` to immediately display the given bounds. - */ -- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated; - -/** - Changes the receiver's viewport to fit the given coordinate bounds and - optionally some additional padding on each side. - - @param bounds The bounds that the viewport will show in its entirety. - @param insets The minimum padding (in screen points) that will be visible - around the given coordinate bounds. - @param animated Specify `YES` to animate the change by smoothly scrolling and - zooming or `NO` to immediately display the given bounds. - */ -- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; - -/** - Changes the receiver's viewport to fit all of the given coordinates and - optionally some additional padding on each side. - - @param coordinates The coordinates that the viewport will show. - @param count The number of coordinates. This number must not be greater than - the number of elements in `coordinates`. - @param insets The minimum padding (in screen points) that will be visible - around the given coordinate bounds. - @param animated Specify `YES` to animate the change by smoothly scrolling and - zooming or `NO` to immediately display the given bounds. - */ -- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; - -/** - Changes the receiver's viewport to fit all of the given coordinates and - optionally some additional padding on each side. - - @param coordinates The coordinates that the viewport will show. - @param count The number of coordinates. This number must not be greater than - the number of elements in `coordinates`. - @param insets The minimum padding (in screen points) that will be visible - around the given coordinate bounds. - @param direction The direction to rotate the map to, measured in degrees - relative to true north. - @param duration The duration to animate the change in seconds. - @param function The timing function to animate the change. - @param completion The block executed after the animation finishes. - */ -- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion; - -/** - Sets the visible region so that the map displays the specified annotations. - - Calling this method updates the value in the `visibleCoordinateBounds` property - and potentially other properties to reflect the new map region. A small amount - of padding is reserved around the edges of the map view. To specify a different - amount of padding, use the `-showAnnotations:edgePadding:animated:` method. - - @param annotations The annotations that you want to be visible in the map. - @param animated `YES` if you want the map region change to be animated, or `NO` - if you want the map to display the new region immediately without animations. - */ -- (void)showAnnotations:(NS_ARRAY_OF(id ) *)annotations animated:(BOOL)animated; - -/** - Sets the visible region so that the map displays the specified annotations with - the specified amount of padding on each side. - - Calling this method updates the value in the visibleCoordinateBounds property - and potentially other properties to reflect the new map region. - - @param annotations The annotations that you want to be visible in the map. - @param insets The minimum padding (in screen points) around the edges of the - map view to keep clear of annotations. - @param animated `YES` if you want the map region change to be animated, or `NO` - if you want the map to display the new region immediately without animations. - */ -- (void)showAnnotations:(NS_ARRAY_OF(id ) *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; - -/** - A camera representing the current viewpoint of the map. - */ -@property (nonatomic, copy) MGLMapCamera *camera; - -/** - Moves the viewpoint to a different location with respect to the map with an - optional transition animation. - - @param camera The new viewpoint. - @param animated Specify `YES` if you want the map view to animate the change to - the new viewpoint or `NO` if you want the map to display the new viewpoint - immediately. - */ -- (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated; - -/** - Moves the viewpoint to a different location with respect to the map with an - optional transition duration and timing function. - - @param camera The new viewpoint. - @param duration The amount of time, measured in seconds, that the transition - animation should take. Specify `0` to jump to the new viewpoint - instantaneously. - @param function A timing function used for the animation. Set this parameter to - `nil` for a transition that matches most system animations. If the duration - is `0`, this parameter is ignored. - */ -- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function; - -/** - Moves the viewpoint to a different location with respect to the map with an - optional transition duration and timing function. - - @param camera The new viewpoint. - @param duration The amount of time, measured in seconds, that the transition - animation should take. Specify `0` to jump to the new viewpoint - instantaneously. - @param function A timing function used for the animation. Set this parameter to - `nil` for a transition that matches most system animations. If the duration - is `0`, this parameter is ignored. - @param completion The block to execute after the animation finishes. - */ -- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion; - -/** - Moves the viewpoint to a different location using a transition animation that - evokes powered flight and a default duration based on the length of the flight - path. - - The transition animation seamlessly incorporates zooming and panning to help - the user find his or her bearings even after traversing a great distance. - - @param camera The new viewpoint. - @param completion The block to execute after the animation finishes. - */ -- (void)flyToCamera:(MGLMapCamera *)camera completionHandler:(nullable void (^)(void))completion; - -/** - Moves the viewpoint to a different location using a transition animation that - evokes powered flight and an optional transition duration. - - The transition animation seamlessly incorporates zooming and panning to help - the user find his or her bearings even after traversing a great distance. - - @param camera The new viewpoint. - @param duration The amount of time, measured in seconds, that the transition - animation should take. Specify `0` to jump to the new viewpoint - instantaneously. Specify a negative value to use the default duration, which - is based on the length of the flight path. - @param completion The block to execute after the animation finishes. - */ -- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration completionHandler:(nullable void (^)(void))completion; - -/** - Moves the viewpoint to a different location using a transition animation that - evokes powered flight and an optional transition duration and peak altitude. - - The transition animation seamlessly incorporates zooming and panning to help - the user find his or her bearings even after traversing a great distance. - - @param camera The new viewpoint. - @param duration The amount of time, measured in seconds, that the transition - animation should take. Specify `0` to jump to the new viewpoint - instantaneously. Specify a negative value to use the default duration, which - is based on the length of the flight path. - @param peakAltitude The altitude, measured in meters, at the midpoint of the - animation. The value of this parameter is ignored if it is negative or if - the animation transition resulting from a similar call to - `-setCamera:animated:` would have a midpoint at a higher altitude. - @param completion The block to execute after the animation finishes. - */ -- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion; - -/** - Returns the camera that best fits the given coordinate bounds. - - @param bounds The coordinate bounds to fit to the receiver’s viewport. - @return A camera object centered on the same location as the coordinate - bounds with zoom level as high (close to the ground) as possible while still - including the entire coordinate bounds. The camera object uses the current - direction and pitch. - */ -- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds; - -/** - Returns the camera that best fits the given coordinate bounds, optionally with - some additional padding on each side. - - @param bounds The coordinate bounds to fit to the receiver’s viewport. - @param insets The minimum padding (in screen points) that would be visible - around the returned camera object if it were set as the receiver’s camera. - @return A camera object centered on the same location as the coordinate bounds - with zoom level as high (close to the ground) as possible while still - including the entire coordinate bounds. The camera object uses the current - direction and pitch. - */ -- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; - -/** - The distance from the edges of the map view’s frame to the edges of the map - view’s logical viewport. - - When the value of this property is equal to `UIEdgeInsetsZero`, viewport - properties such as `centerCoordinate` assume a viewport that matches the map - view’s frame. Otherwise, those properties are inset, excluding part of the - frame from the viewport. For instance, if the only the top edge is inset, the - map center is effectively shifted downward. - - When the map view’s superview is an instance of `UIViewController` whose - `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this - property may be overridden at any time. - - Changing the value of this property updates the map view immediately. If you - want to animate the change, use the `-setContentInset:animated:` method - instead. - */ -@property (nonatomic, assign) UIEdgeInsets contentInset; - -/** - Sets the distance from the edges of the map view’s frame to the edges of the - map view’s logical viewport with an optional transition animation. - - When the value of this property is equal to `UIEdgeInsetsZero`, viewport - properties such as `centerCoordinate` assume a viewport that matches the map - view’s frame. Otherwise, those properties are inset, excluding part of the - frame from the viewport. For instance, if the only the top edge is inset, the - map center is effectively shifted downward. - - When the map view’s superview is an instance of `UIViewController` whose - `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this - property may be overridden at any time. - - @param contentInset The new values to inset the content by. - @param animated Specify `YES` if you want the map view to animate the change to - the content inset or `NO` if you want the map to inset the content - immediately. - */ -- (void)setContentInset:(UIEdgeInsets)contentInset animated:(BOOL)animated; - -#pragma mark Converting Geographic Coordinates - -/** - Converts a point in the given view's coordinate system to a geographic - coordinate. - - @param point The point to convert. - @param view The view in whose coordinate system the point is expressed. - @return The geographic coordinate at the given point. - */ -- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(nullable UIView *)view; - -/** - Converts a geographic coordinate to a point in the given view's coordinate - system. - - @param coordinate The geographic coordinate to convert. - @param view The view in whose coordinate system the returned point should be - expressed. If this parameter is `nil`, the returned point is expressed - in the window's coordinate system. If `view` is not `nil`, it must - belong to the same window as the map view. - @return The point (in the appropriate view or window coordinate system) - corresponding to the given geographic coordinate. - */ -- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(nullable UIView *)view; - -/** - Converts a rectangle in the given view’s coordinate system to a geographic - bounding box. - - @param rect The rectangle to convert. - @param view The view in whose coordinate system the rectangle is expressed. - @return The geographic bounding box coextensive with the given rectangle. - */ -- (MGLCoordinateBounds)convertRect:(CGRect)rect toCoordinateBoundsFromView:(nullable UIView *)view; - -/** - Converts a geographic bounding box to a rectangle in the given view’s - coordinate system. - - @param bounds The geographic bounding box to convert. - @param view The view in whose coordinate system the returned rectangle should - be expressed. If this parameter is `nil`, the returned rectangle is - expressed in the window’s coordinate system. If `view` is not `nil`, it must - belong to the same window as the map view. - */ -- (CGRect)convertCoordinateBounds:(MGLCoordinateBounds)bounds toRectToView:(nullable UIView *)view; - -/** - Returns the distance spanned by one point in the map view's coordinate system - at the given latitude and current zoom level. - - The distance between points decreases as the latitude approaches the poles. - This relationship parallels the relationship between longitudinal coordinates - at different latitudes. - - @param latitude The latitude of the geographic coordinate represented by the - point. - @return The distance in meters spanned by a single point. - */ -- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude; - -- (CLLocationDistance)metersPerPixelAtLatitude:(CLLocationDegrees)latitude __attribute__((deprecated("Use -metersPerPointAtLatitude:."))); - -#pragma mark Annotating the Map - -/** - The complete list of annotations associated with the receiver. (read-only) - - The objects in this array must adopt the `MGLAnnotation` protocol. If no - annotations are associated with the map view, the value of this property is - `nil`. - */ -@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id ) *annotations; - -/** - Adds an annotation to the map view. - - @param annotation The annotation object to add to the receiver. This object - must conform to the `MGLAnnotation` protocol. The map view retains the - annotation object. */ -- (void)addAnnotation:(id )annotation; - -/** - Adds an array of annotations to the map view. - - @param annotations An array of annotation objects. Each object in the array - must conform to the `MGLAnnotation` protocol. The map view retains each - individual annotation object. - */ -- (void)addAnnotations:(NS_ARRAY_OF(id ) *)annotations; - -/** - Removes an annotation from the map view, deselecting it if it is selected. - - Removing an annotation object dissociates it from the map view entirely, - preventing it from being displayed on the map. Thus you would typically call - this method only when you want to hide or delete a given annotation. - - @param annotation The annotation object to remove. This object must conform - to the `MGLAnnotation` protocol - */ -- (void)removeAnnotation:(id )annotation; - -/** - Removes an array of annotations from the map view, deselecting any selected - annotations in the array. - - Removing annotation objects dissociates them from the map view entirely, - preventing them from being displayed on the map. Thus you would typically - call this method only when you want to hide or delete the given annotations. - - @param annotations The array of annotation objects to remove. Objects in the - array must conform to the `MGLAnnotation` protocol. - */ -- (void)removeAnnotations:(NS_ARRAY_OF(id ) *)annotations; - -/** - Returns a reusable annotation image object associated with its identifier. - - For performance reasons, you should generally reuse `MGLAnnotationImage` - objects for identical-looking annotations in your map views. Dequeueing - saves time and memory during performance-critical operations such as - scrolling. - - @param identifier A string identifying the annotation image to be reused. - This string is the same one you specify when initially returning the - annotation image object using the `-mapView:imageForAnnotation:` method. - @return An annotation image object with the given identifier, or `nil` if no - such object exists in the reuse queue. - */ -- (nullable MGLAnnotationImage *)dequeueReusableAnnotationImageWithIdentifier:(NSString *)identifier; - -#pragma mark Managing Annotation Selections - -/** - The currently selected annotations. - - Assigning a new array to this property selects only the first annotation in - the array. - */ -@property (nonatomic, copy) NS_ARRAY_OF(id ) *selectedAnnotations; - -/** - Selects an annotation and displays a callout view for it. - - If the given annotation is not visible within the current viewport, this - method has no effect. - - @param annotation The annotation object to select. - @param animated If `YES`, the callout view is animated into position. - */ -- (void)selectAnnotation:(id )annotation animated:(BOOL)animated; - -/** - Deselects an annotation and hides its callout view. - - @param annotation The annotation object to deselect. - @param animated If `YES`, the callout view is animated offscreen. - */ -- (void)deselectAnnotation:(nullable id )annotation animated:(BOOL)animated; - -#pragma mark Overlaying the Map - -/** - Adds a single overlay object to the map. - - To remove an overlay from a map, use the `-removeOverlay:` method. - - @param overlay The overlay object to add. This object must conform to the - `MGLOverlay` protocol. */ -- (void)addOverlay:(id )overlay; - -/** - Adds an array of overlay objects to the map. - - To remove multiple overlays from a map, use the `-removeOverlays:` method. - - @param overlays An array of objects, each of which must conform to the - `MGLOverlay` protocol. - */ -- (void)addOverlays:(NS_ARRAY_OF(id ) *)overlays; - -/** - Removes a single overlay object from the map. - - If the specified overlay is not currently associated with the map view, this - method does nothing. - - @param overlay The overlay object to remove. - */ -- (void)removeOverlay:(id )overlay; - -/** - Removes one or more overlay objects from the map. - - If a given overlay object is not associated with the map view, it is ignored. - - @param overlays An array of objects, each of which conforms to the `MGLOverlay` - protocol. - */ -- (void)removeOverlays:(NS_ARRAY_OF(id ) *)overlays; - -#pragma mark Debugging the Map - -/** - The options that determine which debugging aids are shown on the map. - - These options are all disabled by default and should remain disabled in - released software for performance and aesthetic reasons. - */ -@property (nonatomic) MGLMapDebugMaskOptions debugMask; - -@property (nonatomic, getter=isDebugActive) BOOL debugActive __attribute__((deprecated("Use -debugMask and -setDebugMask:."))); - -- (void)toggleDebug __attribute__((deprecated("Use -setDebugMask:."))); - -- (void)emptyMemoryCache __attribute__((deprecated)); - -/** - Resets the map to the minimum zoom level, a center coordinate of (0, 0), and - a northern heading. - */ -- (void)resetPosition; - -@end - -#pragma mark - MGLMapViewDelegate - -/** The MGLMapViewDelegate protocol defines a set of optional methods that you can use to receive map-related update messages. Because many map operations require the `MGLMapView` class to load data asynchronously, the map view calls these methods to notify your application when specific operations complete. The map view also uses these methods to request annotation marker symbology and to manage interactions with those markers. */ -@protocol MGLMapViewDelegate - -@optional - -#pragma mark Responding to Map Position Changes - -/** - Tells the delegate that the region displayed by the map view is about to change. - - This method is called whenever the currently displayed map region will start changing. - - @param mapView The map view whose visible region will change. - @param animated Whether the change will cause an animated effect on the map. - */ -- (void)mapView:(MGLMapView *)mapView regionWillChangeAnimated:(BOOL)animated; - -/** - Tells the delegate that the region displayed by the map view is changing. - - This method is called whenever the currently displayed map region changes. During movement, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - - @param mapView The map view whose visible region is changing. - */ -- (void)mapViewRegionIsChanging:(MGLMapView *)mapView; - -/** - Tells the delegate that the region displayed by the map view just changed. - - This method is called whenever the currently displayed map region has finished changing. - - @param mapView The map view whose visible region changed. - @param animated Whether the change caused an animated effect on the map. - */ -- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated; - -#pragma mark Loading the Map - -/** - Tells the delegate that the map view will begin to load. - - This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. - - @param mapView The map view that is starting to load. - */ -- (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView; - -/** - Tells the delegate that the map view has finished loading. - - This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. - - @param mapView The map view that has finished loading. - */ -- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView; - -// TODO -- (void)mapViewDidFailLoadingMap:(MGLMapView *)mapView withError:(NSError *)error; - -// TODO -- (void)mapViewWillStartRenderingMap:(MGLMapView *)mapView; - -// TODO -- (void)mapViewDidFinishRenderingMap:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; - -// TODO -- (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView; - -// TODO -- (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; - -#pragma mark Tracking User Location - -/** - Tells the delegate that the map view will begin tracking the user's location. - - This method is called when the value of the `showsUserLocation` property changes to `YES`. - - @param mapView The map view that is tracking the user's location. - */ -- (void)mapViewWillStartLocatingUser:(MGLMapView *)mapView; - -/** - Tells the delegate that the map view has stopped tracking the user's location. - - This method is called when the value of the `showsUserLocation` property changes to `NO`. - - @param mapView The map view that is tracking the user's location. - */ -- (void)mapViewDidStopLocatingUser:(MGLMapView *)mapView; - -/** - Tells the delegate that the location of the user was updated. - - While the `showsUserLocation` property is set to `YES`, this method is called whenever a new location update is received by the map view. This method is also called if the map view's user tracking mode is set to `MGLUserTrackingModeFollowWithHeading` and the heading changes, or if it is set to `MGLUserTrackingModeFollowWithCourse` and the course changes. - - This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework. - - @param mapView The map view that is tracking the user's location. - @param userLocation The location object representing the user's latest location. This property may be `nil`. - */ -- (void)mapView:(MGLMapView *)mapView didUpdateUserLocation:(nullable MGLUserLocation *)userLocation; - -/** - Tells the delegate that an attempt to locate the user's position failed. - - @param mapView The map view that is tracking the user's location. - @param error An error object containing the reason why location tracking failed. - */ -- (void)mapView:(MGLMapView *)mapView didFailToLocateUserWithError:(NSError *)error; - -/** - Tells the delegate that the map view's user tracking mode has changed. - - This method is called after the map view asynchronously changes to reflect the new user tracking mode, for example by beginning to zoom or rotate. - - @param mapView The map view that changed its tracking mode. - @param mode The new tracking mode. - @param animated Whether the change caused an animated effect on the map. - */ -- (void)mapView:(MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated; - -#pragma mark Managing the Display of Annotations - -/** - Returns an image object to use for the marker for the specified point annotation object. - - @param mapView The map view that requested the annotation image. - @param annotation The object representing the annotation that is about to be displayed. - @return The image object to display for the specified annotation or `nil` if you want to display the default marker image. - */ -- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id )annotation; - -/** - Returns the alpha value to use when rendering a shape annotation. Defaults to `1.0`. - - @param mapView The map view rendering the shape annotation. - @param annotation The annotation being rendered. - @return An alpha value between `0` and `1.0`. - */ -- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation; - -/** - Returns the stroke color to use when rendering a shape annotation. Defaults to the map view’s tint color. - - @param mapView The map view rendering the shape annotation. - @param annotation The annotation being rendered. - @return A color to use for the shape outline. - */ -- (UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation; - -/** - Returns the fill color to use when rendering a polygon annotation. Defaults to the map view’s tint color. - - @param mapView The map view rendering the polygon annotation. - @param annotation The annotation being rendered. - @return A color to use for the polygon interior. - */ -- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation; - -/** - Returns the line width to use when rendering a polyline annotation. Defaults to `3.0`. - - @param mapView The map view rendering the polygon annotation. - @param annotation The annotation being rendered. - @return A line width for the polyline. - */ -- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation; - -/** - Returns a Boolean value indicating whether the annotation is able to display extra information in a callout bubble. - - If the value returned is `YES`, a standard callout bubble is shown when the user taps a selected annotation. The callout uses the title and subtitle text from the associated annotation object. If there is no title text, though, the annotation will not show a callout. The callout also displays any custom callout views returned by the delegate for the left and right callout accessory views. - - If the value returned is `NO`, the value of the title and subtitle strings are ignored. - - @param mapView The map view that requested the annotation callout ability. - @param annotation The object representing the annotation. - @return A Boolean indicating whether the annotation should show a callout. - */ -- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id )annotation; - -/** - Returns a callout view to display for the specified annotation. - - If this method is present in the delegate, it must return a new instance of a view dedicated to display the callout bubble. It will be configured by the map view. If this method is not present, or if it returns `nil`, a standard, two-line, bubble-like callout view is displayed by default. - - @param mapView The map view that requested the callout view. - @param annotation The object representing the annotation. - @return A view conforming to the `MGLCalloutView` protocol, or `nil` to use the default callout view. - */ -- (nullable UIView *)mapView:(MGLMapView *)mapView calloutViewForAnnotation:(id )annotation; - -/** - Returns the view to display on the left side of the standard callout bubble. - - The default value is treated as if `nil`. The left callout view is typically used to display information about the annotation or to link to custom information provided by your application. - - If the view you specify is also a descendant of the `UIControl` class, you can use the map view's delegate to receive notifications when your control is tapped. If it does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. - - @param mapView The map view presenting the annotation callout. - @param annotation The object representing the annotation with the callout. - @return The accessory view to display. - */ -- (nullable UIView *)mapView:(MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(id )annotation; - -/** - Returns the view to display on the right side of the standard callout bubble. - - The default value is treated is if `nil`. The right callout view is typically used to link to more detailed information about the annotation. A common view to specify for this property is `UIButton` object whose type is set to `UIButtonTypeDetailDisclosure`. - - If the view you specify is also a descendant of the `UIControl` class, you can use the map view's delegate to receive notifications when your control is tapped. If it does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. - - @param mapView The map view presenting the annotation callout. - @param annotation The object representing the annotation with the callout. - @return The accessory view to display. - */ -- (nullable UIView *)mapView:(MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation:(id )annotation; - -#pragma mark Managing Annotations - -/** - Tells the delegate that the user tapped one of the annotation's accessory buttons. - - Accessory views contain custom content and are positioned on either side of the annotation title text. If a view you specify is a descendant of the `UIControl` class, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displayed additional information about the annotation, you could use this method to present a modal panel with that information. - - If your custom accessory views are not descendants of the `UIControl` class, the map view does not call this method. - - @param mapView The map view containing the specified annotation. - @param annotation The annotation whose button was tapped. - @param control The control that was tapped. - */ -- (void)mapView:(MGLMapView *)mapView annotation:(id )annotation calloutAccessoryControlTapped:(UIControl *)control; - -/** - Tells the delegate that the user tapped on an annotation's callout view. - - @param mapView The map view containing the specified annotation. - @param annotation The annotation whose callout was tapped. - */ -- (void)mapView:(MGLMapView *)mapView tapOnCalloutForAnnotation:(id )annotation; - -#pragma mark Selecting Annotations - -/** - Tells the delegate that one of its annotations was selected. - - You can use this method to track changes in the selection state of annotations. - - @param mapView The map view containing the annotation. - @param annotation The annotation that was selected. - */ -- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id )annotation; - -/** - Tells the delegate that one of its annotations was deselected. - - You can use this method to track changes in the selection state of annotations. - - @param mapView The map view containing the annotation. - @param annotation The annotation that was deselected. - */ -- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id )annotation; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/MGLUserLocation.h b/platform/ios/include/MGLUserLocation.h deleted file mode 100644 index 6160413510..0000000000 --- a/platform/ios/include/MGLUserLocation.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import - -#import "MGLAnnotation.h" - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The MGLUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing MGLUserLocation object from the userLocation property of the map view displayed in your application. */ -@interface MGLUserLocation : NSObject - -#pragma mark Determining the User’s Position - -/** - The current location of the device. (read-only) - - This property contains `nil` if the map view is not currently showing the user location or if the user’s location has not yet been determined. - */ -@property (nonatomic, readonly, nullable) CLLocation *location; - -/** A Boolean value indicating whether the user’s location is currently being updated. (read-only) */ -@property (nonatomic, readonly, getter=isUpdating) BOOL updating; - -/** - The heading of the user location. (read-only) - - This property is `nil` if the user location tracking mode is not `MGLUserTrackingModeFollowWithHeading`. - */ -@property (nonatomic, readonly, nullable) CLHeading *heading; - -#pragma mark Accessing the User Annotation Text - -/** The title to display for the user location annotation. */ -@property (nonatomic, copy) NSString *title; - -/** The subtitle to display for the user location annotation. */ -@property (nonatomic, copy, nullable) NSString *subtitle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/include/Mapbox.h b/platform/ios/include/Mapbox.h deleted file mode 100644 index df08c1b4a2..0000000000 --- a/platform/ios/include/Mapbox.h +++ /dev/null @@ -1,34 +0,0 @@ -#import - -/// Project version number for Mapbox. -FOUNDATION_EXPORT double MapboxVersionNumber; - -/// Project version string for Mapbox. -FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; - -#import "MGLAccountManager.h" -#import "MGLAnnotation.h" -#import "MGLAnnotationImage.h" -#import "MGLCalloutView.h" -#import "MGLClockDirectionFormatter.h" -#import "MGLCompassDirectionFormatter.h" -#import "MGLCoordinateFormatter.h" -#import "MGLMapCamera.h" -#import "MGLGeometry.h" -#import "MGLMapView.h" -#import "MGLMapView+IBAdditions.h" -#import "MGLMapView+MGLCustomStyleLayerAdditions.h" -#import "MGLMultiPoint.h" -#import "MGLOfflinePack.h" -#import "MGLOfflineRegion.h" -#import "MGLOfflineStorage.h" -#import "MGLOverlay.h" -#import "MGLPointAnnotation.h" -#import "MGLPolygon.h" -#import "MGLPolyline.h" -#import "MGLShape.h" -#import "MGLStyle.h" -#import "MGLTilePyramidOfflineRegion.h" -#import "MGLTypes.h" -#import "MGLUserLocation.h" -#import "NSValue+MGLAdditions.h" diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 9f12dda781..c7367a68a0 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -260,7 +260,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMapView_Internal.h; path = src/MGLMapView_Internal.h; sourceTree = ""; }; + DA17BE2F1CC4BAC300402C41 /* MGLMapView_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView_Internal.h; sourceTree = ""; }; DA1DC94A1CB6C1C2006E619F /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; }; DA1DC9501CB6C1C2006E619F /* MBXAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MBXAppDelegate.h; sourceTree = ""; }; DA1DC9531CB6C1C2006E619F /* MBXViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MBXViewController.h; sourceTree = ""; }; @@ -288,85 +288,85 @@ DA2E885E1CC0382C00F24E7B /* MGLOfflineRegionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineRegionTests.m; path = ../../darwin/test/MGLOfflineRegionTests.m; sourceTree = ""; }; DA2E885F1CC0382C00F24E7B /* MGLOfflineStorageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineStorageTests.m; path = ../../darwin/test/MGLOfflineStorageTests.m; sourceTree = ""; }; DA2E88601CC0382C00F24E7B /* MGLStyleTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLStyleTests.mm; path = ../../darwin/test/MGLStyleTests.mm; sourceTree = ""; }; - DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCoordinateFormatter.h; path = include/MGLCoordinateFormatter.h; sourceTree = ""; }; - DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatter.m; path = src/MGLCoordinateFormatter.m; sourceTree = ""; }; + DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCoordinateFormatter.h; sourceTree = ""; }; + DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCoordinateFormatter.m; sourceTree = ""; }; DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = ""; }; - DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCompassDirectionFormatter.h; path = include/MGLCompassDirectionFormatter.h; sourceTree = ""; }; - DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatter.m; path = src/MGLCompassDirectionFormatter.m; sourceTree = ""; }; - DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatter.m; path = src/MGLClockDirectionFormatter.m; sourceTree = ""; }; - DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLClockDirectionFormatter.h; path = include/MGLClockDirectionFormatter.h; sourceTree = ""; }; + DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCompassDirectionFormatter.h; sourceTree = ""; }; + DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCompassDirectionFormatter.m; sourceTree = ""; }; + DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLClockDirectionFormatter.m; sourceTree = ""; }; + DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLClockDirectionFormatter.h; sourceTree = ""; }; DA35A2C31CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatterTests.m; path = ../../darwin/test/MGLClockDirectionFormatterTests.m; sourceTree = ""; }; DA35A2C41CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatterTests.m; path = ../../darwin/test/MGLCompassDirectionFormatterTests.m; sourceTree = ""; }; - DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSValue+MGLAdditions.h"; path = "include/NSValue+MGLAdditions.h"; sourceTree = ""; }; - DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSValue+MGLAdditions.m"; path = "src/NSValue+MGLAdditions.m"; sourceTree = ""; }; + DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLAdditions.h"; sourceTree = ""; }; + DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSValue+MGLAdditions.m"; sourceTree = ""; }; DA35A2D11CCAB25200E826B2 /* jazzy.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = jazzy.yml; sourceTree = ""; }; DA4A26961CB6E795000B7809 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA8847D21CBAF91600AB86E3 /* Mapbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA8847D61CBAF91600AB86E3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DA8847DF1CBAFA5100AB86E3 /* MGLAccountManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAccountManager.h; path = include/MGLAccountManager.h; sourceTree = ""; }; - DA8847E01CBAFA5100AB86E3 /* MGLAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAnnotation.h; path = include/MGLAnnotation.h; sourceTree = ""; }; - DA8847E11CBAFA5100AB86E3 /* MGLGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLGeometry.h; path = include/MGLGeometry.h; sourceTree = ""; }; - DA8847E21CBAFA5100AB86E3 /* MGLMapCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMapCamera.h; path = include/MGLMapCamera.h; sourceTree = ""; }; - DA8847E31CBAFA5100AB86E3 /* MGLMultiPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMultiPoint.h; path = include/MGLMultiPoint.h; sourceTree = ""; }; - DA8847E41CBAFA5100AB86E3 /* MGLOfflinePack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflinePack.h; path = include/MGLOfflinePack.h; sourceTree = ""; }; - DA8847E51CBAFA5100AB86E3 /* MGLOfflineRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflineRegion.h; path = include/MGLOfflineRegion.h; sourceTree = ""; }; - DA8847E61CBAFA5100AB86E3 /* MGLOfflineStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflineStorage.h; path = include/MGLOfflineStorage.h; sourceTree = ""; }; - DA8847E71CBAFA5100AB86E3 /* MGLOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOverlay.h; path = include/MGLOverlay.h; sourceTree = ""; }; - DA8847E81CBAFA5100AB86E3 /* MGLPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLPointAnnotation.h; path = include/MGLPointAnnotation.h; sourceTree = ""; }; - DA8847E91CBAFA5100AB86E3 /* MGLPolygon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLPolygon.h; path = include/MGLPolygon.h; sourceTree = ""; }; - DA8847EA1CBAFA5100AB86E3 /* MGLPolyline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLPolyline.h; path = include/MGLPolyline.h; sourceTree = ""; }; - DA8847EB1CBAFA5100AB86E3 /* MGLShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLShape.h; path = include/MGLShape.h; sourceTree = ""; }; - DA8847EC1CBAFA5100AB86E3 /* MGLStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLStyle.h; path = include/MGLStyle.h; sourceTree = ""; }; - DA8847ED1CBAFA5100AB86E3 /* MGLTilePyramidOfflineRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLTilePyramidOfflineRegion.h; path = include/MGLTilePyramidOfflineRegion.h; sourceTree = ""; }; - DA8847EE1CBAFA5100AB86E3 /* MGLTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLTypes.h; path = include/MGLTypes.h; sourceTree = ""; }; - DA8847FF1CBAFA6200AB86E3 /* MGLAccountManager_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAccountManager_Private.h; path = src/MGLAccountManager_Private.h; sourceTree = ""; }; - DA8848001CBAFA6200AB86E3 /* MGLAccountManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAccountManager.m; path = src/MGLAccountManager.m; sourceTree = ""; }; - DA8848011CBAFA6200AB86E3 /* MGLGeometry_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLGeometry_Private.h; path = src/MGLGeometry_Private.h; sourceTree = ""; }; - DA8848021CBAFA6200AB86E3 /* MGLGeometry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLGeometry.mm; path = src/MGLGeometry.mm; sourceTree = ""; }; - DA8848031CBAFA6200AB86E3 /* MGLMapCamera.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLMapCamera.mm; path = src/MGLMapCamera.mm; sourceTree = ""; }; - DA8848041CBAFA6200AB86E3 /* MGLMultiPoint_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMultiPoint_Private.h; path = src/MGLMultiPoint_Private.h; sourceTree = ""; }; - DA8848051CBAFA6200AB86E3 /* MGLMultiPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLMultiPoint.mm; path = src/MGLMultiPoint.mm; sourceTree = ""; }; - DA8848061CBAFA6200AB86E3 /* MGLOfflinePack_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflinePack_Private.h; path = src/MGLOfflinePack_Private.h; sourceTree = ""; }; - DA8848071CBAFA6200AB86E3 /* MGLOfflinePack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLOfflinePack.mm; path = src/MGLOfflinePack.mm; sourceTree = ""; }; - DA8848081CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflineRegion_Private.h; path = src/MGLOfflineRegion_Private.h; sourceTree = ""; }; - DA8848091CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLOfflineStorage_Private.h; path = src/MGLOfflineStorage_Private.h; sourceTree = ""; }; - DA88480A1CBAFA6200AB86E3 /* MGLOfflineStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLOfflineStorage.mm; path = src/MGLOfflineStorage.mm; sourceTree = ""; }; - DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLPointAnnotation.m; path = src/MGLPointAnnotation.m; sourceTree = ""; }; - DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLPolygon.mm; path = src/MGLPolygon.mm; sourceTree = ""; }; - DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLPolyline.mm; path = src/MGLPolyline.mm; sourceTree = ""; }; - DA88480E1CBAFA6200AB86E3 /* MGLShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLShape.m; path = src/MGLShape.m; sourceTree = ""; }; - DA88480F1CBAFA6200AB86E3 /* MGLStyle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLStyle.mm; path = src/MGLStyle.mm; sourceTree = ""; }; - DA8848101CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLTilePyramidOfflineRegion.mm; path = src/MGLTilePyramidOfflineRegion.mm; sourceTree = ""; }; - DA8848111CBAFA6200AB86E3 /* MGLTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLTypes.m; path = src/MGLTypes.m; sourceTree = ""; }; - DA8848121CBAFA6200AB86E3 /* NSBundle+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSBundle+MGLAdditions.h"; path = "src/NSBundle+MGLAdditions.h"; sourceTree = ""; }; - DA8848131CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBundle+MGLAdditions.m"; path = "src/NSBundle+MGLAdditions.m"; sourceTree = ""; }; - DA8848141CBAFA6200AB86E3 /* NSException+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSException+MGLAdditions.h"; path = "src/NSException+MGLAdditions.h"; sourceTree = ""; }; - DA8848151CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSProcessInfo+MGLAdditions.h"; path = "src/NSProcessInfo+MGLAdditions.h"; sourceTree = ""; }; - DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSProcessInfo+MGLAdditions.m"; path = "src/NSProcessInfo+MGLAdditions.m"; sourceTree = ""; }; - DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+MGLAdditions.h"; path = "src/NSString+MGLAdditions.h"; sourceTree = ""; }; - DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+MGLAdditions.m"; path = "src/NSString+MGLAdditions.m"; sourceTree = ""; }; - DA8848341CBAFB8500AB86E3 /* MGLAnnotationImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAnnotationImage.h; path = include/MGLAnnotationImage.h; sourceTree = ""; }; - DA8848351CBAFB8500AB86E3 /* MGLCalloutView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCalloutView.h; path = include/MGLCalloutView.h; sourceTree = ""; }; - DA8848361CBAFB8500AB86E3 /* MGLMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMapView.h; path = include/MGLMapView.h; sourceTree = ""; }; - DA8848371CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "MGLMapView+IBAdditions.h"; path = "include/MGLMapView+IBAdditions.h"; sourceTree = ""; }; - DA8848381CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "MGLMapView+MGLCustomStyleLayerAdditions.h"; path = "include/MGLMapView+MGLCustomStyleLayerAdditions.h"; sourceTree = ""; }; - DA8848391CBAFB8500AB86E3 /* MGLUserLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLUserLocation.h; path = include/MGLUserLocation.h; sourceTree = ""; }; - DA8848401CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAnnotationImage_Private.h; path = src/MGLAnnotationImage_Private.h; sourceTree = ""; }; - DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAnnotationImage.m; path = src/MGLAnnotationImage.m; sourceTree = ""; }; - DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLAPIClient.h; path = src/MGLAPIClient.h; sourceTree = ""; }; - DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAPIClient.m; path = src/MGLAPIClient.m; sourceTree = ""; }; - DA8848441CBAFB9800AB86E3 /* MGLCompactCalloutView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCompactCalloutView.h; path = src/MGLCompactCalloutView.h; sourceTree = ""; }; - DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompactCalloutView.m; path = src/MGLCompactCalloutView.m; sourceTree = ""; }; - DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLLocationManager.h; path = src/MGLLocationManager.h; sourceTree = ""; }; - DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLLocationManager.m; path = src/MGLLocationManager.m; sourceTree = ""; }; - DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLMapboxEvents.h; path = src/MGLMapboxEvents.h; sourceTree = ""; }; - DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLMapboxEvents.m; path = src/MGLMapboxEvents.m; sourceTree = ""; }; - DA88484A1CBAFB9800AB86E3 /* MGLMapView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLMapView.mm; path = src/MGLMapView.mm; sourceTree = ""; }; - DA88484B1CBAFB9800AB86E3 /* MGLUserLocation_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLUserLocation_Private.h; path = src/MGLUserLocation_Private.h; sourceTree = ""; }; - DA88484C1CBAFB9800AB86E3 /* MGLUserLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLUserLocation.m; path = src/MGLUserLocation.m; sourceTree = ""; }; - DA88484D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLUserLocationAnnotationView.h; path = src/MGLUserLocationAnnotationView.h; sourceTree = ""; }; - DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLUserLocationAnnotationView.m; path = src/MGLUserLocationAnnotationView.m; sourceTree = ""; }; - DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mapbox.h; path = ../include/Mapbox.h; sourceTree = ""; }; + DA8847DF1CBAFA5100AB86E3 /* MGLAccountManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAccountManager.h; sourceTree = ""; }; + DA8847E01CBAFA5100AB86E3 /* MGLAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotation.h; sourceTree = ""; }; + DA8847E11CBAFA5100AB86E3 /* MGLGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLGeometry.h; sourceTree = ""; }; + DA8847E21CBAFA5100AB86E3 /* MGLMapCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapCamera.h; sourceTree = ""; }; + DA8847E31CBAFA5100AB86E3 /* MGLMultiPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMultiPoint.h; sourceTree = ""; }; + DA8847E41CBAFA5100AB86E3 /* MGLOfflinePack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflinePack.h; sourceTree = ""; }; + DA8847E51CBAFA5100AB86E3 /* MGLOfflineRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineRegion.h; sourceTree = ""; }; + DA8847E61CBAFA5100AB86E3 /* MGLOfflineStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineStorage.h; sourceTree = ""; }; + DA8847E71CBAFA5100AB86E3 /* MGLOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOverlay.h; sourceTree = ""; }; + DA8847E81CBAFA5100AB86E3 /* MGLPointAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointAnnotation.h; sourceTree = ""; }; + DA8847E91CBAFA5100AB86E3 /* MGLPolygon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPolygon.h; sourceTree = ""; }; + DA8847EA1CBAFA5100AB86E3 /* MGLPolyline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPolyline.h; sourceTree = ""; }; + DA8847EB1CBAFA5100AB86E3 /* MGLShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShape.h; sourceTree = ""; }; + DA8847EC1CBAFA5100AB86E3 /* MGLStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyle.h; sourceTree = ""; }; + DA8847ED1CBAFA5100AB86E3 /* MGLTilePyramidOfflineRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTilePyramidOfflineRegion.h; sourceTree = ""; }; + DA8847EE1CBAFA5100AB86E3 /* MGLTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTypes.h; sourceTree = ""; }; + DA8847FF1CBAFA6200AB86E3 /* MGLAccountManager_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAccountManager_Private.h; sourceTree = ""; }; + DA8848001CBAFA6200AB86E3 /* MGLAccountManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAccountManager.m; sourceTree = ""; }; + DA8848011CBAFA6200AB86E3 /* MGLGeometry_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLGeometry_Private.h; sourceTree = ""; }; + DA8848021CBAFA6200AB86E3 /* MGLGeometry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLGeometry.mm; sourceTree = ""; }; + DA8848031CBAFA6200AB86E3 /* MGLMapCamera.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapCamera.mm; sourceTree = ""; }; + DA8848041CBAFA6200AB86E3 /* MGLMultiPoint_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMultiPoint_Private.h; sourceTree = ""; }; + DA8848051CBAFA6200AB86E3 /* MGLMultiPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMultiPoint.mm; sourceTree = ""; }; + DA8848061CBAFA6200AB86E3 /* MGLOfflinePack_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflinePack_Private.h; sourceTree = ""; }; + DA8848071CBAFA6200AB86E3 /* MGLOfflinePack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOfflinePack.mm; sourceTree = ""; }; + DA8848081CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineRegion_Private.h; sourceTree = ""; }; + DA8848091CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineStorage_Private.h; sourceTree = ""; }; + DA88480A1CBAFA6200AB86E3 /* MGLOfflineStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOfflineStorage.mm; sourceTree = ""; }; + DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLPointAnnotation.m; sourceTree = ""; }; + DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolygon.mm; sourceTree = ""; }; + DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolyline.mm; sourceTree = ""; }; + DA88480E1CBAFA6200AB86E3 /* MGLShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLShape.m; sourceTree = ""; }; + DA88480F1CBAFA6200AB86E3 /* MGLStyle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyle.mm; sourceTree = ""; }; + DA8848101CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTilePyramidOfflineRegion.mm; sourceTree = ""; }; + DA8848111CBAFA6200AB86E3 /* MGLTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLTypes.m; sourceTree = ""; }; + DA8848121CBAFA6200AB86E3 /* NSBundle+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+MGLAdditions.h"; sourceTree = ""; }; + DA8848131CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+MGLAdditions.m"; sourceTree = ""; }; + DA8848141CBAFA6200AB86E3 /* NSException+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSException+MGLAdditions.h"; sourceTree = ""; }; + DA8848151CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSProcessInfo+MGLAdditions.h"; sourceTree = ""; }; + DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSProcessInfo+MGLAdditions.m"; sourceTree = ""; }; + DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MGLAdditions.h"; sourceTree = ""; }; + DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MGLAdditions.m"; sourceTree = ""; }; + DA8848341CBAFB8500AB86E3 /* MGLAnnotationImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationImage.h; sourceTree = ""; }; + DA8848351CBAFB8500AB86E3 /* MGLCalloutView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCalloutView.h; sourceTree = ""; }; + DA8848361CBAFB8500AB86E3 /* MGLMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView.h; sourceTree = ""; }; + DA8848371CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLMapView+IBAdditions.h"; sourceTree = ""; }; + DA8848381CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLMapView+MGLCustomStyleLayerAdditions.h"; sourceTree = ""; }; + DA8848391CBAFB8500AB86E3 /* MGLUserLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUserLocation.h; sourceTree = ""; }; + DA8848401CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationImage_Private.h; sourceTree = ""; }; + DA8848411CBAFB9800AB86E3 /* MGLAnnotationImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationImage.m; sourceTree = ""; }; + DA8848421CBAFB9800AB86E3 /* MGLAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAPIClient.h; sourceTree = ""; }; + DA8848431CBAFB9800AB86E3 /* MGLAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAPIClient.m; sourceTree = ""; }; + DA8848441CBAFB9800AB86E3 /* MGLCompactCalloutView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCompactCalloutView.h; sourceTree = ""; }; + DA8848451CBAFB9800AB86E3 /* MGLCompactCalloutView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLCompactCalloutView.m; sourceTree = ""; }; + DA8848461CBAFB9800AB86E3 /* MGLLocationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLocationManager.h; sourceTree = ""; }; + DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLLocationManager.m; sourceTree = ""; }; + DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapboxEvents.h; sourceTree = ""; }; + DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLMapboxEvents.m; sourceTree = ""; }; + DA88484A1CBAFB9800AB86E3 /* MGLMapView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapView.mm; sourceTree = ""; }; + DA88484B1CBAFB9800AB86E3 /* MGLUserLocation_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUserLocation_Private.h; sourceTree = ""; }; + DA88484C1CBAFB9800AB86E3 /* MGLUserLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLUserLocation.m; sourceTree = ""; }; + DA88484D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationAnnotationView.h; sourceTree = ""; }; + DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLUserLocationAnnotationView.m; sourceTree = ""; }; + DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mapbox.h; path = src/Mapbox.h; sourceTree = SOURCE_ROOT; }; DA8848631CBAFCC100AB86E3 /* Compass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Compass.png; sourceTree = ""; }; DA8848641CBAFCC100AB86E3 /* Compass@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@2x.png"; sourceTree = ""; }; DA8848651CBAFCC100AB86E3 /* Compass@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@3x.png"; sourceTree = ""; }; @@ -617,8 +617,8 @@ DA8848911CBB049300AB86E3 /* reachability */, ); name = Foundation; - path = ../../darwin; - sourceTree = ""; + path = ../darwin/src; + sourceTree = SOURCE_ROOT; }; DA8848331CBAFB2A00AB86E3 /* Kit */ = { isa = PBXGroup; @@ -649,8 +649,8 @@ DA8848881CBB036000AB86E3 /* SMCalloutView */, ); name = Kit; - path = ..; - sourceTree = ""; + path = src; + sourceTree = SOURCE_ROOT; }; DA8848621CBAFCC100AB86E3 /* Resources */ = { isa = PBXGroup; @@ -681,7 +681,7 @@ DA8848811CBB033F00AB86E3 /* FABKitProtocol.h */, ); name = Fabric; - path = vendor/Fabric; + path = ../vendor/Fabric; sourceTree = ""; }; DA8848881CBB036000AB86E3 /* SMCalloutView */ = { @@ -691,7 +691,7 @@ DA88488A1CBB037E00AB86E3 /* SMCalloutView.m */, ); name = SMCalloutView; - path = vendor/SMCalloutView; + path = ../vendor/SMCalloutView; sourceTree = ""; }; DA8848911CBB049300AB86E3 /* reachability */ = { @@ -701,6 +701,7 @@ DA88488F1CBB048E00AB86E3 /* reachability.m */, ); name = reachability; + path = ..; sourceTree = ""; }; DA8963321CC5498400684375 /* Fixtures */ = { diff --git a/platform/ios/src/MGLAnnotationImage.h b/platform/ios/src/MGLAnnotationImage.h new file mode 100644 index 0000000000..fa2adb3830 --- /dev/null +++ b/platform/ios/src/MGLAnnotationImage.h @@ -0,0 +1,44 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view. */ +@interface MGLAnnotationImage : NSObject + +#pragma mark Initializing and Preparing the Image Object + +/** + Initializes and returns a new annotation image object. + + @param image The image to be displayed for the annotation. + @param reuseIdentifier The string that identifies that this annotation image is reusable. + @return The initialized annotation image object or `nil` if there was a problem initializing the object. + */ ++ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier; + +#pragma mark Getting and Setting Attributes + +/** The image to be displayed for the annotation. */ +@property (nonatomic, strong, nullable) UIImage *image; + +/** + The string that identifies that this annotation image is reusable. (read-only) + + You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen. + + If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one. + */ +@property (nonatomic, readonly) NSString *reuseIdentifier; + +/** + A Boolean value indicating whether the annotation is enabled. + + The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected. + */ +@property (nonatomic, getter=isEnabled) BOOL enabled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/MGLCalloutView.h b/platform/ios/src/MGLCalloutView.h new file mode 100644 index 0000000000..59f52adb6d --- /dev/null +++ b/platform/ios/src/MGLCalloutView.h @@ -0,0 +1,72 @@ +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol MGLCalloutViewDelegate; +@protocol MGLAnnotation; + +/** + A protocol for a `UIView` subclass that displays information about a selected annotation near that annotation. + */ +@protocol MGLCalloutView + +/** + An object conforming to the `MGLAnnotation` protocol whose details this callout view displays. + */ +@property (nonatomic, strong) id representedObject; + +/** + A view that the user may tap to perform an action. This view is conventionally positioned on the left side of the callout view. + */ +@property (nonatomic, strong) UIView *leftAccessoryView; + +/** + A view that the user may tap to perform an action. This view is conventionally positioned on the right side of the callout view. + */ +@property (nonatomic, strong) UIView *rightAccessoryView; + +/** + An object conforming to the `MGLCalloutViewDelegate` method that receives messages related to the callout view’s interactive subviews. + */ +@property (nonatomic, weak) id delegate; + +/** + Presents a callout view by adding it to `inView` and pointing at the given rect of `inView`’s bounds. Constrains the callout to the bounds of the given view. + */ +- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated; + +/** + Dismisses the callout view. + */ +- (void)dismissCalloutAnimated:(BOOL)animated; + +@end + +/** + The MGLCalloutViewDelegate protocol defines a set of optional methods that you can use to receive messages from an object that conforms to the MGLCalloutView protocol. The callout view uses these methods to inform the delegate that the user has interacted with the the callout view. + */ +@protocol MGLCalloutViewDelegate + +@optional +/** + Returns a Boolean value indicating whether the entire callout view “highlights” when tapped. The default value is `YES`, which means the callout view highlights when tapped. + + The return value of this method is ignored unless the delegate also responds to the `-calloutViewTapped` method. + */ +- (BOOL)calloutViewShouldHighlight:(UIView *)calloutView; + +/** + Tells the delegate that the callout view has been tapped. + */ +- (void)calloutViewTapped:(UIView *)calloutView; + +/** + Called before the callout view appears on screen, or before the appearance animation will start. + */ +- (void)calloutViewWillAppear:(UIView *)calloutView; + +@end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/platform/ios/src/MGLMapView+IBAdditions.h b/platform/ios/src/MGLMapView+IBAdditions.h new file mode 100644 index 0000000000..f18df56e01 --- /dev/null +++ b/platform/ios/src/MGLMapView+IBAdditions.h @@ -0,0 +1,49 @@ +#import + +#import "MGLTypes.h" + +@class MGLMapView; + +NS_ASSUME_NONNULL_BEGIN + +@interface MGLMapView (IBAdditions) + +// Core properties that can be manipulated in the Attributes inspector in +// Interface Builder. These redeclarations merely add the IBInspectable keyword. +// They appear here to ensure that they appear above the convenience properties; +// inspectables declared in MGLMapView.h are always sorted before those in +// MGLMapView+IBAdditions.h, due to ASCII sort order. + +#if TARGET_INTERFACE_BUILDER + +// HACK: We want this property to look like a URL bar in the Attributes +// inspector, but just calling it styleURL would violate Cocoa naming +// conventions and conflict with the existing NSURL property. Fortunately, IB +// strips out the two underscores for display. +@property (nonatomic, nullable) IBInspectable NSString *styleURL__; + +#endif // TARGET_INTERFACE_BUILDER + +// Convenience properties related to the initial viewport. These properties +// are not meant to be used outside of Interface Builder. latitude and longitude +// are backed by properties of type CLLocationDegrees, but these declarations +// must use the type double because Interface Builder is unaware that +// CLLocationDegrees is a typedef for double. + +@property (nonatomic) IBInspectable double latitude; +@property (nonatomic) IBInspectable double longitude; +@property (nonatomic) IBInspectable double zoomLevel; + +// Renamed properties. Interface Builder derives the display name of each +// inspectable from the runtime name, but runtime names don’t always make sense +// in UI. + +@property (nonatomic) IBInspectable BOOL allowsZooming; +@property (nonatomic) IBInspectable BOOL allowsScrolling; +@property (nonatomic) IBInspectable BOOL allowsRotating; +@property (nonatomic) IBInspectable BOOL allowsTilting; +@property (nonatomic) IBInspectable BOOL showsUserLocation; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/MGLMapView+MGLCustomStyleLayerAdditions.h b/platform/ios/src/MGLMapView+MGLCustomStyleLayerAdditions.h new file mode 100644 index 0000000000..de4dc01f99 --- /dev/null +++ b/platform/ios/src/MGLMapView+MGLCustomStyleLayerAdditions.h @@ -0,0 +1,26 @@ +#import "MGLMapView.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^MGLCustomStyleLayerPreparationHandler)(void); + +typedef void (^MGLCustomStyleLayerDrawingHandler)(CGSize size, + CLLocationCoordinate2D centerCoordinate, + double zoomLevel, + CLLocationDirection direction, + CGFloat pitch, + CGFloat perspectiveSkew); + +typedef void (^MGLCustomStyleLayerCompletionHandler)(void); + +@interface MGLMapView (MGLCustomStyleLayerAdditions) + +- (void)insertCustomStyleLayerWithIdentifier:(NSString *)identifier preparationHandler:(MGLCustomStyleLayerPreparationHandler)preparation drawingHandler:(MGLCustomStyleLayerDrawingHandler)drawing completionHandler:(MGLCustomStyleLayerCompletionHandler)completion belowStyleLayerWithIdentifier:(nullable NSString *)otherIdentifier; + +- (void)removeCustomStyleLayerWithIdentifier:(NSString *)identifier; + +- (void)setCustomStyleLayersNeedDisplay; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h new file mode 100644 index 0000000000..0339a5457b --- /dev/null +++ b/platform/ios/src/MGLMapView.h @@ -0,0 +1,1296 @@ +#import "MGLGeometry.h" +#import "MGLMapCamera.h" + +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@class MGLAnnotationImage; +@class MGLUserLocation; +@class MGLPolyline; +@class MGLPolygon; +@class MGLShape; + +@protocol MGLMapViewDelegate; +@protocol MGLAnnotation; +@protocol MGLOverlay; +@protocol MGLCalloutView; + +/** The vertical alignment of an annotation within a map view. */ +typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) { + /** Aligns the annotation vertically in the center of the map view. */ + MGLAnnotationVerticalAlignmentCenter = 0, + /** Aligns the annotation vertically at the top of the map view. */ + MGLAnnotationVerticalAlignmentTop, + /** Aligns the annotation vertically at the bottom of the map view. */ + MGLAnnotationVerticalAlignmentBottom, +}; + +/** Options for enabling debugging features in an MGLMapView instance. */ +typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) { + /** Edges of tile boundaries are shown as thick, red lines to help diagnose + tile clipping issues. */ + MGLMapDebugTileBoundariesMask = 1 << 1, + /** Each tile shows its tile coordinate (x/y/z) in the upper-left corner. */ + MGLMapDebugTileInfoMask = 1 << 2, + /** Each tile shows a timestamp indicating when it was loaded. */ + MGLMapDebugTimestampsMask = 1 << 3, + /** Edges of glyphs and symbols are shown as faint, green lines to help + diagnose collision and label placement issues. */ + MGLMapDebugCollisionBoxesMask = 1 << 4, +}; + +/** + An interactive, customizable map view with an interface similar to the one + provided by Apple's MapKit. + + Using `MGLMapView`, you can embed the map inside a view, allow users to + manipulate it with standard gestures, animate the map between different + viewpoints, and present information in the form of annotations and overlays. + + The map view loads scalable vector tiles that conform to the + Mapbox Vector Tile Specification. + It styles them with a style that conforms to the + Mapbox GL style specification. + Such styles can be designed in + Mapbox Studio and hosted on + mapbox.com. + + A collection of Mapbox-hosted styles is available through the `MGLStyle` + class. These basic styles use + Mapbox Streets + or Mapbox Satellite data + sources, but you can specify a custom style that makes use of your own data. + + Mapbox-hosted vector tiles and styles require an API access token, which you + can obtain from the + Mapbox account page. + Access tokens associate requests to Mapbox's vector tile and style APIs with + your Mapbox account. They also deter other developers from using your styles + without your permission. + + @note You are responsible for getting permission to use the map data and for + ensuring that your use adheres to the relevant terms of use. + */ +IB_DESIGNABLE +@interface MGLMapView : UIView + +#pragma mark Creating Instances + +/** + Initializes and returns a newly allocated map view with the specified frame + and the default style. + + @param frame The frame for the view, measured in points. + @return An initialized map view. + */ +- (instancetype)initWithFrame:(CGRect)frame; + +/** + Initializes and returns a newly allocated map view with the specified frame + and style URL. + + @param frame The frame for the view, measured in points. + @param styleURL URL of the map style to display. The URL may be a full HTTP + or HTTPS URL, a Mapbox URL indicating the style's map ID + (`mapbox://styles/{user}/{style}`), or a path to a local file relative + to the application's resource path. Specify `nil` for the default style. + @return An initialized map view. + */ +- (instancetype)initWithFrame:(CGRect)frame styleURL:(nullable NSURL *)styleURL; + +#pragma mark Accessing the Delegate + +/** + The receiver's delegate. + + A map view sends messages to its delegate to notify it of changes to its + contents or the viewpoint. The delegate also provides information about + annotations displayed on the map, such as the styles to apply to individual + annotations. + */ +@property(nonatomic, weak, nullable) IBOutlet id delegate; + +#pragma mark Configuring the Map's Appearance + +/** + URLs of the styles bundled with the library. + + @deprecated Call the relevant class method of `MGLStyle` for the URL of a + particular default style. + */ +@property (nonatomic, readonly) NS_ARRAY_OF(NSURL *) *bundledStyleURLs __attribute__((deprecated("Call the relevant class method of MGLStyle for the URL of a particular default style."))); + +/** + URL of the style currently displayed in the receiver. + + The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style's + map ID (`mapbox://styles/{user}/{style}`), or a path to a local file + relative to the application's resource path. + + If you set this property to `nil`, the receiver will use the default style + and this property will automatically be set to that style's URL. + */ +@property (nonatomic, null_resettable) NSURL *styleURL; + +/** + Reloads the style. + + You do not normally need to call this method. The map view automatically + responds to changes in network connectivity by reloading the style. You may + need to call this method if you change the access token after a style has + loaded but before loading a style associated with a different Mapbox account. + + This method does not bust the cache. Even if the style has recently changed on + the server, calling this method does not necessarily ensure that the map view + reflects those changes. + */ +- (IBAction)reloadStyle:(id)sender; + +/** + A control indicating the map's direction and allowing the user to manipulate + the direction, positioned in the upper-right corner. + */ +@property (nonatomic, readonly) UIImageView *compassView; + +/** + The Mapbox logo, positioned in the lower-left corner. + + @note The Mapbox terms of service, which governs the use of Mapbox-hosted + vector tiles and styles, + requires most Mapbox + customers to display the Mapbox logo. If this applies to you, do not + hide this view or change its contents. + */ +@property (nonatomic, readonly) UIImageView *logoView; + +/** + A view showing legally required copyright notices and telemetry settings, + positioned at the bottom-right of the map view. + + @note The Mapbox terms of service, which governs the use of Mapbox-hosted + vector tiles and styles, + requires these + copyright notices to accompany any map that features Mapbox-designed styles, + OpenStreetMap data, or other Mapbox data such as satellite or terrain + data. If that applies to this map view, do not hide this view or remove + any notices from it. + + @note You are additionally + required + to provide users with the option to disable anonymous usage and location + sharing (telemetry). If this view is hidden, you must implement this + setting elsewhere in your app or via `Settings.bundle`. See our + website for + implementation help. + */ +@property (nonatomic, readonly) UIButton *attributionButton; + +/** + Currently active style classes, represented as an array of string identifiers. + */ +@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses; + +/** + Returns a Boolean value indicating whether the style class with the given + identifier is currently active. + + @param styleClass The style class to query for. + @return Whether the style class is currently active. + */ +- (BOOL)hasStyleClass:(NSString *)styleClass; + +/** + Activates the style class with the given identifier. + + @param styleClass The style class to activate. + */ +- (void)addStyleClass:(NSString *)styleClass; + +/** + Deactivates the style class with the given identifier. + + @param styleClass The style class to deactivate. + */ +- (void)removeStyleClass:(NSString *)styleClass; + +#pragma mark Displaying the User's Location + +/** + A Boolean value indicating whether the map may display the user location. + + Setting this property to `YES` causes the map view to use the Core Location + framework to find the current location. As long as this property is `YES`, the + map view continues to track the user's location and update it periodically. + + This property does not indicate whether the user's position is actually visible + on the map, only whether the map view is allowed to display it. To determine + whether the user's position is visible, use the `userLocationVisible` property. + The default value of this property is `NO`. + + On iOS 8 and above, your app must specify a value for + `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` in + its `Info.plist` to satisfy the requirements of the underlying Core Location + framework when enabling this property. + */ +@property (nonatomic, assign) BOOL showsUserLocation; + +/** + A Boolean value indicating whether the device's current location is visible in + the map view. + + Use `showsUserLocation` to control the visibility of the on-screen user + location annotation. + */ +@property (nonatomic, assign, readonly, getter=isUserLocationVisible) BOOL userLocationVisible; + +/** + Returns the annotation object indicating the user's current location. + */ +@property (nonatomic, readonly, nullable) MGLUserLocation *userLocation; + +/** + The mode used to track the user location. The default value is + `MGLUserTrackingModeNone`. + + Changing the value of this property updates the map view with an animated + transition. If you don’t want to animate the change, use the + `-setUserTrackingMode:animated:` method instead. + */ +@property (nonatomic, assign) MGLUserTrackingMode userTrackingMode; + +/** + Sets the mode used to track the user location, with an optional transition. + + @param mode The mode used to track the user location. + @param animated If `YES`, there is an animated transition from the current + viewport to a viewport that results from the change to `mode`. If `NO`, the + map view instantaneously changes to the new viewport. This parameter only + affects the initial transition; subsequent changes to the user location or + heading are always animated. + */ +- (void)setUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated; + +/** + The vertical alignment of the user location annotation within the receiver. The + default value is `MGLAnnotationVerticalAlignmentCenter`. + + Changing the value of this property updates the map view with an animated + transition. If you don’t want to animate the change, use the + `-setUserLocationVerticalAlignment:animated:` method instead. + */ +@property (nonatomic, assign) MGLAnnotationVerticalAlignment userLocationVerticalAlignment; + +/** + Sets the vertical alignment of the user location annotation within the + receiver, with an optional transition. + + @param alignment The vertical alignment of the user location annotation. + @param animated If `YES`, the user location annotation animates to its new + position within the map view. If `NO`, the user location annotation + instantaneously moves to its new position. + */ +- (void)setUserLocationVerticalAlignment:(MGLAnnotationVerticalAlignment)alignment animated:(BOOL)animated; + +/** + Whether the map view should display a heading calibration alert when necessary. + The default value is `YES`. + */ +@property (nonatomic, assign) BOOL displayHeadingCalibration; + +/** + The geographic coordinate that is the subject of observation as the user + location is being tracked. + + By default, this property is set to an invalid coordinate, indicating that + there is no target. In course tracking mode, the target forms one of two foci + in the viewport, the other being the user location annotation. Typically, this + property is set to a destination or waypoint in a real-time navigation scene. + As the user annotation moves toward the target, the map automatically zooms in + to fit both foci optimally within the viewport. + + This property has no effect if the `userTrackingMode` property is set to a + value other than `MGLUserTrackingModeFollowWithCourse`. + + Changing the value of this property updates the map view with an animated + transition. If you don’t want to animate the change, use the + `-setTargetCoordinate:animated:` method instead. + */ +@property (nonatomic, assign) CLLocationCoordinate2D targetCoordinate; + +/** + Sets the geographic coordinate that is the subject of observation as the user + location is being tracked, with an optional transition animation. + + By default, the target coordinate is set to an invalid coordinate, indicating + that there is no target. In course tracking mode, the target forms one of two + foci in the viewport, the other being the user location annotation. Typically, + the target is set to a destination or waypoint in a real-time navigation scene. + As the user annotation moves toward the target, the map automatically zooms in + to fit both foci optimally within the viewport. + + This method has no effect if the `userTrackingMode` property is set to a value + other than `MGLUserTrackingModeFollowWithCourse`. + + @param targetCoordinate The target coordinate to fit within the viewport. + @param animated If `YES`, the map animates to fit the target within the map + view. If `NO`, the map fits the target instantaneously. + */ +- (void)setTargetCoordinate:(CLLocationCoordinate2D)targetCoordinate animated:(BOOL)animated; + +#pragma mark Configuring How the User Interacts with the Map + +/** + A Boolean value that determines whether the user may zoom the map in and + out, changing the zoom level. + + When this property is set to `YES`, the default, the user may zoom the map + in and out by pinching two fingers or by double tapping, holding, and moving + the finger up and down. + + This property controls only user interactions with the map. If you set the + value of this property to `NO`, you may still change the map zoom + programmatically. + */ +@property(nonatomic, getter=isZoomEnabled) BOOL zoomEnabled; + +/** + A Boolean value that determines whether the user may scroll around the map, + changing the center coordinate. + + When this property is set to `YES`, the default, the user may scroll the map + by dragging or swiping with one finger. + + This property controls only user interactions with the map. If you set the + value of this property to `NO`, you may still change the map location + programmatically. + */ +@property(nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; + +/** + A Boolean value that determines whether the user may rotate the map, + changing the direction. + + When this property is set to `YES`, the default, the user may rotate the map + by moving two fingers in a circular motion. + + This property controls only user interactions with the map. If you set the + value of this property to `NO`, you may still rotate the map + programmatically. + */ +@property(nonatomic, getter=isRotateEnabled) BOOL rotateEnabled; + +/** + A Boolean value that determines whether the user may change the pitch (tilt) of + the map. + + When this property is set to `YES`, the default, the user may tilt the map by + vertically dragging two fingers. + + This property controls only user interactions with the map. If you set the + value of this property to `NO`, you may still change the pitch of the map + programmatically. + + The default value of this property is `YES`. + */ +@property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled; + +#pragma mark Manipulating the Viewpoint + +/** + The geographic coordinate at the center of the map view. + + Changing the value of this property centers the map on the new coordinate + without changing the current zoom level. + + Changing the value of this property updates the map view immediately. If you + want to animate the change, use the `-setCenterCoordinate:animated:` method + instead. + */ +@property (nonatomic) CLLocationCoordinate2D centerCoordinate; + +/** + Changes the center coordinate of the map and optionally animates the change. + + Changing the center coordinate centers the map on the new coordinate without + changing the current zoom level. + + @param coordinate The new center coordinate for the map. + @param animated Specify `YES` if you want the map view to scroll to the new + location or `NO` if you want the map to display the new location + immediately. + */ +- (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated; + +/** + Changes the center coordinate and zoom level of the map and optionally animates + the change. + + @param centerCoordinate The new center coordinate for the map. + @param zoomLevel The new zoom level for the map. + @param animated Specify `YES` if you want the map view to animate scrolling and + zooming to the new location or `NO` if you want the map to display the new + location immediately. + */ +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel animated:(BOOL)animated; + +/** + Changes the center coordinate, zoom level, and direction of the map and + optionally animates the change. + + @param centerCoordinate The new center coordinate for the map. + @param zoomLevel The new zoom level for the map. + @param direction The new direction for the map, measured in degrees relative to + true north. + @param animated Specify `YES` if you want the map view to animate scrolling, + zooming, and rotating to the new location or `NO` if you want the map to + display the new location immediately. + */ +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated; + +/** + Changes the center coordinate, zoom level, and direction of the map, calling a + completion handler at the end of an optional animation. + + @param centerCoordinate The new center coordinate for the map. + @param zoomLevel The new zoom level for the map. + @param direction The new direction for the map, measured in degrees relative to + true north. + @param animated Specify `YES` if you want the map view to animate scrolling, + zooming, and rotating to the new location or `NO` if you want the map to + display the new location immediately. + @param completion The block executed after the animation finishes. + */ +- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion; + +/** The zoom level of the receiver. + + In addition to affecting the visual size and detail of features on the map, + the zoom level affects the size of the vector tiles that are loaded. At zoom + level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ + of the world; at zoom level 2, 116 of the world, and + so on. + + Changing the value of this property updates the map view immediately. If you + want to animate the change, use the `-setZoomLevel:animated:` method instead. + */ +@property (nonatomic) double zoomLevel; + +/** + Changes the zoom level of the map and optionally animates the change. + + Changing the zoom level scales the map without changing the current center + coordinate. + + @param zoomLevel The new zoom level for the map. + @param animated Specify `YES` if you want the map view to animate the change + to the new zoom level or `NO` if you want the map to display the new + zoom level immediately. + */ +- (void)setZoomLevel:(double)zoomLevel animated:(BOOL)animated; + +/** + * The minimum zoom level at which the map can be shown. + * + * Depending on the map view’s aspect ratio, the map view may be prevented + * from reaching the minimum zoom level, in order to keep the map from + * repeating within the current viewport. + * + * If the value of this property is greater than that of the + * maximumZoomLevel property, the behavior is undefined. + * + * The default minimumZoomLevel is 0. + */ +@property (nonatomic) double minimumZoomLevel; + +/** + * The maximum zoom level the map can be shown at. + * + * If the value of this property is smaller than that of the + * minimumZoomLevel property, the behavior is undefined. + * + * The default maximumZoomLevel is 20. + */ +@property (nonatomic) double maximumZoomLevel; + +/** + The heading of the map, measured in degrees clockwise from true north. + + The value `0` means that the top edge of the map view corresponds to true + north. The value `90` means the top of the map is pointing due east. The + value `180` means the top of the map points due south, and so on. + + Changing the value of this property updates the map view immediately. If you + want to animate the change, use the `-setDirection:animated:` method instead. + */ +@property (nonatomic) CLLocationDirection direction; + +/** + Changes the heading of the map and optionally animates the change. + + @param direction The heading of the map, measured in degrees clockwise from + true north. + @param animated Specify `YES` if you want the map view to animate the change + to the new heading or `NO` if you want the map to display the new + heading immediately. + + Changing the heading rotates the map without changing the current center + coordinate or zoom level. + */ +- (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated; + +/** + Resets the map rotation to a northern heading — a `direction` of `0` degrees. + */ +- (IBAction)resetNorth; + +/** + The coordinate bounds visible in the receiver's viewport. + + Changing the value of this property updates the receiver immediately. If you + want to animate the change, call `-setVisibleCoordinateBounds:animated:` + instead. + */ +@property (nonatomic) MGLCoordinateBounds visibleCoordinateBounds; + +/** + Changes the receiver’s viewport to fit the given coordinate bounds, + optionally animating the change. + + @param bounds The bounds that the viewport will show in its entirety. + @param animated Specify `YES` to animate the change by smoothly scrolling + and zooming or `NO` to immediately display the given bounds. + */ +- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated; + +/** + Changes the receiver's viewport to fit the given coordinate bounds and + optionally some additional padding on each side. + + @param bounds The bounds that the viewport will show in its entirety. + @param insets The minimum padding (in screen points) that will be visible + around the given coordinate bounds. + @param animated Specify `YES` to animate the change by smoothly scrolling and + zooming or `NO` to immediately display the given bounds. + */ +- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; + +/** + Changes the receiver's viewport to fit all of the given coordinates and + optionally some additional padding on each side. + + @param coordinates The coordinates that the viewport will show. + @param count The number of coordinates. This number must not be greater than + the number of elements in `coordinates`. + @param insets The minimum padding (in screen points) that will be visible + around the given coordinate bounds. + @param animated Specify `YES` to animate the change by smoothly scrolling and + zooming or `NO` to immediately display the given bounds. + */ +- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; + +/** + Changes the receiver's viewport to fit all of the given coordinates and + optionally some additional padding on each side. + + @param coordinates The coordinates that the viewport will show. + @param count The number of coordinates. This number must not be greater than + the number of elements in `coordinates`. + @param insets The minimum padding (in screen points) that will be visible + around the given coordinate bounds. + @param direction The direction to rotate the map to, measured in degrees + relative to true north. + @param duration The duration to animate the change in seconds. + @param function The timing function to animate the change. + @param completion The block executed after the animation finishes. + */ +- (void)setVisibleCoordinates:(CLLocationCoordinate2D *)coordinates count:(NSUInteger)count edgePadding:(UIEdgeInsets)insets direction:(CLLocationDirection)direction duration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion; + +/** + Sets the visible region so that the map displays the specified annotations. + + Calling this method updates the value in the `visibleCoordinateBounds` property + and potentially other properties to reflect the new map region. A small amount + of padding is reserved around the edges of the map view. To specify a different + amount of padding, use the `-showAnnotations:edgePadding:animated:` method. + + @param annotations The annotations that you want to be visible in the map. + @param animated `YES` if you want the map region change to be animated, or `NO` + if you want the map to display the new region immediately without animations. + */ +- (void)showAnnotations:(NS_ARRAY_OF(id ) *)annotations animated:(BOOL)animated; + +/** + Sets the visible region so that the map displays the specified annotations with + the specified amount of padding on each side. + + Calling this method updates the value in the visibleCoordinateBounds property + and potentially other properties to reflect the new map region. + + @param annotations The annotations that you want to be visible in the map. + @param insets The minimum padding (in screen points) around the edges of the + map view to keep clear of annotations. + @param animated `YES` if you want the map region change to be animated, or `NO` + if you want the map to display the new region immediately without animations. + */ +- (void)showAnnotations:(NS_ARRAY_OF(id ) *)annotations edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; + +/** + A camera representing the current viewpoint of the map. + */ +@property (nonatomic, copy) MGLMapCamera *camera; + +/** + Moves the viewpoint to a different location with respect to the map with an + optional transition animation. + + @param camera The new viewpoint. + @param animated Specify `YES` if you want the map view to animate the change to + the new viewpoint or `NO` if you want the map to display the new viewpoint + immediately. + */ +- (void)setCamera:(MGLMapCamera *)camera animated:(BOOL)animated; + +/** + Moves the viewpoint to a different location with respect to the map with an + optional transition duration and timing function. + + @param camera The new viewpoint. + @param duration The amount of time, measured in seconds, that the transition + animation should take. Specify `0` to jump to the new viewpoint + instantaneously. + @param function A timing function used for the animation. Set this parameter to + `nil` for a transition that matches most system animations. If the duration + is `0`, this parameter is ignored. + */ +- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function; + +/** + Moves the viewpoint to a different location with respect to the map with an + optional transition duration and timing function. + + @param camera The new viewpoint. + @param duration The amount of time, measured in seconds, that the transition + animation should take. Specify `0` to jump to the new viewpoint + instantaneously. + @param function A timing function used for the animation. Set this parameter to + `nil` for a transition that matches most system animations. If the duration + is `0`, this parameter is ignored. + @param completion The block to execute after the animation finishes. + */ +- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion; + +/** + Moves the viewpoint to a different location using a transition animation that + evokes powered flight and a default duration based on the length of the flight + path. + + The transition animation seamlessly incorporates zooming and panning to help + the user find his or her bearings even after traversing a great distance. + + @param camera The new viewpoint. + @param completion The block to execute after the animation finishes. + */ +- (void)flyToCamera:(MGLMapCamera *)camera completionHandler:(nullable void (^)(void))completion; + +/** + Moves the viewpoint to a different location using a transition animation that + evokes powered flight and an optional transition duration. + + The transition animation seamlessly incorporates zooming and panning to help + the user find his or her bearings even after traversing a great distance. + + @param camera The new viewpoint. + @param duration The amount of time, measured in seconds, that the transition + animation should take. Specify `0` to jump to the new viewpoint + instantaneously. Specify a negative value to use the default duration, which + is based on the length of the flight path. + @param completion The block to execute after the animation finishes. + */ +- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration completionHandler:(nullable void (^)(void))completion; + +/** + Moves the viewpoint to a different location using a transition animation that + evokes powered flight and an optional transition duration and peak altitude. + + The transition animation seamlessly incorporates zooming and panning to help + the user find his or her bearings even after traversing a great distance. + + @param camera The new viewpoint. + @param duration The amount of time, measured in seconds, that the transition + animation should take. Specify `0` to jump to the new viewpoint + instantaneously. Specify a negative value to use the default duration, which + is based on the length of the flight path. + @param peakAltitude The altitude, measured in meters, at the midpoint of the + animation. The value of this parameter is ignored if it is negative or if + the animation transition resulting from a similar call to + `-setCamera:animated:` would have a midpoint at a higher altitude. + @param completion The block to execute after the animation finishes. + */ +- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion; + +/** + Returns the camera that best fits the given coordinate bounds. + + @param bounds The coordinate bounds to fit to the receiver’s viewport. + @return A camera object centered on the same location as the coordinate + bounds with zoom level as high (close to the ground) as possible while still + including the entire coordinate bounds. The camera object uses the current + direction and pitch. + */ +- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds; + +/** + Returns the camera that best fits the given coordinate bounds, optionally with + some additional padding on each side. + + @param bounds The coordinate bounds to fit to the receiver’s viewport. + @param insets The minimum padding (in screen points) that would be visible + around the returned camera object if it were set as the receiver’s camera. + @return A camera object centered on the same location as the coordinate bounds + with zoom level as high (close to the ground) as possible while still + including the entire coordinate bounds. The camera object uses the current + direction and pitch. + */ +- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; + +/** + The distance from the edges of the map view’s frame to the edges of the map + view’s logical viewport. + + When the value of this property is equal to `UIEdgeInsetsZero`, viewport + properties such as `centerCoordinate` assume a viewport that matches the map + view’s frame. Otherwise, those properties are inset, excluding part of the + frame from the viewport. For instance, if the only the top edge is inset, the + map center is effectively shifted downward. + + When the map view’s superview is an instance of `UIViewController` whose + `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this + property may be overridden at any time. + + Changing the value of this property updates the map view immediately. If you + want to animate the change, use the `-setContentInset:animated:` method + instead. + */ +@property (nonatomic, assign) UIEdgeInsets contentInset; + +/** + Sets the distance from the edges of the map view’s frame to the edges of the + map view’s logical viewport with an optional transition animation. + + When the value of this property is equal to `UIEdgeInsetsZero`, viewport + properties such as `centerCoordinate` assume a viewport that matches the map + view’s frame. Otherwise, those properties are inset, excluding part of the + frame from the viewport. For instance, if the only the top edge is inset, the + map center is effectively shifted downward. + + When the map view’s superview is an instance of `UIViewController` whose + `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this + property may be overridden at any time. + + @param contentInset The new values to inset the content by. + @param animated Specify `YES` if you want the map view to animate the change to + the content inset or `NO` if you want the map to inset the content + immediately. + */ +- (void)setContentInset:(UIEdgeInsets)contentInset animated:(BOOL)animated; + +#pragma mark Converting Geographic Coordinates + +/** + Converts a point in the given view's coordinate system to a geographic + coordinate. + + @param point The point to convert. + @param view The view in whose coordinate system the point is expressed. + @return The geographic coordinate at the given point. + */ +- (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(nullable UIView *)view; + +/** + Converts a geographic coordinate to a point in the given view's coordinate + system. + + @param coordinate The geographic coordinate to convert. + @param view The view in whose coordinate system the returned point should be + expressed. If this parameter is `nil`, the returned point is expressed + in the window's coordinate system. If `view` is not `nil`, it must + belong to the same window as the map view. + @return The point (in the appropriate view or window coordinate system) + corresponding to the given geographic coordinate. + */ +- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(nullable UIView *)view; + +/** + Converts a rectangle in the given view’s coordinate system to a geographic + bounding box. + + @param rect The rectangle to convert. + @param view The view in whose coordinate system the rectangle is expressed. + @return The geographic bounding box coextensive with the given rectangle. + */ +- (MGLCoordinateBounds)convertRect:(CGRect)rect toCoordinateBoundsFromView:(nullable UIView *)view; + +/** + Converts a geographic bounding box to a rectangle in the given view’s + coordinate system. + + @param bounds The geographic bounding box to convert. + @param view The view in whose coordinate system the returned rectangle should + be expressed. If this parameter is `nil`, the returned rectangle is + expressed in the window’s coordinate system. If `view` is not `nil`, it must + belong to the same window as the map view. + */ +- (CGRect)convertCoordinateBounds:(MGLCoordinateBounds)bounds toRectToView:(nullable UIView *)view; + +/** + Returns the distance spanned by one point in the map view's coordinate system + at the given latitude and current zoom level. + + The distance between points decreases as the latitude approaches the poles. + This relationship parallels the relationship between longitudinal coordinates + at different latitudes. + + @param latitude The latitude of the geographic coordinate represented by the + point. + @return The distance in meters spanned by a single point. + */ +- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude; + +- (CLLocationDistance)metersPerPixelAtLatitude:(CLLocationDegrees)latitude __attribute__((deprecated("Use -metersPerPointAtLatitude:."))); + +#pragma mark Annotating the Map + +/** + The complete list of annotations associated with the receiver. (read-only) + + The objects in this array must adopt the `MGLAnnotation` protocol. If no + annotations are associated with the map view, the value of this property is + `nil`. + */ +@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id ) *annotations; + +/** + Adds an annotation to the map view. + + @param annotation The annotation object to add to the receiver. This object + must conform to the `MGLAnnotation` protocol. The map view retains the + annotation object. */ +- (void)addAnnotation:(id )annotation; + +/** + Adds an array of annotations to the map view. + + @param annotations An array of annotation objects. Each object in the array + must conform to the `MGLAnnotation` protocol. The map view retains each + individual annotation object. + */ +- (void)addAnnotations:(NS_ARRAY_OF(id ) *)annotations; + +/** + Removes an annotation from the map view, deselecting it if it is selected. + + Removing an annotation object dissociates it from the map view entirely, + preventing it from being displayed on the map. Thus you would typically call + this method only when you want to hide or delete a given annotation. + + @param annotation The annotation object to remove. This object must conform + to the `MGLAnnotation` protocol + */ +- (void)removeAnnotation:(id )annotation; + +/** + Removes an array of annotations from the map view, deselecting any selected + annotations in the array. + + Removing annotation objects dissociates them from the map view entirely, + preventing them from being displayed on the map. Thus you would typically + call this method only when you want to hide or delete the given annotations. + + @param annotations The array of annotation objects to remove. Objects in the + array must conform to the `MGLAnnotation` protocol. + */ +- (void)removeAnnotations:(NS_ARRAY_OF(id ) *)annotations; + +/** + Returns a reusable annotation image object associated with its identifier. + + For performance reasons, you should generally reuse `MGLAnnotationImage` + objects for identical-looking annotations in your map views. Dequeueing + saves time and memory during performance-critical operations such as + scrolling. + + @param identifier A string identifying the annotation image to be reused. + This string is the same one you specify when initially returning the + annotation image object using the `-mapView:imageForAnnotation:` method. + @return An annotation image object with the given identifier, or `nil` if no + such object exists in the reuse queue. + */ +- (nullable MGLAnnotationImage *)dequeueReusableAnnotationImageWithIdentifier:(NSString *)identifier; + +#pragma mark Managing Annotation Selections + +/** + The currently selected annotations. + + Assigning a new array to this property selects only the first annotation in + the array. + */ +@property (nonatomic, copy) NS_ARRAY_OF(id ) *selectedAnnotations; + +/** + Selects an annotation and displays a callout view for it. + + If the given annotation is not visible within the current viewport, this + method has no effect. + + @param annotation The annotation object to select. + @param animated If `YES`, the callout view is animated into position. + */ +- (void)selectAnnotation:(id )annotation animated:(BOOL)animated; + +/** + Deselects an annotation and hides its callout view. + + @param annotation The annotation object to deselect. + @param animated If `YES`, the callout view is animated offscreen. + */ +- (void)deselectAnnotation:(nullable id )annotation animated:(BOOL)animated; + +#pragma mark Overlaying the Map + +/** + Adds a single overlay object to the map. + + To remove an overlay from a map, use the `-removeOverlay:` method. + + @param overlay The overlay object to add. This object must conform to the + `MGLOverlay` protocol. */ +- (void)addOverlay:(id )overlay; + +/** + Adds an array of overlay objects to the map. + + To remove multiple overlays from a map, use the `-removeOverlays:` method. + + @param overlays An array of objects, each of which must conform to the + `MGLOverlay` protocol. + */ +- (void)addOverlays:(NS_ARRAY_OF(id ) *)overlays; + +/** + Removes a single overlay object from the map. + + If the specified overlay is not currently associated with the map view, this + method does nothing. + + @param overlay The overlay object to remove. + */ +- (void)removeOverlay:(id )overlay; + +/** + Removes one or more overlay objects from the map. + + If a given overlay object is not associated with the map view, it is ignored. + + @param overlays An array of objects, each of which conforms to the `MGLOverlay` + protocol. + */ +- (void)removeOverlays:(NS_ARRAY_OF(id ) *)overlays; + +#pragma mark Debugging the Map + +/** + The options that determine which debugging aids are shown on the map. + + These options are all disabled by default and should remain disabled in + released software for performance and aesthetic reasons. + */ +@property (nonatomic) MGLMapDebugMaskOptions debugMask; + +@property (nonatomic, getter=isDebugActive) BOOL debugActive __attribute__((deprecated("Use -debugMask and -setDebugMask:."))); + +- (void)toggleDebug __attribute__((deprecated("Use -setDebugMask:."))); + +- (void)emptyMemoryCache __attribute__((deprecated)); + +/** + Resets the map to the minimum zoom level, a center coordinate of (0, 0), and + a northern heading. + */ +- (void)resetPosition; + +@end + +#pragma mark - MGLMapViewDelegate + +/** The MGLMapViewDelegate protocol defines a set of optional methods that you can use to receive map-related update messages. Because many map operations require the `MGLMapView` class to load data asynchronously, the map view calls these methods to notify your application when specific operations complete. The map view also uses these methods to request annotation marker symbology and to manage interactions with those markers. */ +@protocol MGLMapViewDelegate + +@optional + +#pragma mark Responding to Map Position Changes + +/** + Tells the delegate that the region displayed by the map view is about to change. + + This method is called whenever the currently displayed map region will start changing. + + @param mapView The map view whose visible region will change. + @param animated Whether the change will cause an animated effect on the map. + */ +- (void)mapView:(MGLMapView *)mapView regionWillChangeAnimated:(BOOL)animated; + +/** + Tells the delegate that the region displayed by the map view is changing. + + This method is called whenever the currently displayed map region changes. During movement, this method may be called many times to report updates to the map position. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. + + @param mapView The map view whose visible region is changing. + */ +- (void)mapViewRegionIsChanging:(MGLMapView *)mapView; + +/** + Tells the delegate that the region displayed by the map view just changed. + + This method is called whenever the currently displayed map region has finished changing. + + @param mapView The map view whose visible region changed. + @param animated Whether the change caused an animated effect on the map. + */ +- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated; + +#pragma mark Loading the Map + +/** + Tells the delegate that the map view will begin to load. + + This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. + + @param mapView The map view that is starting to load. + */ +- (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView; + +/** + Tells the delegate that the map view has finished loading. + + This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. + + @param mapView The map view that has finished loading. + */ +- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView; + +// TODO +- (void)mapViewDidFailLoadingMap:(MGLMapView *)mapView withError:(NSError *)error; + +// TODO +- (void)mapViewWillStartRenderingMap:(MGLMapView *)mapView; + +// TODO +- (void)mapViewDidFinishRenderingMap:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; + +// TODO +- (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView; + +// TODO +- (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; + +#pragma mark Tracking User Location + +/** + Tells the delegate that the map view will begin tracking the user's location. + + This method is called when the value of the `showsUserLocation` property changes to `YES`. + + @param mapView The map view that is tracking the user's location. + */ +- (void)mapViewWillStartLocatingUser:(MGLMapView *)mapView; + +/** + Tells the delegate that the map view has stopped tracking the user's location. + + This method is called when the value of the `showsUserLocation` property changes to `NO`. + + @param mapView The map view that is tracking the user's location. + */ +- (void)mapViewDidStopLocatingUser:(MGLMapView *)mapView; + +/** + Tells the delegate that the location of the user was updated. + + While the `showsUserLocation` property is set to `YES`, this method is called whenever a new location update is received by the map view. This method is also called if the map view's user tracking mode is set to `MGLUserTrackingModeFollowWithHeading` and the heading changes, or if it is set to `MGLUserTrackingModeFollowWithCourse` and the course changes. + + This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework. + + @param mapView The map view that is tracking the user's location. + @param userLocation The location object representing the user's latest location. This property may be `nil`. + */ +- (void)mapView:(MGLMapView *)mapView didUpdateUserLocation:(nullable MGLUserLocation *)userLocation; + +/** + Tells the delegate that an attempt to locate the user's position failed. + + @param mapView The map view that is tracking the user's location. + @param error An error object containing the reason why location tracking failed. + */ +- (void)mapView:(MGLMapView *)mapView didFailToLocateUserWithError:(NSError *)error; + +/** + Tells the delegate that the map view's user tracking mode has changed. + + This method is called after the map view asynchronously changes to reflect the new user tracking mode, for example by beginning to zoom or rotate. + + @param mapView The map view that changed its tracking mode. + @param mode The new tracking mode. + @param animated Whether the change caused an animated effect on the map. + */ +- (void)mapView:(MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated; + +#pragma mark Managing the Display of Annotations + +/** + Returns an image object to use for the marker for the specified point annotation object. + + @param mapView The map view that requested the annotation image. + @param annotation The object representing the annotation that is about to be displayed. + @return The image object to display for the specified annotation or `nil` if you want to display the default marker image. + */ +- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id )annotation; + +/** + Returns the alpha value to use when rendering a shape annotation. Defaults to `1.0`. + + @param mapView The map view rendering the shape annotation. + @param annotation The annotation being rendered. + @return An alpha value between `0` and `1.0`. + */ +- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation; + +/** + Returns the stroke color to use when rendering a shape annotation. Defaults to the map view’s tint color. + + @param mapView The map view rendering the shape annotation. + @param annotation The annotation being rendered. + @return A color to use for the shape outline. + */ +- (UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation; + +/** + Returns the fill color to use when rendering a polygon annotation. Defaults to the map view’s tint color. + + @param mapView The map view rendering the polygon annotation. + @param annotation The annotation being rendered. + @return A color to use for the polygon interior. + */ +- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation; + +/** + Returns the line width to use when rendering a polyline annotation. Defaults to `3.0`. + + @param mapView The map view rendering the polygon annotation. + @param annotation The annotation being rendered. + @return A line width for the polyline. + */ +- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation; + +/** + Returns a Boolean value indicating whether the annotation is able to display extra information in a callout bubble. + + If the value returned is `YES`, a standard callout bubble is shown when the user taps a selected annotation. The callout uses the title and subtitle text from the associated annotation object. If there is no title text, though, the annotation will not show a callout. The callout also displays any custom callout views returned by the delegate for the left and right callout accessory views. + + If the value returned is `NO`, the value of the title and subtitle strings are ignored. + + @param mapView The map view that requested the annotation callout ability. + @param annotation The object representing the annotation. + @return A Boolean indicating whether the annotation should show a callout. + */ +- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id )annotation; + +/** + Returns a callout view to display for the specified annotation. + + If this method is present in the delegate, it must return a new instance of a view dedicated to display the callout bubble. It will be configured by the map view. If this method is not present, or if it returns `nil`, a standard, two-line, bubble-like callout view is displayed by default. + + @param mapView The map view that requested the callout view. + @param annotation The object representing the annotation. + @return A view conforming to the `MGLCalloutView` protocol, or `nil` to use the default callout view. + */ +- (nullable UIView *)mapView:(MGLMapView *)mapView calloutViewForAnnotation:(id )annotation; + +/** + Returns the view to display on the left side of the standard callout bubble. + + The default value is treated as if `nil`. The left callout view is typically used to display information about the annotation or to link to custom information provided by your application. + + If the view you specify is also a descendant of the `UIControl` class, you can use the map view's delegate to receive notifications when your control is tapped. If it does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. + + @param mapView The map view presenting the annotation callout. + @param annotation The object representing the annotation with the callout. + @return The accessory view to display. + */ +- (nullable UIView *)mapView:(MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(id )annotation; + +/** + Returns the view to display on the right side of the standard callout bubble. + + The default value is treated is if `nil`. The right callout view is typically used to link to more detailed information about the annotation. A common view to specify for this property is `UIButton` object whose type is set to `UIButtonTypeDetailDisclosure`. + + If the view you specify is also a descendant of the `UIControl` class, you can use the map view's delegate to receive notifications when your control is tapped. If it does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. + + @param mapView The map view presenting the annotation callout. + @param annotation The object representing the annotation with the callout. + @return The accessory view to display. + */ +- (nullable UIView *)mapView:(MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation:(id )annotation; + +#pragma mark Managing Annotations + +/** + Tells the delegate that the user tapped one of the annotation's accessory buttons. + + Accessory views contain custom content and are positioned on either side of the annotation title text. If a view you specify is a descendant of the `UIControl` class, the map view calls this method as a convenience whenever the user taps your view. You can use this method to respond to taps and perform any actions associated with that control. For example, if your control displayed additional information about the annotation, you could use this method to present a modal panel with that information. + + If your custom accessory views are not descendants of the `UIControl` class, the map view does not call this method. + + @param mapView The map view containing the specified annotation. + @param annotation The annotation whose button was tapped. + @param control The control that was tapped. + */ +- (void)mapView:(MGLMapView *)mapView annotation:(id )annotation calloutAccessoryControlTapped:(UIControl *)control; + +/** + Tells the delegate that the user tapped on an annotation's callout view. + + @param mapView The map view containing the specified annotation. + @param annotation The annotation whose callout was tapped. + */ +- (void)mapView:(MGLMapView *)mapView tapOnCalloutForAnnotation:(id )annotation; + +#pragma mark Selecting Annotations + +/** + Tells the delegate that one of its annotations was selected. + + You can use this method to track changes in the selection state of annotations. + + @param mapView The map view containing the annotation. + @param annotation The annotation that was selected. + */ +- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id )annotation; + +/** + Tells the delegate that one of its annotations was deselected. + + You can use this method to track changes in the selection state of annotations. + + @param mapView The map view containing the annotation. + @param annotation The annotation that was deselected. + */ +- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id )annotation; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h new file mode 100644 index 0000000000..6160413510 --- /dev/null +++ b/platform/ios/src/MGLUserLocation.h @@ -0,0 +1,42 @@ +#import +#import + +#import "MGLAnnotation.h" + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** The MGLUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing MGLUserLocation object from the userLocation property of the map view displayed in your application. */ +@interface MGLUserLocation : NSObject + +#pragma mark Determining the User’s Position + +/** + The current location of the device. (read-only) + + This property contains `nil` if the map view is not currently showing the user location or if the user’s location has not yet been determined. + */ +@property (nonatomic, readonly, nullable) CLLocation *location; + +/** A Boolean value indicating whether the user’s location is currently being updated. (read-only) */ +@property (nonatomic, readonly, getter=isUpdating) BOOL updating; + +/** + The heading of the user location. (read-only) + + This property is `nil` if the user location tracking mode is not `MGLUserTrackingModeFollowWithHeading`. + */ +@property (nonatomic, readonly, nullable) CLHeading *heading; + +#pragma mark Accessing the User Annotation Text + +/** The title to display for the user location annotation. */ +@property (nonatomic, copy) NSString *title; + +/** The subtitle to display for the user location annotation. */ +@property (nonatomic, copy, nullable) NSString *subtitle; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h new file mode 100644 index 0000000000..df08c1b4a2 --- /dev/null +++ b/platform/ios/src/Mapbox.h @@ -0,0 +1,34 @@ +#import + +/// Project version number for Mapbox. +FOUNDATION_EXPORT double MapboxVersionNumber; + +/// Project version string for Mapbox. +FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; + +#import "MGLAccountManager.h" +#import "MGLAnnotation.h" +#import "MGLAnnotationImage.h" +#import "MGLCalloutView.h" +#import "MGLClockDirectionFormatter.h" +#import "MGLCompassDirectionFormatter.h" +#import "MGLCoordinateFormatter.h" +#import "MGLMapCamera.h" +#import "MGLGeometry.h" +#import "MGLMapView.h" +#import "MGLMapView+IBAdditions.h" +#import "MGLMapView+MGLCustomStyleLayerAdditions.h" +#import "MGLMultiPoint.h" +#import "MGLOfflinePack.h" +#import "MGLOfflineRegion.h" +#import "MGLOfflineStorage.h" +#import "MGLOverlay.h" +#import "MGLPointAnnotation.h" +#import "MGLPolygon.h" +#import "MGLPolyline.h" +#import "MGLShape.h" +#import "MGLStyle.h" +#import "MGLTilePyramidOfflineRegion.h" +#import "MGLTypes.h" +#import "MGLUserLocation.h" +#import "NSValue+MGLAdditions.h" diff --git a/platform/osx/include/MGLAnnotationImage.h b/platform/osx/include/MGLAnnotationImage.h deleted file mode 100644 index a33ea75a5e..0000000000 --- a/platform/osx/include/MGLAnnotationImage.h +++ /dev/null @@ -1,58 +0,0 @@ -#import - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -/** The MGLAnnotationImage class is responsible for presenting point-based - annotations visually on an MGLMapView instance. Annotation image objects - pair NSImage objects with annotation-related metadata. They may be recycled - later and put into a reuse queue that is maintained by the map view. */ -@interface MGLAnnotationImage : NSObject - -#pragma mark Initializing and preparing the image object -/** @name Initializing and Preparing the Image Object */ - -/** Initializes and returns a new annotation image object. - - @param image The image to display for the annotation. - @param reuseIdentifier The string that identifies this annotation image in - the reuse queue. - @return The initialized annotation image object or `nil` if there was a - problem initializing the object. */ -+ (instancetype)annotationImageWithImage:(NSImage *)image reuseIdentifier:(NSString *)reuseIdentifier; - -#pragma mark Getting and setting attributes -/** @name Getting and Setting Attributes */ - -/** The image to display for the annotation. */ -@property (nonatomic, readonly) NSImage *image; - -/** The string that identifies this annotation image in the reuse queue. - (read-only) - - You specify the reuse identifier when you create the image object. You use - this type later to retrieve an annotation image object that was created - previously but which is currently unused because its annotation is not - on-screen. - - If you define distinctly different types of annotations (with distinctly - different annotation images to go with them), you can differentiate between - the annotation types by specifying different reuse identifiers for each one. - */ -@property (nonatomic, readonly) NSString *reuseIdentifier; - -/** A Boolean value indicating whether the annotation is selectable. - - The default value of this property is `YES`. If the value of this property - is `NO`, the annotation image ignores click events and cannot be selected. - */ -@property (nonatomic, getter=isSelectable) BOOL selectable; - -/** The cursor that appears above any annotation using this annotation image. By - default, this property is set to `nil`, representing the current cursor. */ -@property (nonatomic, nullable) NSCursor *cursor; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/osx/include/MGLMapView+IBAdditions.h b/platform/osx/include/MGLMapView+IBAdditions.h deleted file mode 100644 index 81f4506a57..0000000000 --- a/platform/osx/include/MGLMapView+IBAdditions.h +++ /dev/null @@ -1,68 +0,0 @@ -#import - -#import "MGLMapView.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLMapView (IBAdditions) - -#if TARGET_INTERFACE_BUILDER - -// Core properties that can be manipulated in the Attributes inspector in -// Interface Builder. These redeclarations merely add the IBInspectable keyword. -// They appear here to ensure that they appear above the convenience properties; -// inspectables declared in MGLMapView.h are always sorted before those in -// MGLMapView+IBAdditions.h, due to ASCII sort order. - -// We want this property to look like a URL bar in the Attributes inspector, but -// just calling it styleURL would violate Cocoa naming conventions and conflict -// with the existing NSURL property. Fortunately, IB strips out the two -// underscores for display. - -/** URL of the style currently displayed in the receiver. - - The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s - map ID (`mapbox://styles//