diff options
author | Jesse Bounds <jesse@rebounds.net> | 2016-12-09 16:09:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 16:09:10 -0800 |
commit | 7f75eb5d6ae014391f3baf066a9873c5fb1c1ded (patch) | |
tree | 0451999a6d5397a806dc3214bc5e0b8eb9b51daa /platform/darwin/src | |
parent | ce1d9ff5eee2df57ec4c2d1f39b967ecfef4b9bc (diff) | |
download | qtlocation-mapboxgl-7f75eb5d6ae014391f3baf066a9873c5fb1c1ded.tar.gz |
[ios, macos] Rename MGLGeoJSONSource to MGLShapeSource (#7334)
Diffstat (limited to 'platform/darwin/src')
-rw-r--r-- | platform/darwin/src/MGLFeature.h | 6 | ||||
-rw-r--r-- | platform/darwin/src/MGLPointCollection.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLRuntimeStylingTests.m.ejs | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLShapeSource.h (renamed from platform/darwin/src/MGLGeoJSONSource.h) | 56 | ||||
-rw-r--r-- | platform/darwin/src/MGLShapeSource.mm (renamed from platform/darwin/src/MGLGeoJSONSource.mm) | 32 | ||||
-rw-r--r-- | platform/darwin/src/MGLShapeSource_Private.h (renamed from platform/darwin/src/MGLGeoJSONSource_Private.h) | 5 | ||||
-rw-r--r-- | platform/darwin/src/MGLStyle.mm | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLVectorStyleLayer.h | 2 |
8 files changed, 55 insertions, 54 deletions
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index 384c5a073e..ed4ff627b9 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN using `-[MGLMapView visibleFeaturesAtPoint:]` and related methods. Each feature object associates a shape with an identifier and attributes as specified by the source. Like ordinary `MGLAnnotation` objects, some kinds of `MGLFeature` - objects can also be added to a map view using an `MGLGeoJSONSource` or + objects can also be added to a map view using an `MGLShapeSource` or `-[MGLMapView addAnnotations:]` and related methods. */ @protocol MGLFeature <MGLAnnotation> @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN layer reference. Note that while it is possible to change this value on feature instances obtained from `-[MGLMapView visibleFeaturesAtPoint:]` and related methods, there will be no effect on the map. Setting this value can be useful - when the feature instance is used to initialize an `MGLGeoJSONSource` and that + when the feature instance is used to initialize an `MGLShapeSource` and that source is added to the map and styled. */ @property (nonatomic, copy, nullable) id identifier; @@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN layer references. Note that while it is possible to change this value on feature instances obtained from `-[MGLMapView visibleFeaturesAtPoint:]` and related methods, there will be no effect on the map. Setting this value can be useful - when the feature instance is used to initialize an `MGLGeoJSONSource` and that + when the feature instance is used to initialize an `MGLShapeSource` and that source is added to the map and styled. */ @property (nonatomic, copy) NS_DICTIONARY_OF(NSString *, id) *attributes; diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h index ce3e95a16d..95af9dae5e 100644 --- a/platform/darwin/src/MGLPointCollection.h +++ b/platform/darwin/src/MGLPointCollection.h @@ -11,7 +11,7 @@ @note `MGLPointCollection` objects cannot be added to a map view using `-[MGLMapView addAnnotations:]` and related methods. However, when used in a - `MGLPointCollectionFeature` to initialize a `MGLGeoJSONSource` that is added + `MGLPointCollectionFeature` to initialize a `MGLShapeSource` that is added to the map view's style, the point collection represents as a group of distinct annotations. */ diff --git a/platform/darwin/src/MGLRuntimeStylingTests.m.ejs b/platform/darwin/src/MGLRuntimeStylingTests.m.ejs index 720ee4547e..91c626d1a2 100644 --- a/platform/darwin/src/MGLRuntimeStylingTests.m.ejs +++ b/platform/darwin/src/MGLRuntimeStylingTests.m.ejs @@ -19,7 +19,7 @@ <% } else { -%> NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; NSURL *url = [NSURL fileURLWithPath:filePath]; - MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil]; + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil]; [self.mapView.style addSource:source]; MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source]; <% } -%> diff --git a/platform/darwin/src/MGLGeoJSONSource.h b/platform/darwin/src/MGLShapeSource.h index 2e86cf5b4f..5067466e6d 100644 --- a/platform/darwin/src/MGLGeoJSONSource.h +++ b/platform/darwin/src/MGLShapeSource.h @@ -8,38 +8,38 @@ NS_ASSUME_NONNULL_BEGIN @protocol MGLFeature; /** - Options for `MGLGeoJSONSource` objects. + Options for `MGLShapeSource` objects. */ -typedef NSString *MGLGeoJSONSourceOption NS_STRING_ENUM; +typedef NSString *MGLShapeSourceOption NS_STRING_ENUM; /** An `NSNumber` object containing a Boolean enabling or disabling clustering. - If the `features` property contains point features, setting this option to + If the `shape` property contains point shapes, setting this option to `YES` clusters the points by radius into groups. The default value is `NO`. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionClustered; +extern const MGLShapeSourceOption MGLShapeSourceOptionClustered; /** An `NSNumber` object containing an integer; specifies the radius of each cluster if clustering is enabled. A value of 512 produces a radius equal to the width of a tile. The default value is 50. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionClusterRadius; +extern const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius; /** An `NSNumber` object containing an integer; specifies the maximum zoom level at which to cluster points if clustering is enabled. Defaults to one zoom level - less than the value of `MGLGeoJSONSourceOptionMaximumZoomLevel` so that, at the - maximum zoom level, the features are not clustered. + less than the value of `MGLShapeSourceOptionMaximumZoomLevel` so that, at the + maximum zoom level, the shapes are not clustered. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionMaximumZoomLevelForClustering; +extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering; /** An `NSNumber` object containing an integer; specifies the maximum zoom level at which to create vector tiles. A greater value produces greater detail at high zoom levels. The default value is 18. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionMaximumZoomLevel; +extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel; /** An `NSNumber` object containing an integer; specifies the size of the tile @@ -47,27 +47,27 @@ extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionMaximumZoomLevel; buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance. The default value is 128. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionBuffer; +extern const MGLShapeSourceOption MGLShapeSourceOptionBuffer; /** An `NSNumber` object containing a double; specifies the Douglas-Peucker simplification tolerance. A greater value produces simpler geometries and improves performance. The default value is 0.375. */ -extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance; +extern const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance; /** - A GeoJSON source. + A shape source. @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">The style specification.</a> */ -@interface MGLGeoJSONSource : MGLSource +@interface MGLShapeSource : MGLSource #pragma mark Initializing a Source /** - Returns a GeoJSON source initialized with an identifier, GeoJSON data, and a + Returns a shape source initialized with an identifier, GeoJSON data, and a dictionary of options for the source according to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">style specification</a>. @@ -75,12 +75,12 @@ extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationToleranc @param identifier A string that uniquely identifies the source. @param geoJSONData An `NSData` object representing GeoJSON source code. @param options An `NSDictionary` of options for this source. - @return An initialized GeoJSON source. + @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier geoJSONData:(NSData *)data options:(nullable NS_DICTIONARY_OF(MGLGeoJSONSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier geoJSONData:(NSData *)data options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; /** - Returns a GeoJSON source with an identifier, URL, and dictionary of options for + Returns a shape source with an identifier, URL, and dictionary of options for the source according to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">style specification</a>. @@ -89,12 +89,12 @@ extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationToleranc @param URL An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle. @param options An `NSDictionary` of options for this source. - @return An initialized GeoJSON source. + @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NS_DICTIONARY_OF(MGLGeoJSONSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; /** - Returns a GeoJSON source with an identifier, features dictionary, and dictionary + Returns a shape source with an identifier, a shape, and dictionary of options for the source according to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">style specification</a>. @@ -102,9 +102,9 @@ extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationToleranc @param identifier A string that uniquely identifies the source. @param shape A concrete subclass of `MGLShape` @param options An `NSDictionary` of options for this source. - @return An initialized GeoJSON source. + @return An initialized shape source. */ -- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(nullable NS_DICTIONARY_OF(MGLGeoJSONSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(nullable NS_DICTIONARY_OF(MGLShapeSourceOption, id) *)options NS_DESIGNATED_INITIALIZER; #pragma mark Accessing a Source’s Content @@ -121,22 +121,22 @@ extern const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationToleranc /** A GeoJSON representation of the contents of the source. - Use the `features` property instead to get an object representation of the + Use the `shape` property instead to get an object representation of the contents. Alternatively, use `NSJSONSerialization` with the value of this property to transform it into Foundation types. If the receiver was initialized using `-initWithIdentifier:URL:options` or - `-initWithIdentifier:features:options`, this property is set to `nil`. - This property is unavailable until the receiver is passed - into `-[MGLStyle addSource]`. + `-initWithIdentifier:shape:options`, this property is set to `nil`. + This property is unavailable until the receiver is passed into + `-[MGLStyle addSource]`. */ @property (nonatomic, nullable, copy) NSData *geoJSONData; /** The URL to the GeoJSON document that specifies the contents of the source. - If the receiver was initialized using `-initWithIdentifier:geoJSONData:options`, this - property is set to `nil`. + If the receiver was initialized using `-initWithIdentifier:geoJSONData:options`, + this property is set to `nil`. */ @property (nonatomic, nullable) NSURL *URL; diff --git a/platform/darwin/src/MGLGeoJSONSource.mm b/platform/darwin/src/MGLShapeSource.mm index 570b884149..434e6fcb1b 100644 --- a/platform/darwin/src/MGLGeoJSONSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -1,4 +1,4 @@ -#import "MGLGeoJSONSource_Private.h" +#import "MGLShapeSource_Private.h" #import "MGLMapView_Private.h" #import "MGLSource_Private.h" @@ -9,14 +9,14 @@ #include <mbgl/style/sources/geojson_source.hpp> -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionClustered = @"MGLGeoJSONSourceOptionClustered"; -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionClusterRadius = @"MGLGeoJSONSourceOptionClusterRadius"; -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionMaximumZoomLevelForClustering = @"MGLGeoJSONSourceOptionMaximumZoomLevelForClustering"; -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionMaximumZoomLevel = @"MGLGeoJSONSourceOptionMaximumZoomLevel"; -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionBuffer = @"MGLGeoJSONSourceOptionBuffer"; -const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance = @"MGLGeoJSONSourceOptionSimplificationTolerance"; +const MGLShapeSourceOption MGLShapeSourceOptionClustered = @"MGLShapeSourceOptionClustered"; +const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius = @"MGLShapeSourceOptionClusterRadius"; +const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering = @"MGLShapeSourceOptionMaximumZoomLevelForClustering"; +const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel = @"MGLShapeSourceOptionMaximumZoomLevel"; +const MGLShapeSourceOption MGLShapeSourceOptionBuffer = @"MGLShapeSourceOptionBuffer"; +const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance"; -@interface MGLGeoJSONSource () +@interface MGLShapeSource () - (instancetype)initWithRawSource:(mbgl::style::GeoJSONSource *)rawSource NS_DESIGNATED_INITIALIZER; @@ -25,7 +25,7 @@ const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance = @"M @end -@implementation MGLGeoJSONSource +@implementation MGLShapeSource { std::unique_ptr<mbgl::style::GeoJSONSource> _pendingSource; } @@ -52,7 +52,7 @@ const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance = @"M return self; } -- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NSDictionary<MGLGeoJSONSourceOption,id> *)options +- (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NSDictionary<MGLShapeSourceOption,id> *)options { if (self = [super initWithIdentifier:identifier]) { _shape = shape; @@ -111,32 +111,32 @@ const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance = @"M { auto mbglOptions = mbgl::style::GeoJSONOptions(); - if (id value = self.options[MGLGeoJSONSourceOptionMaximumZoomLevel]) { + if (id value = self.options[MGLShapeSourceOptionMaximumZoomLevel]) { [self validateValue:value]; mbglOptions.maxzoom = [value integerValue]; } - if (id value = self.options[MGLGeoJSONSourceOptionBuffer]) { + if (id value = self.options[MGLShapeSourceOptionBuffer]) { [self validateValue:value]; mbglOptions.buffer = [value integerValue]; } - if (id value = self.options[MGLGeoJSONSourceOptionSimplificationTolerance]) { + if (id value = self.options[MGLShapeSourceOptionSimplificationTolerance]) { [self validateValue:value]; mbglOptions.tolerance = [value doubleValue]; } - if (id value = self.options[MGLGeoJSONSourceOptionClusterRadius]) { + if (id value = self.options[MGLShapeSourceOptionClusterRadius]) { [self validateValue:value]; mbglOptions.clusterRadius = [value integerValue]; } - if (id value = self.options[MGLGeoJSONSourceOptionMaximumZoomLevelForClustering]) { + if (id value = self.options[MGLShapeSourceOptionMaximumZoomLevelForClustering]) { [self validateValue:value]; mbglOptions.clusterMaxZoom = [value integerValue]; } - if (id value = self.options[MGLGeoJSONSourceOptionClustered]) { + if (id value = self.options[MGLShapeSourceOptionClustered]) { [self validateValue:value]; mbglOptions.cluster = [value boolValue]; } diff --git a/platform/darwin/src/MGLGeoJSONSource_Private.h b/platform/darwin/src/MGLShapeSource_Private.h index 9d67deee34..af5dc33f96 100644 --- a/platform/darwin/src/MGLGeoJSONSource_Private.h +++ b/platform/darwin/src/MGLShapeSource_Private.h @@ -1,8 +1,9 @@ -#import "MGLGeoJSONSource.h" +#import "MGLShapeSource.h" +#import "MGLShapeSource_Private.h" #include <mbgl/style/sources/geojson_source.hpp> -@interface MGLGeoJSONSource (Private) +@interface MGLShapeSource (Private) - (instancetype)initWithRawSource:(mbgl::style::GeoJSONSource *)rawSource; diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index ee0bb286ba..c84782dba9 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -19,7 +19,7 @@ #import "MGLSource.h" #import "MGLVectorSource_Private.h" #import "MGLRasterSource.h" -#import "MGLGeoJSONSource.h" +#import "MGLShapeSource.h" #import "MGLAttributionInfo.h" #import "MGLTileSet_Private.h" @@ -167,7 +167,7 @@ static NSURL *MGLStyleURL_emerald; if (auto vectorSource = source->as<mbgl::style::VectorSource>()) { return [[MGLVectorSource alloc] initWithRawSource:vectorSource]; } else if (auto geoJSONSource = source->as<mbgl::style::GeoJSONSource>()) { - return [[MGLGeoJSONSource alloc] initWithRawSource:geoJSONSource]; + return [[MGLShapeSource alloc] initWithRawSource:geoJSONSource]; } else if (auto rasterSource = source->as<mbgl::style::RasterSource>()) { return [[MGLRasterSource alloc] initWithRawSource:rasterSource]; } else { diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h index e0980af44d..1197d76807 100644 --- a/platform/darwin/src/MGLVectorStyleLayer.h +++ b/platform/darwin/src/MGLVectorStyleLayer.h @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN /** `MGLVectorStyleLayer` is an abstract superclass for style layers whose content - is defined by an `MGLGeoJSONSource` or `MGLVectorSource` object. + is defined by an `MGLShapeSource` or `MGLVectorSource` object. Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of the following concrete |