diff --git a/platform/darwin/src/MLNMapCamera.h b/platform/darwin/src/MLNMapCamera.h index c6db09314..437a437d4 100644 --- a/platform/darwin/src/MLNMapCamera.h +++ b/platform/darwin/src/MLNMapCamera.h @@ -8,13 +8,14 @@ NS_ASSUME_NONNULL_BEGIN /** An `MLNMapCamera` object represents a viewpoint from which the user observes - some point on an `MLNMapView`. + some point on an ``MLNMapView``. #### Related examples - TODO: Camera animation, learn how to create a camera that rotates + - : learn how to use the + ``MLNMapViewDelegate/mapView:shouldChangeFromCamera:toCamera:`` method of ``MLNMapViewDelegate`` to + restrict panning. + - *TODO:* Camera animation, learn how to create a camera that rotates around a central point. - TODO: Restrict map panning to an area, learn how to restrict map - panning using `MLNMapViewDelegate`'s `-mapView:shouldChangeFromCamera:toCamera:` method. */ MLN_EXPORT @interface MLNMapCamera : NSObject @@ -38,17 +39,17 @@ MLN_EXPORT The altitude is the distance from the viewpoint to the map, perpendicular to the map plane. This property does not account for physical elevation. - This property’s value may be less than that of the `viewingDistance` property. - Setting this property automatically updates the `viewingDistance` property - based on the `pitch` property’s current value. + This property’s value may be less than that of the ``viewingDistance`` property. + Setting this property automatically updates the ``viewingDistance`` property + based on the ``pitch`` property’s current value. */ @property (nonatomic) CLLocationDistance altitude; /** - The straight-line distance from the viewpoint to the `centerCoordinate`. + The straight-line distance from the viewpoint to the ``centerCoordinate``. - Setting this property automatically updates the `altitude` property based on - the `pitch` property’s current value. + Setting this property automatically updates the ``altitude`` property based on + the ``pitch`` property’s current value. */ @property (nonatomic) CLLocationDistance viewingDistance; @@ -76,12 +77,12 @@ MLN_EXPORT This method interprets the distance as a straight-line distance from the viewpoint to the center coordinate. To specify the altitude of the viewpoint, - use the `-cameraLookingAtCenterCoordinate:altitude:pitch:heading:` method. + use the ``cameraLookingAtCenterCoordinate:altitude:pitch:heading:`` method. @param centerCoordinate The geographic coordinate on which the map should be centered. @param distance The straight-line distance from the viewpoint to the - `centerCoordinate`. + ``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. @@ -117,11 +118,11 @@ MLN_EXPORT heading:(CLLocationDirection)heading; /** - @note This initializer incorrectly interprets the `distance` parameter. To - specify the straight-line distance from the viewpoint to `centerCoordinate`, - use the `-cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading:` + > This initializer incorrectly interprets the `distance` parameter. To + specify the straight-line distance from the viewpoint to ``centerCoordinate``, + use the ``cameraLookingAtCenterCoordinate:acrossDistance:pitch:heading:`` method. To specify the altitude of the viewpoint, use the - `-cameraLookingAtCenterCoordinate:altitude:pitch:heading:` method, which has + ``cameraLookingAtCenterCoordinate:altitude:pitch:heading:`` method, which has the same behavior as this initializer. */ + (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate @@ -135,7 +136,7 @@ MLN_EXPORT Returns a Boolean value indicating whether the given camera is functionally equivalent to the receiver. - Unlike `-isEqual:`, this method returns `YES` if the difference between the + Unlike `isEqual:`, this method returns `YES` if the difference between the coordinates, altitudes, pitches, or headings of the two camera objects is negligible. diff --git a/platform/darwin/src/MLNMapSnapshotter.h b/platform/darwin/src/MLNMapSnapshotter.h index ad2e4eb93..29ea1bb57 100644 --- a/platform/darwin/src/MLNMapSnapshotter.h +++ b/platform/darwin/src/MLNMapSnapshotter.h @@ -9,8 +9,8 @@ NS_ASSUME_NONNULL_BEGIN @protocol MLNMapSnapshotterDelegate; /** - An overlay that is placed within a `MLNMapSnapshot`. - To access this object, use `-[MLNMapSnapshotter startWithOverlayHandler:completionHandler:]`. + An overlay that is placed within a ``MLNMapSnapshot``. + To access this object, use ``MLNMapSnapshotter/startWithOverlayHandler:completionHandler:``. */ MLN_EXPORT @@ -53,12 +53,12 @@ MLN_EXPORT A block provided during the snapshot drawing process, enabling the ability to draw custom overlays rendered with Core Graphics. - @param snapshotOverlay The `MLNMapSnapshotOverlay` provided during snapshot drawing. + @param snapshotOverlay The ``MLNMapSnapshotOverlay`` provided during snapshot drawing. */ typedef void (^MLNMapSnapshotOverlayHandler)(MLNMapSnapshotOverlay *snapshotOverlay); /** - The options to use when creating images with the `MLNMapSnapshotter`. + The options to use when creating images with the ``MLNMapSnapshotter``. */ MLN_EXPORT @interface MLNMapSnapshotOptions : NSObject @@ -94,9 +94,9 @@ MLN_EXPORT /** A camera representing the viewport visible in the snapshot. - If this property is non-nil and the `coordinateBounds` property is set to a + If this property is non-nil and the ``coordinateBounds`` property is set to a non-empty coordinate bounds, the camera’s center coordinate and altitude are - ignored in favor of the `coordinateBounds` property. + ignored in favor of the ``coordinateBounds`` property. */ @property (nonatomic) MLNMapCamera *camera; @@ -170,7 +170,7 @@ MLN_EXPORT /** A block to processes the result or error of a snapshot request. - @param snapshot The `MLNMapSnapshot` that was generated or `nil` if an error + @param snapshot The ``MLNMapSnapshot`` that was generated or `nil` if an error occurred. @param error The error that occured or `nil` when successful. */ @@ -178,10 +178,10 @@ typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot *_Nullable snapsh NSError *_Nullable error); /** - An `MLNMapSnapshotter` generates static raster images of the map. Each snapshot - image depicts a portion of a map defined by an `MLNMapSnapshotOptions` object - you provide. The snapshotter generates an `MLNMapSnapshot` object - asynchronously, calling `MLNMapSnapshotterDelegate` methods if defined, then + An ``MLNMapSnapshotter`` generates static raster images of the map. Each snapshot + image depicts a portion of a map defined by an ``MLNMapSnapshotOptions`` object + you provide. The snapshotter generates an ``MLNMapSnapshot`` object + asynchronously, calling ``MLNMapSnapshotterDelegate`` methods if defined, then passing it into a completion handler once tiles and other resources needed for the snapshot are finished loading. @@ -190,9 +190,9 @@ typedef void (^MLNMapSnapshotCompletionHandler)(MLNMapSnapshot *_Nullable snapsh snapshot at a time. If you need to generate multiple snapshots concurrently, create multiple snapshotter objects. - For an interactive map, use the `MLNMapView` class. Both `MLNMapSnapshotter` - and `MLNMapView` are compatible with offline packs managed by the - `MLNOfflineStorage` class. + For an interactive map, use the ``MLNMapView`` class. Both ``MLNMapSnapshotter`` + and ``MLNMapView`` are compatible with offline packs managed by the + ``MLNOfflineStorage`` class. From a snapshot, you can obtain an image and convert geographic coordinates to the image’s coordinate space in order to superimpose markers and overlays. If @@ -277,7 +277,7 @@ MLN_EXPORT Cancels the snapshot creation request, if any. Once you call this method, you cannot resume the snapshot. In order to obtain - the snapshot, create a new `MLNMapSnapshotter` object. + the snapshot, create a new ``MLNMapSnapshotter`` object. */ - (void)cancel; @@ -308,21 +308,14 @@ MLN_EXPORT /** The style displayed in the resulting snapshot. - Unlike the `MLNMapSnapshotOptions.styleURL` property, this property is set to + Unlike the ``MLNMapSnapshotOptions/styleURL`` property, this property is set to an object that allows you to manipulate every aspect of the style locally. This property is set to `nil` until the style finishes loading. If the style has failed to load, this property is set to `nil`. Because the style loads asynchronously, you should manipulate it in the - `-[MLNMapSnapshotterDelegate mapSnapshotter:didFinishLoadingStyle:]` method. It + ``MLNMapSnapshotterDelegate/mapSnapshotter:didFinishLoadingStyle:`` method. It is not possible to manipulate the style before it has finished loading. - - @note The default styles provided by Mapbox contain sources and layers with - identifiers that will change over time. Applications that use APIs that - manipulate a style’s sources and layers must first set the style URL to an - explicitly versioned style using a convenience method like - `+[MLNStyle outdoorsStyleURLWithVersion:]` or a manually constructed - `NSURL`. */ @property (nonatomic, readonly, nullable) MLNStyle *style; @@ -330,7 +323,7 @@ MLN_EXPORT /** Optional methods about significant events when creating a snapshot using an - `MLNMapSnapshotter` object. + ``MLNMapSnapshotter`` object. */ @protocol MLNMapSnapshotterDelegate @optional @@ -352,8 +345,8 @@ MLN_EXPORT Tells the delegate that the snapshotter has just finished loading a style. This method is called in response to - `-[MLNMapSnapshotter startWithQueue:completionHandler:]` as long as the - `MLNMapSnapshotter.delegate` property is set. Changes to sources or layers of + ``MLNMapSnapshotter/startWithQueue:completionHandler:`` as long as the + ``MLNMapSnapshotter/delegate`` property is set. Changes to sources or layers of the style being snapshotted do not cause this method to be called. @param snapshotter The snapshotter that has just loaded a style. diff --git a/platform/darwin/src/MLNMapSnapshotter.mm b/platform/darwin/src/MLNMapSnapshotter.mm index c2771fbc9..ff85544f2 100644 --- a/platform/darwin/src/MLNMapSnapshotter.mm +++ b/platform/darwin/src/MLNMapSnapshotter.mm @@ -134,13 +134,7 @@ private: /** :nodoc: - Whether the Mapbox wordmark is displayed. - - @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 wordmark. If this applies to you, do not - hide the wordmark or change its contents. + Whether to include the MapLibre logo. Note this is not required. */ @property (nonatomic, readwrite) BOOL showsLogo; @end @@ -388,7 +382,7 @@ MLNImage *MLNAttributedSnapshot(mbgl::MapSnapshotter::Attributions attributions, CGPoint attributionOrigin = CGPointMake(mglImage.size.width - 10 - attributionBackgroundSize.width, logoImageRect.origin.y + (logoImageRect.size.height / 2) - (attributionBackgroundSize.height / 2) + 1); if (!logoImage) { - CGSize defaultLogoSize = [MLNMapSnapshotter mapboxLongStyleLogo].size; + CGSize defaultLogoSize = [MLNMapSnapshotter maplibreLongStyleLogo].size; logoImageRect = CGRectMake(0, mglImage.size.height - (MLNLogoImagePosition.y + defaultLogoSize.height), 0, defaultLogoSize.height); attributionOrigin = CGPointMake(10, logoImageRect.origin.y + (logoImageRect.size.height / 2) - (attributionBackgroundSize.height / 2) + 1); } @@ -461,7 +455,7 @@ MLNImage *MLNAttributedSnapshot(mbgl::MapSnapshotter::Attributions attributions, CGPoint attributionOrigin = CGPointMake(targetFrame.size.width - 10 - attributionBackgroundSize.width, MLNLogoImagePosition.y + 1); if (!logoImage) { - CGSize defaultLogoSize = [MLNMapSnapshotter mapboxLongStyleLogo].size; + CGSize defaultLogoSize = [MLNMapSnapshotter maplibreLongStyleLogo].size; logoImageRect = CGRectMake(0, MLNLogoImagePosition.y, 0, defaultLogoSize.height); attributionOrigin = CGPointMake(10, attributionOrigin.y); } @@ -630,11 +624,11 @@ NSArray *MLNAttributionInfosFromAttributions(mbgl::MapSnap MLNImage *logoImage; switch (style) { case MLNAttributionInfoStyleLong: - logoImage = [MLNMapSnapshotter mapboxLongStyleLogo]; + logoImage = [MLNMapSnapshotter maplibreLongStyleLogo]; break; case MLNAttributionInfoStyleMedium: #if TARGET_OS_IPHONE - logoImage = [UIImage imageNamed:@"mapbox_helmet" inBundle:[NSBundle mgl_frameworkBundle] compatibleWithTraitCollection:nil]; + logoImage = [UIImage imageNamed:@"maplibre-logo-icon" inBundle:[NSBundle mgl_frameworkBundle] compatibleWithTraitCollection:nil]; #else logoImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mgl_frameworkBundle] pathForResource:@"mapbox_helmet" ofType:@"pdf"]]; #endif @@ -646,11 +640,11 @@ NSArray *MLNAttributionInfosFromAttributions(mbgl::MapSnap return logoImage; } -+ (MLNImage *)mapboxLongStyleLogo ++ (MLNImage *)maplibreLongStyleLogo { MLNImage *logoImage; #if TARGET_OS_IPHONE - logoImage =[UIImage imageNamed:@"mapbox" inBundle:[NSBundle mgl_frameworkBundle] compatibleWithTraitCollection:nil]; + logoImage =[UIImage imageNamed:@"maplibre-logo-stroke-gray" inBundle:[NSBundle mgl_frameworkBundle] compatibleWithTraitCollection:nil]; #else logoImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mgl_frameworkBundle] pathForResource:@"mapbox" ofType:@"pdf"]]; #endif diff --git a/platform/darwin/src/MLNSettings.h b/platform/darwin/src/MLNSettings.h index 2f9b01d09..66cc0c7f5 100644 --- a/platform/darwin/src/MLNSettings.h +++ b/platform/darwin/src/MLNSettings.h @@ -40,12 +40,12 @@ MLN_EXPORT // MARK: Authorizing Access /** - The API Key used by all instances of `MLNMapView` in the current application. + The API Key used by all instances of ``MLNMapView`` in the current application. Setting this property to a value of `nil` has no effect. @note You must set the API key before attempting to load any style which requires the token. Therefore, you should generally set it before creating an instance of - `MLNMapView`. The recommended way to set an api key is to add an entry + ``MLNMapView``. The recommended way to set an api key is to add an entry to your application’s Info.plist file with the key `MLNApiKey` and the type `String`. Alternatively, you may call this method from your application delegate’s `-applicationDidFinishLaunching:` method. diff --git a/platform/ios/BUILD.bazel b/platform/ios/BUILD.bazel index 7edf7bc6f..c9b49c16f 100644 --- a/platform/ios/BUILD.bazel +++ b/platform/ios/BUILD.bazel @@ -244,6 +244,7 @@ filegroup( name = "extra_files", srcs = [ "BAZEL.md", + "CHANGELOG.md", "MapLibre.podspec", "PrivacyInfo.xcprivacy", "README.md", diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 5786bd849..16a7a8acb 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -5,6 +5,7 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C ## main - Add [Privacy Manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files). MapLibre Native iOS has no built-in tracking, but it does use some system APIs for functional purposes that are marked by Apple as privacy sensitive. ([#1866](https://github.com/maplibre/maplibre-native/issues/1866)). +- Change default `MLNMapSnapshotter` logo to the MapLibre logo ([#2541](https://github.com/maplibre/maplibre-native/pull/2541)). Note that showing the MapLibre logo is never required. Check with your tile provider if you need to show a logo. ## 6.5.0 diff --git a/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/Contents.json b/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/Contents.json new file mode 100644 index 000000000..a12b75373 --- /dev/null +++ b/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "maplibre-logo-icon.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/maplibre-logo-icon.svg b/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/maplibre-logo-icon.svg new file mode 100644 index 000000000..1039364ba --- /dev/null +++ b/platform/ios/resources/Images.xcassets/maplibre-logo-icon.imageset/maplibre-logo-icon.svg @@ -0,0 +1,48 @@ + + + + + + + + + + +