From ea57be5598826a14991e2ac17a826186c2d9ce0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 2 Dec 2015 16:05:41 -0800 Subject: [osx] Documentation comments for public classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added documentation comments for all the public headers that aren’t being shared with iOS. Removed an animated: parameter from -selectAnnotation: and -deselectAnnotation:: because callout popovers may extend beyond the entire window, there is no need to scroll the map to make the entire callout visible. Added missing geometric conversion methods. Renamed -mapView:regionWillChangeAnimated: et al. to say “camera” instead of “region”. “Region” leaves ambiguity about whether properties like rotation and pitch trigger this method. “Camera” associates these methods with the camera property, which seems apt. --- include/mbgl/osx/MGLAccountManager.h | 36 ++- include/mbgl/osx/MGLAnnotationImage.h | 40 ++- include/mbgl/osx/MGLMapView+IBAdditions.h | 33 +-- include/mbgl/osx/MGLMapView.h | 407 +++++++++++++++++++++++++++++- include/mbgl/osx/MGLMapViewDelegate.h | 164 +++++++++++- 5 files changed, 637 insertions(+), 43 deletions(-) (limited to 'include') diff --git a/include/mbgl/osx/MGLAccountManager.h b/include/mbgl/osx/MGLAccountManager.h index c185f29b2e..efcec5419c 100644 --- a/include/mbgl/osx/MGLAccountManager.h +++ b/include/mbgl/osx/MGLAccountManager.h @@ -4,21 +4,39 @@ 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. */ +/** 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 /** @name Authorizing Access */ -/** Set the Mapbox API access token for the framework. -* -* You can set an access token on MGLAccountManager or on an individual map view. The same token is used throughout the framework. -* @param accessToken The Mapbox API access token. */ +/** Set the + [Mapbox access token](https://www.mapbox.com/help/define-access-token/) to + 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](https://www.mapbox.com/studio/account/tokens/). 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; -/** Retreive the Mapbox API access token for the framework. -* -* You can set an access token on MGLAccountManager or on an individual map view. The same token is used throughout the framework. -* @return accessToken The Mapbox API access token. */ +/** Returns the + [Mapbox access token](https://www.mapbox.com/help/define-access-token/) in + use by instances of MGLMapView in the current application. */ + (nullable NSString *)accessToken; @end diff --git a/include/mbgl/osx/MGLAnnotationImage.h b/include/mbgl/osx/MGLAnnotationImage.h index 66b623a5c1..a33ea75a5e 100644 --- a/include/mbgl/osx/MGLAnnotationImage.h +++ b/include/mbgl/osx/MGLAnnotationImage.h @@ -4,15 +4,53 @@ 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. */ +/** 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 diff --git a/include/mbgl/osx/MGLMapView+IBAdditions.h b/include/mbgl/osx/MGLMapView+IBAdditions.h index b524328c56..81f4506a57 100644 --- a/include/mbgl/osx/MGLMapView+IBAdditions.h +++ b/include/mbgl/osx/MGLMapView+IBAdditions.h @@ -19,13 +19,12 @@ NS_ASSUME_NONNULL_BEGIN // with the existing NSURL property. Fortunately, IB strips out the two // underscores for display. -/** - URL of the style currently displayed in the receiver. - +/** 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//