summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-09-17 23:37:24 -0400
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-09-18 16:21:59 +0300
commita6618dc0f938598f88c9650ef099f37681abed28 (patch)
tree8ac5a8e644a1e3b1d056c11f51fd7f2505c78a91 /platform
parent461358be4b6edc7d49a3ed6a36bdd0cd186241a2 (diff)
downloadqtlocation-mapboxgl-a6618dc0f938598f88c9650ef099f37681abed28.tar.gz
[ios] Speculative fix for failing test: MGLDocumentationExampleTests.testMGLHillshadeStyleLayer()
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/src/MGLRasterDEMSource.mm11
-rw-r--r--platform/darwin/src/MGLRasterTileSource.mm15
-rw-r--r--platform/darwin/src/MGLRasterTileSource_Private.h4
3 files changed, 16 insertions, 14 deletions
diff --git a/platform/darwin/src/MGLRasterDEMSource.mm b/platform/darwin/src/MGLRasterDEMSource.mm
index 27614b9ef4..753499ff94 100644
--- a/platform/darwin/src/MGLRasterDEMSource.mm
+++ b/platform/darwin/src/MGLRasterDEMSource.mm
@@ -7,11 +7,10 @@
@implementation MGLRasterDEMSource
-- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize {
- NSString *configurationURLString = configurationURL.mgl_URLByStandardizingScheme.absoluteString;
- return std::make_unique<mbgl::style::RasterDEMSource>(identifier.UTF8String,
- configurationURLString.UTF8String,
- uint16_t(round(tileSize)));
+- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier urlOrTileset:(mbgl::variant<std::string, mbgl::Tileset>)urlOrTileset tileSize:(uint16_t)tileSize {
+ auto source = std::make_unique<mbgl::style::RasterDEMSource>(identifier.UTF8String,
+ urlOrTileset,
+ tileSize);
+ return source;
}
-
@end
diff --git a/platform/darwin/src/MGLRasterTileSource.mm b/platform/darwin/src/MGLRasterTileSource.mm
index e89367711e..540e27ad7d 100644
--- a/platform/darwin/src/MGLRasterTileSource.mm
+++ b/platform/darwin/src/MGLRasterTileSource.mm
@@ -33,15 +33,16 @@ static const CGFloat MGLRasterTileSourceRetinaTileSize = 512;
}
- (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize {
- auto source = [self pendingSourceWithIdentifier:identifier configurationURL:configurationURL tileSize:tileSize];
+ NSString *configurationURLString = configurationURL.mgl_URLByStandardizingScheme.absoluteString;
+ auto source = [self pendingSourceWithIdentifier:identifier urlOrTileset:configurationURLString.UTF8String tileSize:tileSize];
return self = [super initWithPendingSource:std::move(source)];
}
-- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize {
- NSString *configurationURLString = configurationURL.mgl_URLByStandardizingScheme.absoluteString;
- return std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String,
- configurationURLString.UTF8String,
- uint16_t(round(tileSize)));
+- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier urlOrTileset:(mbgl::variant<std::string, mbgl::Tileset>)urlOrTileset tileSize:(uint16_t)tileSize {
+ auto source = std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String,
+ urlOrTileset,
+ tileSize);
+ return source;
}
- (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NSArray<NSString *> *)tileURLTemplates options:(nullable NSDictionary<MGLTileSourceOption, id> *)options {
@@ -56,7 +57,7 @@ static const CGFloat MGLRasterTileSourceRetinaTileSize = 512;
tileSize = static_cast<uint16_t>(round(tileSizeNumber.doubleValue));
}
- auto source = std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String, tileSet, tileSize);
+ auto source = [self pendingSourceWithIdentifier:identifier urlOrTileset:tileSet tileSize:tileSize];
return self = [super initWithPendingSource:std::move(source)];
}
diff --git a/platform/darwin/src/MGLRasterTileSource_Private.h b/platform/darwin/src/MGLRasterTileSource_Private.h
index 8502b811e2..55f342c7ff 100644
--- a/platform/darwin/src/MGLRasterTileSource_Private.h
+++ b/platform/darwin/src/MGLRasterTileSource_Private.h
@@ -1,8 +1,10 @@
#import "MGLRasterTileSource.h"
#include <memory>
+#include <mbgl/util/variant.hpp>
namespace mbgl {
+ class Tileset;
namespace style {
class RasterSource;
}
@@ -14,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly, nullable) mbgl::style::RasterSource *rawSource;
-- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL tileSize:(CGFloat)tileSize;
+- (std::unique_ptr<mbgl::style::RasterSource>)pendingSourceWithIdentifier:(NSString *)identifier urlOrTileset:(mbgl::variant<std::string, mbgl::Tileset>)urlOrTileset tileSize:(uint16_t)tileSize;
@end