summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-22 08:52:35 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-22 11:13:03 -0700
commite5c6cfde4b4f36cadeadfcb320bd641c4517f366 (patch)
tree6f4159a87abdd3b8e6075129724bf15190d56e87
parent91023f02f85ad243f867a2fb920699c3e1659f94 (diff)
downloadqtlocation-mapboxgl-e5c6cfde4b4f36cadeadfcb320bd641c4517f366.tar.gz
[ios, osx] Direction formatter
Implemented an NSFormatter for formatting CLLocationDirection values as localizable display strings. The formatter supports both absolute compass directions, such as “south”, and relative “clock” directions, such as “6 o’clock”.
-rw-r--r--.jazzy.yaml2
-rw-r--r--platform/darwin/include/MGLDirectionFormatter.h77
-rw-r--r--platform/darwin/src/MGLDirectionFormatter.m167
-rw-r--r--platform/darwin/test/MGLDirectionFormatterTests.m111
-rw-r--r--platform/ios/CHANGELOG.md2
-rw-r--r--platform/ios/framework/Mapbox.h1
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj12
-rw-r--r--platform/osx/osx.xcodeproj/project.pbxproj12
-rw-r--r--platform/osx/sdk/Mapbox.h1
9 files changed, 384 insertions, 1 deletions
diff --git a/.jazzy.yaml b/.jazzy.yaml
index a6d47f25a2..e6ed144282 100644
--- a/.jazzy.yaml
+++ b/.jazzy.yaml
@@ -69,6 +69,8 @@ custom_categories:
- MGLCoordinateSpanMake
- MGLCoordinateSpanZero
- MGLDegreesFromRadians
+ - MGLDirectionFormatter
+ - MGLDirectionFormatterOrigin
- MGLRadiansFromDegrees
- MGLStringFromCoordinateBounds
- NSValue(MGLGeometryAdditions)
diff --git a/platform/darwin/include/MGLDirectionFormatter.h b/platform/darwin/include/MGLDirectionFormatter.h
new file mode 100644
index 0000000000..9091292e22
--- /dev/null
+++ b/platform/darwin/include/MGLDirectionFormatter.h
@@ -0,0 +1,77 @@
+#import <Foundation/Foundation.h>
+#import <CoreLocation/CoreLocation.h>
+
+#import "MGLTypes.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ The reference point for an `MGLDirectionFormatter`.
+ */
+typedef NS_ENUM(NSUInteger, MGLDirectionFormatterOrigin) {
+ /**
+ Directions are assumed to be relative to true north and are given as
+ compass directions, such as “south” for a value of `90`.
+ */
+ MGLDirectionFormatterOriginNorth = 0,
+ /**
+ Directions are assumed to be relative to the direction in which the user is
+ facing and are given as “clock directions”, such as “6 o’clock” for a value
+ of `90`.
+ */
+ MGLDirectionFormatterOriginStraightAhead,
+};
+
+/**
+ The `MGLDirectionFormatter` class provides properly formatted descriptions of
+ absolute or relative headings. Use this class to create localized heading
+ strings when displaying directional information to users.
+ */
+@interface MGLDirectionFormatter : NSFormatter
+
+/**
+ The receiver’s reference point. The receiver’s input is assumed to be relative
+ to this reference point, and its output is given in the conventional form for
+ directions with this reference point.
+
+ This class does not convert between different reference points. To convert an
+ `CLLocationDirection` with respect to true north into a `CLLocationDirection`
+ with respect to the direction in which the user is currently facing, use Core
+ Location to determine the user’s current heading.
+
+ The default value of this property is `MGLDirectionFormatterOriginNorth`, which
+ means a value of `0` is formatted as “north” in the receiver’s locale.
+ */
+@property (nonatomic) MGLDirectionFormatterOrigin origin;
+
+/**
+ 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 as well as the numeral system used
+ when the `relativeToUser` property is set to `YES`.
+ */
+@property (copy) NSLocale *locale;
+
+/**
+ Returns a heading string for the provided value.
+
+ @param direction The heading, measured in degrees.
+ @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/MGLDirectionFormatter.m b/platform/darwin/src/MGLDirectionFormatter.m
new file mode 100644
index 0000000000..ca0468f508
--- /dev/null
+++ b/platform/darwin/src/MGLDirectionFormatter.m
@@ -0,0 +1,167 @@
+#import "MGLDirectionFormatter.h"
+
+#define wrap(value, min, max) \
+ (fmod((fmod((value - min), (max - min)) + (max - min)), (max - min)) + min)
+
+@implementation MGLDirectionFormatter {
+ NSNumberFormatter *_numberFormatter;
+}
+
+- (instancetype)init {
+ if (self = [super init]) {
+ _unitStyle = NSFormattingUnitStyleMedium;
+ _numberFormatter = [[NSNumberFormatter alloc] init];
+ }
+ return self;
+}
+
+- (NSLocale *)locale {
+ return _numberFormatter.locale;
+}
+
+- (void)setLocale:(NSLocale *)locale {
+ _numberFormatter.locale = locale;
+}
+
+- (NSString *)stringFromDirection:(CLLocationDirection)direction {
+ if (self.origin == MGLDirectionFormatterOriginNorth) {
+ return [self stringFromAbsoluteDirection:direction];
+ } else {
+ return [self stringFromRelativeDirection:direction];
+ }
+}
+
+- (NSString *)stringFromRelativeDirection:(CLLocationDirection)direction {
+ NSInteger hour = round(-wrap(-direction, -360, 0) / 360 * 12);
+ NSString *format;
+ NSNumberFormatterStyle style = NSNumberFormatterDecimalStyle;
+ switch (self.unitStyle) {
+ case NSFormattingUnitStyleShort:
+ format = NSLocalizedString(@"%@:00", @"Relative heading format, short style");
+ break;
+
+ case NSFormattingUnitStyleMedium:
+ format = NSLocalizedString(@"%@ o’clock", @"Relative heading format, medium style");
+
+ break;
+
+ case NSFormattingUnitStyleLong:
+ format = NSLocalizedString(@"%@ o’clock", @"Relative heading format, long style");
+ style = NSNumberFormatterSpellOutStyle;
+ break;
+
+ default:
+ break;
+ }
+ _numberFormatter.numberStyle = style;
+ return [NSString stringWithFormat:format, [_numberFormatter stringFromNumber:@(hour)]];
+}
+
+- (NSString *)stringFromAbsoluteDirection:(CLLocationDirection)direction {
+ static NS_ARRAY_OF(NSString *) *shortStrings;
+ static NS_ARRAY_OF(NSString *) *longStrings;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ shortStrings = @[
+ NSLocalizedString(@"N", @"North, short"),
+ NSLocalizedString(@"N×E", @"North by east, short"),
+ NSLocalizedString(@"NNE", @"North-northeast, short"),
+ NSLocalizedString(@"NE×N", @"Northeast by north, short"),
+ NSLocalizedString(@"NE", @"Northeast, short"),
+ NSLocalizedString(@"NE×E", @"Northeast by east, short"),
+ NSLocalizedString(@"ENE", @"East-northeast, short"),
+ NSLocalizedString(@"E×N", @"East by north, short"),
+
+ NSLocalizedString(@"E", @"East, short"),
+ NSLocalizedString(@"E×S", @"East by south, short"),
+ NSLocalizedString(@"ESE", @"East-southeast, short"),
+ NSLocalizedString(@"SE×E", @"Southeast by east, short"),
+ NSLocalizedString(@"SE", @"Southeast, short"),
+ NSLocalizedString(@"SE×S", @"Southeast by south, short"),
+ NSLocalizedString(@"SSE", @"South-southeast, short"),
+ NSLocalizedString(@"S×E", @"South by east, short"),
+
+ NSLocalizedString(@"S", @"South, short"),
+ NSLocalizedString(@"S×W", @"South by west, short"),
+ NSLocalizedString(@"SSW", @"South-southwest, short"),
+ NSLocalizedString(@"SW×S", @"Southwest by south, short"),
+ NSLocalizedString(@"SW", @"Southwest, short"),
+ NSLocalizedString(@"SW×W", @"Southwest by west, short"),
+ NSLocalizedString(@"WSW", @"West-southwest, short"),
+ NSLocalizedString(@"W×S", @"West by south, short"),
+
+ NSLocalizedString(@"W", @"West, short"),
+ NSLocalizedString(@"W×N", @"West by north, short"),
+ NSLocalizedString(@"WNW", @"West-northwest, short"),
+ NSLocalizedString(@"NW×W", @"Northwest by west, short"),
+ NSLocalizedString(@"NW", @"Northwest, short"),
+ NSLocalizedString(@"NW×N", @"Northwest by north, short"),
+ NSLocalizedString(@"NNW", @"North-northwest, short"),
+ NSLocalizedString(@"N×W", @"North by west, short"),
+ ];
+
+ longStrings = @[
+ NSLocalizedString(@"north", @"North, long"),
+ NSLocalizedString(@"north by east", @"North by east, long"),
+ NSLocalizedString(@"north-northeast", @"North-northeast, long"),
+ NSLocalizedString(@"northeast by north", @"Northeast by north, long"),
+ NSLocalizedString(@"northeast", @"Northeast, long"),
+ NSLocalizedString(@"northeast by east", @"Northeast by east, long"),
+ NSLocalizedString(@"east-northeast", @"East-northeast, long"),
+ NSLocalizedString(@"east by north", @"East by north, long"),
+
+ NSLocalizedString(@"east", @"East, long"),
+ NSLocalizedString(@"east by south", @"East by south, long"),
+ NSLocalizedString(@"east-southeast", @"East-southeast, long"),
+ NSLocalizedString(@"southeast by east", @"Southeast by east, long"),
+ NSLocalizedString(@"southeast", @"Southeast, long"),
+ NSLocalizedString(@"southeast by south", @"Southeast by south, long"),
+ NSLocalizedString(@"south-southeast", @"South-southeast, long"),
+ NSLocalizedString(@"south by east", @"South by east, long"),
+
+ NSLocalizedString(@"south", @"South, long"),
+ NSLocalizedString(@"south by west", @"South by west, long"),
+ NSLocalizedString(@"south-southwest", @"South-southwest, long"),
+ NSLocalizedString(@"southwest by south", @"Southwest by south, long"),
+ NSLocalizedString(@"southwest", @"Southwest, long"),
+ NSLocalizedString(@"southwest by west", @"Southwest by west, long"),
+ NSLocalizedString(@"west-southwest", @"West-southwest, long"),
+ NSLocalizedString(@"west by south", @"West by south, long"),
+
+ NSLocalizedString(@"west", @"West, long"),
+ NSLocalizedString(@"west by north", @"West by north, long"),
+ NSLocalizedString(@"west-northwest", @"West-northwest, long"),
+ NSLocalizedString(@"northwest by west", @"Northwest by west, long"),
+ NSLocalizedString(@"northwest", @"Northwest, long"),
+ NSLocalizedString(@"northwest by north", @"Northwest by north, long"),
+ NSLocalizedString(@"north-northwest", @"North-northwest, long"),
+ NSLocalizedString(@"north by west", @"North by west, long"),
+ ];
+
+ NSAssert(shortStrings.count == longStrings.count, @"Long and short direction string arrays must have the same size.");
+ });
+
+ NSInteger cardinalPoint = round(wrap(direction, 0, 360) / 360 * shortStrings.count);
+ switch (self.unitStyle) {
+ case NSFormattingUnitStyleShort:
+ return shortStrings[cardinalPoint];
+
+ case NSFormattingUnitStyleMedium:
+ case NSFormattingUnitStyleLong:
+ return longStrings[cardinalPoint];
+ }
+}
+
+- (nullable NSString *)stringForObjectValue:(id)obj {
+ if (![obj isKindOfClass:[NSValue class]]) {
+ return nil;
+ }
+ return [self stringFromDirection:[obj doubleValue]];
+}
+
+- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error {
+ NSAssert(NO, @"-getObjectValue:forString:errorDescription: has not been implemented");
+ return NO;
+}
+
+@end
diff --git a/platform/darwin/test/MGLDirectionFormatterTests.m b/platform/darwin/test/MGLDirectionFormatterTests.m
new file mode 100644
index 0000000000..81c5223068
--- /dev/null
+++ b/platform/darwin/test/MGLDirectionFormatterTests.m
@@ -0,0 +1,111 @@
+#import <Mapbox/Mapbox.h>
+#import <XCTest/XCTest.h>
+
+static NSString * const MGLTestLocaleIdentifier = @"en-US";
+
+@interface MGLDirectionFormatterTests : XCTestCase
+
+@end
+
+@implementation MGLDirectionFormatterTests
+
+- (void)testAbsoluteDirections {
+ MGLDirectionFormatter *shortFormatter = [[MGLDirectionFormatter alloc] init];
+ XCTAssertEqual(shortFormatter.origin, MGLDirectionFormatterOriginNorth, @"Reference point should be north by default.");
+ shortFormatter.unitStyle = NSFormattingUnitStyleShort;
+ shortFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ MGLDirectionFormatter *mediumFormatter = [[MGLDirectionFormatter alloc] init];
+ XCTAssertEqual(mediumFormatter.unitStyle, NSFormattingUnitStyleMedium, @"Unit style should be medium by default.");
+ mediumFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ MGLDirectionFormatter *longFormatter = [[MGLDirectionFormatter alloc] init];
+ longFormatter.unitStyle = NSFormattingUnitStyleLong;
+ longFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ XCTAssertEqualObjects(@"NW", [shortFormatter stringFromDirection:-45]);
+ XCTAssertEqualObjects(@"northwest", [mediumFormatter stringFromDirection:-45]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:-45], [longFormatter stringFromDirection:-45]);
+
+ XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:0]);
+ XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:0]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:0], [longFormatter stringFromDirection:0]);
+
+ XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:1]);
+ XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:1]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:1], [longFormatter stringFromDirection:1]);
+
+ XCTAssertEqualObjects(@"N×E", [shortFormatter stringFromDirection:10]);
+ XCTAssertEqualObjects(@"north by east", [mediumFormatter stringFromDirection:10]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:10], [longFormatter stringFromDirection:10]);
+
+ XCTAssertEqualObjects(@"NNE", [shortFormatter stringFromDirection:20]);
+ XCTAssertEqualObjects(@"north-northeast", [mediumFormatter stringFromDirection:20]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:20], [longFormatter stringFromDirection:20]);
+
+ XCTAssertEqualObjects(@"NE", [shortFormatter stringFromDirection:45]);
+ XCTAssertEqualObjects(@"northeast", [mediumFormatter stringFromDirection:45]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:45], [longFormatter stringFromDirection:45]);
+
+ XCTAssertEqualObjects(@"E", [shortFormatter stringFromDirection:90]);
+ XCTAssertEqualObjects(@"east", [mediumFormatter stringFromDirection:90]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:90], [longFormatter stringFromDirection:90]);
+
+ XCTAssertEqualObjects(@"S", [shortFormatter stringFromDirection:180]);
+ XCTAssertEqualObjects(@"south", [mediumFormatter stringFromDirection:180]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:180], [longFormatter stringFromDirection:180]);
+
+ XCTAssertEqualObjects(@"W", [shortFormatter stringFromDirection:270]);
+ XCTAssertEqualObjects(@"west", [mediumFormatter stringFromDirection:270]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:270], [longFormatter stringFromDirection:270]);
+
+ XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:360]);
+ XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:360]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:360], [longFormatter stringFromDirection:360]);
+
+ XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:720]);
+ XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:720]);
+ XCTAssertEqualObjects([mediumFormatter stringFromDirection:720], [longFormatter stringFromDirection:720]);
+}
+
+- (void)testRelativeDirections {
+ MGLDirectionFormatter *shortFormatter = [[MGLDirectionFormatter alloc] init];
+ shortFormatter.origin = MGLDirectionFormatterOriginStraightAhead;
+ shortFormatter.unitStyle = NSFormattingUnitStyleShort;
+ shortFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ MGLDirectionFormatter *mediumFormatter = [[MGLDirectionFormatter alloc] init];
+ mediumFormatter.origin = MGLDirectionFormatterOriginStraightAhead;
+ mediumFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ MGLDirectionFormatter *longFormatter = [[MGLDirectionFormatter alloc] init];
+ longFormatter.origin = MGLDirectionFormatterOriginStraightAhead;
+ longFormatter.unitStyle = NSFormattingUnitStyleLong;
+ longFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier];
+
+ XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:-90]);
+ XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:-90]);
+ XCTAssertEqualObjects(@"nine o’clock", [longFormatter stringFromDirection:-90]);
+
+ XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:0]);
+ XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:0]);
+ XCTAssertEqualObjects(@"twelve o’clock", [longFormatter stringFromDirection:0]);
+
+ XCTAssertEqualObjects(@"2:00", [shortFormatter stringFromDirection:45]);
+ XCTAssertEqualObjects(@"2 o’clock", [mediumFormatter stringFromDirection:45]);
+ XCTAssertEqualObjects(@"two o’clock", [longFormatter stringFromDirection:45]);
+
+ XCTAssertEqualObjects(@"3:00", [shortFormatter stringFromDirection:90]);
+ XCTAssertEqualObjects(@"3 o’clock", [mediumFormatter stringFromDirection:90]);
+ XCTAssertEqualObjects(@"three o’clock", [longFormatter stringFromDirection:90]);
+
+ XCTAssertEqualObjects(@"6:00", [shortFormatter stringFromDirection:180]);
+ XCTAssertEqualObjects(@"6 o’clock", [mediumFormatter stringFromDirection:180]);
+ XCTAssertEqualObjects(@"six o’clock", [longFormatter stringFromDirection:180]);
+
+ XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:270]);
+ XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:270]);
+ XCTAssertEqualObjects(@"nine o’clock", [longFormatter stringFromDirection:270]);
+}
+
+@end
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 875b0dd7a6..ba1c635175 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -12,7 +12,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Fixed an issue preventing KVO change notifications from being generated on MGLMapView’s `userTrackingMode` key path when `-setUserTrackingMode:animated:` is called. ([#4724](https://github.com/mapbox/mapbox-gl-native/pull/4724))
- Rendering now occurs on the main thread, fixing a hang when calling `-[MGLMapView styleURL]` before the map view has fully loaded or while the application is in the background. ([#2909](https://github.com/mapbox/mapbox-gl-native/pull/2909))
- Added category methods on NSValue for converting to and from the structure types defined in MGLGeometry.h. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
-- Added MGLCoordinateFormatter for converting geographic coordinates into display strings. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
+- Added NSFormatter subclasses for converting geographic coordinates and directions into display strings. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802))
- Added a `-reloadStyle:` action to MGLMapView to force a reload of the current style. ([#4728](https://github.com/mapbox/mapbox-gl-native/pull/4728))
- A more specific user agent string is now sent with style and tile requests. ([#4012](https://github.com/mapbox/mapbox-gl-native/pull/4012))
- Mapbox Telemetry is automatically disabled while the host application is running in the iOS Simulator. ([#4726](https://github.com/mapbox/mapbox-gl-native/pull/4726))
diff --git a/platform/ios/framework/Mapbox.h b/platform/ios/framework/Mapbox.h
index 68579933b6..db6aba1495 100644
--- a/platform/ios/framework/Mapbox.h
+++ b/platform/ios/framework/Mapbox.h
@@ -11,6 +11,7 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[];
#import "MGLAnnotationImage.h"
#import "MGLCalloutView.h"
#import "MGLCoordinateFormatter.h"
+#import "MGLDirectionFormatter.h"
#import "MGLMapCamera.h"
#import "MGLGeometry.h"
#import "MGLMapView.h"
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 50f2a79dea..5ee63c1c5c 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -33,6 +33,10 @@
DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */; };
DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */; };
DA35A2AA1CCA058D00E826B2 /* MGLCoordinateFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */; };
+ DA35A2B11CCA141D00E826B2 /* MGLDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AF1CCA141D00E826B2 /* MGLDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA35A2B21CCA141D00E826B2 /* MGLDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AF1CCA141D00E826B2 /* MGLDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA35A2B31CCA141D00E826B2 /* MGLDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B01CCA141D00E826B2 /* MGLDirectionFormatter.m */; };
+ DA35A2B41CCA141D00E826B2 /* MGLDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B01CCA141D00E826B2 /* MGLDirectionFormatter.m */; };
DA4A26941CB6E337000B7809 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC9561CB6C1C2006E619F /* Main.storyboard */; };
DA4A26951CB6E337000B7809 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC95B1CB6C1C2006E619F /* LaunchScreen.storyboard */; };
DA8847D91CBAF91600AB86E3 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; };
@@ -277,6 +281,8 @@
DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCoordinateFormatter.h; path = include/MGLCoordinateFormatter.h; sourceTree = "<group>"; };
DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatter.m; path = src/MGLCoordinateFormatter.m; sourceTree = "<group>"; };
DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = "<group>"; };
+ DA35A2AF1CCA141D00E826B2 /* MGLDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLDirectionFormatter.h; path = include/MGLDirectionFormatter.h; sourceTree = "<group>"; };
+ DA35A2B01CCA141D00E826B2 /* MGLDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDirectionFormatter.m; path = src/MGLDirectionFormatter.m; sourceTree = "<group>"; };
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 = "<group>"; };
@@ -545,6 +551,8 @@
DA8847E01CBAFA5100AB86E3 /* MGLAnnotation.h */,
DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */,
DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */,
+ DA35A2AF1CCA141D00E826B2 /* MGLDirectionFormatter.h */,
+ DA35A2B01CCA141D00E826B2 /* MGLDirectionFormatter.m */,
DA8847E11CBAFA5100AB86E3 /* MGLGeometry.h */,
DA8848011CBAFA6200AB86E3 /* MGLGeometry_Private.h */,
DA8848021CBAFA6200AB86E3 /* MGLGeometry.mm */,
@@ -754,6 +762,7 @@
DA88481E1CBAFA6200AB86E3 /* MGLMultiPoint_Private.h in Headers */,
DA35A29E1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */,
DA8847F71CBAFA5100AB86E3 /* MGLOverlay.h in Headers */,
+ DA35A2B11CCA141D00E826B2 /* MGLDirectionFormatter.h in Headers */,
DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */,
DA8847FE1CBAFA5100AB86E3 /* MGLTypes.h in Headers */,
DA8847F11CBAFA5100AB86E3 /* MGLGeometry.h in Headers */,
@@ -799,6 +808,7 @@
DABFB8681CBE99E500D62B32 /* MGLPolyline.h in Headers */,
DABFB86F1CBE9A0F00D62B32 /* MGLMapView.h in Headers */,
DABFB8631CBE99E500D62B32 /* MGLOfflineRegion.h in Headers */,
+ DA35A2B21CCA141D00E826B2 /* MGLDirectionFormatter.h in Headers */,
DABFB8731CBE9A9900D62B32 /* Mapbox.h in Headers */,
DABFB86B1CBE99E500D62B32 /* MGLTilePyramidOfflineRegion.h in Headers */,
DABFB85F1CBE99E500D62B32 /* MGLGeometry.h in Headers */,
@@ -1051,6 +1061,7 @@
DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */,
DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */,
DA8848281CBAFA6200AB86E3 /* MGLShape.m in Sources */,
+ DA35A2B31CCA141D00E826B2 /* MGLDirectionFormatter.m in Sources */,
DA8848321CBAFA6200AB86E3 /* NSString+MGLAdditions.m in Sources */,
DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */,
DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */,
@@ -1085,6 +1096,7 @@
DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */,
DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */,
DAA4E41F1CBB730400178DFB /* MGLMultiPoint.mm in Sources */,
+ DA35A2B41CCA141D00E826B2 /* MGLDirectionFormatter.m in Sources */,
DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */,
DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */,
DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */,
diff --git a/platform/osx/osx.xcodeproj/project.pbxproj b/platform/osx/osx.xcodeproj/project.pbxproj
index dc7030a949..f31d5f6e55 100644
--- a/platform/osx/osx.xcodeproj/project.pbxproj
+++ b/platform/osx/osx.xcodeproj/project.pbxproj
@@ -11,6 +11,9 @@
DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
DA35A2A61CC9EB2700E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */; };
DA35A2A81CC9F41600E826B2 /* MGLCoordinateFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */; };
+ DA35A2AD1CCA091800E826B2 /* MGLDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AB1CCA091800E826B2 /* MGLDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA35A2AE1CCA091800E826B2 /* MGLDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2AC1CCA091800E826B2 /* MGLDirectionFormatter.m */; };
+ DA35A2B61CCA14D700E826B2 /* MGLDirectionFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B51CCA14D700E826B2 /* MGLDirectionFormatterTests.m */; };
DA839E971CC2E3400062CAFB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E961CC2E3400062CAFB /* AppDelegate.m */; };
DA839E9A1CC2E3400062CAFB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E991CC2E3400062CAFB /* main.m */; };
DA839E9D1CC2E3400062CAFB /* MapDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E9C1CC2E3400062CAFB /* MapDocument.m */; };
@@ -139,6 +142,9 @@
DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCoordinateFormatter.h; path = include/MGLCoordinateFormatter.h; sourceTree = "<group>"; };
DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatter.m; path = src/MGLCoordinateFormatter.m; sourceTree = "<group>"; };
DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = "<group>"; };
+ DA35A2AB1CCA091800E826B2 /* MGLDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLDirectionFormatter.h; path = include/MGLDirectionFormatter.h; sourceTree = "<group>"; };
+ DA35A2AC1CCA091800E826B2 /* MGLDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDirectionFormatter.m; path = src/MGLDirectionFormatter.m; sourceTree = "<group>"; };
+ DA35A2B51CCA14D700E826B2 /* MGLDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDirectionFormatterTests.m; path = ../../darwin/test/MGLDirectionFormatterTests.m; sourceTree = "<group>"; };
DA839E921CC2E3400062CAFB /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; };
DA839E951CC2E3400062CAFB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
DA839E961CC2E3400062CAFB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -352,6 +358,7 @@
isa = PBXGroup;
children = (
DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */,
+ DA35A2B51CCA14D700E826B2 /* MGLDirectionFormatterTests.m */,
DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */,
DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */,
DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */,
@@ -372,6 +379,8 @@
DAE6C34B1CC31E0400DB3429 /* MGLAnnotation.h */,
DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */,
DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */,
+ DA35A2AB1CCA091800E826B2 /* MGLDirectionFormatter.h */,
+ DA35A2AC1CCA091800E826B2 /* MGLDirectionFormatter.m */,
DAE6C34C1CC31E0400DB3429 /* MGLGeometry.h */,
DAE6C36C1CC31E2A00DB3429 /* MGLGeometry_Private.h */,
DAE6C36D1CC31E2A00DB3429 /* MGLGeometry.mm */,
@@ -495,6 +504,7 @@
DAE6C3B91CC31EF300DB3429 /* MGLOpenGLLayer.h in Headers */,
DAE6C3891CC31E2A00DB3429 /* MGLMultiPoint_Private.h in Headers */,
DAE6C3A51CC31E9400DB3429 /* MGLMapView+IBAdditions.h in Headers */,
+ DA35A2AD1CCA091800E826B2 /* MGLDirectionFormatter.h in Headers */,
DAE6C3671CC31E0400DB3429 /* MGLStyle.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -672,6 +682,7 @@
DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */,
DAE6C3921CC31E2A00DB3429 /* MGLPolyline.mm in Sources */,
DAE6C3B51CC31EF300DB3429 /* MGLCompassCell.m in Sources */,
+ DA35A2AE1CCA091800E826B2 /* MGLDirectionFormatter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -681,6 +692,7 @@
files = (
DAE6C3D41CC34C9900DB3429 /* MGLOfflineRegionTests.m in Sources */,
DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */,
+ DA35A2B61CCA14D700E826B2 /* MGLDirectionFormatterTests.m in Sources */,
DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */,
DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */,
DAE6C3D31CC34C9900DB3429 /* MGLOfflinePackTests.m in Sources */,
diff --git a/platform/osx/sdk/Mapbox.h b/platform/osx/sdk/Mapbox.h
index 49d5cab728..4fc2e129c2 100644
--- a/platform/osx/sdk/Mapbox.h
+++ b/platform/osx/sdk/Mapbox.h
@@ -9,6 +9,7 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[];
#import <Mapbox/MGLAccountManager.h>
#import <Mapbox/MGLAnnotation.h>
#import <Mapbox/MGLAnnotationImage.h>
+#import <Mapbox/MGLDirectionFormatter.h>
#import <Mapbox/MGLCoordinateFormatter.h>
#import <Mapbox/MGLGeometry.h>
#import <Mapbox/MGLMapCamera.h>