diff options
author | Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> | 2017-01-04 16:18:17 +0100 |
---|---|---|
committer | Fredrik Karlsson <bjorn.fredrik.karlsson@gmail.com> | 2017-01-27 19:41:13 +0100 |
commit | 2ab3af4b1b5dabf7087e6fabfb84617f4ff4b55d (patch) | |
tree | 179312c48bf929914acec1ad9eafcbb2d7d2bd4e | |
parent | 4d358260140c9d52103cc95631a8519b969bc408 (diff) | |
download | qtlocation-mapboxgl-2ab3af4b1b5dabf7087e6fabfb84617f4ff4b55d.tar.gz |
[ios, macos] added a distance formatter
-rw-r--r-- | platform/darwin/src/MGLDistanceFormatter.h | 26 | ||||
-rw-r--r-- | platform/darwin/src/MGLDistanceFormatter.m | 35 | ||||
-rw-r--r-- | platform/darwin/test/MGLDistanceFormatterTests.m | 30 | ||||
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/ios.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | platform/ios/jazzy.yml | 1 | ||||
-rw-r--r-- | platform/ios/src/Mapbox.h | 1 | ||||
-rw-r--r-- | platform/macos/jazzy.yml | 1 | ||||
-rw-r--r-- | platform/macos/macos.xcodeproj/project.pbxproj | 12 | ||||
-rw-r--r-- | platform/macos/src/Mapbox.h | 1 |
10 files changed, 122 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLDistanceFormatter.h b/platform/darwin/src/MGLDistanceFormatter.h new file mode 100644 index 0000000000..46aad9a940 --- /dev/null +++ b/platform/darwin/src/MGLDistanceFormatter.h @@ -0,0 +1,26 @@ +#import <Foundation/Foundation.h> +#import <CoreLocation/CoreLocation.h> + +#import "MGLFoundation.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + `MGLDistanceFormatter` implements a formatter object meant to be used for + geographic distances. The user’s current locale will be used by default + but it can be overriden by changing the locale property of the numberFormatter. + */ +MGL_EXPORT +@interface MGLDistanceFormatter : NSLengthFormatter + +/** + Returns a localized formatted string for the provided distance. + + @param distance The distance, measured in meters. + @return A localized formatted distance string including units. + */ +- (NSString *)stringFromDistance:(CLLocationDistance)distance; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLDistanceFormatter.m b/platform/darwin/src/MGLDistanceFormatter.m new file mode 100644 index 0000000000..e77e48b512 --- /dev/null +++ b/platform/darwin/src/MGLDistanceFormatter.m @@ -0,0 +1,35 @@ +#import "MGLDistanceFormatter.h" + +@interface MGLDistanceFormatter() +@end + +@implementation MGLDistanceFormatter + +static const CLLocationDistance METERS_PER_MILE = 1609.344; +static const double YARDS_PER_MILE = 1760.0; +static const double FEET_PER_MILE = YARDS_PER_MILE * 3.0; + +- (NSString *)stringFromDistance:(CLLocationDistance)distance { + double miles = distance / METERS_PER_MILE; + double feet = miles * FEET_PER_MILE; + + NSLengthFormatterUnit unit = NSLengthFormatterUnitMillimeter; + [self unitStringFromMeters:distance usedUnit:&unit]; + + self.numberFormatter.roundingIncrement = @0.25; + + if (unit == NSLengthFormatterUnitYard) { + if (miles > 0.2) { + unit = NSLengthFormatterUnitMile; + return [self stringFromValue:miles unit:unit]; + } else { + unit = NSLengthFormatterUnitFoot; + self.numberFormatter.roundingIncrement = @50; + return [self stringFromValue:feet unit:unit]; + } + } else { + return [self stringFromMeters:distance]; + } +} + +@end diff --git a/platform/darwin/test/MGLDistanceFormatterTests.m b/platform/darwin/test/MGLDistanceFormatterTests.m new file mode 100644 index 0000000000..f15ad9d313 --- /dev/null +++ b/platform/darwin/test/MGLDistanceFormatterTests.m @@ -0,0 +1,30 @@ +#import <Mapbox/Mapbox.h> +#import <XCTest/XCTest.h> + +@interface MGLDistanceFormatterTests : XCTestCase + +@end + +@implementation MGLDistanceFormatterTests + +- (void)testAbbreviatedMetricUnits { + MGLDistanceFormatter *formatter = [[MGLDistanceFormatter alloc] init]; + formatter.numberFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_CA"]; + for (CLLocationDistance distance=0; distance <= 10000; distance+=5) { + NSString *unit = [[formatter stringFromDistance:distance] componentsSeparatedByString:@" "][1]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF IN %@", @[@"mm", @"cm", @"m", @"km"]]; + XCTAssert([predicate evaluateWithObject:unit], @"Should only contain metric units"); + } +} + +- (void)testAbbreviatedImperialUnits { + MGLDistanceFormatter *formatter = [[MGLDistanceFormatter alloc] init]; + formatter.numberFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US"]; + for (CLLocationDistance distance=0; distance <= 10000; distance+=5) { + NSString *unit = [[formatter stringFromDistance:distance] componentsSeparatedByString:@" "][1]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF IN %@", @[@"ft", @"mi"]]; + XCTAssert([predicate evaluateWithObject:unit], @"Should only contain imperial units"); + } +} + +@end diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 81e6cf37c4..1140753ebb 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -27,6 +27,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue where translucent, non-view-backed point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832)) * Fixed flickering that occurred when panning past the antimeridian. ([#7574](https://github.com/mapbox/mapbox-gl-native/pull/7574)) * Fixed an issue that could prevent a cached style from appearing while the device is offline. ([#7770](https://github.com/mapbox/mapbox-gl-native/pull/7770)) +* Added `MGLDistanceFormatter` which can be used to format geographic distances. ([#7888](https://github.com/mapbox/mapbox-gl-native/pull/7888)) ## 3.4.1 diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 20110727b9..c5db2be7e0 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -74,6 +74,8 @@ 354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */; }; 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */; }; 354B839C1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = 354B839B1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m */; }; + 3557F7B01E1D27D300CCA5E6 /* MGLDistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3557F7AE1E1D27D300CCA5E6 /* MGLDistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3557F7B21E1D27D300CCA5E6 /* MGLDistanceFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3557F7AF1E1D27D300CCA5E6 /* MGLDistanceFormatter.m */; }; 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */; }; 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */; }; 3566C7661D4A77BA008152BC /* MGLShapeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 3566C7641D4A77BA008152BC /* MGLShapeSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -96,6 +98,7 @@ 357FE2DE1E02D2B20068B753 /* NSCoder+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 357FE2DB1E02D2B20068B753 /* NSCoder+MGLAdditions.h */; }; 357FE2DF1E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 357FE2DC1E02D2B20068B753 /* NSCoder+MGLAdditions.mm */; }; 357FE2E01E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 357FE2DC1E02D2B20068B753 /* NSCoder+MGLAdditions.mm */; }; + 3598544D1E1D38AA00B29F84 /* MGLDistanceFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3598544C1E1D38AA00B29F84 /* MGLDistanceFormatterTests.m */; }; 3599A3E61DF708BC00E77FB2 /* MGLStyleValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3599A3E51DF708BC00E77FB2 /* MGLStyleValueTests.m */; }; 359F57461D2FDDA6005217F1 /* MGLUserLocationAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 359F57451D2FDBD5005217F1 /* MGLUserLocationAnnotationView_Private.h */; }; 35B82BF81D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */; }; @@ -552,6 +555,8 @@ 354B83951D2E873E005D9406 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLUserLocationAnnotationView.m; sourceTree = "<group>"; }; 354B839A1D2E9B48005D9406 /* MBXUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBXUserLocationAnnotationView.h; sourceTree = "<group>"; }; 354B839B1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXUserLocationAnnotationView.m; sourceTree = "<group>"; }; + 3557F7AE1E1D27D300CCA5E6 /* MGLDistanceFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLDistanceFormatter.h; sourceTree = "<group>"; }; + 3557F7AF1E1D27D300CCA5E6 /* MGLDistanceFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLDistanceFormatter.m; sourceTree = "<group>"; }; 35599DEA1D46F14E0048254D /* MGLStyleValue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyleValue.mm; sourceTree = "<group>"; }; 3566C7641D4A77BA008152BC /* MGLShapeSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeSource.h; sourceTree = "<group>"; }; 3566C7651D4A77BA008152BC /* MGLShapeSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeSource.mm; sourceTree = "<group>"; }; @@ -567,6 +572,7 @@ 357F09091DF84F3800941873 /* MGLStyleValueTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLStyleValueTests.h; path = ../../darwin/test/MGLStyleValueTests.h; sourceTree = "<group>"; }; 357FE2DB1E02D2B20068B753 /* NSCoder+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSCoder+MGLAdditions.h"; path = "../../darwin/src/NSCoder+MGLAdditions.h"; sourceTree = "<group>"; }; 357FE2DC1E02D2B20068B753 /* NSCoder+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSCoder+MGLAdditions.mm"; path = "../../darwin/src/NSCoder+MGLAdditions.mm"; sourceTree = "<group>"; }; + 3598544C1E1D38AA00B29F84 /* MGLDistanceFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDistanceFormatterTests.m; path = ../../darwin/test/MGLDistanceFormatterTests.m; sourceTree = "<group>"; }; 3599A3E51DF708BC00E77FB2 /* MGLStyleValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLStyleValueTests.m; path = ../../darwin/test/MGLStyleValueTests.m; sourceTree = "<group>"; }; 359F57451D2FDBD5005217F1 /* MGLUserLocationAnnotationView_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationAnnotationView_Private.h; sourceTree = "<group>"; }; 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+MGLAdditions.h"; sourceTree = "<group>"; }; @@ -1099,6 +1105,7 @@ DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */, 6407D66F1E0085FD00F6A9C3 /* MGLDocumentationExampleTests.swift */, DD58A4C51D822BD000E1F038 /* MGLExpressionTests.mm */, + 3598544C1E1D38AA00B29F84 /* MGLDistanceFormatterTests.m */, DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */, DA2E885C1CC0382C00F24E7B /* MGLGeometryTests.mm */, 35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */, @@ -1316,6 +1323,8 @@ DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */, DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */, DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */, + 3557F7AE1E1D27D300CCA5E6 /* MGLDistanceFormatter.h */, + 3557F7AF1E1D27D300CCA5E6 /* MGLDistanceFormatter.m */, ); name = Formatters; sourceTree = "<group>"; @@ -1545,6 +1554,7 @@ DA8848851CBB033F00AB86E3 /* FABKitProtocol.h in Headers */, DA88481B1CBAFA6200AB86E3 /* MGLGeometry_Private.h in Headers */, 3510FFF91D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h in Headers */, + 3557F7B01E1D27D300CCA5E6 /* MGLDistanceFormatter.h in Headers */, DA72620B1DEEE3480043BB89 /* MGLOpenGLStyleLayer.h in Headers */, 404C26E71D89C55D000AA13D /* MGLTileSource_Private.h in Headers */, DA88485C1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.h in Headers */, @@ -1625,6 +1635,7 @@ 354B83971D2E873E005D9406 /* MGLUserLocationAnnotationView.h in Headers */, DAF0D8111DFE0EA000B28378 /* MGLRasterSource_Private.h in Headers */, DABFB86B1CBE99E500D62B32 /* MGLTilePyramidOfflineRegion.h in Headers */, + 3557F7B11E1D27D300CCA5E6 /* MGLDistanceFormatter.h in Headers */, 4018B1CB1CDC288E00F666AF /* MGLAnnotationView.h in Headers */, DABFB85F1CBE99E500D62B32 /* MGLGeometry.h in Headers */, 7E016D851D9E890300A29A21 /* MGLPolygon+MGLAdditions.h in Headers */, @@ -1961,6 +1972,7 @@ DA2E88611CC0382C00F24E7B /* MGLGeometryTests.mm in Sources */, 357579801D501E09000B822E /* MGLFillStyleLayerTests.mm in Sources */, 35D9DDE21DA25EEC00DAAD69 /* MGLCodingTests.m in Sources */, + 3598544D1E1D38AA00B29F84 /* MGLDistanceFormatterTests.m in Sources */, DA2E88641CC0382C00F24E7B /* MGLOfflineStorageTests.m in Sources */, DA2DBBCE1D51E80400D38FF9 /* MGLStyleLayerTests.m in Sources */, DA35A2C61CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */, @@ -2020,6 +2032,7 @@ 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, + 3557F7B21E1D27D300CCA5E6 /* MGLDistanceFormatter.m in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, DA8848281CBAFA6200AB86E3 /* MGLShape.mm in Sources */, @@ -2095,6 +2108,7 @@ DAA4E4251CBB730400178DFB /* MGLShape.mm in Sources */, 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */, + 3557F7B31E1D27D300CCA5E6 /* MGLDistanceFormatter.m in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, diff --git a/platform/ios/jazzy.yml b/platform/ios/jazzy.yml index 71f6be37f2..cea77adfab 100644 --- a/platform/ios/jazzy.yml +++ b/platform/ios/jazzy.yml @@ -115,3 +115,4 @@ custom_categories: - MGLClockDirectionFormatter - MGLCompassDirectionFormatter - MGLCoordinateFormatter + - MGLDistanceFormatter diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h index 37c649781e..2623777d8f 100644 --- a/platform/ios/src/Mapbox.h +++ b/platform/ios/src/Mapbox.h @@ -16,6 +16,7 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLClockDirectionFormatter.h" #import "MGLCompassDirectionFormatter.h" #import "MGLCoordinateFormatter.h" +#import "MGLDistanceFormatter.h" #import "MGLFeature.h" #import "MGLGeometry.h" #import "MGLMapCamera.h" diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml index 56f7255636..3d74fbc652 100644 --- a/platform/macos/jazzy.yml +++ b/platform/macos/jazzy.yml @@ -103,3 +103,4 @@ custom_categories: - MGLClockDirectionFormatter - MGLCompassDirectionFormatter - MGLCoordinateFormatter + - MGLDistanceFormatter diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index fc9e0c74e1..176667d211 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -42,6 +42,9 @@ 35C5D8481D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8441D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm */; }; 35C5D8491D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */; }; 35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */; }; + 35C6DF841E214C0400ACA483 /* MGLDistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 35C6DF851E214C0400ACA483 /* MGLDistanceFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */; }; + 35C6DF871E214C1800ACA483 /* MGLDistanceFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */; }; 35D65C5A1D65AD5500722C23 /* NSDate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */; }; 35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */; }; 4049C2A51DB6CE7F00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -291,6 +294,9 @@ 35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCompoundPredicate+MGLAdditions.h"; sourceTree = "<group>"; }; 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSCompoundPredicate+MGLAdditions.mm"; sourceTree = "<group>"; }; 35C5D84B1D6DD75B00E95907 /* MGLPredicateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLPredicateTests.mm; path = ../../darwin/test/MGLPredicateTests.mm; sourceTree = "<group>"; }; + 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLDistanceFormatter.h; sourceTree = "<group>"; }; + 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLDistanceFormatter.m; sourceTree = "<group>"; }; + 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDistanceFormatterTests.m; path = ../../darwin/test/MGLDistanceFormatterTests.m; sourceTree = "<group>"; }; 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+MGLAdditions.h"; sourceTree = "<group>"; }; 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+MGLAdditions.mm"; sourceTree = "<group>"; }; 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; }; @@ -757,6 +763,8 @@ DA35A2AC1CCA091800E826B2 /* MGLCompassDirectionFormatter.m */, DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */, DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */, + 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */, + 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */, ); name = Formatters; sourceTree = "<group>"; @@ -891,6 +899,7 @@ DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */, DA2987591E1A4290002299F5 /* MGLDocumentationExampleTests.swift */, DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */, + 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */, DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */, DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */, DAE7DEC31E24549F007505A6 /* MGLNSStringAdditionsTests.m */, @@ -1031,6 +1040,7 @@ DAE6C3651CC31E0400DB3429 /* MGLPolyline.h in Headers */, DAE6C39A1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.h in Headers */, DA8F258B1D51CA540010E6B5 /* MGLLineStyleLayer.h in Headers */, + 35C6DF841E214C0400ACA483 /* MGLDistanceFormatter.h in Headers */, DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */, 359819591E02F611008FC139 /* NSCoder+MGLAdditions.h in Headers */, DAE6C38E1CC31E2A00DB3429 /* MGLOfflineStorage_Private.h in Headers */, @@ -1293,6 +1303,7 @@ DA6408D81DA4E5DA00908C90 /* MGLVectorStyleLayer.m in Sources */, DA8F25B31D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */, DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */, + 35C6DF851E214C0400ACA483 /* MGLDistanceFormatter.m in Sources */, DAE6C39B1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m in Sources */, DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */, DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */, @@ -1326,6 +1337,7 @@ DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */, DAEDC4371D606291000224FF /* MGLAttributionButtonTests.m in Sources */, DA35A2B61CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */, + 35C6DF871E214C1800ACA483 /* MGLDistanceFormatterTests.m in Sources */, DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */, DA87A9A41DCACC5000810D09 /* MGLSymbolStyleLayerTests.mm in Sources */, DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */, diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h index 1f30497184..79ecfb21dc 100644 --- a/platform/macos/src/Mapbox.h +++ b/platform/macos/src/Mapbox.h @@ -14,6 +14,7 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLClockDirectionFormatter.h" #import "MGLCompassDirectionFormatter.h" #import "MGLCoordinateFormatter.h" +#import "MGLDistanceFormatter.h" #import "MGLFeature.h" #import "MGLGeometry.h" #import "MGLMapCamera.h" |