summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-08-12 15:15:05 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-08-12 15:15:05 +0200
commit64d5cea94f76499a52fb913ebf3b1f35c486322d (patch)
tree16759455bcda642b477d530986366149d01c7c1c
parent213b6ad4dc5bec3f561486422e5b5686cd988696 (diff)
parent7f968f52e6e72e1aa854b971befd3ff3e000a34d (diff)
downloadqtlocation-mapboxgl-64d5cea94f76499a52fb913ebf3b1f35c486322d.tar.gz
Merge branch 'master' into rasterize
[skip ci]
-rw-r--r--.gitignore1
-rwxr-xr-xbin/build-shaders.js2
-rw-r--r--bin/mkdirp.js97
-rw-r--r--bin/package.json11
-rwxr-xr-xconfigure9
-rw-r--r--include/mbgl/style/style.hpp1
-rw-r--r--mapboxgl.gyp40
-rwxr-xr-xscripts/npm_install.sh8
-rwxr-xr-xsetup-libraries.sh9
-rw-r--r--src/style/style.cpp5
-rw-r--r--src/style/style_parser.cpp85
-rw-r--r--test/fixtures/fixture_log.cpp2
-rw-r--r--test/fixtures/style_parser/colors.info.json6
-rw-r--r--test/fixtures/style_parser/colors.style.json40
-rw-r--r--test/fixtures/style_parser/default.info.json6
-rwxr-xr-xtest/fixtures/style_parser/default.style.json2244
-rw-r--r--test/fixtures/style_parser/function-numeric.info.json7
-rw-r--r--test/fixtures/style_parser/function-numeric.style.json22
-rw-r--r--test/fixtures/style_parser/function-type.info.json7
-rw-r--r--test/fixtures/style_parser/function-type.style.json20
-rw-r--r--test/fixtures/style_parser/line-opacity.info.json7
-rw-r--r--test/fixtures/style_parser/line-opacity.style.json22
-rw-r--r--test/fixtures/style_parser/line-width.info.json7
-rw-r--r--test/fixtures/style_parser/line-width.style.json20
-rw-r--r--test/fixtures/style_parser/stop-zoom-value.info.json7
-rw-r--r--test/fixtures/style_parser/stop-zoom-value.style.json45
-rw-r--r--test/fixtures/style_parser/stops-array.info.json7
-rw-r--r--test/fixtures/style_parser/stops-array.style.json22
-rw-r--r--test/fixtures/style_parser/text-size.info.json7
-rw-r--r--test/fixtures/style_parser/text-size.style.json20
-rw-r--r--test/style_parser.cpp101
-rw-r--r--test/test.gyp34
32 files changed, 2762 insertions, 159 deletions
diff --git a/.gitignore b/.gitignore
index c69b0331ef..740653e6a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@
/src/shader/shaders_gles2.cpp
/bin/style.bin.js
/test/fixtures/styles/index.html
+/test/fixtures/style_parser/styles
diff --git a/bin/build-shaders.js b/bin/build-shaders.js
index be64043d9b..329f8063f7 100755
--- a/bin/build-shaders.js
+++ b/bin/build-shaders.js
@@ -3,7 +3,7 @@
var fs = require('fs');
var path = require('path');
-var mkdirp = require('./mkdirp');
+var mkdirp = require('mkdirp');
try { var glsl = require('mapbox-glsl-optimizer'); } catch(err) {}
diff --git a/bin/mkdirp.js b/bin/mkdirp.js
deleted file mode 100644
index a1742b2069..0000000000
--- a/bin/mkdirp.js
+++ /dev/null
@@ -1,97 +0,0 @@
-var path = require('path');
-var fs = require('fs');
-
-module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
-
-function mkdirP (p, opts, f, made) {
- if (typeof opts === 'function') {
- f = opts;
- opts = {};
- }
- else if (!opts || typeof opts !== 'object') {
- opts = { mode: opts };
- }
-
- var mode = opts.mode;
- var xfs = opts.fs || fs;
-
- if (mode === undefined) {
- mode = 0777 & (~process.umask());
- }
- if (!made) made = null;
-
- var cb = f || function () {};
- p = path.resolve(p);
-
- xfs.mkdir(p, mode, function (er) {
- if (!er) {
- made = made || p;
- return cb(null, made);
- }
- switch (er.code) {
- case 'ENOENT':
- mkdirP(path.dirname(p), opts, function (er, made) {
- if (er) cb(er, made);
- else mkdirP(p, opts, cb, made);
- });
- break;
-
- // In the case of any other error, just see if there's a dir
- // there already. If so, then hooray! If not, then something
- // is borked.
- default:
- xfs.stat(p, function (er2, stat) {
- // if the stat fails, then that's super weird.
- // let the original error be the failure reason.
- if (er2 || !stat.isDirectory()) cb(er, made)
- else cb(null, made);
- });
- break;
- }
- });
-}
-
-mkdirP.sync = function sync (p, opts, made) {
- if (!opts || typeof opts !== 'object') {
- opts = { mode: opts };
- }
-
- var mode = opts.mode;
- var xfs = opts.fs || fs;
-
- if (mode === undefined) {
- mode = 0777 & (~process.umask());
- }
- if (!made) made = null;
-
- p = path.resolve(p);
-
- try {
- xfs.mkdirSync(p, mode);
- made = made || p;
- }
- catch (err0) {
- switch (err0.code) {
- case 'ENOENT' :
- made = sync(path.dirname(p), opts, made);
- sync(p, opts, made);
- break;
-
- // In the case of any other error, just see if there's a dir
- // there already. If so, then hooray! If not, then something
- // is borked.
- default:
- var stat;
- try {
- stat = xfs.statSync(p);
- }
- catch (err1) {
- throw err0;
- }
- if (!stat.isDirectory()) throw err0;
- break;
- }
- }
-
- return made;
-};
diff --git a/bin/package.json b/bin/package.json
index 67b12b5085..1df8454600 100644
--- a/bin/package.json
+++ b/bin/package.json
@@ -1,7 +1,8 @@
{
- "name": "mbgl-native",
- "version": "0.0.1",
- "dependencies": {
- "mapbox-glsl-optimizer": "~0.1.0"
- }
+ "name": "mbgl-native",
+ "version": "0.0.1",
+ "dependencies": {
+ "mapbox-glsl-optimizer": "~0.1.0",
+ "mkdirp": "^0.5.0"
+ }
}
diff --git a/configure b/configure
index f1a39cbbcf..a38c587d69 100755
--- a/configure
+++ b/configure
@@ -22,6 +22,11 @@ parser.add_option("--node",
dest="node",
help="Name of the node executable (defaults to node)")
+parser.add_option("--npm",
+ action="store",
+ dest="npm",
+ help="Name of the npm executable (defaults to npm)")
+
parser.add_option("--pkg-config-root",
action="store",
dest="pkgconfig_root",
@@ -59,6 +64,10 @@ def configure_mbgl(o):
o['variables']['node'] = options.node
else:
o['variables']['node'] = 'node'
+ if options.npm:
+ o['variables']['npm'] = options.npm
+ else:
+ o['variables']['npm'] = 'npm'
o['target_defaults']['default_configuration'] = 'Debug' if options.debug else 'Release'
diff --git a/include/mbgl/style/style.hpp b/include/mbgl/style/style.hpp
index 1f24674e42..6acb5d0cb8 100644
--- a/include/mbgl/style/style.hpp
+++ b/include/mbgl/style/style.hpp
@@ -28,6 +28,7 @@ public:
public:
Style();
+ ~Style();
void loadJSON(const uint8_t *const data);
diff --git a/mapboxgl.gyp b/mapboxgl.gyp
index aa8249a941..5682d7e02a 100644
--- a/mapboxgl.gyp
+++ b/mapboxgl.gyp
@@ -8,6 +8,9 @@
'target_name': 'shaders',
'type': 'none',
'hard_dependency': 1,
+ 'dependencies': [
+ 'npm_install'
+ ],
'actions': [
{
'action_name': 'Build Shaders',
@@ -34,6 +37,23 @@
}
},
{
+ 'target_name': 'npm_install',
+ 'type': 'none',
+ 'hard_dependency': 1,
+ 'actions': [
+ {
+ 'action_name': 'npm install',
+ 'inputs': [
+ 'bin/package.json',
+ ],
+ 'outputs': [
+ 'bin/node_modules',
+ ],
+ 'action': ['./scripts/npm_install.sh', '<@(npm)']
+ }
+ ],
+ },
+ {
'target_name': 'touch_styles',
'type': 'none',
'hard_dependency': 1,
@@ -66,6 +86,20 @@
}],
},
{
+ 'target_name': 'copy_fixtures',
+ 'type': 'none',
+ 'hard_dependency': 1,
+ 'dependencies': [
+ 'bundle_styles'
+ ],
+ 'copies': [
+ {
+ 'files': [ 'styles' ],
+ 'destination': 'test/fixtures/style_parser'
+ }
+ ]
+ },
+ {
'target_name': 'copy_certificate_bundle',
'type': 'none',
'hard_dependency': 1,
@@ -90,7 +124,7 @@
'<!@(find include -name "*.hpp")',
'<!@(find include -name "*.h")',
'<!@(find src -name "*.glsl")',
- 'bin/style.js'
+ 'bin/style.json'
],
'xcode_settings': {
'SDKROOT': 'macosx',
@@ -157,7 +191,7 @@
'<!@(find include -name "*.hpp")',
'<!@(find include -name "*.h")',
'<!@(find src -name "*.glsl")',
- 'bin/style.js'
+ 'bin/style.json'
],
'xcode_settings': {
'SDKROOT': 'iphoneos',
@@ -213,4 +247,4 @@
}
}
]
-} \ No newline at end of file
+}
diff --git a/scripts/npm_install.sh b/scripts/npm_install.sh
new file mode 100755
index 0000000000..7437af9619
--- /dev/null
+++ b/scripts/npm_install.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+cd bin
+$1 install --clang=1
+cd ../
diff --git a/setup-libraries.sh b/setup-libraries.sh
index aa0360d988..3e5e897a79 100755
--- a/setup-libraries.sh
+++ b/setup-libraries.sh
@@ -40,6 +40,9 @@ if [[ $MISSING_DEPS != "" ]]; then
exit 1
fi
+NODE=`which node`
+NPM=`which npm`
+
if [ ! -d 'mapnik-packaging/.git' ]; then
git clone --depth=1 https://github.com/mapnik/mapnik-packaging.git
fi
@@ -92,7 +95,8 @@ cd ../../
./configure \
--pkg-config-root=`pwd`/mapnik-packaging/osx/out/build-cpp11-libcpp-universal/lib/pkgconfig \
--boost=`pwd`/mapnik-packaging/osx/out/build-cpp11-libcpp-universal \
---node=`which node`
+--npm=$NPM \
+--node=$NODE
elif [ ${UNAME} = 'Linux' ]; then
@@ -122,5 +126,6 @@ cd ../../
./configure \
--pkg-config-root=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/pkgconfig \
--boost=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-x86_64-linux \
---node=`which node`
+--npm=$NPM \
+--node=$NODE
fi
diff --git a/src/style/style.cpp b/src/style/style.cpp
index 22c7610105..ee930751ea 100644
--- a/src/style/style.cpp
+++ b/src/style/style.cpp
@@ -19,6 +19,11 @@ Style::Style()
: mtx(std::make_unique<uv::rwlock>()) {
}
+// Note: This constructor is seemingly empty, but we need to declare it anyway
+// because this file includes uv_detail.hpp, which has the declarations necessary
+// for deleting the std::unique_ptr<uv::rwlock>.
+Style::~Style() {}
+
void Style::updateProperties(float z, timestamp now) {
uv::writelock lock(mtx);
diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp
index dd4db5d738..1aa3b54bba 100644
--- a/src/style/style_parser.cpp
+++ b/src/style/style_parser.cpp
@@ -46,7 +46,7 @@ void StyleParser::parseConstants(JSVal value) {
}
}
} else {
- throw Style::exception("constants must be an object");
+ Log::Warning(Event::ParseStyle, "constants must be an object");
}
}
@@ -84,7 +84,7 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, std::string &targe
target = { property.GetString(), property.GetStringLength() };
return true;
} else {
- fprintf(stderr, "[WARNING] '%s' must be a string\n", name);
+ Log::Warning(Event::ParseStyle, "'%s' must be a string", name);
}
}
return false;
@@ -97,7 +97,7 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, float &target, con
target = property.GetDouble();
return true;
} else {
- fprintf(stderr, "[WARNING] '%s' must be a number\n", name);
+ Log::Warning(Event::ParseStyle, "'%s' must be a number", name);
}
}
return false;
@@ -109,14 +109,14 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, uint16_t &target,
if (property.IsUint()) {
unsigned int value = property.GetUint();
if (value > std::numeric_limits<uint16_t>::max()) {
- fprintf(stderr, "[WARNING] values for %s that are larger than %d are not supported\n", name, std::numeric_limits<uint16_t>::max());
+ Log::Warning(Event::ParseStyle, "values for %s that are larger than %d are not supported", name, std::numeric_limits<uint16_t>::max());
return false;
}
target = value;
return true;
} else {
- fprintf(stderr, "[WARNING] %s must be an unsigned integer\n", name);
+ Log::Warning(Event::ParseStyle, "%s must be an unsigned integer", name);
}
}
return false;
@@ -129,7 +129,7 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, int32_t &target, c
target = property.GetInt();
return true;
} else {
- fprintf(stderr, "[WARNING] %s must be an integer\n", name);
+ Log::Warning(Event::ParseStyle, "%s must be an integer", name);
}
}
return false;
@@ -144,10 +144,10 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, vec2<float> &targe
target.y = property[(rapidjson::SizeType)1].GetDouble();
return true;
} else {
- fprintf(stderr, "[WARNING] %s must have at least two members\n", name);
+ Log::Warning(Event::ParseStyle, "%s must have at least two members", name);
}
} else {
- fprintf(stderr, "[WARNING] %s must be a n array of numbers\n", name);
+ Log::Warning(Event::ParseStyle, "%s must be an array of numbers", name);
}
}
return false;
@@ -161,7 +161,7 @@ bool StyleParser::parseRenderProperty(JSVal value, T &target, const char *name)
target = Parser({ property.GetString(), property.GetStringLength() });
return true;
} else {
- fprintf(stderr, "[WARNING] %s must have one of the enum values\n", name);
+ Log::Warning(Event::ParseStyle, "%s must have one of the enum values", name);
}
}
return false;
@@ -192,7 +192,7 @@ void StyleParser::parseSources(JSVal value) {
sources.emplace(std::move(name), std::make_shared<StyleSource>(SourceInfo { type, url, tile_size, min_zoom, max_zoom }));
}
} else {
- throw Style::exception("sources must be an object");
+ Log::Warning(Event::ParseStyle, "sources must be an object");
}
}
@@ -200,7 +200,7 @@ void StyleParser::parseSources(JSVal value) {
Color parseColor(JSVal value) {
if (!value.IsString()) {
- fprintf(stderr, "[WARNING] color value must be a string\n");
+ Log::Warning(Event::ParseStyle, "color value must be a string");
return Color{{ 0, 0, 0, 0 }};
}
@@ -223,7 +223,7 @@ bool StyleParser::parseFunctionArgument(JSVal value) {
} else if (rvalue.IsNumber()) {
return rvalue.GetDouble();
} else {
- fprintf(stderr, "[WARNING] function argument must be a boolean or numeric value");
+ Log::Warning(Event::ParseStyle, "function argument must be a boolean or numeric value");
return false;
}
}
@@ -234,7 +234,7 @@ float StyleParser::parseFunctionArgument(JSVal value) {
if (rvalue.IsNumber()) {
return rvalue.GetDouble();
} else {
- fprintf(stderr, "[WARNING] function argument must be a numeric value");
+ Log::Warning(Event::ParseStyle, "function argument must be a numeric value");
return 0.0f;
}
}
@@ -251,7 +251,7 @@ template <> inline float defaultBaseValue<Color>() { return 1.0; }
template <typename T>
std::tuple<bool, Function<T>> StyleParser::parseFunction(JSVal value) {
if (!value.HasMember("stops")) {
- fprintf(stderr, "[WARNING] stops function must specify a stops array\n");
+ Log::Warning(Event::ParseStyle, "function must specify a function type");
return std::tuple<bool, Function<T>> { false, ConstantFunction<T>(T()) };
}
@@ -262,13 +262,13 @@ std::tuple<bool, Function<T>> StyleParser::parseFunction(JSVal value) {
if (value_base.IsNumber()) {
base = value_base.GetDouble();
} else {
- fprintf(stderr, "[WARNING] base must be numeric\n");
+ Log::Warning(Event::ParseStyle, "base must be numeric");
}
}
JSVal value_stops = value["stops"];
if (!value_stops.IsArray()) {
- fprintf(stderr, "[WARNING] stops function must specify a stops array\n");
+ Log::Warning(Event::ParseStyle, "stops function must specify a stops array");
return std::tuple<bool, Function<T>> { false, ConstantFunction<T>(T()) };
}
@@ -277,19 +277,19 @@ std::tuple<bool, Function<T>> StyleParser::parseFunction(JSVal value) {
JSVal stop = value_stops[i];
if (stop.IsArray()) {
if (stop.Size() != 2) {
- fprintf(stderr, "[WARNING] stop must have zoom level and value specification\n");
+ Log::Warning(Event::ParseStyle, "stop must have zoom level and value specification");
return std::tuple<bool, Function<T>> { false, ConstantFunction<T>(T()) };
}
JSVal z = stop[rapidjson::SizeType(0)];
if (!z.IsNumber()) {
- fprintf(stderr, "[WARNING] zoom level in stop must be a number\n");
+ Log::Warning(Event::ParseStyle, "zoom level in stop must be a number");
return std::tuple<bool, Function<T>> { false, ConstantFunction<T>(T()) };
}
stops.emplace_back(z.GetDouble(), parseFunctionArgument<T>(stop[rapidjson::SizeType(1)]));
} else {
- fprintf(stderr, "[WARNING] function argument must be a numeric value\n");
+ Log::Warning(Event::ParseStyle, "function argument must be a numeric value");
return std::tuple<bool, Function<T>> { false, ConstantFunction<T>(T()) };
}
}
@@ -352,7 +352,7 @@ bool StyleParser::parseOptionalProperty(const char *property_name, T &target, JS
template<> std::tuple<bool, std::string> StyleParser::parseProperty(JSVal value, const char *property_name) {
if (!value.IsString()) {
- fprintf(stderr, "[WARNING] value of '%s' must be a string\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be a string", property_name);
return std::tuple<bool, std::string> { false, std::string() };
}
@@ -361,7 +361,7 @@ template<> std::tuple<bool, std::string> StyleParser::parseProperty(JSVal value,
template<> std::tuple<bool, TranslateAnchorType> StyleParser::parseProperty(JSVal value, const char *property_name) {
if (!value.IsString()) {
- fprintf(stderr, "[WARNING] value of '%s' must be a string\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be a string", property_name);
return std::tuple<bool, TranslateAnchorType> { false, TranslateAnchorType::Map };
}
@@ -370,7 +370,7 @@ template<> std::tuple<bool, TranslateAnchorType> StyleParser::parseProperty(JSVa
template<> std::tuple<bool, RotateAnchorType> StyleParser::parseProperty<RotateAnchorType>(JSVal value, const char *property_name) {
if (!value.IsString()) {
- fprintf(stderr, "[WARNING] value of '%s' must be a string\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be a string", property_name);
return std::tuple<bool, RotateAnchorType> { false, RotateAnchorType::Map };
}
@@ -403,7 +403,7 @@ template<> std::tuple<bool, Function<bool>> StyleParser::parseProperty(JSVal val
} else if (value.IsBool()) {
return std::tuple<bool, Function<bool>> { true, ConstantFunction<bool>(value.GetBool()) };
} else {
- fprintf(stderr, "[WARNING] value of '%s' must be convertible to boolean, or a boolean function\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be convertible to boolean, or a boolean function", property_name);
return std::tuple<bool, Function<bool>> { false, ConstantFunction<bool>(false) };
}
}
@@ -416,7 +416,7 @@ template<> std::tuple<bool, Function<float>> StyleParser::parseProperty(JSVal va
} else if (value.IsBool()) {
return std::tuple<bool, Function<float>> { true, ConstantFunction<float>(value.GetBool()) };
} else {
- fprintf(stderr, "[WARNING] value of '%s' must be a number, or a number function\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be a number, or a number function", property_name);
return std::tuple<bool, Function<float>> { false, ConstantFunction<float>(0) };
}
}
@@ -427,7 +427,7 @@ template<> std::tuple<bool, Function<Color>> StyleParser::parseProperty(JSVal va
} else if (value.IsString()) {
return std::tuple<bool, Function<Color>> { true, ConstantFunction<Color>(parseColor(value)) };
} else {
- fprintf(stderr, "[WARNING] value of '%s' must be a color, or a color function\n", property_name);
+ Log::Warning(Event::ParseStyle, "value of '%s' must be a color, or a color function", property_name);
return std::tuple<bool, Function<Color>> { false, ConstantFunction<Color>(Color {{ 0, 0, 0, 0 }}) };
}
}
@@ -437,11 +437,11 @@ bool StyleParser::parseOptionalProperty(const char *property_name, const std::ve
if (value.HasMember(property_name)) {
JSVal rvalue = replaceConstant(value[property_name]);
if (!rvalue.IsArray()) {
- throw Style::exception("array value must be an array");
+ Log::Warning(Event::ParseStyle, "array value must be an array");
}
if (rvalue.Size() != keys.size()) {
- throw Style::exception("array value has unexpected number of elements");
+ Log::Warning(Event::ParseStyle, "array value has unexpected number of elements");
}
for (uint16_t i = 0; i < keys.size(); i++) {
@@ -464,27 +464,27 @@ std::unique_ptr<StyleLayerGroup> StyleParser::createLayers(JSVal value) {
}
return group;
} else {
- throw Style::exception("layers must be an array");
+ Log::Warning(Event::ParseStyle, "layers must be an array");
}
}
std::shared_ptr<StyleLayer> StyleParser::createLayer(JSVal value) {
if (value.IsObject()) {
if (!value.HasMember("id")) {
- fprintf(stderr, "[WARNING] layer must have an id\n");
+ Log::Warning(Event::ParseStyle, "layer must have an id");
return nullptr;
}
JSVal id = value["id"];
if (!id.IsString()) {
- fprintf(stderr, "[WARNING] layer id must be a string\n");
+ Log::Warning(Event::ParseStyle, "layer id must be a string");
return nullptr;
}
const std::string layer_id = { id.GetString(), id.GetStringLength() };
if (layers.find(layer_id) != layers.end()) {
- fprintf(stderr, "[WARNING] duplicate layer id %s\n", layer_id.c_str());
+ Log::Warning(Event::ParseStyle, "duplicate layer id %s", layer_id.c_str());
return nullptr;
}
@@ -504,7 +504,7 @@ std::shared_ptr<StyleLayer> StyleParser::createLayer(JSVal value) {
return layer;
} else {
- fprintf(stderr, "[WARNING] layer must be an object\n");
+ Log::Warning(Event::ParseStyle, "layer must be an object");
return nullptr;
}
}
@@ -522,7 +522,7 @@ void StyleParser::parseLayer(std::pair<JSVal, std::shared_ptr<StyleLayer>> &pair
if (value.HasMember("type")) {
JSVal type = value["type"];
if (!type.IsString()) {
- fprintf(stderr, "[WARNING] layer type of '%s' must be a string\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "layer type of '%s' must be a string", layer->id.c_str());
} else {
layer->type = StyleLayerTypeClass(std::string { type.GetString(), type.GetStringLength() });
}
@@ -535,7 +535,7 @@ void StyleParser::parseLayer(std::pair<JSVal, std::shared_ptr<StyleLayer>> &pair
// Make sure we have not previously attempted to parse this layer.
if (std::find(stack.begin(), stack.end(), layer.get()) != stack.end()) {
- fprintf(stderr, "[WARNING] layer reference of '%s' is circular\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "layer reference of '%s' is circular", layer->id.c_str());
return;
}
@@ -652,13 +652,13 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) {
void StyleParser::parseReference(JSVal value, std::shared_ptr<StyleLayer> &layer) {
if (!value.IsString()) {
- fprintf(stderr, "[WARNING] layer ref of '%s' must be a string\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "layer ref of '%s' must be a string", layer->id.c_str());
return;
}
const std::string ref { value.GetString(), value.GetStringLength() };
auto it = layers.find(ref);
if (it == layers.end()) {
- fprintf(stderr, "[WARNING] layer '%s' references unknown layer %s\n", layer->id.c_str(), ref.c_str());
+ Log::Warning(Event::ParseStyle, "layer '%s' references unknown layer %s", layer->id.c_str(), ref.c_str());
// We cannot parse this layer further.
return;
}
@@ -674,7 +674,7 @@ void StyleParser::parseReference(JSVal value, std::shared_ptr<StyleLayer> &layer
layer->type = reference->type;
if (reference->layers) {
- fprintf(stderr, "[WARNING] layer '%s' references composite layer\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "layer '%s' references composite layer", layer->id.c_str());
// We cannot parse this layer further.
return;
} else {
@@ -698,11 +698,10 @@ void StyleParser::parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer) {
if (source_it != sources.end()) {
layer->bucket->style_source = source_it->second;
} else {
- fprintf(stderr, "[WARNING] can't find source '%s' required for layer '%s'\n",
- source_name.c_str(), layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "can't find source '%s' required for layer '%s'", source_name.c_str(), layer->id.c_str());
}
} else {
- fprintf(stderr, "[WARNING] source of layer '%s' must be a string\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "source of layer '%s' must be a string", layer->id.c_str());
}
}
@@ -711,7 +710,7 @@ void StyleParser::parseBucket(JSVal value, std::shared_ptr<StyleLayer> &layer) {
if (value_source_layer.IsString()) {
layer->bucket->source_layer = { value_source_layer.GetString(), value_source_layer.GetStringLength() };
} else {
- fprintf(stderr, "[WARNING] source-layer of layer '%s' must be a string\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "source-layer of layer '%s' must be a string", layer->id.c_str());
}
}
@@ -791,7 +790,7 @@ FilterExpression StyleParser::parseFilter(JSVal value, FilterExpression::Operato
expression.add(parseFilter(replaceConstant(value[i])));
}
} else {
- fprintf(stderr, "[WARNING] expression must be either an array or an object\n");
+ Log::Warning(Event::ParseStyle, "expression must be either an array or an object");
}
return expression;
@@ -833,7 +832,7 @@ std::vector<Value> StyleParser::parseValues(JSVal value) {
void StyleParser::parseRender(JSVal value, std::shared_ptr<StyleLayer> &layer) {
if (!value.IsObject()) {
- fprintf(stderr, "[WARNING] render property of layer '%s' must be an object\n", layer->id.c_str());
+ Log::Warning(Event::ParseStyle, "render property of layer '%s' must be an object", layer->id.c_str());
return;
}
diff --git a/test/fixtures/fixture_log.cpp b/test/fixtures/fixture_log.cpp
index cc3dfb4087..c2c10fc9eb 100644
--- a/test/fixtures/fixture_log.cpp
+++ b/test/fixtures/fixture_log.cpp
@@ -44,4 +44,4 @@ std::vector<FixtureLogBackend::LogMessage> FixtureLogBackend::unchecked() const
return os << "]" << std::endl;
}
-} \ No newline at end of file
+}
diff --git a/test/fixtures/style_parser/colors.info.json b/test/fixtures/style_parser/colors.info.json
new file mode 100644
index 0000000000..9c25a2f488
--- /dev/null
+++ b/test/fixtures/style_parser/colors.info.json
@@ -0,0 +1,6 @@
+{
+ "default": {
+ "log": [
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/colors.style.json b/test/fixtures/style_parser/colors.style.json
new file mode 100644
index 0000000000..c3e94d6370
--- /dev/null
+++ b/test/fixtures/style_parser/colors.style.json
@@ -0,0 +1,40 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "constants": {
+ "@land":"r44,239,225)",
+ "@snow":"f4f8foNGbjf#",
+ "@crop":"#eerLznieed4"
+ },
+ "layers": [{
+ "id": "background",
+ "type": "background",
+ "style": {
+ "background-color": "@land"
+ }
+ }, {
+ "id": "landcover_snow",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "snow" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@snow"
+ }
+ }, {
+ "id": "landcover_crop",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "crop" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@crop"
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/default.info.json b/test/fixtures/style_parser/default.info.json
new file mode 100644
index 0000000000..9c25a2f488
--- /dev/null
+++ b/test/fixtures/style_parser/default.info.json
@@ -0,0 +1,6 @@
+{
+ "default": {
+ "log": [
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/default.style.json b/test/fixtures/style_parser/default.style.json
new file mode 100755
index 0000000000..aea2a1a3ac
--- /dev/null
+++ b/test/fixtures/style_parser/default.style.json
@@ -0,0 +1,2244 @@
+{
+ "version": 3,
+ "sprite": "https://www.mapbox.com/mapbox-gl-styles/sprites/outdoors",
+ "glyphs": "https://mapbox.s3.amazonaws.com/gl-glyphs-256/{fontstack}/{range}.pbf",
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "constants": {
+ "@land": "rgb(244,239,225)",
+ "@water": "#cdd",
+ "@water_dark": "#185869",
+ "@crop": "#eeeed4",
+ "@grass": "#e6e6cc",
+ "@scrub": "#dfe5c8",
+ "@wood": "#cee2bd",
+ "@snow": "#f4f8ff",
+ "@rock": "#ddd",
+ "@sand": "#ffd",
+ "@cemetery": "#edf4ed",
+ "@pitch": "#fff",
+ "@park": "#d4e4bc",
+ "@piste": "blue",
+ "@school": "#e8dfe0",
+ "@hospital": "#f8eee0",
+ "@builtup": "#f6faff",
+ "@case": "#fff",
+ "@motorway": "#cda0a0",
+ "@main": "#ddc0b9",
+ "@street": "#fff",
+ "@text": "#666",
+ "@text_stroke": "rgba(255,255,255,0.8)",
+ "@country_text": "#222",
+ "@marine_text": "#a0bdc0",
+ "@water_text": "#185869",
+ "@land_night": "#017293",
+ "@water_night": "#103",
+ "@water_dark_night": "#003366",
+ "@crop_night": "#178d96",
+ "@grass_night": "#23948a",
+ "@scrub_night": "#31a186",
+ "@wood_night": "#45b581",
+ "@park_night": "#51bd8b",
+ "@snow_night": "#5ad9fe",
+ "@rock_night": "#999",
+ "@sand_night": "#437162",
+ "@cemetery_night": "#218c96",
+ "@pitch_night": "rgba(255,255,255,0.2)",
+ "@school_night": "#01536a",
+ "@hospital_night": "#015e7a",
+ "@builtup_night": "#014b60",
+ "@admin_night": "#ffb680",
+ "@text_night": "#fff",
+ "@text_water_night": "#2a5b8a",
+ "@text_stroke_night": "#103",
+ "@text2_stroke_night": "rgba(1,69,89,0.8)",
+ "@case_night": "#015e7a",
+ "@street_case_night": "#015b76",
+ "@motorway_night": "#bbdde7",
+ "@main_night": "#64b2c9",
+ "@street_night": "#0186ac",
+ "@contour_night": "#ffff80",
+ "@river_canal_width": {
+ "stops": [[10, 0.5], [11, 1], [13, 2], [15, 3]]
+ },
+ "@stream_width": {
+ "stops": [[12, 0.25], [13, 0.5], [15, 1.5], [17, 2]]
+ },
+ "@motorway_width": {
+ "stops": [[4, 0], [5, 0.5], [7, 0.8], [9, 1], [10, 1.2], [11, 2], [12, 3], [13, 4], [14, 6], [15, 9], [16, 12], [17, 14]]
+ },
+ "@motorway_casing_width": {
+ "stops": [[6.5, 0.6], [7, 0.8], [9, 2.8], [10, 3], [11, 4], [12, 5], [13, 6.5], [14, 9], [15, 12], [16, 15], [17, 17]]
+ },
+ "@motorway_link_width": {
+ "stops": [[11, 1.2], [13, 2], [15, 3], [17, 4]]
+ },
+ "@motorway_link_casing_width": {
+ "stops": [[11, 2.8], [13, 3.5], [15, 5], [17, 6]]
+ },
+ "@main_width": {
+ "stops": [[4, 1], [11, 1], [12, 1.5], [13, 2], [14, 3], [15, 6], [16, 10], [17, 12]]
+ },
+ "@main_casing_width": {
+ "stops": [[8, 2.9], [11, 2.9], [12, 3.5], [13, 4], [14, 5.5], [15, 9], [16, 12], [17, 14]]
+ },
+ "@street_width": {
+ "stops": [[13.5, 0], [14, 1.5], [15, 3], [16, 8]]
+ },
+ "@street_casing_width": {
+ "stops": [[12, 0.4], [13, 1], [14, 2.5], [15, 4], [16, 10]]
+ },
+ "@street_casing_opacity": {
+ "stops": [[13, 0], [13.5, 1]]
+ },
+ "@service_casing_width": {
+ "stops": [[13, 0.5], [14, 3], [15, 3.5], [16, 4], [17, 5], [18, 6]]
+ },
+ "@runway_width": {
+ "stops": [[9, 1], [10, 2], [11, 3], [12, 5], [13, 7], [14, 11], [15, 15], [16, 19], [17, 23]]
+ },
+ "@taxiway_width": {
+ "stops": [[9, 0.2], [11, 0.2], [12, 1], [13, 1.5], [14, 2], [15, 3], [16, 4], [17, 5]]
+ },
+ "@aerialway_width": {
+ "stops": [[12.5, 0.8], [13, 1.4], [14, 1.6], [15, 2], [16, 2.4], [17, 3]]
+ },
+ "@aerialway_casing_width": {
+ "stops": [[12.5, 2], [13, 2.5], [14, 3], [15, 3.5], [16, 4], [21, 5]]
+ },
+ "@path_width": {
+ "stops": [[13, 1.2], [14, 1.5], [15, 1.8]]
+ },
+ "@admin_l2_width": {
+ "stops": [[1, 0.5], [2, 0.7], [3, 0.7], [4, 0.8], [5, 1], [7, 2], [9, 3]]
+ },
+ "@admin_l3_width": {
+ "stops": [[5, 0.6], [7, 1], [11, 2]]
+ },
+ "@road_label_1_size": {
+ "stops": [[12, 11], [13, 12], [14, 13], [15, 14], [16, 16], [17, 18]]
+ },
+ "@road_label_2_size": {
+ "stops": [[12, 11], [13, 12], [15, 14], [17, 16]]
+ },
+ "@road_label_3_size": {
+ "stops": [[14, 10], [15, 12], [17, 14]]
+ },
+ "@fence_width": {
+ "stops": [[16, 0.6], [18, 1]]
+ },
+ "@hedge_width": {
+ "stops": [[15, 0.6], [16, 1.2], [18, 1.6]]
+ },
+ "@barrier_line_land_width": {
+ "stops": [[13, 0.4], [14, 0.75], [15, 1.5], [16, 3], [17, 6], [18, 12], [19, 24], [20, 48]]
+ },
+ "@country_label_size": {
+ "stops": [[0, 14], [11, 24]]
+ },
+ "@poi_label_1-2_size": {
+ "stops": [[14, 10], [15, 11], [16, 12]]
+ },
+ "@poi_label_3_size": {
+ "stops": [[15, 10], [16, 11]]
+ },
+ "@hillshade_rasterize": {
+ "enabled": {
+ "stops": [[10, false], [11, true]]
+ },
+ "size": {
+ "stops": [[10, 1024], [11, 512], [12, 256]]
+ },
+ "blur": 1
+ }
+ },
+ "layers": [{
+ "id": "background",
+ "type": "background",
+ "style": {
+ "background-color": "@land"
+ },
+ "style.night": {
+ "background-color": "@land_night"
+ }
+ }, {
+ "id": "landcover_snow",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "snow" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@snow"
+ },
+ "style.night": {
+ "fill-color": "@snow_night"
+ }
+ }, {
+ "id": "landcover_crop",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "crop" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@crop"
+ },
+ "style.night": {
+ "fill-color": "@crop_night"
+ }
+ }, {
+ "id": "landcover_grass",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "grass" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@grass",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ },
+ "style.night": {
+ "fill-color": "@grass_night",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ }
+ }, {
+ "id": "landcover_scrub",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "scrub" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@scrub",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ },
+ "style.night": {
+ "fill-color": "@scrub_night",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ }
+ }, {
+ "id": "landcover_wood",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "wood" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@wood",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ },
+ "style.night": {
+ "fill-color": "@wood_night",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ }
+ }, {
+ "id": "landuse_wood",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "wood" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@wood"
+ },
+ "style.night": {
+ "fill-color": "@wood_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_school",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "school" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@school"
+ },
+ "style.night": {
+ "fill-color": "@school_night"
+ }
+ }, {
+ "id": "landuse_sand",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "sand" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@sand"
+ },
+ "style.night": {
+ "fill-color": "@sand_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_pitch",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "pitch" },
+ "type": "fill",
+ "style": {
+ "fill-color": "rgba(255,255,255,0.5)",
+ "fill-outline-color": "@pitch"
+ },
+ "style.night": {
+ "fill-color": "@pitch_night",
+ "fill-outline-color": "@pitch"
+ }
+ }, {
+ "id": "landuse_park",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "park" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@park"
+ },
+ "style.night": {
+ "fill-color": "@park_night"
+ }
+ }, {
+ "id": "landuse_industrial",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "industrial" },
+ "type": "fill",
+ "style": {
+ "fill-color": "rgba(246,250,255,0.5)"
+ },
+ "style.night": {
+ "fill-color": "@builtup_night"
+ }
+ }, {
+ "id": "landuse_scrub",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "scrub" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@scrub"
+ },
+ "style.night": {
+ "fill-color": "@scrub_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_grass",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "grass" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@grass"
+ },
+ "style.night": {
+ "fill-color": "@grass_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_crop",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "crop" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@crop"
+ },
+ "style.night": {
+ "fill-color": "@crop_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_rock",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "rock" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@rock"
+ },
+ "style.night": {
+ "fill-color": "@rock_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_snow",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "snow" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@snow"
+ },
+ "style.night": {
+ "fill-color": "@snow_night",
+ "fill-opacity": 0.8
+ }
+ }, {
+ "id": "landuse_hospital",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "hospital" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@hospital"
+ },
+ "style.night": {
+ "fill-color": "@hospital_night"
+ }
+ }, {
+ "id": "landuse_cemetery",
+ "source": "mapbox",
+ "source-layer": "landuse",
+ "filter": { "class": "cemetery" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@cemetery"
+ },
+ "style.night": {
+ "fill-color": "@cemetery_night"
+ }
+ }, {
+ "id": "overlay_wetland",
+ "source": "mapbox",
+ "source-layer": "landuse_overlay",
+ "filter": { "class": ["wetland", "wetland_noveg"] },
+ "type": "fill",
+ "style": {
+ "fill-color": "rgba(210,225,225,0.2)",
+ "fill-image": "wetland_noveg_64"
+ },
+ "style.night": {
+ "fill-color": "rgba(210,225,225,0.2)",
+ "fill-image": "wetland_noveg_64"
+ }
+ }, {
+ "id": "overlay_breakwater_pier",
+ "source": "mapbox",
+ "source-layer": "landuse_overlay",
+ "filter": { "class": ["breakwater", "pier"] },
+ "type": "fill",
+ "style": {
+ "fill-color": "@land"
+ },
+ "style.night": {
+ "fill-color": "@land_night"
+ }
+ }, {
+ "id": "waterway_river_canal",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": ["river", "canal"] },
+ "type": "line",
+ "render": {
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "#87abaf",
+ "line-width": "@river_canal_width"
+ },
+ "style.night": {
+ "line-color": "rgb(10,20,71)",
+ "line-width": "@river_canal_width"
+ }
+ }, {
+ "id": "waterway_stream",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": "stream" },
+ "type": "line",
+ "render": {
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "#87abaf",
+ "line-width": "@stream_width"
+ },
+ "style.night": {
+ "line-color": "rgb(10,20,71)",
+ "line-width": "@stream_width"
+ }
+ }, {
+ "id": "building_shadow",
+ "source": "mapbox",
+ "source-layer": "building",
+ "type": "fill",
+ "style": {
+ "fill-color": "#d5d1c6",
+ "fill-translate": [1, 1],
+ "fill-opacity": {
+ "stops": [[15.5, 0], [16, 1]]
+ },
+ "fill-outline-color": "#d5d1c6"
+ },
+ "style.night": {
+ "fill-color": "#026688",
+ "fill-translate": [1, 1],
+ "fill-opacity": {
+ "stops": [[15.5, 0], [16, 1]]
+ },
+ "fill-outline-color": "#026688"
+ }
+ }, {
+ "id": "building",
+ "ref": "building_shadow",
+ "style": {
+ "fill-color": "#ebe7db"
+ },
+ "style.night": {
+ "fill-color": "#027797"
+ }
+ }, {
+ "id": "building_wall",
+ "ref": "building_shadow",
+ "style": {
+ "fill-color": "#ebe7db",
+ "fill-opacity": {
+ "stops": [[15.5, 0], [16, 0.7]]
+ },
+ "fill-outline-color": "#d5d1c6"
+ },
+ "style.night": {
+ "fill-color": "#027797",
+ "fill-opacity": {
+ "stops": [[15.5, 0], [16, 0.7]]
+ },
+ "fill-outline-color": "#026688"
+ }
+ }, {
+ "id": "hillshade_full_highlight",
+ "source": "mapbox",
+ "source-layer": "hillshade",
+ "filter": { "class": "full_highlight" },
+ "type": "fill",
+ "rasterize": "@hillshade_rasterize",
+ "style": {
+ "fill-color": "#fffff3",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[14, 0.3], [15, 0.3], [16, 0.2], [17, 0.2], [18, 0.1]]
+ }
+ },
+ "style.night": {
+ "fill-color": "#fdfdad",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[13, 0.4], [14, 0.3], [16, 0.2], [17, 0.1], [18, 0.05]]
+ }
+ }
+ }, {
+ "id": "hillshade_medium_highlight",
+ "source": "mapbox",
+ "source-layer": "hillshade",
+ "filter": { "class": "medium_highlight" },
+ "type": "fill",
+ "rasterize": "@hillshade_rasterize",
+ "style": {
+ "fill-color": "#ffd",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[14, 0.3], [15, 0.3], [16, 0.2], [17, 0.2], [18, 0.1]]
+ }
+ },
+ "style.night": {
+ "fill-color": "#ffe1b7",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[14, 0.3], [16, 0.2], [17, 0.15], [18, 0.05]]
+ }
+ }
+ }, {
+ "id": "hillshade_medium_shadow",
+ "source": "mapbox",
+ "source-layer": "hillshade",
+ "filter": { "class": "medium_shadow" },
+ "type": "fill",
+ "rasterize": "@hillshade_rasterize",
+ "style": {
+ "fill-color": "#206",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[14, 0.08], [15, 0.075], [16, 0.05], [17, 0.05], [18, 0.025]]
+ }
+ },
+ "style.night": {
+ "fill-color": "#206",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[15, 0.3], [16, 0.2], [17, 0.1], [18, 0.05]]
+ }
+ }
+ }, {
+ "id": "hillshade_full_shadow",
+ "source": "mapbox",
+ "source-layer": "hillshade",
+ "filter": { "class": "full_shadow" },
+ "type": "fill",
+ "rasterize": "@hillshade_rasterize",
+ "style": {
+ "fill-color": "#103",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[14, 0.08], [15, 0.075], [16, 0.05], [17, 0.05], [18, 0.025]]
+ }
+ },
+ "style.night": {
+ "fill-color": "#103",
+ "fill-antialias": false,
+ "fill-opacity": {
+ "stops": [[15, 0.3], [16, 0.2], [17, 0.1], [18, 0.05]]
+ }
+ }
+ }, {
+ "id": "contour_line_loud",
+ "source": "mapbox",
+ "source-layer": "contour",
+ "filter": { "index": 5 },
+ "type": "line",
+ "render": {
+ "line-join": "round"
+ },
+ "style": {
+ "line-color": "#008",
+ "line-width": 0.9,
+ "line-opacity": {
+ "stops": [[11, 0.05], [12, 0.11]]
+ }
+ },
+ "style.night": {
+ "line-color": "@contour_night",
+ "line-width": 0.9,
+ "line-opacity": {
+ "stops": [[11, 0.1], [12, 0.2]]
+ }
+ }
+ }, {
+ "id": "contour_line_regular",
+ "source": "mapbox",
+ "source-layer": "contour",
+ "type": "line",
+ "render": {
+ "line-join": "round"
+ },
+ "style": {
+ "line-color": "#008",
+ "line-width": 0.5,
+ "line-opacity": {
+ "stops": [[11, 0.05], [12, 0.11]]
+ }
+ },
+ "style.night": {
+ "line-color": "@contour_night",
+ "line-width": 0.5,
+ "line-opacity": {
+ "stops": [[11, 0.1], [12, 0.4]]
+ }
+ }
+ }, {
+ "id": "barrier_line_gate",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "gate" },
+ "type": "line",
+ "style": {
+ "line-width": 2.5,
+ "line-color": "#aab"
+ },
+ "style.night": {
+ "line-width": 2.5,
+ "line-color": "#59596f"
+ }
+ }, {
+ "id": "barrier_line_fence",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "fence" },
+ "type": "line",
+ "style": {
+ "line-color": "#aeada3",
+ "line-width": "@fence_width"
+ },
+ "style.night": {
+ "line-color": "#014b61",
+ "line-width": "@fence_width"
+ }
+ }, {
+ "id": "barrier_line_hedge",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "hedge" },
+ "type": "line",
+ "style": {
+ "line-color": "#8de99b",
+ "line-width": "@hedge_width"
+ },
+ "style.night": {
+ "line-color": "#2e7a57",
+ "line-width": "@hedge_width"
+ }
+ }, {
+ "id": "barrier_line_land",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "land" },
+ "type": "line",
+ "style": {
+ "line-color": "@land",
+ "line-width": "@barrier_line_land_width"
+ },
+ "style.night": {
+ "line-color": "@land_night",
+ "line-width": "@barrier_line_land_width"
+ }
+ }, {
+ "id": "barrier_line_land_fill",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "land" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@land"
+ },
+ "style.night": {
+ "fill-color": "@land_night"
+ }
+ }, {
+ "id": "barrier_line_cliff",
+ "source": "mapbox",
+ "source-layer": "barrier_line",
+ "filter": { "class": "cliff" },
+ "type": "line",
+ "style": {
+ "line-color": "#987",
+ "line-width": 4
+ },
+ "style.night": {
+ "line-color": "#63574b",
+ "line-width": 4
+ }
+ }, {
+ "id": "water",
+ "source": "mapbox",
+ "source-layer": "water",
+ "type": "fill",
+ "style": {
+ "fill-color": "@water",
+ "fill-outline-color": "#a2bdc0"
+ },
+ "style.night": {
+ "fill-color": "@water_night",
+ "fill-outline-color": "@water_dark_night"
+ }
+ }, {
+ "id": "aeroway_fill",
+ "source": "mapbox",
+ "source-layer": "aeroway",
+ "type": "fill",
+ "style": {
+ "fill-color": "#ddd"
+ },
+ "style.night": {
+ "fill-color": "#367"
+ }
+ }, {
+ "id": "aeroway_runway",
+ "source": "mapbox",
+ "source-layer": "aeroway",
+ "filter": { "type": "runway" },
+ "type": "line",
+ "style": {
+ "line-color": "#ddd",
+ "line-width": "@runway_width"
+ },
+ "style.night": {
+ "line-color": "#367",
+ "line-width": "@runway_width"
+ }
+ }, {
+ "id": "aeroway_taxiway",
+ "source": "mapbox",
+ "source-layer": "aeroway",
+ "filter": { "type": "taxiway" },
+ "type": "line",
+ "style": {
+ "line-color": "#ddd",
+ "line-width": "@taxiway_width"
+ },
+ "style.night": {
+ "line-color": "#367",
+ "line-width": "@taxiway_width"
+ }
+ }, {
+ "id": "tunnel_motorway_link_casing",
+ "source": "mapbox",
+ "source-layer": "tunnel",
+ "filter": { "class": "motorway_link" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-dasharray": [6, 6],
+ "line-width": "@motorway_link_casing_width"
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-dasharray": [6, 6],
+ "line-width": "@motorway_link_casing_width"
+ }
+ }, {
+ "id": "tunnel_service_casing",
+ "source": "mapbox",
+ "source-layer": "tunnel",
+ "filter": { "class": "service" },
+ "type": "line",
+ "style": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-dasharray": [6, 6],
+ "line-width": "@service_casing_width"
+ },
+ "style.night": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-dasharray": [6, 6],
+ "line-width": "@service_casing_width"
+ }
+ }, {
+ "id": "tunnel_main_casing",
+ "source": "mapbox",
+ "source-layer": "tunnel",
+ "filter": { "class": "main" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-dasharray": [6, 6],
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-dasharray": [6, 6],
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "tunnel_street_casing",
+ "source": "mapbox",
+ "source-layer": "tunnel",
+ "filter": { "class": ["street", "street_limited"] },
+ "type": "line",
+ "style": {
+ "line-color": "#d9d5c6",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ },
+ "style.night": {
+ "line-color": "@street_case_night",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ }
+ }, {
+ "id": "tunnel_motorway_link",
+ "ref": "tunnel_motorway_link_casing",
+ "style": {
+ "line-color": "#e6cec7",
+ "line-width": "@motorway_link_width"
+ },
+ "style.night": {
+ "line-color": "#78b0c1",
+ "line-width": "@motorway_link_width"
+ }
+ }, {
+ "id": "tunnel_service",
+ "ref": "tunnel_service_casing",
+ "style": {
+ "line-color": "#e6cec7",
+ "line-width": 2
+ },
+ "style.night": {
+ "line-color": "#017ca0",
+ "line-width": 2
+ }
+ }, {
+ "id": "tunnel_street",
+ "ref": "tunnel_street_casing",
+ "style": {
+ "line-color": "#d9d5c6",
+ "line-width": "@street_width"
+ },
+ "style.night": {
+ "line-color": "@street_night",
+ "line-width": "@street_width"
+ }
+ }, {
+ "id": "tunnel_main",
+ "ref": "tunnel_main_casing",
+ "style": {
+ "line-color": "#e6cec7",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "#78b0c1",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "tunnel_motorway_casing",
+ "source": "mapbox",
+ "source-layer": "tunnel",
+ "filter": { "class": "motorway" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-dasharray": [6, 6],
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-dasharray": [6, 6],
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "tunnel_motorway",
+ "ref": "tunnel_motorway_casing",
+ "style": {
+ "line-color": "#e6cec7",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "#78b0c1",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "road_path_case",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": "path" },
+ "type": "line",
+ "style": {
+ "line-color": "#ffd",
+ "line-opacity": 0.4,
+ "line-width": {
+ "stops": [[14, 3], [15, 4]]
+ }
+ },
+ "style.night": {
+ "line-color": "@land_night",
+ "line-opacity": 0.2
+ }
+ }, {
+ "id": "road_path_footway",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "footway" },
+ "type": "line",
+ "style": {
+ "line-color": "#bba",
+ "line-dasharray": [10, 4],
+ "line-width": "@path_width"
+ },
+ "style.night": {
+ "line-color": "#fff",
+ "line-dasharray": [10, 4],
+ "line-width": "@path_width"
+ }
+ }, {
+ "id": "road_path_path",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "path" },
+ "type": "line",
+ "style": {
+ "line-color": "#987",
+ "line-dasharray": [10, 4],
+ "line-opacity": 0.8,
+ "line-width": {
+ "stops": [[13, 0.8], [14, 0.9], [15, 1.2]]
+ }
+ },
+ "style.night": {
+ "line-color": "#fff",
+ "line-dasharray": [10, 4],
+ "line-opacity": 0.8,
+ "line-width": {
+ "stops": [[13, 0.8], [14, 0.9], [15, 1.2]]
+ }
+ }
+ }, {
+ "id": "road_path_cycleway",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "cycleway" },
+ "type": "line",
+ "style": {
+ "line-color": "#488",
+ "line-dasharray": [10, 4],
+ "line-width": "@path_width"
+ },
+ "style.night": {
+ "line-color": "#94e6ff",
+ "line-dasharray": [10, 4],
+ "line-width": "@path_width"
+ }
+ }, {
+ "id": "road_path_mtb",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "mtb" },
+ "type": "line",
+ "style": {
+ "line-color": "#488",
+ "line-dasharray": [12, 4],
+ "line-width": "@path_width"
+ },
+ "style.night": {
+ "line-color": "#94e6ff",
+ "line-dasharray": [12, 4],
+ "line-width": "@path_width"
+ }
+ }, {
+ "id": "road_path_piste",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "piste" },
+ "type": "line",
+ "style": {
+ "line-color": "#87b",
+ "line-dasharray": [8, 4],
+ "line-width": "@path_width"
+ },
+ "style.night": {
+ "line-color": "#715dae",
+ "line-dasharray": [8, 4],
+ "line-width": "@path_width"
+ }
+ }, {
+ "id": "road_path_steps",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "type": "steps" },
+ "type": "line",
+ "style": {
+ "line-color": "#bba",
+ "line-dasharray": [10, 4],
+ "line-width": 4
+ },
+ "style.night": {
+ "line-color": "#016684",
+ "line-dasharray": [10, 4],
+ "line-opacity": 0.3,
+ "line-width": 6
+ }
+ }, {
+ "id": "road_major_rail",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "major_rail" },
+ "type": "line",
+ "style": {
+ "line-color": "#c8c4c0",
+ "line-width": 0.8
+ },
+ "style.night": {
+ "line-color": "#c8c4c0",
+ "line-width": 0.8
+ }
+ }, {
+ "id": "road_motorway_link_casing",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": "motorway_link" },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "@case",
+ "line-width": "@motorway_link_casing_width"
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@motorway_link_casing_width"
+ }
+ }, {
+ "id": "road_service_casing",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": "service" },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-width": "@service_casing_width"
+ },
+ "style.night": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-width": "@service_casing_width"
+ }
+ }, {
+ "id": "road_main_casing",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": "main" },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "@case",
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "road_street_casing",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": ["street", "street_limited"] },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "#d9d5c6",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ },
+ "style.night": {
+ "line-color": "@street_case_night",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ }
+ }, {
+ "id": "road_motorway_link",
+ "ref": "road_motorway_link_casing",
+ "style": {
+ "line-color": "@motorway",
+ "line-width": "@motorway_link_width"
+ },
+ "style.night": {
+ "line-color": "@motorway_night",
+ "line-width": "@motorway_link_width"
+ }
+ }, {
+ "id": "road_service",
+ "ref": "road_service_casing",
+ "style": {
+ "line-color": "@street",
+ "line-width": 2
+ },
+ "style.night": {
+ "line-color": "@street_night",
+ "line-width": 2
+ }
+ }, {
+ "id": "road_street",
+ "ref": "road_street_casing",
+ "style": {
+ "line-color": "@street",
+ "line-width": "@street_width"
+ },
+ "style.night": {
+ "line-color": "@street_night",
+ "line-width": "@street_width"
+ }
+ }, {
+ "id": "road_main",
+ "ref": "road_main_casing",
+ "style": {
+ "line-color": "@main",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@main_night",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "road_motorway_casing",
+ "source": "mapbox",
+ "source-layer": "road",
+ "filter": { "class": "motorway" },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "@case",
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "road_motorway",
+ "ref": "road_motorway_casing",
+ "style": {
+ "line-color": "@motorway",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@motorway_night",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "road_major_rail_hatching",
+ "ref": "road_major_rail",
+ "style": {
+ "line-color": "#c8c4c0",
+ "line-dasharray": [2, 31],
+ "line-width": 5
+ },
+ "style.night": {
+ "line-color": "#c8c4c0",
+ "line-dasharray": [2, 31],
+ "line-width": 5
+ }
+ }, {
+ "id": "bridge_motorway_link_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "motorway_link" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-width": "@motorway_link_casing_width"
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@motorway_link_casing_width"
+ }
+ }, {
+ "id": "bridge_service_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "service" },
+ "type": "line",
+ "style": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-width": "@service_casing_width"
+ },
+ "style.night": {
+ "line-color": "#000",
+ "line-opacity": 0.04,
+ "line-width": "@service_casing_width"
+ }
+ }, {
+ "id": "bridge_main_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "main" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@main_casing_width",
+ "line-opacity": {
+ "stops": [[8, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "bridge_street_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": ["street", "street_limited"] },
+ "type": "line",
+ "style": {
+ "line-color": "#d9d5c6",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ },
+ "style.night": {
+ "line-color": "@street_case_night",
+ "line-width": "@street_casing_width",
+ "line-opacity": "@street_casing_opacity"
+ }
+ }, {
+ "id": "bridge_motorway_link",
+ "ref": "bridge_motorway_link_casing",
+ "style": {
+ "line-color": "@motorway",
+ "line-width": "@motorway_link_width"
+ },
+ "style.night": {
+ "line-color": "@motorway_night",
+ "line-width": "@motorway_link_width"
+ }
+ }, {
+ "id": "bridge_service",
+ "ref": "bridge_service_casing",
+ "style": {
+ "line-color": "@street",
+ "line-width": 2
+ },
+ "style.night": {
+ "line-color": "@street_night",
+ "line-width": 2
+ }
+ }, {
+ "id": "bridge_street",
+ "ref": "bridge_street_casing",
+ "style": {
+ "line-color": "@street",
+ "line-width": "@street_width"
+ },
+ "style.night": {
+ "line-color": "@street_night",
+ "line-width": "@street_width"
+ }
+ }, {
+ "id": "bridge_main",
+ "ref": "bridge_main_casing",
+ "style": {
+ "line-color": "@main",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@main_night",
+ "line-width": "@main_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "bridge_motorway_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "motorway" },
+ "type": "line",
+ "style": {
+ "line-color": "@case",
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@case_night",
+ "line-width": "@motorway_casing_width",
+ "line-opacity": {
+ "stops": [[8.5, 0], [9, 1]]
+ }
+ }
+ }, {
+ "id": "bridge_motorway",
+ "ref": "bridge_motorway_casing",
+ "style": {
+ "line-color": "@motorway",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ },
+ "style.night": {
+ "line-color": "@motorway_night",
+ "line-width": "@motorway_width",
+ "line-opacity": {
+ "stops": [[5.5, 0], [6, 1]]
+ }
+ }
+ }, {
+ "id": "bridge_aerialway_casing",
+ "source": "mapbox",
+ "source-layer": "bridge",
+ "filter": { "class": "aerialway" },
+ "type": "line",
+ "style": {
+ "line-color": "white",
+ "line-opacity": 0.5,
+ "line-width": "@aerialway_casing_width"
+ },
+ "style.night": {
+ "line-color": "white",
+ "line-opacity": 0.5,
+ "line-width": "@aerialway_casing_width"
+ }
+ }, {
+ "id": "bridge_aerialway",
+ "ref": "bridge_aerialway_casing",
+ "style": {
+ "line-color": "#876",
+ "line-opacity": 0.5,
+ "line-width": "@aerialway_width"
+ },
+ "style.night": {
+ "line-color": "#876",
+ "line-opacity": 0.5,
+ "line-width": "@aerialway_width"
+ }
+ }, {
+ "id": "admin_l3",
+ "source": "mapbox",
+ "source-layer": "admin",
+ "filter": { "admin_level": [3, 4, 5] },
+ "type": "line",
+ "render": {
+ "line-join": "round"
+ },
+ "style": {
+ "line-color": "#88a",
+ "line-dasharray": [60, 20],
+ "line-opacity": {
+ "stops": [[3, 0], [5, 1]]
+ },
+ "line-width": "@admin_l3_width"
+ },
+ "style.night": {
+ "line-color": "@admin_night",
+ "line-dasharray": [60, 20],
+ "line-opacity": {
+ "stops": [[3, 0], [5, 1]]
+ },
+ "line-width": "@admin_l3_width"
+ }
+ }, {
+ "id": "admin_l2",
+ "source": "mapbox",
+ "source-layer": "admin",
+ "filter": { "admin_level": 2 },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "#88a",
+ "line-width": "@admin_l2_width"
+ },
+ "style.night": {
+ "line-color": "@admin_night",
+ "line-width": "@admin_l2_width"
+ }
+ }, {
+ "id": "admin_maritime_cover",
+ "source": "mapbox",
+ "source-layer": "admin",
+ "filter": { "maritime": 1 },
+ "type": "line",
+ "render": {
+ "line-join": "round",
+ "line-cap": "round"
+ },
+ "style": {
+ "line-color": "@water",
+ "line-width": 5
+ },
+ "style.night": {
+ "line-color": "@water_night",
+ "line-width": 5
+ }
+ }, {
+ "id": "admin_maritime",
+ "ref": "admin_maritime_cover",
+ "style": {
+ "line-color": "#c0d6d6",
+ "line-width": {
+ "stops": [[5, 1], [7, 2], [11, 3]]
+ }
+ },
+ "style.night": {
+ "line-color": "#0a1347",
+ "line-width": {
+ "stops": [[5, 1], [7, 2], [11, 3]]
+ }
+ }
+ }, {
+ "id": "country_label_line",
+ "source": "mapbox",
+ "source-layer": "country_label_line",
+ "type": "line",
+ "render": {
+ "text-max-width": 5
+ },
+ "style": {
+ "line-color": "@country_text",
+ "line-width": 0.5,
+ "line-opacity": 0.5
+ },
+ "style.night": {
+ "line-color": "@text_night",
+ "line-width": 0.5,
+ "line-opacity": 0.5
+ }
+ }, {
+ "id": "country_label",
+ "source": "mapbox",
+ "source-layer": "country_label",
+ "filter": { "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 24,
+ "text-max-width": 5
+ },
+ "style": {
+ "text-color": "@country_text",
+ "text-halo-color": "rgba(255,255,255,0.5)",
+ "text-halo-width": 0.5,
+ "text-size": "@country_label_size"
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.4,
+ "text-size": "@country_label_size"
+ }
+ }, {
+ "id": "marine_label_line_1",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "LineString", "labelrank": 1 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 30,
+ "text-max-angle": 0.5,
+ "text-letter-spacing": 0.4
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 20], [3, 25], [4, 30], [21, 30]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 20], [3, 25], [4, 30], [21, 30]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_line_2",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "LineString", "labelrank": 2 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 24,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 13], [3, 14], [4, 20], [5, 24], [21, 24]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 13], [3, 14], [4, 20], [5, 24], [21, 24]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_line_3",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "LineString", "labelrank": 3 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 18,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 12], [3, 13], [4, 15], [5, 18], [21, 18]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 12], [3, 13], [4, 15], [5, 18], [21, 18]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_line_other",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "LineString", "labelrank": [4, 5, 6] },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 16,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[3, 12], [4, 14], [5, 16], [21, 16]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[3, 12], [4, 14], [5, 16], [21, 16]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_point_1",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "Point", "labelrank": 1 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 30,
+ "text-max-width": 8,
+ "text-letter-spacing": 0.4,
+ "text-line-height": 2
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 20], [3, 25], [4, 30], [21, 30]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 20], [3, 25], [4, 30], [21, 30]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_point_2",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "Point", "labelrank": 2 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 24,
+ "text-max-width": 8,
+ "text-letter-spacing": 0.2,
+ "text-line-height": 1.5
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 13], [3, 14], [4, 20], [5, 24], [21, 24]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 13], [3, 14], [4, 20], [5, 24], [21, 24]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_point_3",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "Point", "labelrank": 3 },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 18,
+ "text-max-width": 8,
+ "text-letter-spacing": 0.1,
+ "text-line-height": 1.3
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[2, 12], [3, 13], [4, 15], [5, 18], [21, 18]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[2, 12], [3, 13], [4, 15], [5, 18], [21, 18]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "marine_label_point_other",
+ "source": "mapbox",
+ "source-layer": "marine_label",
+ "filter": { "$type": "Point", "labelrank": [4, 5, 6] },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 16,
+ "text-max-width": 8,
+ "text-letter-spacing": 0.1,
+ "text-line-height": 1.2
+ },
+ "style": {
+ "text-color": "@marine_text",
+ "text-size": {
+ "stops": [[3, 12], [4, 14], [5, 16], [21, 16]]
+ },
+ "text-halo-color": "@water"
+ },
+ "style.night": {
+ "text-color": "@water_dark_night",
+ "text-size": {
+ "stops": [[3, 12], [4, 14], [5, 16], [21, 16]]
+ },
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "state_label",
+ "source": "mapbox",
+ "source-layer": "state_label",
+ "filter": { "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Regular, Arial Unicode MS Regular",
+ "text-max-size": 16,
+ "text-max-width": 8
+ },
+ "style": {
+ "text-color": "#333",
+ "text-halo-width": 0.4,
+ "text-halo-color": "rgba(244,239,225,0.8)",
+ "text-size": {
+ "stops": [[2.99, 0], [3, 10], [8.99, 16], [9, 0]]
+ }
+ },
+ "style.night": {
+ "text-color": "#fff",
+ "text-halo-width": 0.4,
+ "text-halo-color": "@land_night",
+ "text-size": {
+ "stops": [[2.99, 0], [3, 10], [8.99, 16], [9, 0]]
+ }
+ }
+ }, {
+ "id": "place_label_city",
+ "source": "mapbox",
+ "source-layer": "place_label",
+ "filter": { "type": "city", "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 20,
+ "text-max-width": 8
+ },
+ "style": {
+ "text-color": "#444",
+ "text-halo-width": 0.4,
+ "text-halo-color": "@text_stroke",
+ "text-size": {
+ "stops": [[2.99, 0], [3, 10], [6, 14], [13.99, 20], [14, 0]]
+ }
+ },
+ "style.night": {
+ "text-color": "#fff",
+ "text-halo-width": 0.4,
+ "text-halo-color": "@text2_stroke_night",
+ "text-size": {
+ "stops": [[2.99, 0], [3, 10], [6, 14], [13.99, 20], [14, 0]]
+ }
+ }
+ }, {
+ "id": "place_label_town",
+ "source": "mapbox",
+ "source-layer": "place_label",
+ "filter": { "type": "town", "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 24,
+ "text-max-width": 8
+ },
+ "style": {
+ "text-color": "#716656",
+ "text-halo-width": 0.3,
+ "text-halo-color": "@text_stroke",
+ "text-size": {
+ "stops": [[8, 10], [11, 13], [13, 17], [15, 22]]
+ }
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-width": 0.3,
+ "text-halo-color": "@text2_stroke_night",
+ "text-size": {
+ "stops": [[8, 10], [11, 13], [13, 17], [15, 22]]
+ }
+ }
+ }, {
+ "id": "place_label_village",
+ "source": "mapbox",
+ "source-layer": "place_label",
+ "filter": { "type": "village", "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 22,
+ "text-max-width": 8
+ },
+ "style": {
+ "text-color": "#635644",
+ "text-halo-width": 0.3,
+ "text-halo-color": "@text_stroke",
+ "text-size": {
+ "stops": [[8, 8], [11, 10], [13, 14], [15, 16], [16, 20]]
+ }
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-width": 0.3,
+ "text-halo-color": "@text2_stroke_night",
+ "text-size": {
+ "stops": [[8, 8], [11, 10], [13, 14], [15, 16], [16, 20]]
+ }
+ }
+ }, {
+ "id": "place_label_other",
+ "source": "mapbox",
+ "source-layer": "place_label",
+ "filter": { "type": ["hamlet", "suburb", "neighbourhood"], "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 18,
+ "text-max-width": 6
+ },
+ "style": {
+ "text-color": "#7d6c55",
+ "text-halo-color": "@text_stroke",
+ "text-size": {
+ "stops": [[12, 11], [13, 12], [15, 14], [17, 18]]
+ }
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.3,
+ "text-size": {
+ "stops": [[12, 11], [13, 12], [15, 14], [17, 18]]
+ }
+ }
+ }, {
+ "id": "road_label_1",
+ "source": "mapbox",
+ "source-layer": "road_label",
+ "filter": { "class": ["motorway", "main"], "$type": "LineString" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-padding": 2,
+ "text-font": "Open Sans Regular, Arial Unicode MS Regular",
+ "text-max-size": 18,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "#585042",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.6,
+ "text-size": "@road_label_1_size"
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.5,
+ "text-size": "@road_label_1_size"
+ }
+ }, {
+ "id": "road_label_2",
+ "source": "mapbox",
+ "source-layer": "road_label",
+ "filter": { "class": ["street", "street_limited"], "$type": "LineString" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-padding": 2,
+ "text-font": "Open Sans Regular, Arial Unicode MS Regular",
+ "text-max-size": 16,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "#585042",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.6,
+ "text-size": "@road_label_2_size"
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.5,
+ "text-size": "@road_label_2_size"
+ }
+ }, {
+ "id": "road_label_3",
+ "source": "mapbox",
+ "source-layer": "road_label",
+ "filter": { "class": ["service", "driveway", "path"], "$type": "LineString" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-padding": 2,
+ "text-font": "Open Sans Regular, Arial Unicode MS Regular",
+ "text-max-size": 14,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "#585042",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.6,
+ "text-size": "@road_label_3_size"
+ },
+ "style.night": {
+ "text-color": "@text_night",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.5,
+ "text-size": "@road_label_3_size"
+ }
+ }, {
+ "id": "contour_label",
+ "source": "mapbox",
+ "source-layer": "contour",
+ "filter": { "index": [5, 10], "$type": "LineString" },
+ "type": "text",
+ "render": {
+ "text-path": "curve",
+ "text-field": "{ele} m",
+ "text-font": "Open Sans Regular, Arial Unicode MS Regular",
+ "text-max-size": 10,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "@text",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.3,
+ "text-size": 10
+ },
+ "style.night": {
+ "text-color": "@contour_night",
+ "text-halo-color": "@land_night",
+ "text-halo-width": 0.3,
+ "text-size": 10
+ }
+ }, {
+ "id": "water_label",
+ "source": "mapbox",
+ "source-layer": "water_label",
+ "filter": { "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 12,
+ "text-max-width": 8
+ },
+ "style": {
+ "text-color": "@water_dark",
+ "text-halo-color": "rgba(255,255,255,0.75)"
+ },
+ "style.night": {
+ "text-color": "@text_water_night",
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "waterway_label",
+ "source": "mapbox",
+ "source-layer": "waterway_label",
+ "filter": { "$type": "LineString" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "curve",
+ "text-font": "Open Sans Semibold Italic, Arial Unicode MS Bold",
+ "text-max-size": 12,
+ "text-max-angle": 0.5
+ },
+ "style": {
+ "text-color": "@water_dark",
+ "text-halo-width": 0.4,
+ "text-halo-color": "@text_stroke"
+ },
+ "style.night": {
+ "text-color": "@text_water_night",
+ "text-halo-color": "@water_night"
+ }
+ }, {
+ "id": "poi",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": [1, 2] },
+ "type": "icon",
+ "render": {
+ "icon-image": "{maki}-12",
+ "icon-size": 12
+ },
+ "style.night": {}
+ }, {
+ "id": "poi_label_1-2",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": [1, 2], "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-padding": 2,
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 12,
+ "text-max-width": 10,
+ "text-alignment": "center"
+ },
+ "style": {
+ "text-color": "#444",
+ "text-size": "@poi_label_1-2_size",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.3
+ },
+ "style.night": {
+ "text-color": "#fff",
+ "text-size": "@poi_label_1-2_size",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.3
+ }
+ }, {
+ "id": "poi_3",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": 3 },
+ "type": "icon",
+ "render": {
+ "icon-image": "{maki}-12",
+ "icon-size": 12
+ },
+ "style": {
+ "icon-opacity": {
+ "stops": [[15.5, 0], [15.75, 1]]
+ }
+ },
+ "style.night": {
+ "icon-opacity": {
+ "stops": [[15.5, 0], [15.75, 1]]
+ }
+ }
+ }, {
+ "id": "poi_label_3",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": 3, "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-padding": 2,
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 11,
+ "text-max-width": 10,
+ "text-alignment": "center"
+ },
+ "style": {
+ "text-color": "#444",
+ "text-size": "@poi_label_3_size",
+ "text-halo-color": "@land",
+ "text-halo-width": 0.3,
+ "text-opacity": {
+ "stops": [[15.5, 0], [15.75, 1]]
+ }
+ },
+ "style.night": {
+ "text-color": "#fff",
+ "text-size": "@poi_label_3_size",
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.3,
+ "text-opacity": {
+ "stops": [[15.5, 0], [15.75, 1]]
+ }
+ }
+ }, {
+ "id": "poi_4",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": 4 },
+ "type": "icon",
+ "render": {
+ "icon-image": "{maki}-12",
+ "icon-size": 12
+ },
+ "style": {
+ "icon-opacity": {
+ "stops": [[17.5, 0], [17.75, 1]]
+ }
+ },
+ "style.night": {
+ "icon-opacity": {
+ "stops": [[17.5, 0], [17.75, 1]]
+ }
+ }
+ }, {
+ "id": "poi_label_4",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "scalerank": 4, "$type": "Point" },
+ "type": "text",
+ "render": {
+ "text-field": "{name_en}",
+ "text-path": "horizontal",
+ "text-padding": 2,
+ "text-font": "Open Sans Semibold, Arial Unicode MS Bold",
+ "text-max-size": 10,
+ "text-max-width": 10,
+ "text-alignment": "center"
+ },
+ "style": {
+ "text-color": "#444",
+ "text-size": 10,
+ "text-opacity": {
+ "stops": [[17.5, 0], [17.75, 1]]
+ },
+ "text-halo-color": "@land",
+ "text-halo-width": 0.3
+ },
+ "style.night": {
+ "text-color": "#fff",
+ "text-size": 10,
+ "text-opacity": {
+ "stops": [[17.5, 0], [17.75, 1]]
+ },
+ "text-halo-color": "@text2_stroke_night",
+ "text-halo-width": 0.3
+ }
+ }, {
+ "id": "poi_aerodrome",
+ "source": "mapbox",
+ "source-layer": "poi_label",
+ "filter": { "maki": "airport" },
+ "type": "icon",
+ "render": {
+ "icon-image": "{maki}-12",
+ "icon-size": 12
+ },
+ "style": {
+ "icon-opacity": {
+ "stops": [[12, 0], [12.25, 1]]
+ }
+ },
+ "style.night": {
+ "icon-opacity": {
+ "stops": [[12, 0], [12.25, 1]]
+ }
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/function-numeric.info.json b/test/fixtures/style_parser/function-numeric.info.json
new file mode 100644
index 0000000000..e2170eed4f
--- /dev/null
+++ b/test/fixtures/style_parser/function-numeric.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "function argument must be a numeric value"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/function-numeric.style.json b/test/fixtures/style_parser/function-numeric.style.json
new file mode 100644
index 0000000000..1df0702633
--- /dev/null
+++ b/test/fixtures/style_parser/function-numeric.style.json
@@ -0,0 +1,22 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "waterway_river_canal",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": ["river", "canal"] },
+ "type": "line",
+ "style": {
+ "line-width": {
+ "stops": [0]
+ }
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/function-type.info.json b/test/fixtures/style_parser/function-type.info.json
new file mode 100644
index 0000000000..1549262bb0
--- /dev/null
+++ b/test/fixtures/style_parser/function-type.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "function must specify a function type"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/function-type.style.json b/test/fixtures/style_parser/function-type.style.json
new file mode 100644
index 0000000000..4439cf0385
--- /dev/null
+++ b/test/fixtures/style_parser/function-type.style.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "waterway_river_canal",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": ["river", "canal"] },
+ "type": "line",
+ "style": {
+ "line-width": {}
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/line-opacity.info.json b/test/fixtures/style_parser/line-opacity.info.json
new file mode 100644
index 0000000000..36f02e6e02
--- /dev/null
+++ b/test/fixtures/style_parser/line-opacity.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "value of 'line-opacity' must be a number, or a number function"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/line-opacity.style.json b/test/fixtures/style_parser/line-opacity.style.json
new file mode 100644
index 0000000000..31b0c1dea9
--- /dev/null
+++ b/test/fixtures/style_parser/line-opacity.style.json
@@ -0,0 +1,22 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "contour_line_loud",
+ "source": "mapbox",
+ "source-layer": "contour",
+ "filter": { "index": 5 },
+ "type": "line",
+ "style": {
+ "line-color": "#008",
+ "line-width": 0.9,
+ "line-opacity": null
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/line-width.info.json b/test/fixtures/style_parser/line-width.info.json
new file mode 100644
index 0000000000..af2f9b284a
--- /dev/null
+++ b/test/fixtures/style_parser/line-width.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "value of 'line-width' must be a number, or a number function"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/line-width.style.json b/test/fixtures/style_parser/line-width.style.json
new file mode 100644
index 0000000000..83c66065db
--- /dev/null
+++ b/test/fixtures/style_parser/line-width.style.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "waterway_river_canal",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": ["river", "canal"] },
+ "type": "line",
+ "style": {
+ "line-width": null
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/stop-zoom-value.info.json b/test/fixtures/style_parser/stop-zoom-value.info.json
new file mode 100644
index 0000000000..deaba65e25
--- /dev/null
+++ b/test/fixtures/style_parser/stop-zoom-value.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "stop must have zoom level and value specification"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/stop-zoom-value.style.json b/test/fixtures/style_parser/stop-zoom-value.style.json
new file mode 100644
index 0000000000..87e674d52d
--- /dev/null
+++ b/test/fixtures/style_parser/stop-zoom-value.style.json
@@ -0,0 +1,45 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "landcover_grass",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "grass" },
+ "type": "fill",
+ "style": {
+ "fill-opacity": {
+ "stops": []
+ }
+ }
+ }, {
+ "id": "landcover_scrub",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "scrub" },
+ "type": "fill",
+ "style": {
+ "fill-opacity": {
+ "stops": [[12]]
+ }
+ }
+ }, {
+ "id": "landcover_wood",
+ "source": "mapbox",
+ "source-layer": "landcover",
+ "filter": { "class": "wood" },
+ "type": "fill",
+ "style": {
+ "fill-color": "@wood",
+ "fill-opacity": {
+ "stops": [[12, 1], [13, 0.8], [16, 0.2]]
+ }
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/stops-array.info.json b/test/fixtures/style_parser/stops-array.info.json
new file mode 100644
index 0000000000..3324958c85
--- /dev/null
+++ b/test/fixtures/style_parser/stops-array.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "stops function must specify a stops array"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/stops-array.style.json b/test/fixtures/style_parser/stops-array.style.json
new file mode 100644
index 0000000000..67a2f83b07
--- /dev/null
+++ b/test/fixtures/style_parser/stops-array.style.json
@@ -0,0 +1,22 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "waterway_river_canal",
+ "source": "mapbox",
+ "source-layer": "waterway",
+ "filter": { "type": ["river", "canal"] },
+ "type": "line",
+ "style": {
+ "line-width": {
+ "stops": null
+ }
+ }
+ }]
+}
diff --git a/test/fixtures/style_parser/text-size.info.json b/test/fixtures/style_parser/text-size.info.json
new file mode 100644
index 0000000000..871a6ad499
--- /dev/null
+++ b/test/fixtures/style_parser/text-size.info.json
@@ -0,0 +1,7 @@
+{
+ "default": {
+ "log": [
+ [1, "WARNING", "ParseStyle", "value of 'text-size' must be a number, or a number function"]
+ ]
+ }
+}
diff --git a/test/fixtures/style_parser/text-size.style.json b/test/fixtures/style_parser/text-size.style.json
new file mode 100644
index 0000000000..bb221efb62
--- /dev/null
+++ b/test/fixtures/style_parser/text-size.style.json
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "mapbox://mapbox.mapbox-terrain-v1,mapbox.mapbox-streets-v5",
+ "maxZoom": 14
+ }
+ },
+ "layers": [{
+ "id": "country_label",
+ "source": "mapbox",
+ "source-layer": "country_label",
+ "filter": { "$type": "Point" },
+ "type": "text",
+ "style": {
+ "text-size": null
+ }
+ }]
+}
diff --git a/test/style_parser.cpp b/test/style_parser.cpp
new file mode 100644
index 0000000000..53113ad53e
--- /dev/null
+++ b/test/style_parser.cpp
@@ -0,0 +1,101 @@
+#include "gtest/gtest.h"
+
+#include <mbgl/style/style.hpp>
+#include <mbgl/util/io.hpp>
+
+#include <rapidjson/document.h>
+
+#include "./fixtures/fixture_log.hpp"
+
+#include <iostream>
+#include <fstream>
+
+#include <dirent.h>
+
+const std::string base_directory = []{
+ std::string fn = __FILE__;
+ fn.erase(fn.find_last_of("/"));
+ return fn + "/fixtures/style_parser";
+}();
+
+using namespace mbgl;
+
+typedef std::pair<uint32_t, std::string> Message;
+typedef std::vector<Message> Messages;
+
+class StyleParserTest : public ::testing::TestWithParam<std::string> {};
+
+TEST_P(StyleParserTest, ParseStyle) {
+ const std::string &base = base_directory + "/" + GetParam();
+
+ const std::string style_path = base + ".style.json";
+ const std::string info = util::read_file(base + ".info.json");
+
+ // Parse settings.
+ rapidjson::Document doc;
+ doc.Parse<0>((const char *const)info.c_str());
+ ASSERT_EQ(false, doc.HasParseError());
+ ASSERT_EQ(true, doc.IsObject());
+
+ std::ifstream stylefile(style_path);
+ ASSERT_TRUE(stylefile.good());
+ std::stringstream stylejson;
+ stylejson << stylefile.rdbuf();
+
+ const FixtureLogBackend &log = Log::Set<FixtureLogBackend>();
+
+ Style style;
+ style.loadJSON((const uint8_t *)stylejson.str().c_str());
+
+ for (auto it = doc.MemberBegin(), end = doc.MemberEnd(); it != end; it++) {
+ const std::string name { it->name.GetString(), it->name.GetStringLength() };
+ const rapidjson::Value &value = it->value;
+ ASSERT_EQ(true, value.IsObject());
+
+ if (value.HasMember("log")) {
+ const rapidjson::Value &js_log = value["log"];
+ ASSERT_EQ(true, js_log.IsArray());
+ for (rapidjson::SizeType i = 0; i < js_log.Size(); i++) {
+ const rapidjson::Value &js_entry = js_log[i];
+ ASSERT_EQ(true, js_entry.IsArray());
+
+ const uint32_t count = js_entry[rapidjson::SizeType(0)].GetUint();
+ const FixtureLogBackend::LogMessage message {
+ EventSeverityClass(js_entry[rapidjson::SizeType(1)].GetString()),
+ EventClass(js_entry[rapidjson::SizeType(2)].GetString()),
+ js_entry[rapidjson::SizeType(3)].GetString()
+ };
+
+ EXPECT_EQ(count, log.count(message)) << "Message: " << message << std::endl;
+ }
+ }
+
+ const auto &unchecked = log.unchecked();
+ if (unchecked.size()) {
+ std::cerr << "Unchecked Log Messages (" << base << "/" << name << "): " << std::endl << unchecked;
+ }
+
+ ASSERT_EQ(0, unchecked.size());
+ }
+}
+
+INSTANTIATE_TEST_CASE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] {
+ std::vector<std::string> names;
+ const std::string ending = ".info.json";
+
+ DIR *dir = opendir(base_directory.c_str());
+ if (dir == nullptr) {
+ return names;
+ }
+
+ for (dirent *dp = nullptr; (dp = readdir(dir)) != nullptr;) {
+ const std::string name = dp->d_name;
+ if (name.length() >= ending.length() && name.compare(name.length() - ending.length(), ending.length(), ending) == 0) {
+ names.push_back(name.substr(0, name.length() - ending.length()));
+ }
+ }
+
+ closedir(dir);
+
+ return names;
+}()));
diff --git a/test/test.gyp b/test/test.gyp
index b32f0f515a..07709ecc86 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -71,7 +71,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -87,7 +87,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -103,7 +103,26 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
+ ]
+ },
+ {
+ "target_name": "style_parser",
+ "product_name": "test_style_parser",
+ "type": "executable",
+ "libraries": [
+ "-lpthread",
+ ],
+ "sources": [
+ "./main.cpp",
+ "./style_parser.cpp",
+ "./fixtures/fixture_log.hpp",
+ "./fixtures/fixture_log.cpp",
+ ],
+ "dependencies": [
+ "../deps/gtest/gtest.gyp:gtest",
+ "../mapboxgl.gyp:mapboxgl",
+ "../mapboxgl.gyp:copy_fixtures",
]
},
{
@@ -119,7 +138,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -135,7 +154,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -151,7 +170,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -167,7 +186,7 @@
],
"dependencies": [
"../deps/gtest/gtest.gyp:gtest",
- "../mapboxgl.gyp:mapboxgl"
+ "../mapboxgl.gyp:mapboxgl",
]
},
{
@@ -203,6 +222,7 @@
"tile",
"functions",
"headless",
+ "style_parser",
"comparisons",
],
}