summaryrefslogtreecommitdiff
path: root/platform/ios/MGLStyle.mm
blob: 15a25db9e343a8e548ea68aa6c341da8eeb70231 (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
#import "MGLStyle.h"

#import <mbgl/util/default_styles.hpp>

@implementation MGLStyle

// name is lowercase
#define MGL_DEFINE_STYLE(name) \
    static NSURL *MGLStyleURL_##name; \
    + (NSURL *)name##StyleURL { \
        static dispatch_once_t onceToken; \
        dispatch_once(&onceToken, ^{ \
            MGLStyleURL_##name = [NSURL URLWithString:@(mbgl::util::default_styles::name.url)]; \
        }); \
        return MGLStyleURL_##name; \
    }

MGL_DEFINE_STYLE(streets)
MGL_DEFINE_STYLE(emerald)
MGL_DEFINE_STYLE(light)
MGL_DEFINE_STYLE(dark)
MGL_DEFINE_STYLE(satellite)
MGL_DEFINE_STYLE(hybrid)

// Make sure all the styles listed in mbgl::util::default_styles::orderedStyles
// are defined above and also declared in MGLStyle.h.
static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
              "mbgl::util::default_styles::orderedStyles and MGLStyle have different numbers of styles.");

@end