blob: 3d8a11101e88d9cb9a53dfb63c873dab76bbf1f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#import "MGLRasterSource.h"
#import "MGLSource_Private.h"
#import "MGLTileSet_Private.h"
#import "NSURL+MGLAdditions.h"
#include <mbgl/style/sources/raster_source.hpp>
@implementation MGLRasterSource
- (instancetype)initWithSourceIdentifier:(NSString *)sourceIdentifier URL:(NSURL *)url tileSize:(CGFloat)tileSize
{
if (self = [super initWithSourceIdentifier:sourceIdentifier]) {
_URL = url;
_tileSize = tileSize;
}
return self;
}
- (instancetype)initWithSourceIdentifier:(NSString *)sourceIdentifier tileSet:(MGLTileSet *)tileSet tileSize:(CGFloat)tileSize;
{
if (self = [super initWithSourceIdentifier:sourceIdentifier])
{
_tileSet = tileSet;
_tileSize = tileSize;
}
return self;
}
- (std::unique_ptr<mbgl::style::Source>)mbglSource
{
std::unique_ptr<mbgl::style::RasterSource> source;
if (self.URL)
{
source = std::make_unique<mbgl::style::RasterSource>(self.sourceIdentifier.UTF8String,
self.URL.mgl_URLByStandardizingScheme.absoluteString.UTF8String,
uint16_t(self.tileSize));
}
else
{
source = std::make_unique<mbgl::style::RasterSource>(self.sourceIdentifier.UTF8String,
self.tileSet.mbglTileset,
uint16_t(self.tileSize));
}
return std::move(source);
}
@end
|