summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-04-02 15:41:29 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-04-03 12:40:51 -0700
commit2916ae2735bd46cdd87f32c0ab3efb5651ea8998 (patch)
tree653c773713d2785d7d455f7f24be78013012d322
parent836de8bc1c9ebbe86e0b20cf11291ef449faccfd (diff)
downloadqtlocation-mapboxgl-2916ae2735bd46cdd87f32c0ab3efb5651ea8998.tar.gz
formatting & docs changes
Ran this through `./ios/docs/install_docs.sh` to double-check things. * Less-specific initializers above more-specific per Apple convention. * Shores up `accessToken` docs as property, not a method. * Edited comments for consistency and/or to keep them out of the docs.
-rw-r--r--include/mbgl/ios/MGLMapView+IBAdditions.h5
-rw-r--r--include/mbgl/ios/MGLMapView.h23
-rw-r--r--platform/ios/MGLMapView.mm23
-rw-r--r--platform/ios/NSString+MGLAdditions.h2
4 files changed, 25 insertions, 28 deletions
diff --git a/include/mbgl/ios/MGLMapView+IBAdditions.h b/include/mbgl/ios/MGLMapView+IBAdditions.h
index 4661e549e5..fdd1ea3503 100644
--- a/include/mbgl/ios/MGLMapView+IBAdditions.h
+++ b/include/mbgl/ios/MGLMapView+IBAdditions.h
@@ -17,13 +17,8 @@
// must use the type double because Interface Builder is unaware that
// CLLocationDegrees is a typedef for double.
-/// Initial latitude at which the receiver is centered.
@property (nonatomic) IBInspectable double latitude;
-
-/// Initial longitude at which the receiver is centered.
@property (nonatomic) IBInspectable double longitude;
-
-/// Initial zoom level of the receiver.
@property (nonatomic) IBInspectable double zoomLevel;
@end
diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h
index 632175a308..3ee1b4e9d0 100644
--- a/include/mbgl/ios/MGLMapView.h
+++ b/include/mbgl/ios/MGLMapView.h
@@ -20,19 +20,19 @@ IB_DESIGNABLE
/** @name Initializing a Map View */
-/** Initialize a map view with a given frame, access token, and style URL.
-* @param frame The frame with which to initialize the map view.
-* @param accessToken A Mapbox API access token.
-* @param styleURL The map style URL to use. Can be either an HTTP/HTTPS URL or a Mapbox map ID style URL (`mapbox://<user.style>`).
-* @return An initialized map view, or `nil` if the map view was unable to be initialized. */
-- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken styleURL:(NSURL *)styleURL;
-
-/** Initialize a map view with the default style given a frame and access token.
+/** Initialize a map view with the default style and a given frame and access token.
* @param frame The frame with which to initialize the map view.
* @param accessToken A Mapbox API access token.
* @return An initialized map view, or `nil` if the map view was unable to be initialized. */
- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken;
+/** Initialize a map view with a given frame, access token, and style URL.
+ * @param frame The frame with which to initialize the map view.
+ * @param accessToken A Mapbox API access token.
+ * @param styleURL The map style URL to use. Can be either an HTTP/HTTPS URL or a Mapbox map ID style URL (`mapbox://<user.style>`).
+ * @return An initialized map view, or `nil` if the map view was unable to be initialized. */
+- (instancetype)initWithFrame:(CGRect)frame accessToken:(NSString *)accessToken styleURL:(NSURL *)styleURL;
+
- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("Instantiating an MGLMapView requires setting a style and/or an access token.")));
#pragma mark - Authorizing Access
@@ -166,7 +166,7 @@ IB_DESIGNABLE
/** Mapbox map ID of the style currently displayed in the receiver, or `nil` if the style does not have a map ID.
*
-* The style may lack a map ID if it is located at an HTTP, HTTPS, or local file URL. Use `styleURL` to get the URL in these cases.
+* The style may lack a map ID if it is located at an HTTP, HTTPS, or local file URL. Use `styleURL` to get the URL in these cases.
*
* To display the default style, set this property to `nil`. */
@property (nonatomic) NSString *mapID;
@@ -175,9 +175,8 @@ IB_DESIGNABLE
- (NSArray *)bundledStyleURLs;
/** URL of the style currently displayed in the receiver.
-
- The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://<user.style>`). To display the default style, set this property to `nil`.
- */
+*
+* The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://<user.style>`). To display the default style, set this property to `nil`. */
@property (nonatomic) NSURL *styleURL;
#pragma mark - Annotating the Map
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 2ad9db6882..63ed8e11a8 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -91,7 +91,8 @@ static NSURL *MGLURLForBundledStyleNamed(NSString *styleName)
@end
-@implementation MGLMapView {
+@implementation MGLMapView
+{
BOOL _isTargetingInterfaceBuilder;
CLLocationDegrees _pendingLatitude;
CLLocationDegrees _pendingLongitude;
@@ -168,7 +169,8 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
[MGLMapboxEvents setToken:accessToken.mgl_stringOrNilIfEmpty];
}
-+ (NSSet *)keyPathsForValuesAffectingStyleURL {
++ (NSSet *)keyPathsForValuesAffectingStyleURL
+{
return [NSSet setWithObjects:@"mapID", @"accessToken", nil];
}
@@ -180,10 +182,7 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
- (void)setStyleURL:(NSURL *)styleURL
{
- if ( _isTargetingInterfaceBuilder )
- {
- return;
- }
+ if (_isTargetingInterfaceBuilder) return;
if ( ! styleURL)
{
@@ -245,7 +244,8 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
// load extensions
//
- dispatch_once(&loadGLExtensions, ^{
+ dispatch_once(&loadGLExtensions, ^
+ {
const std::string extensions = (char *)glGetString(GL_EXTENSIONS);
using namespace mbgl;
@@ -1319,16 +1319,19 @@ CLLocationCoordinate2D latLngToCoordinate(mbgl::LatLng latLng)
return [NSArray arrayWithArray:_bundledStyleURLs];
}
-+ (NSSet *)keyPathsForValuesAffectingMapID {
++ (NSSet *)keyPathsForValuesAffectingMapID
+{
return [NSSet setWithObjects:@"styleURL", @"accessToken", nil];
}
-- (NSString *)mapID {
+- (NSString *)mapID
+{
NSURL *styleURL = self.styleURL;
return [styleURL.scheme isEqualToString:@"mapbox"] ? styleURL.host.mgl_stringOrNilIfEmpty : nil;
}
-- (void)setMapID:(NSString *)mapID {
+- (void)setMapID:(NSString *)mapID
+{
self.styleURL = [NSURL URLWithString:[NSString stringWithFormat:@"mapbox://%@", mapID]];
}
diff --git a/platform/ios/NSString+MGLAdditions.h b/platform/ios/NSString+MGLAdditions.h
index 263cfc8cb7..913f1cacda 100644
--- a/platform/ios/NSString+MGLAdditions.h
+++ b/platform/ios/NSString+MGLAdditions.h
@@ -2,7 +2,7 @@
@interface NSString (MGLAdditions)
-/// Returns the receiver if non-empty or \c nil if empty.
+/** Returns the receiver if non-empty or nil if empty. */
- (NSString *)mgl_stringOrNilIfEmpty;
@end