summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-12-09 16:09:10 -0800
committerGitHub <noreply@github.com>2016-12-09 16:09:10 -0800
commit7f75eb5d6ae014391f3baf066a9873c5fb1c1ded (patch)
tree0451999a6d5397a806dc3214bc5e0b8eb9b51daa /platform/darwin
parentce1d9ff5eee2df57ec4c2d1f39b967ecfef4b9bc (diff)
downloadqtlocation-mapboxgl-7f75eb5d6ae014391f3baf066a9873c5fb1c1ded.tar.gz
[ios, macos] Rename MGLGeoJSONSource to MGLShapeSource (#7334)
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/MGLFeature.h6
-rw-r--r--platform/darwin/src/MGLPointCollection.h2
-rw-r--r--platform/darwin/src/MGLRuntimeStylingTests.m.ejs2
-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.mm4
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.h2
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.m2
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.m2
-rw-r--r--platform/darwin/test/MGLFilterTests.mm4
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.m2
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.m2
-rw-r--r--platform/darwin/test/MGLShapeSourceTests.mm (renamed from platform/darwin/test/MGLGeoJSONSourceTests.mm)68
-rw-r--r--platform/darwin/test/MGLStyleTests.mm10
-rw-r--r--platform/darwin/test/MGLStyleValueTests.swift6
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.m2
17 files changed, 104 insertions, 103 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
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m
index 432d3ffa79..f98e731354 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.m
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.m
@@ -11,7 +11,7 @@
- (void)testCircleLayer {
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];
MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
[self.mapView.style addLayer:layer];
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.m b/platform/darwin/test/MGLFillStyleLayerTests.m
index 87846302ea..dd16214a71 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.m
+++ b/platform/darwin/test/MGLFillStyleLayerTests.m
@@ -11,7 +11,7 @@
- (void)testFillLayer {
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];
MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
[self.mapView.style addLayer:layer];
diff --git a/platform/darwin/test/MGLFilterTests.mm b/platform/darwin/test/MGLFilterTests.mm
index b18400f83a..4b393fd1dc 100644
--- a/platform/darwin/test/MGLFilterTests.mm
+++ b/platform/darwin/test/MGLFilterTests.mm
@@ -5,7 +5,7 @@
@interface MGLFilterTests : MGLStyleLayerTests {
- MGLGeoJSONSource *source;
+ MGLShapeSource *source;
MGLLineStyleLayer *layer;
}
@end
@@ -18,7 +18,7 @@
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
NSURL *url = [NSURL fileURLWithPath:filePath];
NSData *geoJSONData = [NSData dataWithContentsOfURL:url];
- source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"test-source" geoJSONData:geoJSONData options:nil];
+ source = [[MGLShapeSource alloc] initWithIdentifier:@"test-source" geoJSONData:geoJSONData options:nil];
[self.mapView.style addSource:source];
layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"test-layer" source:source];
}
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.m b/platform/darwin/test/MGLLineStyleLayerTests.m
index e313b55bc7..49dd1f2198 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.m
+++ b/platform/darwin/test/MGLLineStyleLayerTests.m
@@ -11,7 +11,7 @@
- (void)testLineLayer {
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];
MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
[self.mapView.style addLayer:layer];
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.m b/platform/darwin/test/MGLRasterStyleLayerTests.m
index 197f1d4723..485664c986 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.m
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.m
@@ -11,7 +11,7 @@
- (void)testRasterLayer {
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];
MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
[self.mapView.style addLayer:layer];
diff --git a/platform/darwin/test/MGLGeoJSONSourceTests.mm b/platform/darwin/test/MGLShapeSourceTests.mm
index 47f12828eb..c4273e6e3f 100644
--- a/platform/darwin/test/MGLGeoJSONSourceTests.mm
+++ b/platform/darwin/test/MGLShapeSourceTests.mm
@@ -2,26 +2,26 @@
#import <Mapbox/Mapbox.h>
#import "MGLFeature_Private.h"
-#import "MGLGeoJSONSource_Private.h"
+#import "MGLShapeSource_Private.h"
#import "MGLSource_Private.h"
#include <mbgl/style/sources/geojson_source.hpp>
-@interface MGLGeoJSONSourceTests : XCTestCase
+@interface MGLShapeSourceTests : XCTestCase
@end
-@implementation MGLGeoJSONSourceTests
+@implementation MGLShapeSourceTests
-- (void)testMGLGeoJSONSourceWithOptions {
+- (void)testMGLShapeSourceWithOptions {
NSURL *url = [NSURL URLWithString:@"http://www.mapbox.com/source"];
- NSDictionary *options = @{MGLGeoJSONSourceOptionClustered: @YES,
- MGLGeoJSONSourceOptionClusterRadius: @42,
- MGLGeoJSONSourceOptionMaximumZoomLevelForClustering: @98,
- MGLGeoJSONSourceOptionMaximumZoomLevel: @99,
- MGLGeoJSONSourceOptionBuffer: @1976,
- MGLGeoJSONSourceOptionSimplificationTolerance: @0.42};
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" URL:url options:options];
+ NSDictionary *options = @{MGLShapeSourceOptionClustered: @YES,
+ MGLShapeSourceOptionClusterRadius: @42,
+ MGLShapeSourceOptionMaximumZoomLevelForClustering: @98,
+ MGLShapeSourceOptionMaximumZoomLevel: @99,
+ MGLShapeSourceOptionBuffer: @1976,
+ MGLShapeSourceOptionSimplificationTolerance: @0.42};
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" URL:url options:options];
auto mbglOptions = [source geoJSONOptions];
XCTAssertTrue(mbglOptions.cluster);
@@ -31,21 +31,21 @@
XCTAssertEqual(mbglOptions.buffer, 1976);
XCTAssertEqual(mbglOptions.tolerance, 0.42);
- options = @{MGLGeoJSONSourceOptionClustered: @"number 1"};
- XCTAssertThrows([[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" URL:url options:options]);
+ options = @{MGLShapeSourceOptionClustered: @"number 1"};
+ XCTAssertThrows([[MGLShapeSource alloc] initWithIdentifier:@"source-id" URL:url options:options]);
}
- (void)testNilShape {
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"id" shape:nil options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"id" shape:nil options:nil];
XCTAssertNil(source.shape);
}
-- (void)testMGLGeoJSONSourceWithDataMultipleFeatures {
+- (void)testMGLShapeSourceWithDataMultipleFeatures {
NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-104.34814453125,37.64903402157866]]}}]}";
NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" geoJSONData:data options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" geoJSONData:data options:nil];
MGLShapeCollection *collection = (MGLShapeCollection *)source.shape;
XCTAssertNotNil(collection);
@@ -53,25 +53,25 @@
XCTAssertTrue([collection.shapes.firstObject isMemberOfClass:[MGLPolylineFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithSingleFeature {
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"geojson"
+- (void)testMGLShapeSourceWithSingleFeature {
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"geojson"
geoJSONData:[@"{\"type\": \"Point\", \"coordinates\": [0, 0]}" dataUsingEncoding:NSUTF8StringEncoding]
options:nil];
XCTAssertNotNil(source.shape);
XCTAssert([source.shape isKindOfClass:[MGLPointFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithPolylineFeatures {
+- (void)testMGLShapeSourceWithPolylineFeatures {
CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)};
MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:2];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" shape:polylineFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polylineFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLPolylineFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithPolygonFeatures {
+- (void)testMGLShapeSourceWithPolygonFeatures {
CLLocationCoordinate2D coordinates[] = {
CLLocationCoordinate2DMake(100.0, 0.0),
CLLocationCoordinate2DMake(101.0, 0.0),
@@ -101,7 +101,7 @@
@"array-of-array-attribute": arrayOfArrays,
@"array-of-dictionary-attribute": arrayOfDictionaries};
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil];
XCTAssertNotNil(source.shape);
MGLPolygonFeature *expectedPolygonFeature = (MGLPolygonFeature *)source.shape;
@@ -117,7 +117,7 @@
XCTAssertEqualObjects(expectedPolygonFeature.attributes[@"array-of-dictionary-attribute"], arrayOfDictionaries);
}
-- (void)testMGLGeoJSONSourceWithPolygonFeaturesInculdingInteriorPolygons {
+- (void)testMGLShapeSourceWithPolygonFeaturesInculdingInteriorPolygons {
CLLocationCoordinate2D coordinates[] = {
CLLocationCoordinate2DMake(100.0, 0.0),
CLLocationCoordinate2DMake(101.0, 0.0),
@@ -136,26 +136,26 @@
MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLPolygonFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithMultiPolylineFeatures {
+- (void)testMGLShapeSourceWithMultiPolylineFeatures {
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:@"source-id" shape:multiPolylineFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:multiPolylineFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLMultiPolylineFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithMultiPolygonFeatures {
+- (void)testMGLShapeSourceWithMultiPolygonFeatures {
CLLocationCoordinate2D coordinates[] = {
CLLocationCoordinate2DMake(100.0, 0.0),
CLLocationCoordinate2DMake(101.0, 0.0),
@@ -177,23 +177,23 @@
MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[firstPolygon, secondPolygon]];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" shape:multiPolygonFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:multiPolygonFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLMultiPolygonFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithPointFeature {
+- (void)testMGLShapeSourceWithPointFeature {
MGLPointFeature *pointFeature = [MGLPointFeature new];
pointFeature.coordinate = CLLocationCoordinate2DMake(100.2, 0.2);
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"souce-id" shape:pointFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"souce-id" shape:pointFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLPointFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithPointCollectionFeature {
+- (void)testMGLShapeSourceWithPointCollectionFeature {
CLLocationCoordinate2D coordinates[] = {
CLLocationCoordinate2DMake(100.0, 0.0),
CLLocationCoordinate2DMake(101.0, 0.0),
@@ -201,13 +201,13 @@
CLLocationCoordinate2DMake(100.0, 1.0),
CLLocationCoordinate2DMake(100.0, 0.0)};
MGLPointCollectionFeature *pointCollectionFeature = [MGLPointCollectionFeature pointCollectionWithCoordinates:coordinates count:5];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"souce-id" shape:pointCollectionFeature options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"souce-id" shape:pointCollectionFeature options:nil];
XCTAssertNotNil(source.shape);
XCTAssertTrue([source.shape isMemberOfClass:[MGLPointCollectionFeature class]]);
}
-- (void)testMGLGeoJSONSourceWithShapeCollectionFeatures {
+- (void)testMGLShapeSourceWithShapeCollectionFeatures {
CLLocationCoordinate2D coordinates[] = {
CLLocationCoordinate2DMake(100.0, 0.0),
CLLocationCoordinate2DMake(101.0, 0.0),
@@ -243,7 +243,7 @@
MGLShapeCollectionFeature *shapeCollectionFeature_1 = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[polygonFeature, polylineFeature, multiPolygonFeature, multiPolylineFeature, pointCollectionFeature, pointFeature, shapeCollectionFeature]];
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"source-id" shape:shapeCollectionFeature_1 options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:shapeCollectionFeature_1 options:nil];
MGLShapeCollectionFeature *shape = (MGLShapeCollectionFeature *)source.shape;
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index ae55951fd9..f2151988b9 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -1,7 +1,7 @@
#import "MGLMapView.h"
#import "MGLStyle_Private.h"
-#import "MGLGeoJSONSource.h"
+#import "MGLShapeSource.h"
#import "MGLRasterSource.h"
#import "MGLVectorSource.h"
@@ -121,9 +121,9 @@
}
- (void)testAddingSourcesTwice {
- MGLGeoJSONSource *geoJSONSource = [[MGLGeoJSONSource alloc] initWithIdentifier:@"geoJSONSource" shape:nil options:nil];
- [self.style addSource:geoJSONSource];
- XCTAssertThrowsSpecificNamed([self.style addSource:geoJSONSource], NSException, @"MGLRedundantSourceException");
+ MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"geoJSONSource" shape:nil options:nil];
+ [self.style addSource:shapeSource];
+ XCTAssertThrowsSpecificNamed([self.style addSource:shapeSource], NSException, @"MGLRedundantSourceException");
MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"rasterSource" URL:[NSURL new] tileSize:42];
[self.style addSource:rasterSource];
@@ -143,7 +143,7 @@
}
- (void)testAddingLayersTwice {
- MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithIdentifier:@"geoJSONSource" shape:nil options:nil];
+ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"geoJSONSource" shape:nil options:nil];
MGLBackgroundStyleLayer *backgroundLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"backgroundLayer"];
[self.style addLayer:backgroundLayer];
diff --git a/platform/darwin/test/MGLStyleValueTests.swift b/platform/darwin/test/MGLStyleValueTests.swift
index 7a266a495f..2d2792fdc0 100644
--- a/platform/darwin/test/MGLStyleValueTests.swift
+++ b/platform/darwin/test/MGLStyleValueTests.swift
@@ -5,8 +5,8 @@ import Mapbox
extension MGLStyleValueTests {
func testConstantValues() {
- let geoJSONSource = MGLGeoJSONSource(identifier: "test", shape: nil, options: nil)
- let symbolStyleLayer = MGLSymbolStyleLayer(identifier: "test", source: geoJSONSource)
+ let shapeSource = MGLShapeSource(identifier: "test", shape: nil, options: nil)
+ let symbolStyleLayer = MGLSymbolStyleLayer(identifier: "test", source: shapeSource)
// Boolean
symbolStyleLayer.iconAllowOverlap = MGLStyleConstantValue(rawValue: true)
@@ -22,7 +22,7 @@ extension MGLStyleValueTests {
}
func testFunctions() {
- let geoJSONSource = MGLGeoJSONSource(identifier: "test", shape: nil, options: nil)
+ let geoJSONSource = MGLShapeSource(identifier: "test", shape: nil, options: nil)
let symbolStyleLayer = MGLSymbolStyleLayer(identifier: "test", source: geoJSONSource)
// Boolean
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m
index 13019ffdfc..fc8d848a0a 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.m
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m
@@ -11,7 +11,7 @@
- (void)testSymbolLayer {
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];
MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
[self.mapView.style addLayer:layer];