summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLAttributionInfo.h
blob: 1de37c3b24a8be7bc1baf77150666bf94a2f6775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>

#import "MGLFoundation.h"
#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
 The attribution info is represented in the longest format available.
 */
typedef NS_ENUM(NSUInteger, MGLAttributionInfoStyle) {
    /**
     Specifies a short attribution info style.
     */
    MGLAttributionInfoStyleShort = 1,
    /**
     Specifies a medium attribution info style.
     */
    MGLAttributionInfoStyleMedium,
    /**
     Specifies a long attribution info style.
     */
    MGLAttributionInfoStyleLong
};

/**
 Information about an attribution statement, usually a copyright or trademark
 statement, associated with a map content source.
 */
MGL_EXPORT
@interface MGLAttributionInfo : NSObject

/**
 Returns an initialized attribution info object with the given title and URL.

 @param title The attribution statement’s title.
 @param URL A URL to more information about the entity named in the attribution.
 @return An initialized attribution info object.
 */
- (instancetype)initWithTitle:(NSAttributedString *)title URL:(nullable NSURL *)URL;

/**
 The attribution statement’s attributed title text.
 */
@property (nonatomic) NSAttributedString *title;

/**
 The URL to more information about the entity named in the attribution.

 If this property is set, the attribution statement should be displayed as a
 hyperlink or action button. Otherwise, if it is `nil`, the attribution
 statement should be displayed as plain text.
 */
@property (nonatomic, nullable) NSURL *URL;

/**
 A Boolean value indicating whether the attribution statement is a shortcut to a
 feedback tool.

 If this property is set, the statement should be treated as a way for the user
 to provide feedback rather than an attribution statement.
 */
@property (nonatomic, getter=isFeedbackLink) BOOL feedbackLink;

/**
 Returns a copy of the `URL` property modified to account for the given center
 coordinate and zoom level.

 @param centerCoordinate The map’s center coordinate.
 @param zoomLevel The map’s zoom level. See the `MGLMapView.zoomLevel` property
    for more information.
 @return A modified URL containing a fragment that points to the specified
    viewport. If the `feedbackLink` property is set to `NO`, this method returns
    `nil`.
 */
- (nullable NSURL *)feedbackURLAtCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel;

/**
 Returns a copy of the current `title` formatted accordingly to `style`.
 
 Example: If the `style` property is set to `MGLAttributionInfoStyleShort` and the
 `title` property is set to `OpenStreetMap`, then this method returns `OSM`.
 
 @param style The attribution info style.
 
 @return The `NSAttributedString` styled title.
 */
- (NSAttributedString *)titleWithStyle:(MGLAttributionInfoStyle)style;

@end

NS_ASSUME_NONNULL_END