diff options
Diffstat (limited to 'platform/darwin/src/MGLTileSet.mm')
-rw-r--r-- | platform/darwin/src/MGLTileSet.mm | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/platform/darwin/src/MGLTileSet.mm b/platform/darwin/src/MGLTileSet.mm deleted file mode 100644 index 6afc6c19af..0000000000 --- a/platform/darwin/src/MGLTileSet.mm +++ /dev/null @@ -1,101 +0,0 @@ -#import "MGLTileSet.h" - -#import "MGLAttributionInfo.h" - -#include <mbgl/util/tileset.hpp> - -@implementation MGLTileSet - -- (instancetype)initWithTileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates -{ - if (self = [super init]) - { - _tileURLTemplates = tileURLTemplates; - } - return self; -} - -- (instancetype)initWithTileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates minimumZoomLevel:(NSUInteger)minimumZoomLevel maximumZoomLevel:(NSUInteger)maximumZoomLevel -{ - if (minimumZoomLevel > maximumZoomLevel) - { - [[NSException exceptionWithName:@"Invalid minimumZoomLevel" - reason:@"minimumZoomLevel must be less than maximumZoomLevel" - userInfo:nil] raise]; - return nil; - } - - if (self = [super init]) - { - _tileURLTemplates = tileURLTemplates; - _minimumZoomLevel = @(minimumZoomLevel); - _maximumZoomLevel = @(maximumZoomLevel); - } - return self; -} - -- (void)setMinimumZoomLevel:(NSNumber *)minimumZoomLevel -{ - if (self.maximumZoomLevel && [minimumZoomLevel integerValue] > [self.maximumZoomLevel integerValue]) - { - [[NSException exceptionWithName:@"Invalid minimumZoomLevel" - reason:@"minimumZoomLevel must be less than maximumZoomLevel" - userInfo:nil] raise]; - return; - } - - _minimumZoomLevel = minimumZoomLevel; -} - -- (void)setMaximumZoomLevel:(NSNumber *)maximumZoomLevel -{ - if (self.maximumZoomLevel && [maximumZoomLevel integerValue] < [self.maximumZoomLevel integerValue]) - { - [[NSException exceptionWithName:@"Invalid minimumZoomLevel" - reason:@"minimumZoomLevel must be less than maximumZoomLevel" - userInfo:nil] raise]; - } - - _maximumZoomLevel = maximumZoomLevel; -} - -- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor { - return [MGLAttributionInfo attributionInfosFromHTMLString:self.attribution - fontSize:fontSize - linkColor:linkColor]; -} - -- (mbgl::Tileset)mbglTileset -{ - mbgl::Tileset tileset; - - for (NSString *tileURLTemplate in self.tileURLTemplates) - { - tileset.tiles.push_back(tileURLTemplate.UTF8String); - } - - // set the minimum / maximum zoom range to the values specified by this class if they - // were set. otherwise, use the core objects default values - uint8_t minimumZoomLevel = self.minimumZoomLevel ? [self.minimumZoomLevel unsignedIntegerValue] : tileset.zoomRange.min; - uint8_t maximumZoomLevel = self.minimumZoomLevel ? [self.maximumZoomLevel unsignedIntegerValue] : tileset.zoomRange.max; - tileset.zoomRange = mbgl::Range<uint8_t>(minimumZoomLevel, maximumZoomLevel); - - if (self.attribution) - { - tileset.attribution = self.attribution.UTF8String; - } - - if (self.scheme == MGLTileSetSchemeTMS) { - tileset.scheme = mbgl::Tileset::Scheme::TMS; - } - - return tileset; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p; tileURLTemplates = %@>", - NSStringFromClass([self class]), (void *)self, self.tileURLTemplates]; -} - -@end |