Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release-ios-v3.4.0' into 1ec5-release-ios-v3.4.0-beta.4…
Browse files Browse the repository at this point in the history
…-master
  • Loading branch information
1ec5 committed Dec 2, 2016
2 parents 687f704 + 9eb7f88 commit d0c1d93
Show file tree
Hide file tree
Showing 26 changed files with 188 additions and 34 deletions.
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLBackgroundStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ - (instancetype)initWithIdentifier:(NSString *)identifier

- (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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLCircleStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ - (NSPredicate *)predicate

- (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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLFillStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ - (NSPredicate *)predicate

- (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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLGeoJSONSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ - (instancetype)initWithIdentifier:(NSString *)identifier features:(NSArray<id<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));
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLLineStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ - (NSPredicate *)predicate

- (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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLRasterSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ - (void)commonInit

- (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));
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLRasterStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ - (instancetype)initWithIdentifier:(NSString *)identifier source:(MGLSource *)so

- (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];
}

Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/src/MGLRuntimeStylingTests.m.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGL<%- camelize(type) %>LayerTests : MGLMapViewTests
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
@end

@implementation MGL<%- camelize(type) %>LayerTests
Expand Down
21 changes: 21 additions & 0 deletions platform/darwin/src/MGLStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ static const NSInteger MGLStyleDefaultVersion = 9;

/**
Adds a new source to the current style.
@note Adding the same source instance more than once will result in a
`MGLRedundantSourceException`. Reusing the same source identifier, even with
different source instances, will result in a
`MGLRedundantSourceIdentiferException`.
@param source The source to add to the current style.
*/
Expand Down Expand Up @@ -247,6 +252,10 @@ static const NSInteger MGLStyleDefaultVersion = 9;
/**
Adds a new layer on top of existing layers.
@note Adding the same layer instance more than once will result in a
`MGLRedundantLayerException`. Reusing the same layer identifer, even with
different layer instances, will also result in an exception.
@param layer The layer object to add to the map view. This object must be an
instance of a concrete subclass of `MGLStyleLayer`.
*/
Expand All @@ -255,6 +264,10 @@ 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 will result in a
`MGLRedundantLayerException`. Reusing the same layer identifer, even with
different layer instances, will also result in an exception.
@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
Expand All @@ -272,6 +285,10 @@ 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.
Inserting the same layer instance more than once will result in a
`MGLRedundantLayerException`. Reusing the same layer identifer, even with
different layer instances, will also result in an exception.
@param layer The layer to insert.
@param sibling An existing layer in the style.
Expand All @@ -288,6 +305,10 @@ 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.
Inserting the same layer instance more than once will result in a
`MGLRedundantLayerException`. Reusing the same layer identifer, even with
different layer instances, will also result in an exception.
@param layer The layer to insert.
@param sibling An existing layer in the style.
Expand Down
3 changes: 2 additions & 1 deletion platform/darwin/src/MGLStyle.mm
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ - (void)addSource:(MGLSource *)source
@"Make sure the source was created as a member of a concrete subclass of MGLSource.",
source];
}

try {
[source addToMapView:self.mapView];
} catch (std::runtime_error & err) {
[NSException raise:@"Could not add source" format:@"%s", err.what()];
[NSException raise:@"MGLRedundantSourceIdentiferException" format:@"%s", err.what()];
}
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLStyleLayer.mm.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLSymbolStyleLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ - (NSPredicate *)predicate

- (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];
}

Expand Down
6 changes: 6 additions & 0 deletions platform/darwin/src/MGLVectorSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ - (void)commonInit

- (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));
}

Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLBackgroundStyleLayerTests.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGLBackgroundLayerTests : MGLMapViewTests
@interface MGLBackgroundLayerTests : MGLStyleLayerTests
@end

@implementation MGLBackgroundLayerTests
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLCircleStyleLayerTests.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGLCircleLayerTests : MGLMapViewTests
@interface MGLCircleLayerTests : MGLStyleLayerTests
@end

@implementation MGLCircleLayerTests
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLFillStyleLayerTests.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGLFillLayerTests : MGLMapViewTests
@interface MGLFillLayerTests : MGLStyleLayerTests
@end

@implementation MGLFillLayerTests
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLFilterTests.mm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

#import "NSPredicate+MGLAdditions.h"
#import "MGLValueEvaluator.h"


@interface MGLFilterTests : MGLMapViewTests {
@interface MGLFilterTests : MGLStyleLayerTests {
MGLGeoJSONSource *source;
MGLLineStyleLayer *layer;
}
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLLineStyleLayerTests.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGLLineLayerTests : MGLMapViewTests
@interface MGLLineLayerTests : MGLStyleLayerTests
@end

@implementation MGLLineLayerTests
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/test/MGLRasterStyleLayerTests.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@interface MGLRasterLayerTests : MGLMapViewTests
@interface MGLRasterLayerTests : MGLStyleLayerTests
@end

@implementation MGLRasterLayerTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#import "MGLRuntimeStylingHelper.h"
#import <XCTest/XCTest.h>

@interface MGLMapViewTests : XCTestCase <MGLMapViewDelegate>
@interface MGLStyleLayerTests : XCTestCase <MGLMapViewDelegate>

@property (nonatomic) IBOutlet MGLMapView *mapView;
@property (nonatomic) XCTestExpectation *expectation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "MGLMapViewTests.h"
#import "MGLStyleLayerTests.h"

@implementation MGLMapViewTests
@implementation MGLStyleLayerTests

- (void)setUp {
[super setUp];
Expand All @@ -14,7 +14,7 @@ - (void)setUp {
_mapView.delegate = self;
#else
[MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"];
NSWindowController *windowController = [[NSWindowController alloc] initWithWindowNibName:@"MGLMapViewTests" owner:self];
NSWindowController *windowController = [[NSWindowController alloc] initWithWindowNibName:@"MGLStyleLayerTests" owner:self];
[windowController showWindow:nil];
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MGLMapViewTests">
<customObject id="-2" userLabel="File's Owner" customClass="MGLStyleLayerTests">
<connections>
<outlet property="mapView" destination="6RL-d9-juy" id="0ch-aR-Um6"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="MGLMapViewTests" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<window title="MGLStyleLayerTests" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="256" height="256"/>
Expand Down
Loading

0 comments on commit d0c1d93

Please sign in to comment.