From 0a8858f2da4f637fbf8ae7d3f5ffe4640d3e0c80 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Fri, 7 Oct 2016 15:58:51 -0700 Subject: [PATCH] [ios, macos] Teach features and shapes about GeoJSON and mbgl types MGLShape subclasses can now return NSDictionaries that represent the shapes' GeoJSON geometries. MGLFeature classes can now return NSDictionaries that represent the features as GeoJSON features. This makes it trivial to serialize iOS and macOS shapes and features into GeoJSON. MGLFeature instances can also return a representation of themselves as an mbgl::Feature. This capability is used in a refactoring of the implementations of MGLGeoJSONSource to more efficiently transform MGLFeatures into mbgl::Features so they can be fed directly into mbgl::GeoJSONSource without having to round trip through NSJSONSerialization. The MGLFeature identifier is converted into the mbgl::identifier type based on the type of the identifier. The MGLFeature attributes are recursively converted into an mbgl::PropertyMap and each value is converted into one of the types that the PropertyMap's Value variant supports. --- platform/darwin/src/MGLFeature.h | 15 +- platform/darwin/src/MGLFeature.mm | 169 +++++++----------- platform/darwin/src/MGLFeature_Private.h | 25 +++ platform/darwin/src/MGLGeoJSONSource.mm | 23 +-- platform/darwin/src/MGLMultiPoint.h | 21 ++- platform/darwin/src/MGLMultiPoint.mm | 28 +++ platform/darwin/src/MGLMultiPoint_Private.h | 1 + ...ointAnnotation.m => MGLPointAnnotation.mm} | 18 ++ platform/darwin/src/MGLPolygon+MGLAdditions.h | 8 - platform/darwin/src/MGLPolygon+MGLAdditions.m | 16 +- platform/darwin/src/MGLPolygon.mm | 39 ++++ .../darwin/src/MGLPolyline+MGLAdditions.h | 8 - .../darwin/src/MGLPolyline+MGLAdditions.m | 15 +- platform/darwin/src/MGLPolyline.mm | 39 +++- .../darwin/src/{MGLShape.m => MGLShape.mm} | 0 platform/darwin/src/MGLShapeCollection.m | 14 ++ platform/darwin/src/MGLShape_Private.h | 17 ++ platform/darwin/src/NSArray+MGLAdditions.h | 9 + platform/darwin/src/NSArray+MGLAdditions.mm | 26 +++ .../darwin/src/NSDictionary+MGLAdditions.h | 13 ++ .../darwin/src/NSDictionary+MGLAdditions.mm | 24 +++ .../darwin/src/NSExpression+MGLAdditions.h | 2 +- .../darwin/src/NSExpression+MGLAdditions.mm | 26 +++ platform/darwin/test/MGLFeatureTests.mm | 165 +++++++++++++++++ platform/ios/app/MBXViewController.m | 35 ++-- platform/ios/ios.xcodeproj/project.pbxproj | 76 +++++--- platform/ios/test/MGLGeoJSONSourceTests.mm | 106 +++++++---- .../macos/macos.xcodeproj/project.pbxproj | 63 +++++-- 28 files changed, 749 insertions(+), 252 deletions(-) rename platform/darwin/src/{MGLPointAnnotation.m => MGLPointAnnotation.mm} (57%) rename platform/darwin/src/{MGLShape.m => MGLShape.mm} (100%) create mode 100644 platform/darwin/src/MGLShape_Private.h create mode 100644 platform/darwin/src/NSArray+MGLAdditions.h create mode 100644 platform/darwin/src/NSArray+MGLAdditions.mm create mode 100644 platform/darwin/src/NSDictionary+MGLAdditions.h create mode 100644 platform/darwin/src/NSDictionary+MGLAdditions.mm diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index d187e9cf0..239a338f6 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -83,10 +83,6 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, copy, readonly) NS_DICTIONARY_OF(NSString *, id) *attributes; - - -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary; - /** Returns the feature attribute for the given attribute name. @@ -95,6 +91,17 @@ NS_ASSUME_NONNULL_BEGIN */ - (nullable id)attributeForKey:(NSString *)key; +/** + Returns a dictionary that can be serialized as a GeoJSON Feature representation + of an instance of an `MGLFeature` subclass. + + The dictionary includes a `geometry` key corresponding to the receiver’s + underlying geometry data, a `properties` key corresponding to the receiver’s + `attributes` property, and an `id` key corresponding to the receiver’s + `identifier` property. + */ +- (NS_DICTIONARY_OF(NSString *, id) *)geoJSONDictionary; + @end /** diff --git a/platform/darwin/src/MGLFeature.mm b/platform/darwin/src/MGLFeature.mm index 142a5e7ae..84dcc4f0b 100644 --- a/platform/darwin/src/MGLFeature.mm +++ b/platform/darwin/src/MGLFeature.mm @@ -5,17 +5,16 @@ #import "MGLPolygon.h" #import "MGLValueEvaluator.h" +#import "MGLShape_Private.h" #import "MGLMultiPoint_Private.h" #import "MGLPolyline+MGLAdditions.h" #import "MGLPolygon+MGLAdditions.h" +#import "NSDictionary+MGLAdditions.h" + +#import "NSExpression+MGLAdditions.h" + #import - -@protocol MGLFeaturePrivate - -@property (nonatomic, copy, nullable, readwrite) id identifier; -@property (nonatomic, copy, readwrite) NS_DICTIONARY_OF(NSString *, id) *attributes; - -@end +#import @interface MGLPointFeature () @end @@ -29,15 +28,12 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"Point", - @"coordinates":@[@(self.coordinate.longitude), @(self.coordinate.latitude)] - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -49,20 +45,17 @@ @synthesize identifier; @synthesize attributes; -// - (id)attributeForKey:(NSString *)key { return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"LineString", - @"coordinates":self.mgl_coordinates - } - };; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -79,14 +72,12 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"Polygon", - @"coordinates":self.mgl_coordinates - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -103,21 +94,12 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - NSMutableArray *coordinates = [NSMutableArray array]; - - for (NSUInteger index = 0; index < self.pointCount; index++) { - CLLocationCoordinate2D coordinate = self.coordinates[index]; - [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; - } - - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"Multipoint", - @"coordinates":coordinates - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -134,19 +116,12 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - NSMutableArray *coordinates = [NSMutableArray array]; - for (MGLPolylineFeature *feature in self.polylines) { - [coordinates addObject:feature.mgl_coordinates]; - } - - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"MultiLineString", - @"coordinates":coordinates - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -163,19 +138,12 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - NSMutableArray *coordinates = [NSMutableArray array]; - for (MGLPolygonFeature *feature in self.polygons) { - [coordinates addObject:feature.mgl_coordinates]; - } - - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"MultiPolygon", - @"coordinates":coordinates - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); +} + +- (mbgl::Feature)mbglFeature { + return mbglFeature([self featureObject], identifier, self.attributes); } @end @@ -190,7 +158,7 @@ @dynamic shapes; -+ (instancetype)shapeCollectionWithShapes:(NS_ARRAY_OF(MGLShape *) *)shapes { ++ (instancetype)shapeCollectionWithShapes:(NSArray *)shapes { return [super shapeCollectionWithShapes:shapes]; } @@ -198,37 +166,18 @@ return self.attributes[key]; } -- (NS_DICTIONARY_OF(NSString *, id) *)featureDictionary { - - return @{@"type":@"Feature", - @"properties":(self.attributes) ? self.attributes : @{}, - @"geometry":@{ - @"type":@"GeometryCollection", - @"geometries":[self geometryCollection:self.shapes] - } - }; +- (NSDictionary *)geoJSONDictionary { + return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier); } -- (NS_MUTABLE_ARRAY_OF(NS_DICTIONARY_OF(NSString *, id) *) *)geometryCollection:(NS_ARRAY_OF(MGLShape *) *)shapes { - NSMutableArray *geometries = [NSMutableArray array]; - - for (MGLShape *shape in shapes) { - if ([shape isKindOfClass:[MGLShapeCollectionFeature class]]) { - [geometries addObject:@{@"type":@"GeometryCollection", - @"geometries":[self geometryCollection:((MGLShapeCollectionFeature *)shape).shapes]}]; - } else { - NSDictionary *geometry = shape.featureDictionary[@"geometry"]; - [geometries addObject:@{@"type":geometry[@"type"], - @"coordinates":geometry[@"coordinates"] }]; - } - } - - return geometries; +- (mbgl::Feature)mbglFeature { + [NSException raise:@"Method unavailable" format:@"%s is not available on %@.", __PRETTY_FUNCTION__, [self class]]; + mbgl::Polygon geometry; + return mbgl::Feature{geometry}; } + @end - - /** Transforms an `mbgl::geometry::geometry` type into an instance of the corresponding Objective-C geometry class. @@ -337,3 +286,21 @@ NS_ARRAY_OF(MGLShape *) *MGLFeaturesFromMBGLFeatures(const std::vec } return shapes; } + +mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *attributes) +{ + if (identifier) { + NSExpression *identifierExpression = [NSExpression expressionForConstantValue:identifier]; + feature.id = [identifierExpression mgl_featureIdentifier]; + } + feature.properties = [attributes mgl_propertyMap]; + return feature; +} + +NS_DICTIONARY_OF(NSString *, id) *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier) { + NSMutableDictionary *feature = [@{@"type": @"Feature", + @"properties": (attributes) ?: [NSNull null], + @"geometry": geometry} mutableCopy]; + feature[@"id"] = identifier; + return [feature copy]; +} diff --git a/platform/darwin/src/MGLFeature_Private.h b/platform/darwin/src/MGLFeature_Private.h index fbc7f8855..5fb82bde5 100644 --- a/platform/darwin/src/MGLFeature_Private.h +++ b/platform/darwin/src/MGLFeature_Private.h @@ -4,8 +4,33 @@ #import #import +NS_ASSUME_NONNULL_BEGIN + /** Returns an array of `MGLFeature` objects converted from the given vector of vector tile features. */ NS_ARRAY_OF(MGLShape *) *MGLFeaturesFromMBGLFeatures(const std::vector &features); + +/** + Takes an `mbgl::Feature` object, an identifer, and attributes dictionary and + returns the feature object with converted `mbgl::FeatureIdentifier` and + `mbgl::PropertyMap` properties. + */ +mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *attributes); + +/** + Returns an `NSDictionary` representation of an `MGLFeature`. + */ +NS_DICTIONARY_OF(NSString *, id) *NSDictionaryFeatureForGeometry(NSDictionary *geometry, NSDictionary *attributes, id identifier); + +@protocol MGLFeaturePrivate + +@property (nonatomic, copy, nullable, readwrite) id identifier; +@property (nonatomic, copy, readwrite) NS_DICTIONARY_OF(NSString *, id) *attributes; + +- (mbgl::Feature)mbglFeature; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLGeoJSONSource.mm b/platform/darwin/src/MGLGeoJSONSource.mm index 441778885..27f2eb8bd 100644 --- a/platform/darwin/src/MGLGeoJSONSource.mm +++ b/platform/darwin/src/MGLGeoJSONSource.mm @@ -115,23 +115,14 @@ NSString * const MGLGeoJSONToleranceOption = @"MGLGeoJSONOptionsClusterTolerance source->setGeoJSON(geojson); _features = MGLFeaturesFromMBGLFeatures(geojson); } else { - - NSMutableArray *featuresArray = [NSMutableArray array]; - for (id feature in self.features) { - [featuresArray addObject:[feature featureDictionary]]; + mbgl::FeatureCollection featureCollection; + featureCollection.reserve(self.features.count); + for (id feature in self.features) { + featureCollection.push_back([feature mbglFeature]); } - - NSDictionary *featureCollection = @{ - @"type":@"FeatureCollection", - @"features":featuresArray}; - - NSError *error; - NSData *featuresJSONData = [NSJSONSerialization dataWithJSONObject:featureCollection options:0 error:&error]; - - NSString *string = [[NSString alloc] initWithData:featuresJSONData encoding:NSUTF8StringEncoding]; - const auto geojson = mapbox::geojson::parse(string.UTF8String).get(); - source->setGeoJSON(geojson); - _features = MGLFeaturesFromMBGLFeatures(geojson); + const auto geojson = mbgl::GeoJSON{featureCollection}; + source->setGeoJSON(geojson); + _features = MGLFeaturesFromMBGLFeatures(featureCollection); } return std::move(source); diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h index 69c729584..b33d68f86 100644 --- a/platform/darwin/src/MGLMultiPoint.h +++ b/platform/darwin/src/MGLMultiPoint.h @@ -6,15 +6,24 @@ NS_ASSUME_NONNULL_BEGIN /** - The `MGLMultiPoint` class is an abstract superclass used to define shapes - composed of multiple points. You should not create instances of this class - directly. Instead, you should create instances of the `MGLPolyline` or - `MGLPolygon` classes. However, you can use the method and properties of this - class to access information about the specific points associated with the line - or polygon. + The `MGLMultiPoint` class is used to define shapes composed of multiple points. + This class is also the superclass of `MGLPolyline` and `MGLPolygon`. The + methods and properties of this class can be used to access information about + the specific points associated with a line or polygon. */ @interface MGLMultiPoint : MGLShape +/** + Creates and returns an `MGLMultiPoint` object from the specified set of + coordinates. + + @param coords The array of coordinates defining the shape. The data in this + array is copied to the new object. + @param count The number of items in the `coords` array. + @return A new multipoint object. + */ ++ (instancetype)multiPointWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; + /** The array of coordinates associated with the shape. diff --git a/platform/darwin/src/MGLMultiPoint.mm b/platform/darwin/src/MGLMultiPoint.mm index 17a61ed08..0090c5e35 100644 --- a/platform/darwin/src/MGLMultiPoint.mm +++ b/platform/darwin/src/MGLMultiPoint.mm @@ -18,6 +18,11 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) MGLCoordinateBounds _bounds; } ++ (instancetype)multiPointWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count +{ + return [[self alloc] initWithCoordinates:coords count:count]; +} + - (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count { self = [super init]; @@ -141,6 +146,29 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) return mbgl::SymbolAnnotation({mbgl::Point()}); } +- (mbgl::Feature)featureObject +{ + mbgl::MultiPoint multiPoint; + multiPoint.reserve(self.pointCount); + for (NSInteger i = 0; i< self.pointCount; i++) + { + multiPoint.push_back(mbgl::Point(self.coordinates[i].longitude, self.coordinates[i].latitude)); + } + return mbgl::Feature {multiPoint}; +} + +- (NSDictionary *)geoJSONDictionary +{ + NSMutableArray *coordinates = [[NSMutableArray alloc] initWithCapacity:self.pointCount]; + for (NSUInteger index = 0; index < self.pointCount; index++) { + CLLocationCoordinate2D coordinate = self.coordinates[index]; + [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; + } + + return @{@"type": @"MultiPoint", + @"coordinates": coordinates}; +} + - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; count = %lu; bounds = %@>", diff --git a/platform/darwin/src/MGLMultiPoint_Private.h b/platform/darwin/src/MGLMultiPoint_Private.h index dc3917272..7bc3cae58 100644 --- a/platform/darwin/src/MGLMultiPoint_Private.h +++ b/platform/darwin/src/MGLMultiPoint_Private.h @@ -3,6 +3,7 @@ #import "MGLGeometry.h" #import +#import #import #import diff --git a/platform/darwin/src/MGLPointAnnotation.m b/platform/darwin/src/MGLPointAnnotation.mm similarity index 57% rename from platform/darwin/src/MGLPointAnnotation.m rename to platform/darwin/src/MGLPointAnnotation.mm index 9495a2c6f..ce8e4a235 100644 --- a/platform/darwin/src/MGLPointAnnotation.m +++ b/platform/darwin/src/MGLPointAnnotation.mm @@ -1,5 +1,10 @@ #import "MGLPointAnnotation.h" +#import "MGLShape_Private.h" + +#import + + @implementation MGLPointAnnotation @synthesize coordinate; @@ -13,4 +18,17 @@ coordinate.latitude, coordinate.longitude]; } +- (NSDictionary *)geoJSONDictionary +{ + return @{@"type": @"Point", + @"coordinates": @[@(self.coordinate.longitude), @(self.coordinate.latitude)]}; +} + +- (mbgl::Feature)featureObject +{ + mbgl::Point point = { self.coordinate.longitude, self.coordinate.latitude }; + return mbgl::Feature {point}; +} + @end + diff --git a/platform/darwin/src/MGLPolygon+MGLAdditions.h b/platform/darwin/src/MGLPolygon+MGLAdditions.h index c9ef95b6b..f409fb96c 100644 --- a/platform/darwin/src/MGLPolygon+MGLAdditions.h +++ b/platform/darwin/src/MGLPolygon+MGLAdditions.h @@ -1,11 +1,3 @@ -// -// MGLPolygonFeature+MGLAdditions.h -// ios -// -// Created by Mapbox on 9/30/16. -// Copyright © 2016 Mapbox. All rights reserved. -// - #import @interface MGLPolygon (MGLAdditions) diff --git a/platform/darwin/src/MGLPolygon+MGLAdditions.m b/platform/darwin/src/MGLPolygon+MGLAdditions.m index 74fb5668d..def468701 100644 --- a/platform/darwin/src/MGLPolygon+MGLAdditions.m +++ b/platform/darwin/src/MGLPolygon+MGLAdditions.m @@ -1,19 +1,11 @@ -// -// MGLPolygonFeature+MGLAdditions.m -// ios -// -// Created by Mapbox on 9/30/16. -// Copyright © 2016 Mapbox. All rights reserved. -// - #import "MGLPolygon+MGLAdditions.h" @implementation MGLPolygon (MGLAdditions) - (NS_ARRAY_OF(id) *)mgl_coordinates { - NS_MUTABLE_ARRAY_OF(NS_MUTABLE_ARRAY_OF(NS_ARRAY_OF(NSNumber *) *) *) *coordinates = [NSMutableArray array]; + NSMutableArray *coordinates = [NSMutableArray array]; - NS_MUTABLE_ARRAY_OF(NS_ARRAY_OF(NSNumber *) *) *exteriorRing = [NSMutableArray array]; + NSMutableArray *exteriorRing = [NSMutableArray array]; for (NSUInteger index = 0; index < self.pointCount; index++) { CLLocationCoordinate2D coordinate = self.coordinates[index]; [exteriorRing addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; @@ -21,7 +13,7 @@ [coordinates addObject:exteriorRing]; for (MGLPolygon *interiorPolygon in self.interiorPolygons) { - NS_MUTABLE_ARRAY_OF(NS_ARRAY_OF(NSNumber *) *) *interiorRing = [NSMutableArray array]; + NSMutableArray *interiorRing = [NSMutableArray array]; for (int index = 0; index < interiorPolygon.pointCount; index++) { CLLocationCoordinate2D coordinate = interiorPolygon.coordinates[index]; [interiorRing addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; @@ -29,7 +21,7 @@ [coordinates addObject:interiorRing]; } - return coordinates; + return [coordinates copy]; } @end diff --git a/platform/darwin/src/MGLPolygon.mm b/platform/darwin/src/MGLPolygon.mm index b8f02b640..eae2cfe75 100644 --- a/platform/darwin/src/MGLPolygon.mm +++ b/platform/darwin/src/MGLPolygon.mm @@ -3,6 +3,8 @@ #import "MGLMultiPoint_Private.h" #import "MGLGeometry_Private.h" +#import "MGLPolygon+MGLAdditions.h" + @implementation MGLPolygon @dynamic overlayBounds; @@ -36,6 +38,15 @@ return result; } +- (mbgl::Feature)featureObject { + mbgl::Polygon geometry; + geometry.push_back(self.ring); + for (MGLPolygon *polygon in self.interiorPolygons) { + geometry.push_back(polygon.ring); + } + return mbgl::Feature{geometry}; +} + - (mbgl::Annotation)annotationObjectWithDelegate:(id )delegate { mbgl::Polygon geometry; geometry.push_back(self.ring); @@ -51,6 +62,11 @@ return annotation; } +- (NSDictionary *)geoJSONDictionary { + return @{@"type": @"Polygon", + @"coordinates": self.mgl_coordinates}; +} + @end @interface MGLMultiPolygon () @@ -87,4 +103,27 @@ return MGLLatLngBoundsFromCoordinateBounds(_overlayBounds).intersects(MGLLatLngBoundsFromCoordinateBounds(overlayBounds)); } +- (mbgl::Feature)featureObject { + mbgl::MultiPolygon multiPolygon; + multiPolygon.reserve(self.polygons.count); + for (MGLPolygon *polygon in self.polygons) { + mbgl::Polygon geometry; + geometry.push_back(polygon.ring); + for (MGLPolygon *interiorPolygon in polygon.interiorPolygons) { + geometry.push_back(interiorPolygon.ring); + } + multiPolygon.push_back(geometry); + } + return mbgl::Feature {multiPolygon}; +} + +- (NSDictionary *)geoJSONDictionary { + NSMutableArray *coordinates = [[NSMutableArray alloc] initWithCapacity:self.polygons.count]; + for (MGLPolygonFeature *feature in self.polygons) { + [coordinates addObject: feature.mgl_coordinates]; + } + return @{@"type": @"MultiPolygon", + @"coordinates": coordinates}; +} + @end diff --git a/platform/darwin/src/MGLPolyline+MGLAdditions.h b/platform/darwin/src/MGLPolyline+MGLAdditions.h index e1e24a8eb..4cdbbf17f 100644 --- a/platform/darwin/src/MGLPolyline+MGLAdditions.h +++ b/platform/darwin/src/MGLPolyline+MGLAdditions.h @@ -1,11 +1,3 @@ -// -// MGLPolyline+MGLPolyline_MGLAdditions.h -// ios -// -// Created by Mapbox on 9/30/16. -// Copyright © 2016 Mapbox. All rights reserved. -// - #import @interface MGLPolyline (MGLAdditions) diff --git a/platform/darwin/src/MGLPolyline+MGLAdditions.m b/platform/darwin/src/MGLPolyline+MGLAdditions.m index e91e4fc19..d1db2c58a 100644 --- a/platform/darwin/src/MGLPolyline+MGLAdditions.m +++ b/platform/darwin/src/MGLPolyline+MGLAdditions.m @@ -1,25 +1,14 @@ -// -// MGLPolyline+MGLPolyline_MGLAdditions.m -// ios -// -// Created by Mapbox on 9/30/16. -// Copyright © 2016 Mapbox. All rights reserved. -// - #import "MGLPolyline+MGLAdditions.h" @implementation MGLPolyline (MGLAdditions) - (NS_ARRAY_OF(id) *)mgl_coordinates { - - NS_MUTABLE_ARRAY_OF(NS_ARRAY_OF(NSNumber *) *) *coordinates = [NSMutableArray array]; - + NSMutableArray *coordinates = [[NSMutableArray alloc] initWithCapacity:self.pointCount]; for (NSUInteger index = 0; index < self.pointCount; index++) { CLLocationCoordinate2D coordinate = self.coordinates[index]; [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; } - - return coordinates; + return [coordinates copy]; } @end diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index b81147a3b..dd2fccf53 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -3,6 +3,8 @@ #import "MGLMultiPoint_Private.h" #import "MGLGeometry_Private.h" +#import "MGLPolyline+MGLAdditions.h" + @implementation MGLPolyline @dynamic overlayBounds; @@ -13,17 +15,21 @@ return [[self alloc] initWithCoordinates:coords count:count]; } -- (mbgl::Annotation)annotationObjectWithDelegate:(id )delegate { +- (mbgl::LineString)lineString { NSUInteger count = self.pointCount; CLLocationCoordinate2D *coordinates = self.coordinates; - + mbgl::LineString geometry; geometry.reserve(self.pointCount); for (NSUInteger i = 0; i < count; i++) { geometry.push_back(mbgl::Point(coordinates[i].longitude, coordinates[i].latitude)); } + + return geometry; +} - mbgl::LineAnnotation annotation { geometry }; +- (mbgl::Annotation)annotationObjectWithDelegate:(id )delegate { + mbgl::LineAnnotation annotation { [self lineString] }; annotation.opacity = { static_cast([delegate alphaForShapeAnnotation:self]) }; annotation.color = { [delegate strokeColorForShapeAnnotation:self] }; annotation.width = { static_cast([delegate lineWidthForPolylineAnnotation:self]) }; @@ -31,6 +37,15 @@ return annotation; } +- (mbgl::Feature)featureObject { + return mbgl::Feature {[self lineString]}; +} + +- (NSDictionary *)geoJSONDictionary { + return @{@"type": @"LineString", + @"coordinates": self.mgl_coordinates}; +} + @end @interface MGLMultiPolyline () @@ -67,4 +82,22 @@ return MGLLatLngBoundsFromCoordinateBounds(_overlayBounds).intersects(MGLLatLngBoundsFromCoordinateBounds(overlayBounds)); } +- (mbgl::Feature)featureObject { + mbgl::MultiLineString multiLineString; + multiLineString.reserve(self.polylines.count); + for (MGLPolyline *polyline in self.polylines) { + multiLineString.push_back([polyline lineString]); + } + return mbgl::Feature {multiLineString}; +} + +- (NSDictionary *)geoJSONDictionary { + NSMutableArray *coordinates = [NSMutableArray array]; + for (MGLPolylineFeature *feature in self.polylines) { + [coordinates addObject: feature.mgl_coordinates]; + } + return @{@"type": @"MultiLineString", + @"coordinates": coordinates}; +} + @end diff --git a/platform/darwin/src/MGLShape.m b/platform/darwin/src/MGLShape.mm similarity index 100% rename from platform/darwin/src/MGLShape.m rename to platform/darwin/src/MGLShape.mm diff --git a/platform/darwin/src/MGLShapeCollection.m b/platform/darwin/src/MGLShapeCollection.m index 5d42b5a51..0f011bfd2 100644 --- a/platform/darwin/src/MGLShapeCollection.m +++ b/platform/darwin/src/MGLShapeCollection.m @@ -18,4 +18,18 @@ return _shapes.firstObject.coordinate; } +- (NSDictionary *)geoJSONDictionary { + return @{@"type": @"GeometryCollection", + @"geometries": [self geometryCollection]}; +} + +- (NSArray *)geometryCollection { + NSMutableArray *geometries = [[NSMutableArray alloc] initWithCapacity:self.shapes.count]; + for (id shape in self.shapes) { + NSDictionary *geometry = [shape geoJSONDictionary]; + [geometries addObject:geometry]; + } + return [geometries copy]; +} + @end diff --git a/platform/darwin/src/MGLShape_Private.h b/platform/darwin/src/MGLShape_Private.h new file mode 100644 index 000000000..a8ee12c20 --- /dev/null +++ b/platform/darwin/src/MGLShape_Private.h @@ -0,0 +1,17 @@ +#import "MGLShape.h" + +#import + +@interface MGLShape (Private) + +/** + Returns an `mbgl::Feature` representation of the `MGLShape`. + */ +- (mbgl::Feature)featureObject; + +/** + Returns a dictionary with the GeoJSON geometry member object. + */ +- (NSDictionary *)geoJSONDictionary; + +@end diff --git a/platform/darwin/src/NSArray+MGLAdditions.h b/platform/darwin/src/NSArray+MGLAdditions.h new file mode 100644 index 000000000..6871f1548 --- /dev/null +++ b/platform/darwin/src/NSArray+MGLAdditions.h @@ -0,0 +1,9 @@ +#import + +#import + +@interface NSArray (MGLAdditions) + +- (std::vector)mgl_vector; + +@end diff --git a/platform/darwin/src/NSArray+MGLAdditions.mm b/platform/darwin/src/NSArray+MGLAdditions.mm new file mode 100644 index 000000000..976eda704 --- /dev/null +++ b/platform/darwin/src/NSArray+MGLAdditions.mm @@ -0,0 +1,26 @@ +#import "NSArray+MGLAdditions.h" + +#import "NSDictionary+MGLAdditions.h" +#import "NSExpression+MGLAdditions.mm" + +@implementation NSArray (MGLAdditions) + +- (std::vector)mgl_vector { + std::vector vector; + vector.reserve(self.count); + for (id value in self) { + if ([value isKindOfClass:[NSArray class]]) { + std::vector innerVector = [value mgl_vector]; + vector.push_back(innerVector); + } else if ([value isKindOfClass:[NSDictionary class]]) { + mbgl::PropertyMap propertyMap = [value mgl_propertyMap]; + vector.push_back(propertyMap); + } else { + NSExpression *expression = [NSExpression expressionForConstantValue:value]; + vector.push_back([expression mgl_filterValue]); + } + } + return vector; +} + +@end diff --git a/platform/darwin/src/NSDictionary+MGLAdditions.h b/platform/darwin/src/NSDictionary+MGLAdditions.h new file mode 100644 index 000000000..556f21992 --- /dev/null +++ b/platform/darwin/src/NSDictionary+MGLAdditions.h @@ -0,0 +1,13 @@ +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSDictionary (MGLAdditions) + +- (mbgl::PropertyMap)mgl_propertyMap; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/NSDictionary+MGLAdditions.mm b/platform/darwin/src/NSDictionary+MGLAdditions.mm new file mode 100644 index 000000000..1023e91a4 --- /dev/null +++ b/platform/darwin/src/NSDictionary+MGLAdditions.mm @@ -0,0 +1,24 @@ +#import "NSDictionary+MGLAdditions.h" + +#import "NSExpression+MGLAdditions.mm" +#import "NSArray+MGLAdditions.h" + +@implementation NSDictionary (MGLAdditions) + +- (mbgl::PropertyMap)mgl_propertyMap { + mbgl::PropertyMap propertyMap; + for (NSString *key in self.allKeys) { + if ([self[key] isKindOfClass:[NSDictionary class]]) { + propertyMap[[key UTF8String]] = [self[key] mgl_propertyMap]; + } else if ([self[key] isKindOfClass:[NSArray class]]) { + NSArray *array = self[key]; + propertyMap[[key UTF8String]] = [array mgl_vector]; + } else { + NSExpression *expression = [NSExpression expressionForConstantValue:self[key]]; + propertyMap[[key UTF8String]] = [expression mgl_filterValue]; + } + } + return propertyMap; +} + +@end diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h index 4e8c5ee07..6d0fff576 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.h +++ b/platform/darwin/src/NSExpression+MGLAdditions.h @@ -5,7 +5,7 @@ @interface NSExpression (MGLAdditions) - (mbgl::Value)mgl_filterValue; - - (std::vector)mgl_filterValues; +- (mbgl::FeatureIdentifier)mgl_featureIdentifier; @end diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index 52a0b9bd8..392a6d7f5 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -61,4 +61,30 @@ return { }; } +- (mbgl::FeatureIdentifier)mgl_featureIdentifier +{ + id value = self.constantValue; + mbgl::Value mbglValue = [self mgl_filterValue]; + + if ([value isKindOfClass:NSString.class]) { + return mbglValue.get(); + } else if ([value isKindOfClass:NSNumber.class]) { + NSNumber *number = (NSNumber *)value; + if ((strcmp([number objCType], @encode(char)) == 0) || + (strcmp([number objCType], @encode(BOOL)) == 0)) { + return mbglValue.get(); + } else if ( strcmp([number objCType], @encode(double)) == 0 || + strcmp([number objCType], @encode(float)) == 0) { + return mbglValue.get(); + } else if ([number compare:@(0)] == NSOrderedDescending || + [number compare:@(0)] == NSOrderedSame) { + return mbglValue.get(); + } else if ([number compare:@(0)] == NSOrderedAscending) { + return mbglValue.get(); + } + } + + return {}; +} + @end diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm index 1b1722f17..18c3fd16c 100644 --- a/platform/darwin/test/MGLFeatureTests.mm +++ b/platform/darwin/test/MGLFeatureTests.mm @@ -158,4 +158,169 @@ XCTAssertEqual(string, shape.attributes[@"string"]); } +- (void)testPointFeatureGeoJSONDictionary { + MGLPointFeature *pointFeature = (MGLPointFeature *)[[MGLPointFeature alloc] init]; + CLLocationCoordinate2D coordinate = { 10, 10 }; + pointFeature.coordinate = coordinate; + + // A GeoJSON feature + // when there are no identifier or properties + NSDictionary *geoJSONFeature = [pointFeature geoJSONDictionary]; + + // it has the correct type + XCTAssertEqualObjects(geoJSONFeature[@"type"], @"Feature"); + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"Point", + @"coordinates": @[@(coordinate.longitude), @(coordinate.latitude)]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); + // it has no "id" key (or value) + XCTAssertNil(geoJSONFeature[@"id"]); + // it has a null representation of the properties object + XCTAssertEqualObjects(geoJSONFeature[@"properties"], [NSNull null]); + + // when there is a string identifier + pointFeature.identifier = @"string-id"; + + // it has the identifier in the result + geoJSONFeature = [pointFeature geoJSONDictionary]; + XCTAssertEqualObjects(geoJSONFeature[@"id"], pointFeature.identifier); + + // when there are properties + pointFeature.attributes = @{@"name": @"name-value"}; + + // it has the properties value in the result + geoJSONFeature = [pointFeature geoJSONDictionary]; + XCTAssertEqualObjects(geoJSONFeature[@"properties"], pointFeature.attributes); +} + +- (void)testPolylineFeatureGeoJSONDictionary { + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coords[] = { coord1, coord2 }; + MGLPolylineFeature *polyLineFeature = [MGLPolylineFeature polylineWithCoordinates:coords count:2]; + + // A GeoJSON feature + NSDictionary *geoJSONFeature = [polyLineFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"LineString", + @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)]]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + +- (void)testPolygonFeatureGeoJSONDictionary { + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coord3 = { 0, 0 }; + CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; + MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coords count:3]; + + // A GeoJSON feature + NSDictionary *geoJSONFeature = [polygonFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"Polygon", + @"coordinates": @[@[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]]]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + +- (void)testMultiPointFeatureGeoJSONDictionary { + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coord3 = { 0, 0 }; + CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; + MGLMultiPointFeature *multiPointFeature = [MGLMultiPointFeature multiPointWithCoordinates:coords count:3]; + + // A GeoJSON feature + NSDictionary *geoJSONFeature = [multiPointFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"MultiPoint", + @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + +- (void)testMultiPolylineFeatureGeoJSONDictionary { + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coord3 = { 0, 0 }; + CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; + + MGLPolyline *polyLine1 = [MGLPolyline polylineWithCoordinates:coords count:3]; + MGLPolyline *polyLine2 = [MGLPolyline polylineWithCoordinates:coords count:3]; + + MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[polyLine1, polyLine2]]; + + // A GeoJSON feature + NSDictionary *geoJSONFeature = [multiPolylineFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"MultiLineString", + @"coordinates": @[@[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]], + @[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]]]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + +- (void)testMultiPolygonFeatureGeoJSONDictionary { + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coord3 = { 0, 0 }; + CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; + + MGLPolygon *polygon1 = [MGLPolygon polygonWithCoordinates:coords count:3]; + MGLPolygon *polygon2 = [MGLPolygon polygonWithCoordinates:coords count:3]; + + MGLMultiPolygonFeature *multiPolylineFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[polygon1, polygon2]]; + + // A GeoJSON feature + NSDictionary *geoJSONFeature = [multiPolylineFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"MultiPolygon", + @"coordinates": @[ + @[@[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]]], + @[@[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)], + @[@(coord3.longitude), @(coord3.latitude)]]]]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + +- (void)testShapeCollectionFeatureGeoJSONDictionary { + MGLPointAnnotation *pointFeature = [[MGLPointAnnotation alloc] init]; + CLLocationCoordinate2D pointCoordinate = { 10, 10 }; + pointFeature.coordinate = pointCoordinate; + + CLLocationCoordinate2D coord1 = { 0, 0 }; + CLLocationCoordinate2D coord2 = { 10, 10 }; + CLLocationCoordinate2D coords[] = { coord1, coord2 }; + MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coords count:2]; + + MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature, + polyline]]; + // A GeoJSON feature + NSDictionary *geoJSONFeature = [shapeCollectionFeature geoJSONDictionary]; + + // it has the correct geometry + NSDictionary *expectedGeometry = @{@"type": @"GeometryCollection", + @"geometries": @[ + @{@"type": @"Point", + @"coordinates": @[@(pointCoordinate.longitude), @(pointCoordinate.latitude)]}, + @{@"type": @"LineString", + @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], + @[@(coord2.longitude), @(coord2.latitude)]]} + ]}; + XCTAssertEqualObjects(geoJSONFeature[@"geometry"], expectedGeometry); +} + @end diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 3ee405fd0..0f62e65ce 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -796,19 +796,32 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { CGRect queryRect = CGRectInset(self.mapView.bounds, 100, 200); NSArray *features = [self.mapView visibleFeaturesInRect:queryRect]; -// NSMutableArray *polygonFeatures = [NSMutableArray array]; -// for (id feature in features) { -// if ([feature isMemberOfClass:[MGLPolygonFeature class]]) { -// [polygonFeatures addObject:feature]; -// } -// } + NSString *querySourceID = @"query-source-id"; + NSString *queryLayerID = @"query-layer-id"; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"query-id" features:features options:nil]; - [self.mapView.style addSource:source]; + // RTE if you don't remove the layer first + // RTE if you pass a nill layer to remove layer + MGLStyleLayer *layer = [self.mapView.style layerWithIdentifier:queryLayerID]; + if (layer) { + [self.mapView.style removeLayer:layer]; + } - MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"query-layer-id" source:source]; - fillLayer.fillColor = [UIColor blueColor]; - [self.mapView.style addLayer:fillLayer]; + // RTE if you pass a nill source to remove source + MGLSource *source = [self.mapView.style sourceWithIdentifier:querySourceID]; + if (source) { + [self.mapView.style removeSource:source]; + } + + + dispatch_async(dispatch_get_main_queue(), ^{ + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:querySourceID features:features options:nil]; + [self.mapView.style addSource:source]; + + MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:source]; + fillLayer.fillColor = [UIColor blueColor]; + fillLayer.fillOpacity = @(0.5); + [self.mapView.style addLayer:fillLayer]; + }); } - (IBAction)startWorldTour diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 9b5a405f3..c1190c7c1 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -157,6 +157,9 @@ 35E79F201D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 35E79F211D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 36F1153D1D46080700878E1A /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F1153B1D46080700878E1A /* libmbgl-core.a */; }; + 400533011DB0862B0069F638 /* NSArray+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 400532FF1DB0862B0069F638 /* NSArray+MGLAdditions.h */; }; + 400533021DB0862B0069F638 /* NSArray+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */; }; + 400533031DB086490069F638 /* NSArray+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */; }; 4018B1C71CDC287F00F666AF /* MGLAnnotationView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */; }; 4018B1C81CDC287F00F666AF /* MGLAnnotationView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */; }; 4018B1C91CDC288A00F666AF /* MGLAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */; }; @@ -170,6 +173,10 @@ 404C26E71D89C55D000AA13D /* MGLTileSet_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404C26E61D89C515000AA13D /* MGLTileSet_Private.h */; }; 404C26E81D89C55D000AA13D /* MGLTileSet_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404C26E61D89C515000AA13D /* MGLTileSet_Private.h */; }; 4085AF091D933DEA00F11B22 /* MGLTileSetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4085AF081D933DEA00F11B22 /* MGLTileSetTests.mm */; }; + 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */; }; + 408AA8581DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; + 408AA8591DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */; }; + 40CF6DBB1DAC3C6600A4D18B /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */; }; 40CFA6511D7875BB008103BD /* MGLGeoJSONSourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 40CFA6501D787579008103BD /* MGLGeoJSONSourceTests.mm */; }; 40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */; }; 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */; }; @@ -268,10 +275,10 @@ DA8848221CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848081CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h */; }; DA8848231CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848091CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h */; }; DA8848241CBAFA6200AB86E3 /* MGLOfflineStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480A1CBAFA6200AB86E3 /* MGLOfflineStorage.mm */; }; - DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */; }; + DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.mm */; }; DA8848261CBAFA6200AB86E3 /* MGLPolygon.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */; }; DA8848271CBAFA6200AB86E3 /* MGLPolyline.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */; }; - DA8848281CBAFA6200AB86E3 /* MGLShape.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88480E1CBAFA6200AB86E3 /* MGLShape.m */; }; + DA8848281CBAFA6200AB86E3 /* MGLShape.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480E1CBAFA6200AB86E3 /* MGLShape.mm */; }; DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480F1CBAFA6200AB86E3 /* MGLStyle.mm */; }; DA88482A1CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8848101CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm */; }; DA88482B1CBAFA6200AB86E3 /* MGLTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848111CBAFA6200AB86E3 /* MGLTypes.m */; }; @@ -356,10 +363,10 @@ DAA4E41F1CBB730400178DFB /* MGLMultiPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8848051CBAFA6200AB86E3 /* MGLMultiPoint.mm */; }; DAA4E4201CBB730400178DFB /* MGLOfflinePack.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8848071CBAFA6200AB86E3 /* MGLOfflinePack.mm */; }; DAA4E4211CBB730400178DFB /* MGLOfflineStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480A1CBAFA6200AB86E3 /* MGLOfflineStorage.mm */; }; - DAA4E4221CBB730400178DFB /* MGLPointAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */; }; + DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.mm */; }; DAA4E4231CBB730400178DFB /* MGLPolygon.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */; }; DAA4E4241CBB730400178DFB /* MGLPolyline.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */; }; - DAA4E4251CBB730400178DFB /* MGLShape.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88480E1CBAFA6200AB86E3 /* MGLShape.m */; }; + DAA4E4251CBB730400178DFB /* MGLShape.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480E1CBAFA6200AB86E3 /* MGLShape.mm */; }; DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA88480F1CBAFA6200AB86E3 /* MGLStyle.mm */; }; DAA4E4271CBB730400178DFB /* MGLTilePyramidOfflineRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA8848101CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm */; }; DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8848111CBAFA6200AB86E3 /* MGLTypes.m */; }; @@ -591,6 +598,8 @@ 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleLayer_Private.h; sourceTree = ""; }; 36F1153B1D46080700878E1A /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-core.a"; path = "build/Debug-iphoneos/libmbgl-core.a"; sourceTree = ""; }; 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-platform-ios.a"; path = "build/Debug-iphoneos/libmbgl-platform-ios.a"; sourceTree = ""; }; + 400532FF1DB0862B0069F638 /* NSArray+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLAdditions.h"; sourceTree = ""; }; + 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+MGLAdditions.mm"; sourceTree = ""; }; 4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView_Private.h; sourceTree = ""; }; 4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAnnotationView.mm; sourceTree = ""; }; 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView.h; sourceTree = ""; }; @@ -600,6 +609,9 @@ 404C26E11D89B877000AA13D /* MGLTileSet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTileSet.mm; sourceTree = ""; }; 404C26E61D89C515000AA13D /* MGLTileSet_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLTileSet_Private.h; sourceTree = ""; }; 4085AF081D933DEA00F11B22 /* MGLTileSetTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTileSetTests.mm; sourceTree = ""; }; + 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MGLAdditions.h"; sourceTree = ""; }; + 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDictionary+MGLAdditions.mm"; sourceTree = ""; }; + 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLShape_Private.h; sourceTree = ""; }; 40CFA6501D787579008103BD /* MGLGeoJSONSourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLGeoJSONSourceTests.mm; sourceTree = ""; }; 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationContainerView.h; sourceTree = ""; }; 40EDA1BE1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAnnotationContainerView.m; sourceTree = ""; }; @@ -692,10 +704,10 @@ DA8848081CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineRegion_Private.h; sourceTree = ""; }; DA8848091CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineStorage_Private.h; sourceTree = ""; }; DA88480A1CBAFA6200AB86E3 /* MGLOfflineStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOfflineStorage.mm; sourceTree = ""; }; - DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLPointAnnotation.m; sourceTree = ""; }; + DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointAnnotation.mm; sourceTree = ""; }; DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolygon.mm; sourceTree = ""; }; DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolyline.mm; sourceTree = ""; }; - DA88480E1CBAFA6200AB86E3 /* MGLShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLShape.m; sourceTree = ""; }; + DA88480E1CBAFA6200AB86E3 /* MGLShape.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShape.mm; sourceTree = ""; }; DA88480F1CBAFA6200AB86E3 /* MGLStyle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyle.mm; sourceTree = ""; }; DA8848101CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTilePyramidOfflineRegion.mm; sourceTree = ""; }; DA8848111CBAFA6200AB86E3 /* MGLTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLTypes.m; sourceTree = ""; }; @@ -1311,13 +1323,14 @@ DA8848051CBAFA6200AB86E3 /* MGLMultiPoint.mm */, DA8847E71CBAFA5100AB86E3 /* MGLOverlay.h */, DA8847E81CBAFA5100AB86E3 /* MGLPointAnnotation.h */, - DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.m */, + DA88480B1CBAFA6200AB86E3 /* MGLPointAnnotation.mm */, DA8847E91CBAFA5100AB86E3 /* MGLPolygon.h */, DA88480C1CBAFA6200AB86E3 /* MGLPolygon.mm */, DA8847EA1CBAFA5100AB86E3 /* MGLPolyline.h */, DA88480D1CBAFA6200AB86E3 /* MGLPolyline.mm */, DA8847EB1CBAFA5100AB86E3 /* MGLShape.h */, - DA88480E1CBAFA6200AB86E3 /* MGLShape.m */, + 40CF6DBA1DAC3C1800A4D18B /* MGLShape_Private.h */, + DA88480E1CBAFA6200AB86E3 /* MGLShape.mm */, DAD165761CF4CDFF001FF4B9 /* MGLShapeCollection.h */, DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.m */, ); @@ -1344,13 +1357,29 @@ DAD165831CF4CFED001FF4B9 /* Categories */ = { isa = PBXGroup; children = ( - 353AFA121D65AB17005A69F4 /* NSDate+MGLAdditions.h */, - 353AFA131D65AB17005A69F4 /* NSDate+MGLAdditions.mm */, + 7E016D821D9E890300A29A21 /* MGLPolygon+MGLAdditions.h */, + 7E016D831D9E890300A29A21 /* MGLPolygon+MGLAdditions.m */, + 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */, + 7E016D7D1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m */, + 400532FF1DB0862B0069F638 /* NSArray+MGLAdditions.h */, + 400533001DB0862B0069F638 /* NSArray+MGLAdditions.mm */, DA8848121CBAFA6200AB86E3 /* NSBundle+MGLAdditions.h */, DA8848131CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m */, + 3510FFE81D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h */, + 3510FFE91D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm */, + 3510FFF71D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h */, + 3510FFF81D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm */, 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */, 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */, + 353AFA121D65AB17005A69F4 /* NSDate+MGLAdditions.h */, + 353AFA131D65AB17005A69F4 /* NSDate+MGLAdditions.mm */, + 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */, + 408AA8561DAEDA0800022900 /* NSDictionary+MGLAdditions.mm */, DA8848141CBAFA6200AB86E3 /* NSException+MGLAdditions.h */, + 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */, + 3510FFEF1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm */, + 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */, + 35B82BF71D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm */, DA8848151CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.h */, DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */, DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */, @@ -1359,18 +1388,6 @@ DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */, DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */, DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */, - 35B82BF61D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h */, - 35B82BF71D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm */, - 3510FFE81D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h */, - 3510FFE91D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm */, - 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */, - 3510FFEF1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.mm */, - 3510FFF71D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h */, - 3510FFF81D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm */, - 7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */, - 7E016D7D1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m */, - 7E016D821D9E890300A29A21 /* MGLPolygon+MGLAdditions.h */, - 7E016D831D9E890300A29A21 /* MGLPolygon+MGLAdditions.m */, ); name = Categories; sourceTree = ""; @@ -1458,7 +1475,9 @@ 354B83961D2E873E005D9406 /* MGLUserLocationAnnotationView.h in Headers */, DA8847F01CBAFA5100AB86E3 /* MGLAnnotation.h in Headers */, 7E016D841D9E890300A29A21 /* MGLPolygon+MGLAdditions.h in Headers */, + 400533011DB0862B0069F638 /* NSArray+MGLAdditions.h in Headers */, DA88483E1CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */, + 40CF6DBB1DAC3C6600A4D18B /* MGLShape_Private.h in Headers */, 4018B1CA1CDC288E00F666AF /* MGLAnnotationView.h in Headers */, 350098C61D48288B004B2AF0 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */, 35E79F201D41266300957B9E /* MGLStyleLayer_Private.h in Headers */, @@ -1475,6 +1494,7 @@ DA8847F41CBAFA5100AB86E3 /* MGLOfflinePack.h in Headers */, DA88482E1CBAFA6200AB86E3 /* NSException+MGLAdditions.h in Headers */, DA8848551CBAFB9800AB86E3 /* MGLLocationManager.h in Headers */, + 408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */, 350098C11D48149E004B2AF0 /* NSNumber+MGLStyleAttributeAdditions.h in Headers */, DA88483F1CBAFB8500AB86E3 /* MGLUserLocation.h in Headers */, DA88483D1CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h in Headers */, @@ -1964,11 +1984,12 @@ 30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */, 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, DA8848541CBAFB9800AB86E3 /* MGLCompactCalloutView.m in Sources */, - DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.m in Sources */, + DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.mm in Sources */, 35136D3C1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */, 350098DE1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */, DA6408DD1DA4E7D300908C90 /* MGLVectorStyleLayer.m in Sources */, 3566C7681D4A77BA008152BC /* MGLGeoJSONSource.mm in Sources */, + 400533021DB0862B0069F638 /* NSArray+MGLAdditions.mm in Sources */, 35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, 3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.m in Sources */, DA88482D1CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m in Sources */, @@ -1985,11 +2006,12 @@ DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, - DA8848281CBAFA6200AB86E3 /* MGLShape.m in Sources */, + DA8848281CBAFA6200AB86E3 /* MGLShape.mm in Sources */, DA35A2B31CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, 35D13AB91D3D15E300AFB4E0 /* MGLStyleLayer.mm in Sources */, DA35A2CB1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, DA8848321CBAFA6200AB86E3 /* NSString+MGLAdditions.m in Sources */, + 408AA8581DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */, DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */, @@ -2028,7 +2050,7 @@ 7E016D811D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m in Sources */, 350098D61D4830A6004B2AF0 /* NSString+MGLStyleAttributeAdditions.mm in Sources */, 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, - DAA4E4221CBB730400178DFB /* MGLPointAnnotation.m in Sources */, + DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */, 3593E5241D529C29006D9365 /* MGLStyleAttribute.mm in Sources */, 350098B21D47E6F4004B2AF0 /* UIColor+MGLStyleAttributeAdditions.mm in Sources */, DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, @@ -2042,6 +2064,7 @@ 350098DF1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */, DA6408DE1DA4E7D300908C90 /* MGLVectorStyleLayer.m in Sources */, 3566C7691D4A77BA008152BC /* MGLGeoJSONSource.mm in Sources */, + 400533031DB086490069F638 /* NSArray+MGLAdditions.mm in Sources */, 35136D431D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, 3538AA201D542239008EC33D /* MGLForegroundStyleLayer.m in Sources */, DAA4E4201CBB730400178DFB /* MGLOfflinePack.mm in Sources */, @@ -2053,7 +2076,7 @@ DA35A2B91CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657B1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, 350098CD1D482D9C004B2AF0 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */, - DAA4E4251CBB730400178DFB /* MGLShape.m in Sources */, + DAA4E4251CBB730400178DFB /* MGLShape.mm in Sources */, 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, 35599DEE1D46F14E0048254D /* MGLStyleAttributeFunction.mm in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, @@ -2063,6 +2086,7 @@ DA35A2B41CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, 35D13ABA1D3D15E300AFB4E0 /* MGLStyleLayer.mm in Sources */, DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, + 408AA8591DAEDA1E00022900 /* NSDictionary+MGLAdditions.mm in Sources */, DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */, DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, diff --git a/platform/ios/test/MGLGeoJSONSourceTests.mm b/platform/ios/test/MGLGeoJSONSourceTests.mm index ce92ec24a..40d806798 100644 --- a/platform/ios/test/MGLGeoJSONSourceTests.mm +++ b/platform/ios/test/MGLGeoJSONSourceTests.mm @@ -1,12 +1,18 @@ #import #import +#import "MGLFeature_Private.h" #import "MGLGeoJSONSource_Private.h" #import "MGLSource_Private.h" #include @interface MGLGeoJSONSourceTests : XCTestCase +@end + +@interface MGLPolygonFeature (Test) + +@property (nonatomic, copy, readwrite) NS_DICTIONARY_OF(NSString *, id) *attributes; @end @@ -38,10 +44,10 @@ - (void)testMGLGeoJSONSourceWithData { - NSString *data = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-104.34814453125,37.64903402157866]]}}]}"; + NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-104.34814453125,37.64903402157866]]}}]}"; - NSData *geoJSON = [data dataUsingEncoding:NSUTF8StringEncoding]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"test-id" geoJSONData:geoJSON options:nil]; + NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" geoJSONData:data options:nil]; [source mbglSource]; @@ -54,7 +60,7 @@ CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:2]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[polylineFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[polylineFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; @@ -63,7 +69,6 @@ XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLPolylineFeature class]]); } - - (void)testMGLGeoJSONSourceWithPolygonFeatures { CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(100.0, 0.0), @@ -71,15 +76,45 @@ CLLocationCoordinate2DMake(101.0, 1.0), CLLocationCoordinate2DMake(100.0, 1.0), CLLocationCoordinate2DMake(100.0, 0.0)}; - MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[polygonFeature] options:nil]; + MGLPolygonFeature *polygonFeature = (MGLPolygonFeature *)[MGLPolygonFeature polygonWithCoordinates:coordinates count:5]; + polygonFeature.identifier = @"feature-id"; + NSString *stringAttribute = @"string"; + NSNumber *boolAttribute = [NSNumber numberWithBool:YES]; + NSNumber *doubleAttribute = [NSNumber numberWithDouble:1.23]; + NSDictionary *nestedDictionaryValue = @{@"nested-key-1": @"nested-string-value"}; + NSArray *arrayValue = @[@"string-value", @2]; + NSDictionary *dictionaryValue = @{@"key-1": @"string-value", + @"key-2": @1, + @"key-3": nestedDictionaryValue, + @"key-4": arrayValue}; + NSArray *arrayOfArrays = @[@[@1, @"string-value", @[@"jagged"]]]; + NSArray *arrayOfDictionaries = @[@{@"key": @"value"}]; + + polygonFeature.attributes = @{@"name": stringAttribute, + @"bool": boolAttribute, + @"double": doubleAttribute, + @"dictionary-attribute": dictionaryValue, + @"array-attribute": arrayValue, + @"array-of-array-attribute": arrayOfArrays, + @"array-of-dictionary-attribute": arrayOfDictionaries}; + + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[polygonFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; XCTAssertNotNil(source.features); XCTAssertEqual(source.features.count, 1); - XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLPolygonFeature class]]); + MGLPolygonFeature *expectedPolygonFeature = (MGLPolygonFeature *)source.features.firstObject; + XCTAssertTrue([expectedPolygonFeature isMemberOfClass:[MGLPolygonFeature class]]); + XCTAssertEqualObjects(expectedPolygonFeature.identifier, polygonFeature.identifier); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"name"], stringAttribute); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"bool"], boolAttribute); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"double"], doubleAttribute); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"dictionary-attribute"], dictionaryValue); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"array-attribute"], arrayValue); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"array-of-array-attribute"], arrayOfArrays); + XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"array-of-dictionary-attribute"], arrayOfDictionaries); } - (void)testMGLGeoJSONSourceWithPolygonFeaturesInculdingInteriorPolygons { @@ -101,7 +136,7 @@ MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[polygonFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[polygonFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; @@ -114,17 +149,20 @@ - (void)testMGLGeoJSONSourceWithMultiPointFeaturesUsingPolylines { CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(100.0, 0.0), - CLLocationCoordinate2DMake(101.0, 0.0)}; + CLLocationCoordinate2DMake(101.0, 0.0), + CLLocationCoordinate2DMake(101.0, 1.0), + CLLocationCoordinate2DMake(100.0, 1.0), + CLLocationCoordinate2DMake(100.0, 0.0)}; - MGLMultiPointFeature *multiPointFeature = (MGLMultiPointFeature *)[MGLPolylineFeature polylineWithCoordinates:coordinates count:2]; + MGLMultiPointFeature *multiPointFeature = [MGLMultiPointFeature multiPointWithCoordinates:coordinates count:5]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[multiPointFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[multiPointFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; XCTAssertNotNil(source.features); XCTAssertEqual(source.features.count, 1); - XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLPolylineFeature class]]); + XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLMultiPointFeature class]]); } - (void)testMGLGeoJSONSourceWithMultiPointFeaturesUsingPolygons { @@ -146,7 +184,7 @@ MGLMultiPointFeature *multiPointFeature = (MGLMultiPointFeature *)[MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[multiPointFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[multiPointFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; @@ -156,13 +194,13 @@ } - (void)testMGLGeoJSONSourceWithMultiPolylineFeatures { - CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; - MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:2]; - CLLocationCoordinate2D coordinates_1[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; - MGLPolylineFeature *polylineFeature_1 = [MGLPolylineFeature polylineWithCoordinates:coordinates_1 count:2]; - MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[polylineFeature, polylineFeature_1]]; + CLLocationCoordinate2D firstCoordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; + MGLPolylineFeature *firstPolylineFeature = [MGLPolylineFeature polylineWithCoordinates:firstCoordinates count:2]; + CLLocationCoordinate2D secondCoordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; + MGLPolylineFeature *secondPolylineFeature = [MGLPolylineFeature polylineWithCoordinates:secondCoordinates count:2]; + MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[firstPolylineFeature, secondPolylineFeature]]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[multiPolylineFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[multiPolylineFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; @@ -188,12 +226,12 @@ MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:interiorCoordinates count:5]; - MGLPolygonFeature *polygon_1 = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - MGLPolygonFeature *polygon_2 = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; + MGLPolygonFeature *firstPolygon = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; + MGLPolygonFeature *secondPolygon = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[polygon_1, polygon_2]]; + MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[firstPolygon, secondPolygon]]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[multiPolygonFeature] options:nil]; + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" features:@[multiPolygonFeature] options:nil]; std::unique_ptr mbglSource = [source mbglSource]; @@ -203,6 +241,19 @@ } +- (void)testMGLGeoJSONSourceWithPointFeature { + MGLPointFeature *pointFeature = [MGLPointFeature new]; + pointFeature.coordinate = CLLocationCoordinate2DMake(100.2, 0.2); + + MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"souce-id" features:@[pointFeature] options:nil]; + + std::unique_ptr mbglSource = [source mbglSource]; + + XCTAssertNotNil(source.features); + XCTAssertEqual(source.features.count, 1); + XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLPointFeature class]]); +} + - (void)testMGLGeoJSONSourceWithShapeCollectionFeatures { CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(100.0, 0.0), @@ -240,12 +291,7 @@ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"" features:@[shapeCollectionFeature_1] options:nil]; - std::unique_ptr mbglSource = [source mbglSource]; - - XCTAssertNotNil(source.features); - XCTAssertEqual(source.features.count, 1); - XCTAssertTrue([source.features.firstObject isMemberOfClass:[MGLShapeCollectionFeature class]]); - + XCTAssertThrowsSpecificNamed([source mbglSource], NSException, @"Method unavailable"); } @end diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 3726376fc..62634374e 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 30E5781B1DAA857E0050F07E /* NSImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */; }; - 30E5781C1DAA85820050F07E /* NSImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 30E578151DAA7D920050F07E /* NSImage+MGLAdditions.mm */; }; 3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */; }; 3508EC651D749D39009B0EE4 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */; }; 352742781D4C220900A1ECE6 /* MGLStyleAttributeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 352742771D4C220900A1ECE6 /* MGLStyleAttributeValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -48,6 +47,16 @@ 35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */; }; 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 */; }; + 408AA85B1DAEECFE00022900 /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA85A1DAEECF100022900 /* MGLShape_Private.h */; }; + 408AA8651DAEEE3400022900 /* MGLPolygon+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8601DAEED3300022900 /* MGLPolygon+MGLAdditions.h */; }; + 408AA8661DAEEE3600022900 /* MGLPolyline+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8611DAEED3300022900 /* MGLPolyline+MGLAdditions.h */; }; + 408AA8671DAEEE3900022900 /* NSDictionary+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA85F1DAEED3300022900 /* NSDictionary+MGLAdditions.h */; }; + 408AA8681DAEEE5200022900 /* MGLPolygon+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 408AA85C1DAEED3300022900 /* MGLPolygon+MGLAdditions.m */; }; + 408AA8691DAEEE5500022900 /* MGLPolyline+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 408AA85D1DAEED3300022900 /* MGLPolyline+MGLAdditions.m */; }; + 408AA86A1DAEEE5D00022900 /* NSDictionary+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 408AA85E1DAEED3300022900 /* NSDictionary+MGLAdditions.mm */; }; + 40ABDB561DB0022100372083 /* NSImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 405C03971DB0004E001AC280 /* NSImage+MGLAdditions.mm */; }; + 40B77E451DB11BC9003DA2FE /* NSArray+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 40B77E431DB11BB0003DA2FE /* NSArray+MGLAdditions.h */; }; + 40B77E461DB11BCD003DA2FE /* NSArray+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 40B77E421DB11BB0003DA2FE /* NSArray+MGLAdditions.mm */; }; 52BECB0A1CC5A26F009CD791 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */; }; 5548BE781D09E718005DDE81 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; }; 558F18221D0B13B100123F46 /* libmbgl-loop.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 558F18211D0B13B000123F46 /* libmbgl-loop.a */; }; @@ -145,10 +154,10 @@ DAE6C38D1CC31E2A00DB3429 /* MGLOfflineRegion_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C3731CC31E2A00DB3429 /* MGLOfflineRegion_Private.h */; }; DAE6C38E1CC31E2A00DB3429 /* MGLOfflineStorage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE6C3741CC31E2A00DB3429 /* MGLOfflineStorage_Private.h */; }; DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3751CC31E2A00DB3429 /* MGLOfflineStorage.mm */; }; - DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.m */; }; + DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.mm */; }; DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3771CC31E2A00DB3429 /* MGLPolygon.mm */; }; DAE6C3921CC31E2A00DB3429 /* MGLPolyline.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3781CC31E2A00DB3429 /* MGLPolyline.mm */; }; - DAE6C3931CC31E2A00DB3429 /* MGLShape.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3791CC31E2A00DB3429 /* MGLShape.m */; }; + DAE6C3931CC31E2A00DB3429 /* MGLShape.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3791CC31E2A00DB3429 /* MGLShape.mm */; }; DAE6C3941CC31E2A00DB3429 /* MGLStyle.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C37A1CC31E2A00DB3429 /* MGLStyle.mm */; }; DAE6C3951CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C37B1CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm */; }; DAE6C3961CC31E2A00DB3429 /* MGLTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C37C1CC31E2A00DB3429 /* MGLTypes.m */; }; @@ -220,7 +229,6 @@ /* Begin PBXFileReference section */ 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+MGLAdditions.h"; path = "src/NSImage+MGLAdditions.h"; sourceTree = SOURCE_ROOT; }; - 30E578151DAA7D920050F07E /* NSImage+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSImage+MGLAdditions.mm"; path = "src/NSImage+MGLAdditions.mm"; sourceTree = SOURCE_ROOT; }; 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+MGLAdditions.h"; sourceTree = ""; }; 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSExpression+MGLAdditions.mm"; sourceTree = ""; }; 352742771D4C220900A1ECE6 /* MGLStyleAttributeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleAttributeValue.h; sourceTree = ""; }; @@ -260,6 +268,17 @@ 35C5D84B1D6DD75B00E95907 /* MGLFilterTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFilterTests.mm; sourceTree = ""; }; 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+MGLAdditions.h"; sourceTree = ""; }; 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+MGLAdditions.mm"; sourceTree = ""; }; + 405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+MGLAdditions.h"; sourceTree = ""; }; + 405C03971DB0004E001AC280 /* NSImage+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSImage+MGLAdditions.mm"; sourceTree = ""; }; + 408AA85A1DAEECF100022900 /* MGLShape_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShape_Private.h; sourceTree = ""; }; + 408AA85C1DAEED3300022900 /* MGLPolygon+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLPolygon+MGLAdditions.m"; sourceTree = ""; }; + 408AA85D1DAEED3300022900 /* MGLPolyline+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLPolyline+MGLAdditions.m"; sourceTree = ""; }; + 408AA85E1DAEED3300022900 /* NSDictionary+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDictionary+MGLAdditions.mm"; sourceTree = ""; }; + 408AA85F1DAEED3300022900 /* NSDictionary+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MGLAdditions.h"; sourceTree = ""; }; + 408AA8601DAEED3300022900 /* MGLPolygon+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLPolygon+MGLAdditions.h"; sourceTree = ""; }; + 408AA8611DAEED3300022900 /* MGLPolyline+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLPolyline+MGLAdditions.h"; sourceTree = ""; }; + 40B77E421DB11BB0003DA2FE /* NSArray+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSArray+MGLAdditions.mm"; sourceTree = ""; }; + 40B77E431DB11BB0003DA2FE /* NSArray+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MGLAdditions.h"; sourceTree = ""; }; 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 5548BE791D0ACBB2005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = ""; }; 5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = ""; }; @@ -382,10 +401,10 @@ DAE6C3731CC31E2A00DB3429 /* MGLOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineRegion_Private.h; sourceTree = ""; }; DAE6C3741CC31E2A00DB3429 /* MGLOfflineStorage_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOfflineStorage_Private.h; sourceTree = ""; }; DAE6C3751CC31E2A00DB3429 /* MGLOfflineStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOfflineStorage.mm; sourceTree = ""; }; - DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLPointAnnotation.m; sourceTree = ""; }; + DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointAnnotation.mm; sourceTree = ""; }; DAE6C3771CC31E2A00DB3429 /* MGLPolygon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolygon.mm; sourceTree = ""; }; DAE6C3781CC31E2A00DB3429 /* MGLPolyline.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPolyline.mm; sourceTree = ""; }; - DAE6C3791CC31E2A00DB3429 /* MGLShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLShape.m; sourceTree = ""; }; + DAE6C3791CC31E2A00DB3429 /* MGLShape.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShape.mm; sourceTree = ""; }; DAE6C37A1CC31E2A00DB3429 /* MGLStyle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLStyle.mm; sourceTree = ""; }; DAE6C37B1CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTilePyramidOfflineRegion.mm; sourceTree = ""; }; DAE6C37C1CC31E2A00DB3429 /* MGLTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLTypes.m; sourceTree = ""; }; @@ -684,13 +703,14 @@ DAE6C3701CC31E2A00DB3429 /* MGLMultiPoint.mm */, DAE6C3521CC31E0400DB3429 /* MGLOverlay.h */, DAE6C3531CC31E0400DB3429 /* MGLPointAnnotation.h */, - DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.m */, + DAE6C3761CC31E2A00DB3429 /* MGLPointAnnotation.mm */, DAE6C3541CC31E0400DB3429 /* MGLPolygon.h */, DAE6C3771CC31E2A00DB3429 /* MGLPolygon.mm */, DAE6C3551CC31E0400DB3429 /* MGLPolyline.h */, DAE6C3781CC31E2A00DB3429 /* MGLPolyline.mm */, DAE6C3561CC31E0400DB3429 /* MGLShape.h */, - DAE6C3791CC31E2A00DB3429 /* MGLShape.m */, + 408AA85A1DAEECF100022900 /* MGLShape_Private.h */, + DAE6C3791CC31E2A00DB3429 /* MGLShape.mm */, DAD165721CF4CD7A001FF4B9 /* MGLShapeCollection.h */, DAD165731CF4CD7A001FF4B9 /* MGLShapeCollection.m */, ); @@ -717,8 +737,12 @@ DAD1657F1CF4CF50001FF4B9 /* Categories */ = { isa = PBXGroup; children = ( - 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */, - 30E578151DAA7D920050F07E /* NSImage+MGLAdditions.mm */, + 408AA8601DAEED3300022900 /* MGLPolygon+MGLAdditions.h */, + 408AA85C1DAEED3300022900 /* MGLPolygon+MGLAdditions.m */, + 408AA8611DAEED3300022900 /* MGLPolyline+MGLAdditions.h */, + 408AA85D1DAEED3300022900 /* MGLPolyline+MGLAdditions.m */, + 40B77E431DB11BB0003DA2FE /* NSArray+MGLAdditions.h */, + 40B77E421DB11BB0003DA2FE /* NSArray+MGLAdditions.mm */, DAE6C37D1CC31E2A00DB3429 /* NSBundle+MGLAdditions.h */, DAE6C37E1CC31E2A00DB3429 /* NSBundle+MGLAdditions.m */, 35C5D8431D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h */, @@ -727,6 +751,8 @@ 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */, 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */, 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */, + 408AA85F1DAEED3300022900 /* NSDictionary+MGLAdditions.h */, + 408AA85E1DAEED3300022900 /* NSDictionary+MGLAdditions.mm */, DAE6C37F1CC31E2A00DB3429 /* NSException+MGLAdditions.h */, 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */, 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */, @@ -820,6 +846,8 @@ DAE6C39E1CC31E7C00DB3429 /* Kit */ = { isa = PBXGroup; children = ( + 405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */, + 405C03971DB0004E001AC280 /* NSImage+MGLAdditions.mm */, DAE6C39F1CC31E9400DB3429 /* MGLAnnotationImage.h */, DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */, DAE6C3A71CC31EF300DB3429 /* MGLAnnotationImage.m */, @@ -861,6 +889,7 @@ DA8F258F1D51CA600010E6B5 /* MGLRasterStyleLayer.h in Headers */, 3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */, DAE6C38D1CC31E2A00DB3429 /* MGLOfflineRegion_Private.h in Headers */, + 408AA8651DAEEE3400022900 /* MGLPolygon+MGLAdditions.h in Headers */, DA8F25AB1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions_Private.h in Headers */, DA8F259C1D51CB000010E6B5 /* MGLStyleAttributeValue_Private.h in Headers */, DA8F25B41D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions_Private.h in Headers */, @@ -868,6 +897,7 @@ DAE6C3B61CC31EF300DB3429 /* MGLMapView_Private.h in Headers */, 3527428D1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.h in Headers */, DAE6C3B21CC31EF300DB3429 /* MGLAttributionButton.h in Headers */, + 40B77E451DB11BC9003DA2FE /* NSArray+MGLAdditions.h in Headers */, 35C5D8471D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.h in Headers */, DAE6C3A31CC31E9400DB3429 /* MGLAnnotationImage.h in Headers */, DAE6C3A41CC31E9400DB3429 /* MGLMapView.h in Headers */, @@ -911,6 +941,7 @@ DA8F258B1D51CA540010E6B5 /* MGLLineStyleLayer.h in Headers */, DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */, DAE6C38E1CC31E2A00DB3429 /* MGLOfflineStorage_Private.h in Headers */, + 408AA8661DAEEE3600022900 /* MGLPolyline+MGLAdditions.h in Headers */, DAE6C3601CC31E0400DB3429 /* MGLOfflineRegion.h in Headers */, DAE6C3681CC31E0400DB3429 /* MGLTilePyramidOfflineRegion.h in Headers */, DA8F25AC1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.h in Headers */, @@ -935,9 +966,11 @@ DAE6C3A51CC31E9400DB3429 /* MGLMapView+IBAdditions.h in Headers */, DA35A2AD1CCA091800E826B2 /* MGLCompassDirectionFormatter.h in Headers */, 352742851D4C244700A1ECE6 /* MGLRasterSource.h in Headers */, + 408AA85B1DAEECFE00022900 /* MGLShape_Private.h in Headers */, DACC22181CF3D4F700D220D9 /* MGLFeature_Private.h in Headers */, DA6408D71DA4E5DA00908C90 /* MGLVectorStyleLayer.h in Headers */, 352742891D4C245800A1ECE6 /* MGLGeoJSONSource.h in Headers */, + 408AA8671DAEEE3900022900 /* NSDictionary+MGLAdditions.h in Headers */, DAE6C3671CC31E0400DB3429 /* MGLStyle.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1119,10 +1152,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.m in Sources */, + 40ABDB561DB0022100372083 /* NSImage+MGLAdditions.mm in Sources */, + DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.mm in Sources */, DAE6C3981CC31E2A00DB3429 /* NSBundle+MGLAdditions.m in Sources */, DA8F25AA1D51CB270010E6B5 /* NSNumber+MGLStyleAttributeAdditions.mm in Sources */, DAE6C3B71CC31EF300DB3429 /* MGLMapView.mm in Sources */, + 40B77E461DB11BCD003DA2FE /* NSArray+MGLAdditions.mm in Sources */, DAE6C38C1CC31E2A00DB3429 /* MGLOfflinePack.mm in Sources */, 35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */, DAE6C3B11CC31EF300DB3429 /* MGLAnnotationImage.m in Sources */, @@ -1131,13 +1166,14 @@ 355BA4EE1D41633E00CCC6D5 /* NSColor+MGLAdditions.mm in Sources */, DAE6C3B31CC31EF300DB3429 /* MGLAttributionButton.m in Sources */, 35602BFB1D3EA99F0050646F /* MGLFillStyleLayer.mm in Sources */, - DAE6C3931CC31E2A00DB3429 /* MGLShape.m in Sources */, + DAE6C3931CC31E2A00DB3429 /* MGLShape.mm in Sources */, 352742861D4C244700A1ECE6 /* MGLRasterSource.mm in Sources */, DAE6C39D1CC31E2A00DB3429 /* NSString+MGLAdditions.m in Sources */, DAE6C3941CC31E2A00DB3429 /* MGLStyle.mm in Sources */, DAE6C3871CC31E2A00DB3429 /* MGLGeometry.mm in Sources */, 3527428E1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm in Sources */, 35602C011D3EA9B40050646F /* MGLForegroundStyleLayer.m in Sources */, + 408AA86A1DAEEE5D00022900 /* NSDictionary+MGLAdditions.mm in Sources */, 3527427D1D4C238F00A1ECE6 /* NSColor+MGLStyleAttributeAdditions.m in Sources */, DA8F25881D51C9E10010E6B5 /* MGLBackgroundStyleLayer.mm in Sources */, DAE6C3B81CC31EF300DB3429 /* MGLMapView+IBAdditions.mm in Sources */, @@ -1148,7 +1184,6 @@ DAE6C38A1CC31E2A00DB3429 /* MGLMultiPoint.mm in Sources */, DAE6C3961CC31E2A00DB3429 /* MGLTypes.m in Sources */, DA35A2A61CC9EB2700E826B2 /* MGLCoordinateFormatter.m in Sources */, - 30E5781C1DAA85820050F07E /* NSImage+MGLAdditions.mm in Sources */, 352742821D4C243B00A1ECE6 /* MGLSource.mm in Sources */, DAE6C3881CC31E2A00DB3429 /* MGLMapCamera.mm in Sources */, DA6408D81DA4E5DA00908C90 /* MGLVectorStyleLayer.m in Sources */, @@ -1158,6 +1193,7 @@ DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */, DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */, 35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, + 408AA8681DAEEE5200022900 /* MGLPolygon+MGLAdditions.m in Sources */, DAE6C3951CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm in Sources */, 3593E52B1D52A628006D9365 /* MGLStyleAttribute.mm in Sources */, DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */, @@ -1171,6 +1207,7 @@ DA35A2AE1CCA091800E826B2 /* MGLCompassDirectionFormatter.m in Sources */, DA8F258C1D51CA540010E6B5 /* MGLLineStyleLayer.mm in Sources */, DA8F25AD1D51CB270010E6B5 /* NSArray+MGLStyleAttributeAdditions.mm in Sources */, + 408AA8691DAEEE5500022900 /* MGLPolyline+MGLAdditions.m in Sources */, DA8F25941D51CA750010E6B5 /* MGLSymbolStyleLayer.mm in Sources */, 3529039C1D6C63B80002C7DF /* NSPredicate+MGLAdditions.mm in Sources */, DA8F25981D51CAC70010E6B5 /* MGLVectorSource.mm in Sources */,