summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/mbgl/storage/reachability.h95
-rw-r--r--platform/darwin/mbgl/storage/reachability.m (renamed from platform/darwin/src/reachability.m)2
-rw-r--r--platform/darwin/resources/zh-Hans.lproj/Foundation.strings291
-rwxr-xr-xplatform/darwin/scripts/check-public-symbols.js83
-rw-r--r--platform/darwin/scripts/generate-style-code.js15
-rw-r--r--platform/darwin/src/MGLAccountManager.h3
-rw-r--r--platform/darwin/src/MGLAttributionInfo.h2
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm3
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h43
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm46
-rw-r--r--platform/darwin/src/MGLClockDirectionFormatter.h3
-rw-r--r--platform/darwin/src/MGLCompassDirectionFormatter.h3
-rw-r--r--platform/darwin/src/MGLCoordinateFormatter.h3
-rw-r--r--platform/darwin/src/MGLFeature.h8
-rw-r--r--platform/darwin/src/MGLFeature_Private.h2
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm4
-rw-r--r--platform/darwin/src/MGLForegroundStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLFoundation.h5
-rw-r--r--platform/darwin/src/MGLGeometry.h4
-rw-r--r--platform/darwin/src/MGLGeometry.mm8
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm4
-rw-r--r--platform/darwin/src/MGLMapCamera.h3
-rw-r--r--platform/darwin/src/MGLMultiPoint.h2
-rw-r--r--platform/darwin/src/MGLOfflinePack.h2
-rw-r--r--platform/darwin/src/MGLOfflineStorage.h24
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer.h3
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer.mm2
-rw-r--r--platform/darwin/src/MGLPointAnnotation.h2
-rw-r--r--platform/darwin/src/MGLPointCollection.h2
-rw-r--r--platform/darwin/src/MGLPolygon.h3
-rw-r--r--platform/darwin/src/MGLPolyline.h3
-rw-r--r--platform/darwin/src/MGLRasterSource.h8
-rw-r--r--platform/darwin/src/MGLRasterSource.mm2
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm3
-rw-r--r--platform/darwin/src/MGLShape.h2
-rw-r--r--platform/darwin/src/MGLShapeCollection.h2
-rw-r--r--platform/darwin/src/MGLShapeSource.h14
-rw-r--r--platform/darwin/src/MGLShapeSource.mm2
-rw-r--r--platform/darwin/src/MGLShapeSource_Private.h3
-rw-r--r--platform/darwin/src/MGLSource.h3
-rw-r--r--platform/darwin/src/MGLStyle.h4
-rw-r--r--platform/darwin/src/MGLStyle.mm8
-rw-r--r--platform/darwin/src/MGLStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs2
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs6
-rw-r--r--platform/darwin/src/MGLStyleLayer_Private.h1
-rw-r--r--platform/darwin/src/MGLStyleValue.h5
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h2
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm4
-rw-r--r--platform/darwin/src/MGLTilePyramidOfflineRegion.h2
-rw-r--r--platform/darwin/src/MGLTileSource.h16
-rw-r--r--platform/darwin/src/MGLTileSource_Private.h6
-rw-r--r--platform/darwin/src/MGLTypes.h4
-rw-r--r--platform/darwin/src/MGLVectorSource.h2
-rw-r--r--platform/darwin/src/MGLVectorSource.mm2
-rw-r--r--platform/darwin/src/MGLVectorStyleLayer.h2
-rw-r--r--platform/darwin/src/NSDate+MGLAdditions.h1
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.mm3
-rw-r--r--platform/darwin/src/headless_backend_cgl.cpp64
-rw-r--r--platform/darwin/src/headless_backend_eagl.mm44
-rw-r--r--platform/darwin/src/headless_display_cgl.cpp52
-rw-r--r--platform/darwin/src/image.mm22
-rw-r--r--platform/darwin/src/logging_nslog.mm (renamed from platform/darwin/src/log_nslog.mm)2
-rw-r--r--platform/darwin/src/nsthread.mm2
-rw-r--r--platform/darwin/src/string_nsstring.mm2
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm107
-rw-r--r--platform/darwin/test/MGLFeatureTests.mm2
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm2
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm8
-rw-r--r--platform/darwin/test/MGLVersionNumber.m15
76 files changed, 1005 insertions, 117 deletions
diff --git a/platform/darwin/mbgl/storage/reachability.h b/platform/darwin/mbgl/storage/reachability.h
new file mode 100644
index 0000000000..78e302eafc
--- /dev/null
+++ b/platform/darwin/mbgl/storage/reachability.h
@@ -0,0 +1,95 @@
+/*
+ Copyright (c) 2011, Tony Million.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+#import <SystemConfiguration/SystemConfiguration.h>
+
+
+/**
+ * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
+ *
+ * @see http://nshipster.com/ns_enum-ns_options/
+ **/
+#ifndef NS_ENUM
+#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
+#endif
+
+extern NSString *const kMGLReachabilityChangedNotification;
+
+typedef NS_ENUM(NSInteger, NetworkStatus) {
+ // Apple NetworkStatus Compatible Names.
+ NotReachable = 0,
+ ReachableViaWiFi = 2,
+ ReachableViaWWAN = 1
+};
+
+@class MGLReachability;
+
+typedef void (^NetworkReachable)(MGLReachability * reachability);
+typedef void (^NetworkUnreachable)(MGLReachability * reachability);
+
+
+@interface MGLReachability : NSObject
+
+@property (nonatomic, copy) NetworkReachable reachableBlock;
+@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
+
+@property (nonatomic, assign) BOOL reachableOnWWAN;
+
+
++(instancetype)reachabilityWithHostname:(NSString*)hostname;
+// This is identical to the function above, but is here to maintain
+//compatibility with Apples original code. (see .m)
++(instancetype)reachabilityWithHostName:(NSString*)hostname;
++(instancetype)reachabilityForInternetConnection;
++(instancetype)reachabilityWithAddress:(void *)hostAddress;
++(instancetype)reachabilityForLocalWiFi;
+
+-(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
+
+-(BOOL)startNotifier;
+-(void)stopNotifier;
+
+-(BOOL)isReachable;
+-(BOOL)isReachableViaWWAN;
+-(BOOL)isReachableViaWiFi;
+
+// WWAN may be available, but not active until a connection has been established.
+// WiFi may require a connection for VPN on Demand.
+-(BOOL)isConnectionRequired; // Identical DDG variant.
+-(BOOL)connectionRequired; // Apple's routine.
+// Dynamic, on demand connection?
+-(BOOL)isConnectionOnDemand;
+// Is user intervention required?
+-(BOOL)isInterventionRequired;
+
+-(NetworkStatus)currentReachabilityStatus;
+-(SCNetworkReachabilityFlags)reachabilityFlags;
+-(NSString*)currentReachabilityString;
+-(NSString*)currentReachabilityFlags;
+
+@end
diff --git a/platform/darwin/src/reachability.m b/platform/darwin/mbgl/storage/reachability.m
index 8abcf5ae6d..aa6746a2a9 100644
--- a/platform/darwin/src/reachability.m
+++ b/platform/darwin/mbgl/storage/reachability.m
@@ -25,7 +25,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#import <mbgl/platform/darwin/reachability.h>
+#import <mbgl/storage/reachability.h>
#import <sys/socket.h>
#import <netinet/in.h>
diff --git a/platform/darwin/resources/zh-Hans.lproj/Foundation.strings b/platform/darwin/resources/zh-Hans.lproj/Foundation.strings
new file mode 100644
index 0000000000..7dec6184e5
--- /dev/null
+++ b/platform/darwin/resources/zh-Hans.lproj/Foundation.strings
@@ -0,0 +1,291 @@
+/* Clock position format, long: {hours} o’clock */
+"CLOCK_FMT_LONG" = "%@点";
+
+/* Clock position format, medium: {hours} o’clock */
+"CLOCK_FMT_MEDIUM" = "%@点";
+
+/* Clock position format, short: {hours}:00 */
+"CLOCK_FMT_SHORT" = "%@:00";
+
+/* East, long */
+"COMPASS_E_LONG" = "东";
+
+/* East, short */
+"COMPASS_E_SHORT" = "东";
+
+/* East by north, long */
+"COMPASS_EbN_LONG" = "东微北";
+
+/* East by north, short */
+"COMPASS_EbN_SHORT" = "东微北";
+
+/* East by south, long */
+"COMPASS_EbS_LONG" = "东微南";
+
+/* East by south, short */
+"COMPASS_EbS_SHORT" = "东微南";
+
+/* East-northeast, long */
+"COMPASS_ENE_LONG" = "东北偏东";
+
+/* East-northeast, short */
+"COMPASS_ENE_SHORT" = "东北偏东";
+
+/* East-southeast, long */
+"COMPASS_ESE_LONG" = "东南偏东";
+
+/* East-southeast, short */
+"COMPASS_ESE_SHORT" = "东南偏东";
+
+/* North, long */
+"COMPASS_N_LONG" = "北";
+
+/* North, short */
+"COMPASS_N_SHORT" = "北";
+
+/* North by east, long */
+"COMPASS_NbE_LONG" = "北微东";
+
+/* North by east, short */
+"COMPASS_NbE_SHORT" = "北微东";
+
+/* North by west, long */
+"COMPASS_NbW_LONG" = "北微西";
+
+/* North by west, short */
+"COMPASS_NbW_SHORT" = "北微西";
+
+/* Northeast, long */
+"COMPASS_NE_LONG" = "东北";
+
+/* Northeast, short */
+"COMPASS_NE_SHORT" = "东北";
+
+/* Northeast by east, long */
+"COMPASS_NEbE_LONG" = "东北微东";
+
+/* Northeast by east, short */
+"COMPASS_NEbE_SHORT" = "东北微东";
+
+/* Northeast by north, long */
+"COMPASS_NEbN_LONG" = "东北微北";
+
+/* Northeast by north, short */
+"COMPASS_NEbN_SHORT" = "东北微北";
+
+/* North-northeast, long */
+"COMPASS_NNE_LONG" = "东北偏北";
+
+/* North-northeast, short */
+"COMPASS_NNE_SHORT" = "东北偏北";
+
+/* North-northwest, long */
+"COMPASS_NNW_LONG" = "西北偏北";
+
+/* North-northwest, short */
+"COMPASS_NNW_SHORT" = "西北偏北";
+
+/* Northwest, long */
+"COMPASS_NW_LONG" = "西北";
+
+/* Northwest, short */
+"COMPASS_NW_SHORT" = "西北";
+
+/* Northwest by north, long */
+"COMPASS_NWbN_LONG" = "西北微北";
+
+/* Northwest by north, short */
+"COMPASS_NWbN_SHORT" = "西北微北";
+
+/* Northwest by west, long */
+"COMPASS_NWbW_LONG" = "西北微西";
+
+/* Northwest by west, short */
+"COMPASS_NWbW_SHORT" = "西北微西";
+
+/* South, long */
+"COMPASS_S_LONG" = "南";
+
+/* South, short */
+"COMPASS_S_SHORT" = "南";
+
+/* South by east, long */
+"COMPASS_SbE_LONG" = "南微东";
+
+/* South by east, short */
+"COMPASS_SbE_SHORT" = "南微东";
+
+/* South by west, long */
+"COMPASS_SbW_LONG" = "南微西";
+
+/* South by west, short */
+"COMPASS_SbW_SHORT" = "南微西";
+
+/* Southeast, long */
+"COMPASS_SE_LONG" = "东南";
+
+/* Southeast, short */
+"COMPASS_SE_SHORT" = "东南";
+
+/* Southeast by east, long */
+"COMPASS_SEbE_LONG" = "东南微东";
+
+/* Southeast by east, short */
+"COMPASS_SEbE_SHORT" = "东南微东";
+
+/* Southeast by south, long */
+"COMPASS_SEbS_LONG" = "东南微南";
+
+/* Southeast by south, short */
+"COMPASS_SEbS_SHORT" = "东南微南";
+
+/* South-southeast, long */
+"COMPASS_SSE_LONG" = "东南偏南";
+
+/* South-southeast, short */
+"COMPASS_SSE_SHORT" = "东南偏南";
+
+/* South-southwest, long */
+"COMPASS_SSW_LONG" = "西南偏南";
+
+/* South-southwest, short */
+"COMPASS_SSW_SHORT" = "西南偏南";
+
+/* Southwest, long */
+"COMPASS_SW_LONG" = "西南";
+
+/* Southwest, short */
+"COMPASS_SW_SHORT" = "西南";
+
+/* Southwest by south, long */
+"COMPASS_SWbS_LONG" = "西南偏南";
+
+/* Southwest by south, short */
+"COMPASS_SWbS_SHORT" = "西南偏南";
+
+/* Southwest by west, long */
+"COMPASS_SWbW_LONG" = "西南偏西";
+
+/* Southwest by west, short */
+"COMPASS_SWbW_SHORT" = "西南偏西";
+
+/* West, long */
+"COMPASS_W_LONG" = "西";
+
+/* West, short */
+"COMPASS_W_SHORT" = "西";
+
+/* West by north, long */
+"COMPASS_WbN_LONG" = "西微北";
+
+/* West by north, short */
+"COMPASS_WbN_SHORT" = "西微北";
+
+/* West by south, long */
+"COMPASS_WbS_LONG" = "西微南";
+
+/* West by south, short */
+"COMPASS_WbS_SHORT" = "西微南";
+
+/* West-northwest, long */
+"COMPASS_WNW_LONG" = "西北偏西";
+
+/* West-northwest, short */
+"COMPASS_WNW_SHORT" = "西北偏西";
+
+/* West-southwest, long */
+"COMPASS_WSW_LONG" = "西南偏西";
+
+/* West-southwest, short */
+"COMPASS_WSW_SHORT" = "西南偏西";
+
+/* Degrees format, long */
+"COORD_DEG_LONG" = "%d度";
+
+/* Degrees format, medium: {degrees} */
+"COORD_DEG_MEDIUM" = "%d°";
+
+/* Degrees format, short: {degrees} */
+"COORD_DEG_SHORT" = "%d°";
+
+/* Coordinate format, long: {degrees}{minutes} */
+"COORD_DM_LONG" = "%1$@度%2$@分";
+
+/* Coordinate format, medium: {degrees}{minutes} */
+"COORD_DM_MEDIUM" = "%1$@度%2$@";
+
+/* Coordinate format, short: {degrees}{minutes} */
+"COORD_DM_SHORT" = "%1$@%度2$@";
+
+/* Coordinate format, long: {degrees}{minutes}{seconds} */
+"COORD_DMS_LONG" = "%1$@度%2$@分%3$@秒";
+
+/* Coordinate format, medium: {degrees}{minutes}{seconds} */
+"COORD_DMS_MEDIUM" = "%1$@度%2$@分%3$@秒";
+
+/* Coordinate format, short: {degrees}{minutes}{seconds} */
+"COORD_DMS_SHORT" = "%1$@%度2$@分%3$@秒";
+
+/* East longitude format, long: {longitude} */
+"COORD_E_LONG" = "东经%@";
+
+/* East longitude format, medium: {longitude} */
+"COORD_E_MEDIUM" = "东经%@";
+
+/* East longitude format, short: {longitude} */
+"COORD_E_SHORT" = "%@E";
+
+/* Coordinate pair format, long: {latitude}, {longitude} */
+"COORD_FMT_LONG" = "%1$@,%2$@";
+
+/* Coordinate pair format, medium: {latitude}, {longitude} */
+"COORD_FMT_MEDIUM" = "%1$@,%2$@";
+
+/* Coordinate pair format, short: {latitude}, {longitude} */
+"COORD_FMT_SHORT" = "%1$@,%2$@";
+
+/* Minutes format, long */
+"COORD_MIN_LONG" = "%d分";
+
+/* Minutes format, medium: {minutes} */
+"COORD_MIN_MEDIUM" = "%d′";
+
+/* Minutes format, short: {minutes} */
+"COORD_MIN_SHORT" = "%d′";
+
+/* North latitude format, long: {latitude} */
+"COORD_N_LONG" = "北纬%@";
+
+/* North latitude format, medium: {latitude} */
+"COORD_N_MEDIUM" = "北纬%@";
+
+/* North latitude format, short: {latitude} */
+"COORD_N_SHORT" = "%@N";
+
+/* South latitude format, long: {latitude} */
+"COORD_S_LONG" = "南纬%@";
+
+/* South latitude format, medium: {latitude} */
+"COORD_S_MEDIUM" = "南纬%@";
+
+/* South latitude format, short: {latitude} */
+"COORD_S_SHORT" = "%@S";
+
+/* Seconds format, long */
+"COORD_SEC_LONG" = "%d秒";
+
+/* Seconds format, medium: {seconds} */
+"COORD_SEC_MEDIUM" = "%d″";
+
+/* Seconds format, short: {seconds} */
+"COORD_SEC_SHORT" = "%d″";
+
+/* West longitude format, long: {longitude} */
+"COORD_W_LONG" = "西经%@";
+
+/* West longitude format, medium: {longitude} */
+"COORD_W_MEDIUM" = "西经%@";
+
+/* West longitude format, short: {longitude} */
+"COORD_W_SHORT" = "%@W";
+
diff --git a/platform/darwin/scripts/check-public-symbols.js b/platform/darwin/scripts/check-public-symbols.js
new file mode 100755
index 0000000000..4dde5d677b
--- /dev/null
+++ b/platform/darwin/scripts/check-public-symbols.js
@@ -0,0 +1,83 @@
+#!/usr/bin/env node
+
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const execFileSync = require('child_process').execFileSync;
+const _ = require('lodash');
+
+const keyword = /\bMGL_EXPORT\b/;
+
+let scanned = [];
+
+function hasMissingSymbols(os) {
+ let missing = false;
+ let sdk = os === 'iOS' ? 'iphonesimulator' : 'macosx';
+ let sysroot = execFileSync('xcrun', ['--show-sdk-path', '--sdk', sdk]).toString().trim();
+ let umbrellaPath = `platform/${os.toLowerCase()}/src/Mapbox.h`;
+ let docArgs = ['doc', '--objc', umbrellaPath, '--',
+ '-x', 'objective-c', '-I', 'platform/darwin/src/', '-isysroot', sysroot];
+ let docStr = execFileSync('sourcekitten', docArgs).toString().trim();
+ let docJson = JSON.parse(docStr);
+ _.forEach(docJson, function (result) {
+ _.forEach(result, function (structure, path) {
+ // Prevent multiple scans of the same file.
+ if (scanned.indexOf(path) >= 0) return;
+ scanned.push(path);
+
+ const src = fs.readFileSync(path, 'utf8').split('\n');
+ _.forEach(structure['key.substructure'], function (substructure) {
+ switch (substructure['key.kind']) {
+ case 'sourcekitten.source.lang.objc.decl.class':
+ if (!(keyword.test(src[substructure['key.doc.line'] - 1]) || keyword.test(src[substructure['key.doc.line'] - 2]))) {
+ console.warn(`- missing symbol export for class ${substructure['key.name']} in ${path}:${substructure['key.doc.line']}:${substructure['key.doc.column']}`);
+ missing = true;
+ }
+ break;
+ case 'sourcekitten.source.lang.objc.decl.constant':
+ if (!keyword.test(src[substructure['key.doc.line'] - 1])) {
+ console.warn(`- missing symbol export for constant ${substructure['key.name']} in ${path}:${substructure['key.doc.line']}:${substructure['key.doc.column']}`);
+ missing = true;
+ }
+ break;
+ }
+ });
+ });
+ });
+
+ return missing;
+}
+
+function ensureSourceKittenIsInstalled() {
+ try {
+ execFileSync('which', ['sourcekitten']);
+ } catch (e) {
+ console.log(`Installing SourceKitten via Homebrew…`);
+ execFileSync('brew', ['install', 'sourcekitten']);
+ }
+}
+
+if (process.argv.length < 3) {
+ console.warn(`Usage: ${path.relative(process.cwd(), process.argv[1])} [macOS|iOS] ...`);
+ process.exit(1);
+}
+
+ensureSourceKittenIsInstalled();
+
+let missing = false;
+for (var i = 2; i < process.argv.length; i++) {
+ let os = process.argv[i];
+ if (os == 'iOS' || os == 'macOS') {
+ missing |= hasMissingSymbols(os);
+ } else {
+ console.warn(`Argument must be one of iOS or macOS`);
+ process.exit(1);
+ }
+}
+
+if (missing) {
+ process.exit(1);
+} else {
+ console.warn(`All symbols are correctly exported.`);
+}
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index 0266e25890..3998246580 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -4,11 +4,20 @@ const fs = require('fs');
const ejs = require('ejs');
const _ = require('lodash');
const colorParser = require('csscolorparser');
+
+require('../../../scripts/style-code');
+
const cocoaConventions = require('./style-spec-cocoa-conventions-v8.json');
-let spec = _.merge(require('mapbox-gl-style-spec').latest, require('./style-spec-overrides-v8.json'));
const prefix = 'MGL';
const suffix = 'StyleLayer';
+let spec = _.merge(require('mapbox-gl-style-spec').latest, require('./style-spec-overrides-v8.json'));
+
+///
+// Temporarily IGNORE layers that are in the spec yet still not supported in mbgl core
+///
+delete spec.layer.type.values['fill-extrusion'];
+
// Rename properties and keep `original` for use with setters and getters
_.forOwn(cocoaConventions, function (properties, kind) {
_.forOwn(properties, function (newName, oldName) {
@@ -148,7 +157,7 @@ global.mbglTestValue = function (property, layerType) {
return `mbgl::style::${type}Type::${value}`;
}
case 'color':
- return '{ .r = 1, .g = 0, .b = 0, .a = 1 }';
+ return '{ 1, 0, 0, 1 }';
case 'array':
switch (arrayType(property)) {
case 'dasharray':
@@ -558,7 +567,7 @@ for (var layer of layers) {
if (!_.isEmpty(renamedProperties)) {
renamedPropertiesByLayerType[layer.type] = renamedProperties;
}
-
+
fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`, duplicatePlatformDecls(layerH(layer)));
fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`, layerM(layer));
fs.writeFileSync(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.mm`, testLayers(layer));
diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h
index fe602aa210..c1aebd879c 100644
--- a/platform/darwin/src/MGLAccountManager.h
+++ b/platform/darwin/src/MGLAccountManager.h
@@ -1,11 +1,14 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
The MGLAccountManager object provides a global way to set a Mapbox API access
token.
*/
+MGL_EXPORT
@interface MGLAccountManager : NSObject
#pragma mark Authorizing Access
diff --git a/platform/darwin/src/MGLAttributionInfo.h b/platform/darwin/src/MGLAttributionInfo.h
index 3c9df47912..c4e037059e 100644
--- a/platform/darwin/src/MGLAttributionInfo.h
+++ b/platform/darwin/src/MGLAttributionInfo.h
@@ -2,6 +2,7 @@
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -10,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
Information about an attribution statement, usually a copyright or trademark
statement, associated with a map content source.
*/
+MGL_EXPORT
@interface MGLAttributionInfo : NSObject
/**
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index ed797c9f0a..06d7c9ee08 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLStyleLayer.h"
@@ -20,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
If the background style layer is transparent or omitted from the style, any
portion of the map view that does not show another style layer is transparent.
*/
+MGL_EXPORT
@interface MGLBackgroundStyleLayer : MGLStyleLayer
- (instancetype)initWithIdentifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER;
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index f6a00de941..caf8ca9681 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,6 +8,7 @@
#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/background_layer.hpp>
@interface MGLBackgroundStyleLayer ()
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index 1117077d59..8d8c4588e7 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLVectorStyleLayer.h"
@@ -75,6 +76,7 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) {
mapView.style?.addLayer(layer)
```
*/
+MGL_EXPORT
@interface MGLCircleStyleLayer : MGLVectorStyleLayer
#pragma mark - Accessing the Paint Attributes
@@ -146,6 +148,47 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) {
#if TARGET_OS_IPHONE
/**
+ The stroke color of the circle.
+
+ The default value of this property is an `MGLStyleValue` object containing
+ `UIColor.blackColor`. Set this property to `nil` to reset it to the default
+ value.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<UIColor *> *circleStrokeColor;
+#else
+/**
+ The stroke color of the circle.
+
+ The default value of this property is an `MGLStyleValue` object containing
+ `NSColor.blackColor`. Set this property to `nil` to reset it to the default
+ value.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<NSColor *> *circleStrokeColor;
+#endif
+
+/**
+ The opacity of the circle's stroke.
+
+ The default value of this property is an `MGLStyleValue` object containing an
+ `NSNumber` object containing the float `1`. Set this property to `nil` to reset
+ it to the default value.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity;
+
+/**
+ The width of the circle's stroke. Strokes are placed outside of the
+ "circle-radius".
+
+ This property is measured in points.
+
+ The default value of this property is an `MGLStyleValue` object containing an
+ `NSNumber` object containing the float `0`. Set this property to `nil` to reset
+ it to the default value.
+ */
+@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth;
+
+#if TARGET_OS_IPHONE
+/**
The geometry's offset.
This property is measured in points.
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 0aff74ffa6..adc5ed8dd3 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,7 +8,9 @@
#import "MGLStyleValue_Private.h"
#import "MGLCircleStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
+
namespace mbgl {
MBGL_DEFINE_ENUM(MGLCircleScaleAlignment, {
@@ -208,6 +210,48 @@ namespace mbgl {
return self.circleScaleAlignment;
}
+- (void)setCircleStrokeColor:(MGLStyleValue<MGLColor *> *)circleStrokeColor {
+ MGLAssertStyleLayerIsValid();
+
+ auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(circleStrokeColor);
+ self.rawLayer->setCircleStrokeColor(mbglValue);
+}
+
+- (MGLStyleValue<MGLColor *> *)circleStrokeColor {
+ MGLAssertStyleLayerIsValid();
+
+ auto propertyValue = self.rawLayer->getCircleStrokeColor() ?: self.rawLayer->getDefaultCircleStrokeColor();
+ return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
+}
+
+- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
+ MGLAssertStyleLayerIsValid();
+
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleStrokeOpacity);
+ self.rawLayer->setCircleStrokeOpacity(mbglValue);
+}
+
+- (MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
+ MGLAssertStyleLayerIsValid();
+
+ auto propertyValue = self.rawLayer->getCircleStrokeOpacity() ?: self.rawLayer->getDefaultCircleStrokeOpacity();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
+}
+
+- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth {
+ MGLAssertStyleLayerIsValid();
+
+ auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleStrokeWidth);
+ self.rawLayer->setCircleStrokeWidth(mbglValue);
+}
+
+- (MGLStyleValue<NSNumber *> *)circleStrokeWidth {
+ MGLAssertStyleLayerIsValid();
+
+ auto propertyValue = self.rawLayer->getCircleStrokeWidth() ?: self.rawLayer->getDefaultCircleStrokeWidth();
+ return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
+}
+
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
MGLAssertStyleLayerIsValid();
diff --git a/platform/darwin/src/MGLClockDirectionFormatter.h b/platform/darwin/src/MGLClockDirectionFormatter.h
index ea427aa7b1..a428f51c63 100644
--- a/platform/darwin/src/MGLClockDirectionFormatter.h
+++ b/platform/darwin/src/MGLClockDirectionFormatter.h
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -14,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
irrespective of the user’s orientation, use `MGLCompassDirectionFormatter`
instead.
*/
+MGL_EXPORT
@interface MGLClockDirectionFormatter : NSFormatter
/**
diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.h b/platform/darwin/src/MGLCompassDirectionFormatter.h
index fde26ba42a..714e1cc035 100644
--- a/platform/darwin/src/MGLCompassDirectionFormatter.h
+++ b/platform/darwin/src/MGLCompassDirectionFormatter.h
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -12,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
irrespective of the user’s current location. To format a direction relative to
the user’s current location, use `MGLClockDirectionFormatter` instead.
*/
+MGL_EXPORT
@interface MGLCompassDirectionFormatter : NSFormatter
/**
diff --git a/platform/darwin/src/MGLCoordinateFormatter.h b/platform/darwin/src/MGLCoordinateFormatter.h
index 909c1e8935..c42c196d5a 100644
--- a/platform/darwin/src/MGLCoordinateFormatter.h
+++ b/platform/darwin/src/MGLCoordinateFormatter.h
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -8,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
geographic coordinate pairs. Use this class to create localized coordinate
strings when displaying location information to users.
*/
+MGL_EXPORT
@interface MGLCoordinateFormatter : NSFormatter
/**
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h
index 30abcb1934..82dbb450cf 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLPolyline.h"
#import "MGLPolygon.h"
#import "MGLPointAnnotation.h"
@@ -148,6 +149,7 @@ NS_ASSUME_NONNULL_BEGIN
An `MGLPointFeature` object associates a point shape with an optional
identifier and attributes.
*/
+MGL_EXPORT
@interface MGLPointFeature : MGLPointAnnotation <MGLFeature>
@end
@@ -159,6 +161,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
feature in GeoJSON.
*/
+MGL_EXPORT
@interface MGLPolylineFeature : MGLPolyline <MGLFeature>
@end
@@ -166,6 +169,7 @@ NS_ASSUME_NONNULL_BEGIN
An `MGLPolygonFeature` object associates a polygon shape with an optional
identifier and attributes.
*/
+MGL_EXPORT
@interface MGLPolygonFeature : MGLPolygon <MGLFeature>
@end
@@ -177,6 +181,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.3">MultiPoint</a>
feature in GeoJSON.
*/
+MGL_EXPORT
@interface MGLPointCollectionFeature : MGLPointCollection <MGLFeature>
@end
@@ -191,6 +196,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a>
feature in GeoJSON.
*/
+MGL_EXPORT
@interface MGLMultiPolylineFeature : MGLMultiPolyline <MGLFeature>
@end
@@ -198,6 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
An `MGLMultiPolygonFeature` object associates a multipolygon shape with an
optional identifier and attributes.
*/
+MGL_EXPORT
@interface MGLMultiPolygonFeature : MGLMultiPolygon <MGLFeature>
@end
@@ -209,6 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
in GeoJSON.
*/
+MGL_EXPORT
@interface MGLShapeCollectionFeature : MGLShapeCollection <MGLFeature>
@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLShape<MGLFeature> *) *shapes;
diff --git a/platform/darwin/src/MGLFeature_Private.h b/platform/darwin/src/MGLFeature_Private.h
index 3277a94d5b..6751b3196a 100644
--- a/platform/darwin/src/MGLFeature_Private.h
+++ b/platform/darwin/src/MGLFeature_Private.h
@@ -1,3 +1,4 @@
+#import "MGLFoundation.h"
#import "MGLFeature.h"
#import "MGLShape.h"
@@ -11,6 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
Returns an array of `MGLFeature` objects converted from the given vector of
vector tile features.
*/
+MGL_EXPORT
NS_ARRAY_OF(MGLShape <MGLFeature> *) *MGLFeaturesFromMBGLFeatures(const std::vector<mbgl::Feature> &features);
/**
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index d05b21eb51..2ab02acf5a 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLVectorStyleLayer.h"
@@ -48,6 +49,7 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) {
mapView.style?.addLayer(layer)
```
*/
+MGL_EXPORT
@interface MGLFillStyleLayer : MGLVectorStyleLayer
#pragma mark - Accessing the Paint Attributes
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index ec736d8825..63a482ac2e 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,7 +8,9 @@
#import "MGLStyleValue_Private.h"
#import "MGLFillStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
+
namespace mbgl {
MBGL_DEFINE_ENUM(MGLFillTranslationAnchor, {
diff --git a/platform/darwin/src/MGLForegroundStyleLayer.h b/platform/darwin/src/MGLForegroundStyleLayer.h
index 642dde4992..474e1f6307 100644
--- a/platform/darwin/src/MGLForegroundStyleLayer.h
+++ b/platform/darwin/src/MGLForegroundStyleLayer.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLStyleLayer.h"
NS_ASSUME_NONNULL_BEGIN
@@ -14,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
subclasses of this class. Instead, create instances of `MGLRasterStyleLayer`
and the concrete subclasses of `MGLVectorStyleLayer`.
*/
+MGL_EXPORT
@interface MGLForegroundStyleLayer : MGLStyleLayer
#pragma mark Initializing a Style Layer
diff --git a/platform/darwin/src/MGLFoundation.h b/platform/darwin/src/MGLFoundation.h
new file mode 100644
index 0000000000..3400c63979
--- /dev/null
+++ b/platform/darwin/src/MGLFoundation.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#import <Foundation/Foundation.h>
+
+#define MGL_EXPORT __attribute__((visibility ("default")))
diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h
index 8e36b86d96..408bdb2632 100644
--- a/platform/darwin/src/MGLGeometry.h
+++ b/platform/darwin/src/MGLGeometry.h
@@ -2,6 +2,8 @@
#import <CoreLocation/CoreLocation.h>
#import <CoreGraphics/CGBase.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/** Defines the area spanned by an `MGLCoordinateBounds`. */
@@ -33,7 +35,7 @@ NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, M
}
/** An area of zero width and zero height. */
-extern const MGLCoordinateSpan MGLCoordinateSpanZero;
+extern MGL_EXPORT const MGLCoordinateSpan MGLCoordinateSpanZero;
/** A rectangular area as measured on a two-dimensional map projection. */
typedef struct MGLCoordinateBounds {
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm
index 70f00afd2f..36e096dd03 100644
--- a/platform/darwin/src/MGLGeometry.mm
+++ b/platform/darwin/src/MGLGeometry.mm
@@ -1,12 +1,14 @@
#import "MGLGeometry_Private.h"
+#import "MGLFoundation.h"
+
#import <mbgl/util/projection.hpp>
/** Vertical field of view, measured in degrees, for determining the altitude
of the viewpoint.
- TransformState::getProjMatrix() assumes a vertical field of view of
- 2 arctan ⅓ rad ≈ 36.9°, but MapKit uses a vertical field of view of 30°.
+ TransformState::getProjMatrix() has a variable vertical field of view that
+ defaults to 2 arctan ⅓ rad ≈ 36.9° but MapKit uses a vertical field of view of 30°.
flyTo() assumes a field of view of 2 arctan ½ rad. */
const CLLocationDegrees MGLAngularFieldOfView = 30;
@@ -30,6 +32,7 @@ CGRect MGLExtendRect(CGRect rect, CGPoint point) {
return rect;
}
+MGL_EXPORT
CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLocationDegrees latitude, CGSize size) {
CLLocationDistance metersPerPixel = mbgl::Projection::getMetersPerPixelAtLatitude(latitude, zoomLevel);
CLLocationDistance metersTall = metersPerPixel * size.height;
@@ -37,6 +40,7 @@ CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLo
return altitude * std::sin(M_PI_2 - MGLRadiansFromDegrees(pitch)) / std::sin(M_PI_2);
}
+MGL_EXPORT
double MGLZoomLevelForAltitude(CLLocationDistance altitude, CGFloat pitch, CLLocationDegrees latitude, CGSize size) {
CLLocationDistance eyeAltitude = altitude / std::sin(M_PI_2 - MGLRadiansFromDegrees(pitch)) * std::sin(M_PI_2);
CLLocationDistance metersTall = eyeAltitude * 2 * std::tan(MGLRadiansFromDegrees(MGLAngularFieldOfView) / 2.);
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index 9b37a97460..98f2778291 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLVectorStyleLayer.h"
@@ -103,6 +104,7 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) {
mapView.style?.addLayer(layer)
```
*/
+MGL_EXPORT
@interface MGLLineStyleLayer : MGLVectorStyleLayer
#pragma mark - Accessing the Layout Attributes
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index f6884fad15..13408d426c 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,7 +8,9 @@
#import "MGLStyleValue_Private.h"
#import "MGLLineStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/line_layer.hpp>
+
namespace mbgl {
MBGL_DEFINE_ENUM(MGLLineCap, {
diff --git a/platform/darwin/src/MGLMapCamera.h b/platform/darwin/src/MGLMapCamera.h
index f6bff36280..3d492656af 100644
--- a/platform/darwin/src/MGLMapCamera.h
+++ b/platform/darwin/src/MGLMapCamera.h
@@ -2,12 +2,15 @@
#import <CoreGraphics/CoreGraphics.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
An `MGLMapCamera` object represents a viewpoint from which the user observes
some point on an `MGLMapView`.
*/
+MGL_EXPORT
@interface MGLMapCamera : NSObject <NSSecureCoding, NSCopying>
/** Coordinate at the center of the map view. */
diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h
index f083a5bec4..31ab5744a3 100644
--- a/platform/darwin/src/MGLMultiPoint.h
+++ b/platform/darwin/src/MGLMultiPoint.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLShape.h"
NS_ASSUME_NONNULL_BEGIN
@@ -17,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
Do not confuse `MGLMultiPoint` with `MGLPointCollection`, which represents a
collection of related but disconnected points.
*/
+MGL_EXPORT
@interface MGLMultiPoint : MGLShape
/**
diff --git a/platform/darwin/src/MGLOfflinePack.h b/platform/darwin/src/MGLOfflinePack.h
index a741833105..8436434e68 100644
--- a/platform/darwin/src/MGLOfflinePack.h
+++ b/platform/darwin/src/MGLOfflinePack.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLOfflineRegion.h"
NS_ASSUME_NONNULL_BEGIN
@@ -100,6 +101,7 @@ typedef struct MGLOfflinePackProgress {
`+[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method.
A pack created using `-[MGLOfflinePack init]` is immediately invalid.
*/
+MGL_EXPORT
@interface MGLOfflinePack : NSObject
/**
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h
index 6e60f26e77..9125c5341e 100644
--- a/platform/darwin/src/MGLOfflineStorage.h
+++ b/platform/darwin/src/MGLOfflineStorage.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
alternatively observe KVO change notifications to the pack’s `progress` key
path.
*/
-extern const NSNotificationName MGLOfflinePackProgressChangedNotification;
+extern MGL_EXPORT const NSNotificationName MGLOfflinePackProgressChangedNotification;
/**
Posted by the shared `MGLOfflineStorage` object whenever an `MGLOfflinePack`
@@ -38,7 +39,7 @@ extern const NSNotificationName MGLOfflinePackProgressChangedNotification;
`userInfo` dictionary contains the error object in the
`MGLOfflinePackErrorUserInfoKey` key.
*/
-extern const NSNotificationName MGLOfflinePackErrorNotification;
+extern MGL_EXPORT const NSNotificationName MGLOfflinePackErrorNotification;
/**
Posted by the shared `MGLOfflineStorage` object when the maximum number of
@@ -53,7 +54,7 @@ extern const NSNotificationName MGLOfflinePackErrorNotification;
calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method.
Contact your Mapbox sales representative to have the limit raised.
*/
-extern const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification;
+extern MGL_EXPORT const NSNotificationName MGLOfflinePackMaximumMapboxTilesReachedNotification;
/**
A key in the `userInfo` property of a notification posted by `MGLOfflinePack`.
@@ -66,9 +67,9 @@ typedef NSString *MGLOfflinePackUserInfoKey NS_EXTENSIBLE_STRING_ENUM;
`MGLOfflinePackProgressChangedNotification` notification. Call `-integerValue`
on the object to receive the `MGLOfflinePackState`-typed state.
*/
-extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState;
+extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyState;
-extern NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState")));
+extern MGL_EXPORT NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyState")));
/**
The key for an `NSValue` object that indicates an offline pack’s current
@@ -77,9 +78,9 @@ extern NSString * const MGLOfflinePackStateUserInfoKey __attribute__((deprecated
`-MGLOfflinePackProgressValue` on the object to receive the
`MGLOfflinePackProgress`-typed progress.
*/
-extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress;
+extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyProgress;
-extern NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress")));
+extern MGL_EXPORT NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyProgress")));
/**
The key for an `NSError` object that is encountered in the course of
@@ -87,9 +88,9 @@ extern NSString * const MGLOfflinePackProgressUserInfoKey __attribute__((depreca
an `MGLOfflinePackErrorNotification` notification. The error’s domain is
`MGLErrorDomain`. See `MGLErrorCode` for possible error codes.
*/
-extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError;
+extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyError;
-extern NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError")));
+extern MGL_EXPORT NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyError")));
/**
The key for an `NSNumber` object that indicates the maximum number of
@@ -99,9 +100,9 @@ extern NSString * const MGLOfflinePackErrorUserInfoKey __attribute__((deprecated
`-unsignedLongLongValue` on the object to receive the `uint64_t`-typed tile
limit.
*/
-extern const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount;
+extern MGL_EXPORT const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount;
-extern NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount")));
+extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attribute__((deprecated("Use MGLOfflinePackUserInfoKeyMaximumCount")));
/**
A block to be called once an offline pack has been completely created and
@@ -136,6 +137,7 @@ typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error
fact that offline resources are stored in a database. The shared object
maintains a canonical collection of offline packs in its `packs` property.
*/
+MGL_EXPORT
@interface MGLOfflineStorage : NSObject
/**
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.h b/platform/darwin/src/MGLOpenGLStyleLayer.h
index f395484436..de4fc92b17 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer.h
+++ b/platform/darwin/src/MGLOpenGLStyleLayer.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLStyleLayer.h"
@@ -14,8 +15,10 @@ typedef struct MGLStyleLayerDrawingContext {
double zoomLevel;
CLLocationDirection direction;
CGFloat pitch;
+ CGFloat fieldOfView;
} MGLStyleLayerDrawingContext;
+MGL_EXPORT
@interface MGLOpenGLStyleLayer : MGLStyleLayer
@property (nonatomic, weak, readonly) MGLMapView *mapView;
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.mm b/platform/darwin/src/MGLOpenGLStyleLayer.mm
index 12986f64c1..5d81eb85ea 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer.mm
+++ b/platform/darwin/src/MGLOpenGLStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLStyle_Private.h"
#import "MGLStyleLayer_Private.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/math/wrap.hpp>
@@ -34,6 +35,7 @@ void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRender
.zoomLevel = params.zoom,
.direction = mbgl::util::wrap(params.bearing, 0., 360.),
.pitch = static_cast<CGFloat>(params.pitch),
+ .fieldOfView = static_cast<CGFloat>(params.fieldOfView),
};
[layer drawInMapView:layer.mapView withContext:drawingContext];
}
diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h
index 969f8c91e7..aeac43bd39 100644
--- a/platform/darwin/src/MGLPointAnnotation.h
+++ b/platform/darwin/src/MGLPointAnnotation.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLShape.h"
NS_ASSUME_NONNULL_BEGIN
@@ -33,6 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry
in GeoJSON.
*/
+MGL_EXPORT
@interface MGLPointAnnotation : MGLShape
/**
diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h
index 9e14161aed..c7054c6bbf 100644
--- a/platform/darwin/src/MGLPointCollection.h
+++ b/platform/darwin/src/MGLPointCollection.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLOverlay.h"
#import "MGLShape.h"
@@ -26,6 +27,7 @@
geometry in GeoJSON. Do not confuse `MGLPointCollection` with `MGLMultiPoint`,
the abstract superclass of `MGLPolyline` and `MGLPolygon`.
*/
+MGL_EXPORT
@interface MGLPointCollection : MGLShape <MGLOverlay>
/**
diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h
index 674c006095..560741a150 100644
--- a/platform/darwin/src/MGLPolygon.h
+++ b/platform/darwin/src/MGLPolygon.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLMultiPoint.h"
#import "MGLOverlay.h"
@@ -43,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
To make the polygon straddle the antimeridian, specify some longitudes less
than −180 degrees or greater than 180 degrees.
*/
+MGL_EXPORT
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>
/**
@@ -100,6 +102,7 @@ NS_ASSUME_NONNULL_BEGIN
`-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can
add the `polygons` array’s items as overlays individually.
*/
+MGL_EXPORT
@interface MGLMultiPolygon : MGLShape <MGLOverlay>
/**
diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h
index 429ba9cddc..ca1f8e36cc 100644
--- a/platform/darwin/src/MGLPolyline.h
+++ b/platform/darwin/src/MGLPolyline.h
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
+#import "MGLFoundation.h"
#import "MGLMultiPoint.h"
#import "MGLOverlay.h"
@@ -39,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
geometry in GeoJSON.
*/
+MGL_EXPORT
@interface MGLPolyline : MGLMultiPoint <MGLOverlay>
/**
@@ -73,6 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a>
geometry in GeoJSON.
*/
+MGL_EXPORT
@interface MGLMultiPolyline : MGLShape <MGLOverlay>
/**
diff --git a/platform/darwin/src/MGLRasterSource.h b/platform/darwin/src/MGLRasterSource.h
index c2807c8d2e..ac5be60105 100644
--- a/platform/darwin/src/MGLRasterSource.h
+++ b/platform/darwin/src/MGLRasterSource.h
@@ -1,7 +1,8 @@
-#import "MGLTileSource.h"
-
#import <CoreGraphics/CoreGraphics.h>
+#import "MGLFoundation.h"
+#import "MGLTileSource.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -18,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
This option is only applicable to `MGLRasterSource` objects; it is ignored when
initializing `MGLVectorSource` objects.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionTileSize;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize;
/**
`MGLRasterSource` is a map content source that supplies raster image tiles to
@@ -50,6 +51,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionTileSize;
mapView.style?.addSource(source)
```
*/
+MGL_EXPORT
@interface MGLRasterSource : MGLTileSource
#pragma mark Initializing a Source
diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterSource.mm
index b52b4e3eed..fd36413fe0 100644
--- a/platform/darwin/src/MGLRasterSource.mm
+++ b/platform/darwin/src/MGLRasterSource.mm
@@ -5,7 +5,7 @@
#import "MGLTileSource_Private.h"
#import "NSURL+MGLAdditions.h"
-#include <mbgl/mbgl.hpp>
+#include <mbgl/map/map.hpp>
#include <mbgl/style/sources/raster_source.hpp>
const MGLTileSourceOption MGLTileSourceOptionTileSize = @"MGLTileSourceOptionTileSize";
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index 736e8ee2f5..cd57a74f6a 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLForegroundStyleLayer.h"
@@ -32,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
mapView.style?.addLayer(layer)
```
*/
+MGL_EXPORT
@interface MGLRasterStyleLayer : MGLForegroundStyleLayer
#pragma mark - Accessing the Paint Attributes
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 22e182df61..87afb8da9d 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,6 +8,7 @@
#import "MGLStyleValue_Private.h"
#import "MGLRasterStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/raster_layer.hpp>
@interface MGLRasterStyleLayer ()
diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h
index 8dc1b4f1cf..d1c150d02e 100644
--- a/platform/darwin/src/MGLShape.h
+++ b/platform/darwin/src/MGLShape.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLAnnotation.h"
NS_ASSUME_NONNULL_BEGIN
@@ -27,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
you can add some kinds of shapes directly to a map view as annotations or
overlays.
*/
+MGL_EXPORT
@interface MGLShape : NSObject <MGLAnnotation, NSSecureCoding>
#pragma mark Creating a Shape
diff --git a/platform/darwin/src/MGLShapeCollection.h b/platform/darwin/src/MGLShapeCollection.h
index 01aece824f..5d2ce588c9 100644
--- a/platform/darwin/src/MGLShapeCollection.h
+++ b/platform/darwin/src/MGLShapeCollection.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLShape.h"
#import "MGLTypes.h"
@@ -32,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.8">GeometryCollection</a>
geometry in GeoJSON.
*/
+MGL_EXPORT
@interface MGLShapeCollection : MGLShape
/**
diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h
index a44db69475..34806c548d 100644
--- a/platform/darwin/src/MGLShapeSource.h
+++ b/platform/darwin/src/MGLShapeSource.h
@@ -1,5 +1,6 @@
#import "MGLSource.h"
+#import "MGLFoundation.h"
#import "MGLTypes.h"
#import "MGLShape.h"
@@ -21,14 +22,14 @@ typedef NSString *MGLShapeSourceOption NS_STRING_ENUM;
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-cluster"><code>cluster</code></a>
source property in the Mapbox Style Specification.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionClustered;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClustered;
/**
An `NSNumber` object containing an integer; specifies the radius of each
cluster if clustering is enabled. A value of 512 produces a radius equal to
the width of a tile. The default value is 50.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius;
/**
An `NSNumber` object containing an integer; specifies the maximum zoom level at
@@ -40,7 +41,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius;
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-clusterMaxZoom"><code>clusterMaxZoom</code></a>
source property in the Mapbox Style Specification.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForClustering;
/**
An `NSNumber` object containing an integer; specifies the maximum zoom level at
@@ -51,7 +52,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevelForCluster
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-maxzoom"><code>maxzoom</code></a>
source property in the Mapbox Style Specification.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel;
/**
An `NSNumber` object containing an integer; specifies the size of the tile
@@ -63,7 +64,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLevel;
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-buffer"><code>buffer</code></a>
source property in the Mapbox Style Specification.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionBuffer;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionBuffer;
/**
An `NSNumber` object containing a double; specifies the Douglas-Peucker
@@ -74,7 +75,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionBuffer;
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-tolerance"><code>tolerance</code></a>
source property in the Mapbox Style Specification.
*/
-extern const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance;
+extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance;
/**
`MGLShapeSource` is a map content source that supplies vector shapes to be
@@ -107,6 +108,7 @@ extern const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance;
mapView.style?.addSource(source)
```
*/
+MGL_EXPORT
@interface MGLShapeSource : MGLSource
#pragma mark Initializing a Source
diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm
index 50322f300c..245b7f2de2 100644
--- a/platform/darwin/src/MGLShapeSource.mm
+++ b/platform/darwin/src/MGLShapeSource.mm
@@ -7,7 +7,7 @@
#import "NSURL+MGLAdditions.h"
-#include <mbgl/mbgl.hpp>
+#include <mbgl/map/map.hpp>
#include <mbgl/style/sources/geojson_source.hpp>
const MGLShapeSourceOption MGLShapeSourceOptionClustered = @"MGLShapeSourceOptionClustered";
diff --git a/platform/darwin/src/MGLShapeSource_Private.h b/platform/darwin/src/MGLShapeSource_Private.h
index 584a5a4b30..c14f4fbb59 100644
--- a/platform/darwin/src/MGLShapeSource_Private.h
+++ b/platform/darwin/src/MGLShapeSource_Private.h
@@ -1,5 +1,5 @@
+#import "MGLFoundation.h"
#import "MGLShapeSource.h"
-#import "MGLShapeSource_Private.h"
NS_ASSUME_NONNULL_BEGIN
@@ -16,6 +16,7 @@ namespace mbgl {
@end
+MGL_EXPORT
mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options);
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h
index 03bb5fcba2..7b3242e3ae 100644
--- a/platform/darwin/src/MGLSource.h
+++ b/platform/darwin/src/MGLSource.h
@@ -1,5 +1,7 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -18,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
subclasses of this class. Instead, create instances of `MGLShapeSource` and the
concrete subclasses of `MGLTileSource`, `MGLVectorSource` and `MGLRasterSource`.
*/
+MGL_EXPORT
@interface MGLSource : NSObject
#pragma mark Initializing a Source
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index fcb464a303..9bd35142c2 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLStyleLayer.h"
#import "MGLTypes.h"
@@ -27,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
the constant itself. Such details may change significantly from version to
version.
*/
-static const NSInteger MGLStyleDefaultVersion = 9;
+static MGL_EXPORT const NSInteger MGLStyleDefaultVersion = 9;
/**
The proxy object for the current map style.
@@ -45,6 +46,7 @@ static const NSInteger MGLStyleDefaultVersion = 9;
`-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` methods as indicators
that it's safe to modify the map's style.
*/
+MGL_EXPORT
@interface MGLStyle : NSObject
#pragma mark Accessing Default Styles
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index fcfa762972..7e96c08ccc 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -24,6 +24,7 @@
#import "MGLAttributionInfo_Private.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/util/default_styles.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
@@ -36,7 +37,6 @@
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/style/sources/vector_source.hpp>
#include <mbgl/style/sources/raster_source.hpp>
-#include <mbgl/mbgl.hpp>
#if TARGET_OS_IPHONE
#import "UIImage+MGLAdditions.h"
@@ -71,7 +71,11 @@ static_assert(mbgl::util::default_styles::currentVersion == MGLStyleDefaultVersi
} \
\
+ (NSURL *)name##StyleURL##WithVersion:(NSInteger)version { \
- return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
+ if (mbgl::util::default_styles::currentVersion == version) { \
+ return [NSURL URLWithString:@(mbgl::util::default_styles::name.url)]; \
+ } else { \
+ return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
+ } \
}
MGL_DEFINE_STYLE(streets, streets)
diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h
index 4032be9297..ac40545398 100644
--- a/platform/darwin/src/MGLStyleLayer.h
+++ b/platform/darwin/src/MGLStyleLayer.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -18,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
`MGLBackgroundStyleLayer` and the concrete subclasses of
`MGLForegroundStyleLayer`.
*/
+MGL_EXPORT
@interface MGLStyleLayer : NSObject
#pragma mark Initializing a Style Layer
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index a10512dbcb..8ffed66b54 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -8,6 +8,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGL<%-
(type === 'background' ? '' :
@@ -75,6 +76,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) {
```
*/
<% } -%>
+MGL_EXPORT
@interface MGL<%- camelize(type) %>StyleLayer : MGL<%-
(type === 'background' ? '' :
(type === 'raster' ? 'Foreground' :
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index ec8f8599b3..9445c3cf21 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -5,7 +5,7 @@
const enumProperties = locals.enumProperties;
-%>
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -14,8 +14,10 @@
#import "MGLStyleValue_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
-#include <mbgl/style/layers/<%- type %>_layer.hpp>
+#include <mbgl/map/map.hpp>
+#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
<% if (enumProperties) { -%>
+
namespace mbgl {
<% if (layoutProperties.length) { -%>
diff --git a/platform/darwin/src/MGLStyleLayer_Private.h b/platform/darwin/src/MGLStyleLayer_Private.h
index c5e3e76549..8f1cdfb4a1 100644
--- a/platform/darwin/src/MGLStyleLayer_Private.h
+++ b/platform/darwin/src/MGLStyleLayer_Private.h
@@ -3,7 +3,6 @@
#import "MGLStyleLayer.h"
#import "MGLStyleValue_Private.h"
-#include <mbgl/mbgl.hpp>
#include <mbgl/style/layer.hpp>
NS_ASSUME_NONNULL_BEGIN
diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h
index eec7ed9781..5b6528f6fd 100644
--- a/platform/darwin/src/MGLStyleValue.h
+++ b/platform/darwin/src/MGLStyleValue.h
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
+#import "MGLFoundation.h"
+
NS_ASSUME_NONNULL_BEGIN
/**
@@ -25,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
<li><code>NSArray</code></li>
</ul>
*/
+MGL_EXPORT
@interface MGLStyleValue<T> : NSObject
#pragma mark Creating a Style Value
@@ -68,6 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates
the Foundation class being wrapped by this class.
*/
+MGL_EXPORT
@interface MGLStyleConstantValue<T> : MGLStyleValue<T>
#pragma mark Creating a Style Constant Value
@@ -111,6 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
The `MGLStyleFunction` class takes a generic parameter `T` that indicates the
Foundation class being wrapped by this class.
*/
+MGL_EXPORT
@interface MGLStyleFunction<T> : MGLStyleValue<T>
#pragma mark Creating a Style Function
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index c693978ab6..23ddd59d0d 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -1,6 +1,7 @@
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+#import "MGLFoundation.h"
#import "MGLStyleValue.h"
#import "MGLVectorStyleLayer.h"
@@ -276,6 +277,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) {
mapView.style?.addLayer(layer)
```
*/
+MGL_EXPORT
@interface MGLSymbolStyleLayer : MGLVectorStyleLayer
#pragma mark - Accessing the Layout Attributes
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index c7ba9d7dc5..493a8c5b6f 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLSource.h"
#import "MGLMapView_Private.h"
@@ -8,7 +8,9 @@
#import "MGLStyleValue_Private.h"
#import "MGLSymbolStyleLayer.h"
+#include <mbgl/map/map.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
+
namespace mbgl {
MBGL_DEFINE_ENUM(MGLIconRotationAlignment, {
diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.h b/platform/darwin/src/MGLTilePyramidOfflineRegion.h
index 4e9f394e74..4c6237702d 100644
--- a/platform/darwin/src/MGLTilePyramidOfflineRegion.h
+++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLOfflineRegion.h"
#import "MGLGeometry.h"
@@ -9,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
An offline region defined by a style URL, geographic coordinate bounds, and
range of zoom levels.
*/
+MGL_EXPORT
@interface MGLTilePyramidOfflineRegion : NSObject <MGLOfflineRegion, NSSecureCoding, NSCopying>
/**
diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h
index db5bc73338..99d23f4add 100644
--- a/platform/darwin/src/MGLTileSource.h
+++ b/platform/darwin/src/MGLTileSource.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLSource.h"
#import "MGLTypes.h"
@@ -24,7 +25,7 @@ typedef NSString *MGLTileSourceOption NS_STRING_ENUM;
<a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">TileJSON</a>
specification.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel;
/**
An `NSNumber` object containing an unsigned integer that specifies the maximum
@@ -38,7 +39,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel;
<a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">TileJSON</a>
specification.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel;
#if TARGET_OS_IPHONE
/**
@@ -54,7 +55,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel;
<a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">TileJSON</a>
specification.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
/**
An array of `MGLAttributionInfo` objects defining the buttons to be displayed
@@ -63,7 +64,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
By default, no attribution statements are displayed.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
#else
/**
An HTML string defining the buttons to be displayed in the map view’s
@@ -77,7 +78,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
<a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">TileJSON</a>
specification.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
/**
An array of `MGLAttributionInfo` objects defining the buttons to be displayed
@@ -86,7 +87,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLString;
By default, no attribution statements are displayed.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
#endif
/**
@@ -100,7 +101,7 @@ extern const MGLTileSourceOption MGLTileSourceOptionAttributionInfos;
<a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">TileJSON</a>
specification.
*/
-extern const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem;
+extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem;
/**
Tile coordinate systems that determine how tile coordinates in tile URLs are
@@ -139,6 +140,7 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) {
subclasses of this class. Instead, create instances of `MGLRasterSource` and
`MGLVectorSource`.
*/
+MGL_EXPORT
@interface MGLTileSource : MGLSource
#pragma mark Initializing a Source
diff --git a/platform/darwin/src/MGLTileSource_Private.h b/platform/darwin/src/MGLTileSource_Private.h
index ca80e3d960..8da69274f2 100644
--- a/platform/darwin/src/MGLTileSource_Private.h
+++ b/platform/darwin/src/MGLTileSource_Private.h
@@ -1,7 +1,8 @@
-#import "MGLTileSource.h"
-
#import <CoreGraphics/CoreGraphics.h>
+#import "MGLFoundation.h"
+#import "MGLTileSource.h"
+
NS_ASSUME_NONNULL_BEGIN
namespace mbgl {
@@ -31,6 +32,7 @@ namespace mbgl {
@end
+MGL_EXPORT
mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTemplates, NS_DICTIONARY_OF(MGLTileSourceOption, id) * _Nullable options);
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index a6b7254b58..8cd2cacaa6 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -1,5 +1,7 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
+
#pragma once
#if TARGET_OS_IPHONE
@@ -28,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
#endif
/** Indicates an error occurred in the Mapbox SDK. */
-extern NSErrorDomain const MGLErrorDomain;
+extern MGL_EXPORT NSErrorDomain const MGLErrorDomain;
/** Error constants for the Mapbox SDK. */
typedef NS_ENUM(NSInteger, MGLErrorCode) {
diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorSource.h
index 5032ca3863..bfa52f5b49 100644
--- a/platform/darwin/src/MGLVectorSource.h
+++ b/platform/darwin/src/MGLVectorSource.h
@@ -1,3 +1,4 @@
+#import "MGLFoundation.h"
#import "MGLTileSource.h"
NS_ASSUME_NONNULL_BEGIN
@@ -38,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
mapView.style?.addSource(source)
```
*/
+MGL_EXPORT
@interface MGLVectorSource : MGLTileSource
- (instancetype)initWithIdentifier:(NSString *)identifier configurationURL:(NSURL *)configurationURL NS_DESIGNATED_INITIALIZER;
diff --git a/platform/darwin/src/MGLVectorSource.mm b/platform/darwin/src/MGLVectorSource.mm
index c95ff63bbf..8fda528546 100644
--- a/platform/darwin/src/MGLVectorSource.mm
+++ b/platform/darwin/src/MGLVectorSource.mm
@@ -5,7 +5,7 @@
#import "MGLTileSource_Private.h"
#import "NSURL+MGLAdditions.h"
-#include <mbgl/mbgl.hpp>
+#include <mbgl/map/map.hpp>
#include <mbgl/style/sources/vector_source.hpp>
@interface MGLVectorSource ()
diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h
index 360b86c517..ca09c11716 100644
--- a/platform/darwin/src/MGLVectorStyleLayer.h
+++ b/platform/darwin/src/MGLVectorStyleLayer.h
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#import "MGLForegroundStyleLayer.h"
NS_ASSUME_NONNULL_BEGIN
@@ -13,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
subclasses: `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLLineStyleLayer`,
and `MGLSymbolStyleLayer`.
*/
+MGL_EXPORT
@interface MGLVectorStyleLayer : MGLForegroundStyleLayer
#pragma mark Refining a Style Layer’s Content
diff --git a/platform/darwin/src/NSDate+MGLAdditions.h b/platform/darwin/src/NSDate+MGLAdditions.h
index a116ef32de..918aae233f 100644
--- a/platform/darwin/src/NSDate+MGLAdditions.h
+++ b/platform/darwin/src/NSDate+MGLAdditions.h
@@ -1,6 +1,5 @@
#import <Foundation/Foundation.h>
-#include <mbgl/mbgl.hpp>
#include <mbgl/util/chrono.hpp>
@interface NSDate (MGLAdditions)
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index f11a1919cf..b095091b17 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.mm
+++ b/platform/darwin/src/NSExpression+MGLAdditions.mm
@@ -69,9 +69,6 @@
if (mbglValue.is<std::string>()) {
return mbglValue.get<std::string>();
}
- if (mbglValue.is<bool>()) {
- return mbglValue.get<bool>();
- }
if (mbglValue.is<double>()) {
return mbglValue.get<double>();
}
diff --git a/platform/darwin/src/headless_backend_cgl.cpp b/platform/darwin/src/headless_backend_cgl.cpp
index 4ca567f55c..7069738fb1 100644
--- a/platform/darwin/src/headless_backend_cgl.cpp
+++ b/platform/darwin/src/headless_backend_cgl.cpp
@@ -1,6 +1,7 @@
-#include <mbgl/platform/default/headless_backend.hpp>
-#include <mbgl/platform/default/headless_display.hpp>
+#include <mbgl/gl/headless_backend.hpp>
+#include <mbgl/gl/headless_display.hpp>
+#include <OpenGL/OpenGL.h>
#include <CoreFoundation/CoreFoundation.h>
#include <string>
@@ -8,6 +9,33 @@
namespace mbgl {
+struct CGLImpl : public HeadlessBackend::Impl {
+ CGLImpl(CGLContextObj glContext_) : glContext(glContext_) {
+ }
+
+ ~CGLImpl() {
+ CGLDestroyContext(glContext);
+ }
+
+ void activateContext() final {
+ CGLError error = CGLSetCurrentContext(glContext);
+ if (error != kCGLNoError) {
+ throw std::runtime_error(std::string("Switching OpenGL context failed:") +
+ CGLErrorString(error) + "\n");
+ }
+ }
+
+ void deactivateContext() final {
+ CGLError error = CGLSetCurrentContext(nullptr);
+ if (error != kCGLNoError) {
+ throw std::runtime_error(std::string("Removing OpenGL context failed:") +
+ CGLErrorString(error) + "\n");
+ }
+ }
+
+ CGLContextObj glContext = nullptr;
+};
+
gl::glProc HeadlessBackend::initializeExtension(const char* name) {
static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
if (!framework) {
@@ -21,8 +49,18 @@ gl::glProc HeadlessBackend::initializeExtension(const char* name) {
return reinterpret_cast<gl::glProc>(symbol);
}
+bool HeadlessBackend::hasDisplay() {
+ if (!display) {
+ display.reset(new HeadlessDisplay);
+ }
+ return bool(display);
+}
+
void HeadlessBackend::createContext() {
- CGLError error = CGLCreateContext(display->pixelFormat, nullptr, &glContext);
+ assert(!hasContext());
+
+ CGLContextObj glContext = nullptr;
+ CGLError error = CGLCreateContext(display->attribute<CGLPixelFormatObj>(), nullptr, &glContext);
if (error != kCGLNoError) {
throw std::runtime_error(std::string("Error creating GL context object:") +
CGLErrorString(error) + "\n");
@@ -33,26 +71,8 @@ void HeadlessBackend::createContext() {
throw std::runtime_error(std::string("Error enabling OpenGL multithreading:") +
CGLErrorString(error) + "\n");
}
-}
-
-void HeadlessBackend::destroyContext() {
- CGLDestroyContext(glContext);
-}
-
-void HeadlessBackend::activateContext() {
- CGLError error = CGLSetCurrentContext(glContext);
- if (error != kCGLNoError) {
- throw std::runtime_error(std::string("Switching OpenGL context failed:") +
- CGLErrorString(error) + "\n");
- }
-}
-void HeadlessBackend::deactivateContext() {
- CGLError error = CGLSetCurrentContext(nullptr);
- if (error != kCGLNoError) {
- throw std::runtime_error(std::string("Removing OpenGL context failed:") +
- CGLErrorString(error) + "\n");
- }
+ impl.reset(new CGLImpl(glContext));
}
} // namespace mbgl
diff --git a/platform/darwin/src/headless_backend_eagl.mm b/platform/darwin/src/headless_backend_eagl.mm
index 0a1ae706b8..bd4a202ec5 100644
--- a/platform/darwin/src/headless_backend_eagl.mm
+++ b/platform/darwin/src/headless_backend_eagl.mm
@@ -1,4 +1,4 @@
-#include <mbgl/platform/default/headless_backend.hpp>
+#include <mbgl/gl/headless_backend.hpp>
#include <mbgl/gl/extension.hpp>
@@ -8,6 +8,27 @@
namespace mbgl {
+struct EAGLImpl : public HeadlessBackend::Impl {
+ EAGLImpl(EAGLContext* glContext_) : glContext(glContext_) {
+ [reinterpret_cast<EAGLContext*>(glContext) retain];
+ reinterpret_cast<EAGLContext*>(glContext).multiThreaded = YES;
+ }
+
+ ~EAGLImpl() {
+ [glContext release];
+ }
+
+ void activateContext() {
+ [EAGLContext setCurrentContext:glContext];
+ }
+
+ void deactivateContext() {
+ [EAGLContext setCurrentContext:nil];
+ }
+
+ EAGLContext* glContext = nullptr;
+};
+
gl::glProc HeadlessBackend::initializeExtension(const char* name) {
static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles"));
if (!framework) {
@@ -21,26 +42,17 @@ gl::glProc HeadlessBackend::initializeExtension(const char* name) {
return reinterpret_cast<gl::glProc>(symbol);
}
+bool HeadlessBackend::hasDisplay() {
+ return true;
+}
+
void HeadlessBackend::createContext() {
- glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ EAGLContext* glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (glContext == nil) {
throw std::runtime_error("Error creating GL context object");
}
- [reinterpret_cast<EAGLContext*>(glContext) retain];
- reinterpret_cast<EAGLContext*>(glContext).multiThreaded = YES;
-}
-
-void HeadlessBackend::destroyContext() {
- [reinterpret_cast<EAGLContext*>(glContext) release];
- glContext = nil;
-}
-
-void HeadlessBackend::activateContext() {
- [EAGLContext setCurrentContext:reinterpret_cast<EAGLContext*>(glContext)];
-}
-void HeadlessBackend::deactivateContext() {
- [EAGLContext setCurrentContext:nil];
+ impl.reset(new EAGLImpl(glContext));
}
} // namespace mbgl
diff --git a/platform/darwin/src/headless_display_cgl.cpp b/platform/darwin/src/headless_display_cgl.cpp
new file mode 100644
index 0000000000..90d187d3db
--- /dev/null
+++ b/platform/darwin/src/headless_display_cgl.cpp
@@ -0,0 +1,52 @@
+#include <mbgl/gl/headless_display.hpp>
+
+#include <OpenGL/OpenGL.h>
+
+#include <stdexcept>
+#include <string>
+
+namespace mbgl {
+
+class HeadlessDisplay::Impl {
+public:
+ Impl();
+ ~Impl();
+ CGLPixelFormatObj pixelFormat = nullptr;
+};
+
+HeadlessDisplay::Impl::Impl() {
+ // TODO: test if OpenGL 4.1 with GL_ARB_ES2_compatibility is supported
+ // If it is, use kCGLOGLPVersion_3_2_Core and enable that extension.
+ CGLPixelFormatAttribute attributes[] = {
+ kCGLPFAOpenGLProfile,
+ static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_Legacy),
+ static_cast<CGLPixelFormatAttribute>(0)
+ };
+
+ GLint num;
+ CGLError error = CGLChoosePixelFormat(attributes, &pixelFormat, &num);
+ if (error != kCGLNoError) {
+ throw std::runtime_error(std::string("Error choosing pixel format:") + CGLErrorString(error) + "\n");
+ }
+ if (num <= 0) {
+ throw std::runtime_error("No pixel formats found.");
+ }
+}
+
+HeadlessDisplay::Impl::~Impl() {
+ CGLDestroyPixelFormat(pixelFormat);
+}
+
+template <>
+CGLPixelFormatObj HeadlessDisplay::attribute() const {
+ return impl->pixelFormat;
+}
+
+HeadlessDisplay::HeadlessDisplay()
+ : impl(std::make_unique<Impl>()) {
+}
+
+HeadlessDisplay::~HeadlessDisplay() {
+}
+
+} // namespace mbgl
diff --git a/platform/darwin/src/image.mm b/platform/darwin/src/image.mm
index 066535a58c..3a707d4a36 100644
--- a/platform/darwin/src/image.mm
+++ b/platform/darwin/src/image.mm
@@ -11,7 +11,7 @@
namespace mbgl {
std::string encodePNG(const PremultipliedImage& src) {
- CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, src.data.get(), src.size(), NULL);
+ CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, src.data.get(), src.bytes(), NULL);
if (!provider) {
return "";
}
@@ -22,9 +22,10 @@ std::string encodePNG(const PremultipliedImage& src) {
return "";
}
- CGImageRef image = CGImageCreate(src.width, src.height, 8, 32, 4 * src.width, color_space,
- kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast, provider, NULL, false,
- kCGRenderingIntentDefault);
+ CGImageRef image =
+ CGImageCreate(src.size.width, src.size.height, 8, 32, 4 * src.size.width, color_space,
+ kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast, provider, NULL,
+ false, kCGRenderingIntentDefault);
if (!image) {
CGColorSpaceRelease(color_space);
CGDataProviderRelease(provider);
@@ -92,11 +93,12 @@ PremultipliedImage decodeImage(const std::string &source_data) {
throw std::runtime_error("CGColorSpaceCreateDeviceRGB failed");
}
- PremultipliedImage result{ static_cast<uint16_t>(CGImageGetWidth(image)),
- static_cast<uint16_t>(CGImageGetHeight(image)) };
+ PremultipliedImage result({ static_cast<uint32_t>(CGImageGetWidth(image)),
+ static_cast<uint32_t>(CGImageGetHeight(image)) });
- CGContextRef context = CGBitmapContextCreate(result.data.get(), result.width, result.height, 8, result.stride(),
- color_space, kCGImageAlphaPremultipliedLast);
+ CGContextRef context =
+ CGBitmapContextCreate(result.data.get(), result.size.width, result.size.height, 8,
+ result.stride(), color_space, kCGImageAlphaPremultipliedLast);
if (!context) {
CGColorSpaceRelease(color_space);
CGImageRelease(image);
@@ -107,7 +109,9 @@ PremultipliedImage decodeImage(const std::string &source_data) {
CGContextSetBlendMode(context, kCGBlendModeCopy);
- CGRect rect = {{ 0, 0 }, { static_cast<CGFloat>(result.width), static_cast<CGFloat>(result.height) }};
+ CGRect rect = { { 0, 0 },
+ { static_cast<CGFloat>(result.size.width),
+ static_cast<CGFloat>(result.size.height) } };
CGContextDrawImage(context, rect, image);
CGContextRelease(context);
diff --git a/platform/darwin/src/log_nslog.mm b/platform/darwin/src/logging_nslog.mm
index 49583ae3c4..dd428f56b1 100644
--- a/platform/darwin/src/log_nslog.mm
+++ b/platform/darwin/src/logging_nslog.mm
@@ -1,4 +1,4 @@
-#include <mbgl/platform/log.hpp>
+#include <mbgl/util/logging.hpp>
#include <mbgl/util/enum.hpp>
#import <Foundation/Foundation.h>
diff --git a/platform/darwin/src/nsthread.mm b/platform/darwin/src/nsthread.mm
index eee6d6991b..6caa1be43e 100644
--- a/platform/darwin/src/nsthread.mm
+++ b/platform/darwin/src/nsthread.mm
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
-#include <mbgl/platform/platform.hpp>
+#include <mbgl/util/platform.hpp>
#include <pthread.h>
diff --git a/platform/darwin/src/string_nsstring.mm b/platform/darwin/src/string_nsstring.mm
index 9bf199afc0..08f9aeccef 100644
--- a/platform/darwin/src/string_nsstring.mm
+++ b/platform/darwin/src/string_nsstring.mm
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
-#include <mbgl/platform/platform.hpp>
+#include <mbgl/util/platform.hpp>
namespace mbgl {
namespace platform {
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index ec962ae502..60a332a5e7 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -30,7 +30,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.backgroundColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getBackgroundColor(), propertyValue,
@"Setting backgroundColor to a constant value should update background-color.");
XCTAssertEqualObjects(layer.backgroundColor, styleValue,
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index 1f4b82e32b..35e29b31d5 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -85,7 +85,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.circleColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getCircleColor(), propertyValue,
@"Setting circleColor to a constant value should update circle-color.");
XCTAssertEqualObjects(layer.circleColor, styleValue,
@@ -213,6 +213,108 @@
@"circleScaleAlignment should return the default value after being unset.");
}
+ // circle-stroke-color
+ {
+ XCTAssertTrue(rawLayer->getCircleStrokeColor().isUndefined(),
+ @"circle-stroke-color should be unset initially.");
+ MGLStyleValue<MGLColor *> *defaultStyleValue = layer.circleStrokeColor;
+
+ MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
+ layer.circleStrokeColor = styleValue;
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
+ XCTAssertEqual(rawLayer->getCircleStrokeColor(), propertyValue,
+ @"Setting circleStrokeColor to a constant value should update circle-stroke-color.");
+ XCTAssertEqualObjects(layer.circleStrokeColor, styleValue,
+ @"circleStrokeColor should round-trip constant values.");
+
+ styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{
+ @18: styleValue,
+ }];
+ layer.circleStrokeColor = styleValue;
+ propertyValue = { mbgl::style::Function<mbgl::Color> {
+ {{ 18, propertyValue.asConstant() }},
+ 1,
+ }};
+ XCTAssertEqual(rawLayer->getCircleStrokeColor(), propertyValue,
+ @"Setting circleStrokeColor to a function should update circle-stroke-color.");
+ XCTAssertEqualObjects(layer.circleStrokeColor, styleValue,
+ @"circleStrokeColor should round-trip functions.");
+
+ layer.circleStrokeColor = nil;
+ XCTAssertTrue(rawLayer->getCircleStrokeColor().isUndefined(),
+ @"Unsetting circleStrokeColor should return circle-stroke-color to the default value.");
+ XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue,
+ @"circleStrokeColor should return the default value after being unset.");
+ }
+
+ // circle-stroke-opacity
+ {
+ XCTAssertTrue(rawLayer->getCircleStrokeOpacity().isUndefined(),
+ @"circle-stroke-opacity should be unset initially.");
+ MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleStrokeOpacity;
+
+ MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff];
+ layer.circleStrokeOpacity = styleValue;
+ mbgl::style::PropertyValue<float> propertyValue = { 0xff };
+ XCTAssertEqual(rawLayer->getCircleStrokeOpacity(), propertyValue,
+ @"Setting circleStrokeOpacity to a constant value should update circle-stroke-opacity.");
+ XCTAssertEqualObjects(layer.circleStrokeOpacity, styleValue,
+ @"circleStrokeOpacity should round-trip constant values.");
+
+ styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{
+ @18: styleValue,
+ }];
+ layer.circleStrokeOpacity = styleValue;
+ propertyValue = { mbgl::style::Function<float> {
+ {{ 18, propertyValue.asConstant() }},
+ 1,
+ }};
+ XCTAssertEqual(rawLayer->getCircleStrokeOpacity(), propertyValue,
+ @"Setting circleStrokeOpacity to a function should update circle-stroke-opacity.");
+ XCTAssertEqualObjects(layer.circleStrokeOpacity, styleValue,
+ @"circleStrokeOpacity should round-trip functions.");
+
+ layer.circleStrokeOpacity = nil;
+ XCTAssertTrue(rawLayer->getCircleStrokeOpacity().isUndefined(),
+ @"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value.");
+ XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue,
+ @"circleStrokeOpacity should return the default value after being unset.");
+ }
+
+ // circle-stroke-width
+ {
+ XCTAssertTrue(rawLayer->getCircleStrokeWidth().isUndefined(),
+ @"circle-stroke-width should be unset initially.");
+ MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleStrokeWidth;
+
+ MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff];
+ layer.circleStrokeWidth = styleValue;
+ mbgl::style::PropertyValue<float> propertyValue = { 0xff };
+ XCTAssertEqual(rawLayer->getCircleStrokeWidth(), propertyValue,
+ @"Setting circleStrokeWidth to a constant value should update circle-stroke-width.");
+ XCTAssertEqualObjects(layer.circleStrokeWidth, styleValue,
+ @"circleStrokeWidth should round-trip constant values.");
+
+ styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{
+ @18: styleValue,
+ }];
+ layer.circleStrokeWidth = styleValue;
+ propertyValue = { mbgl::style::Function<float> {
+ {{ 18, propertyValue.asConstant() }},
+ 1,
+ }};
+ XCTAssertEqual(rawLayer->getCircleStrokeWidth(), propertyValue,
+ @"Setting circleStrokeWidth to a function should update circle-stroke-width.");
+ XCTAssertEqualObjects(layer.circleStrokeWidth, styleValue,
+ @"circleStrokeWidth should round-trip functions.");
+
+ layer.circleStrokeWidth = nil;
+ XCTAssertTrue(rawLayer->getCircleStrokeWidth().isUndefined(),
+ @"Unsetting circleStrokeWidth should return circle-stroke-width to the default value.");
+ XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue,
+ @"circleStrokeWidth should return the default value after being unset.");
+ }
+
// circle-translate
{
XCTAssertTrue(rawLayer->getCircleTranslate().isUndefined(),
@@ -294,6 +396,9 @@
[self testPropertyName:@"circle-opacity" isBoolean:NO];
[self testPropertyName:@"circle-radius" isBoolean:NO];
[self testPropertyName:@"circle-scale-alignment" isBoolean:NO];
+ [self testPropertyName:@"circle-stroke-color" isBoolean:NO];
+ [self testPropertyName:@"circle-stroke-opacity" isBoolean:NO];
+ [self testPropertyName:@"circle-stroke-width" isBoolean:NO];
[self testPropertyName:@"circle-translation" isBoolean:NO];
[self testPropertyName:@"circle-translation-anchor" isBoolean:NO];
}
diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm
index 7d60f53faa..91ec9d429e 100644
--- a/platform/darwin/test/MGLFeatureTests.mm
+++ b/platform/darwin/test/MGLFeatureTests.mm
@@ -91,7 +91,7 @@
mbgl::Point<double> point = { -90.066667, 29.95 };
mbgl::Feature pointFeature { point };
pointFeature.id = { UINT64_MAX };
- pointFeature.properties["null"] = nullptr;
+ pointFeature.properties["null"] = mapbox::geometry::null_value;
pointFeature.properties["bool"] = true;
pointFeature.properties["unsigned int"] = UINT64_MAX;
pointFeature.properties["int"] = INT64_MIN;
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index 869ad4f9b5..fb50512afd 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -85,7 +85,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.fillColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getFillColor(), propertyValue,
@"Setting fillColor to a constant value should update fill-color.");
XCTAssertEqualObjects(layer.fillColor, styleValue,
@@ -153,7 +153,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.fillOutlineColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue,
@"Setting fillOutlineColor to a constant value should update fill-outline-color.");
XCTAssertEqualObjects(layer.fillOutlineColor, styleValue,
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 1abe1cf6c3..24a9d7afea 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -221,7 +221,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.lineColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getLineColor(), propertyValue,
@"Setting lineColor to a constant value should update line-color.");
XCTAssertEqualObjects(layer.lineColor, styleValue,
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index c4dee559fc..80a9c9d3ec 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -1225,7 +1225,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.iconColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getIconColor(), propertyValue,
@"Setting iconColor to a constant value should update icon-color.");
XCTAssertEqualObjects(layer.iconColor, styleValue,
@@ -1293,7 +1293,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.iconHaloColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getIconHaloColor(), propertyValue,
@"Setting iconHaloColor to a constant value should update icon-halo-color.");
XCTAssertEqualObjects(layer.iconHaloColor, styleValue,
@@ -1469,7 +1469,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.textColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getTextColor(), propertyValue,
@"Setting textColor to a constant value should update text-color.");
XCTAssertEqualObjects(layer.textColor, styleValue,
@@ -1537,7 +1537,7 @@
MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]];
layer.textHaloColor = styleValue;
- mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { .r = 1, .g = 0, .b = 0, .a = 1 } };
+ mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } };
XCTAssertEqual(rawLayer->getTextHaloColor(), propertyValue,
@"Setting textHaloColor to a constant value should update text-halo-color.");
XCTAssertEqualObjects(layer.textHaloColor, styleValue,
diff --git a/platform/darwin/test/MGLVersionNumber.m b/platform/darwin/test/MGLVersionNumber.m
new file mode 100644
index 0000000000..fae08a087d
--- /dev/null
+++ b/platform/darwin/test/MGLVersionNumber.m
@@ -0,0 +1,15 @@
+#import <Mapbox/Mapbox.h>
+
+#import <XCTest/XCTest.h>
+
+@interface MGLVersionTests : XCTestCase
+
+@end
+
+@implementation MGLVersionTests
+
+- (void)testVersionNumber {
+ XCTAssertEqual(1, MapboxVersionNumber);
+}
+
+@end