summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLGeoJSONSource.mm6
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLRasterSource.mm6
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLStyle.h15
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs6
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm6
-rw-r--r--platform/darwin/src/MGLVectorSource.mm6
11 files changed, 75 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index c8f8b39b3e..253414852a 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -35,6 +35,12 @@
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 7768ff66c9..91f91a7bcd 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -75,6 +75,12 @@ namespace mbgl {
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index d1a96f7230..87a5144c6b 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -70,6 +70,12 @@ namespace mbgl {
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLGeoJSONSource.mm b/platform/darwin/src/MGLGeoJSONSource.mm
index f7cd6be7df..8b37ba47cd 100644
--- a/platform/darwin/src/MGLGeoJSONSource.mm
+++ b/platform/darwin/src/MGLGeoJSONSource.mm
@@ -61,6 +61,12 @@ const MGLGeoJSONSourceOption MGLGeoJSONSourceOptionSimplificationTolerance = @"M
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingSource == nullptr) {
+ [NSException raise:@"MGLRedundantSourceException"
+ format:@"This instance %@ was already added to %@. Adding the same source instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
mapView.mbglMap->addSource(std::move(_pendingSource));
}
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index a7ed2fc100..b155ec65d6 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -82,6 +82,12 @@ namespace mbgl {
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterSource.mm
index 53caae5af9..62472050e3 100644
--- a/platform/darwin/src/MGLRasterSource.mm
+++ b/platform/darwin/src/MGLRasterSource.mm
@@ -62,6 +62,12 @@
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingSource == nullptr) {
+ [NSException raise:@"MGLRedundantSourceException"
+ format:@"This instance %@ was already added to %@. Adding the same source instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
mapView.mbglMap->addSource(std::move(_pendingSource));
}
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 24dba21c71..3b2c3bd83b 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -34,6 +34,12 @@
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 10fad0196e..31808290f9 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -200,6 +200,9 @@ static const NSInteger MGLStyleDefaultVersion = 9;
/**
Adds a new source to the current style.
+ @note Adding the same source instance more than once or reusing source
+ identifers in the sources you add will trigger exceptions.
+
@param source The source to add to the current style.
*/
- (void)addSource:(MGLSource *)source;
@@ -247,6 +250,9 @@ static const NSInteger MGLStyleDefaultVersion = 9;
/**
Adds a new layer on top of existing layers.
+ @note Adding the same layer instance more than once or reusing layer
+ identifers in the layers you add will trigger exceptions.
+
@param layer The layer object to add to the map view. This object must be an
instance of a concrete subclass of `MGLStyleLayer`.
*/
@@ -255,6 +261,9 @@ static const NSInteger MGLStyleDefaultVersion = 9;
/**
Inserts a new layer into the style at the given index.
+ @note Adding the same layer instance more than once or reusing layer
+ identifers in the layers you add will trigger exceptions.
+
@param layer The layer to insert.
@param index The index at which to insert the layer. An index of 0 would send
the layer to the back; an index equal to the number of objects in the
@@ -272,6 +281,9 @@ static const NSInteger MGLStyleDefaultVersion = 9;
inspectable in Interface Builder, or a manually constructed `NSURL`. This
approach also avoids layer identifer name changes that will occur in the default
style’s layers over time.
+
+ Adding the same layer instance more than once or reusing layer identifers in
+ the layers you add will trigger exceptions.
@param layer The layer to insert.
@param sibling An existing layer in the style.
@@ -288,6 +300,9 @@ static const NSInteger MGLStyleDefaultVersion = 9;
inspectable in Interface Builder, or a manually constructed `NSURL`. This
approach also avoids layer identifer name changes that will occur in the default
style’s layers over time.
+
+ Adding the same layer instance more than once or reusing layer identifers in
+ the layers you add will trigger exceptions.
@param layer The layer to insert.
@param sibling An existing layer in the style.
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index 85a1af9970..c89912c1ff 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -112,6 +112,12 @@ namespace mbgl {
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 29fe322181..d1d66f8ffb 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -129,6 +129,12 @@ namespace mbgl {
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingLayer == nullptr) {
+ [NSException raise:@"MGLRedundantLayerException"
+ format:@"This instance %@ was already added to %@. Adding the same layer instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
[self addToMapView:mapView belowLayer:nil];
}
diff --git a/platform/darwin/src/MGLVectorSource.mm b/platform/darwin/src/MGLVectorSource.mm
index ae69456b45..ab68d45ba1 100644
--- a/platform/darwin/src/MGLVectorSource.mm
+++ b/platform/darwin/src/MGLVectorSource.mm
@@ -59,6 +59,12 @@
- (void)addToMapView:(MGLMapView *)mapView
{
+ if (_pendingSource == nullptr) {
+ [NSException raise:@"MGLRedundantSourceException"
+ format:@"This instance %@ was already added to %@. Adding the same source instance " \
+ "to the style more than once is invalid.", self, mapView.style];
+ }
+
mapView.mbglMap->addSource(std::move(_pendingSource));
}