diff --git a/.travis.yml b/.travis.yml index ec877eb68..eb4e700b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ before_install: install: - make setup +- npm install git+https://github.com/mapbox/mapbox-gl-test-suite.git before_script: - rm -rf mapnik-packaging/out/packages @@ -30,10 +31,7 @@ script: - make linux -j4 BUILDTYPE=${BUILDTYPE} - make test -j4 BUILDTYPE=${BUILDTYPE} - ./scripts/run_tests.sh -- ./scripts/compare_images.js - -after_script: -- ./scripts/deploy_results.sh +- (cd ./node_modules/mapbox-gl-test-suite/ && (./bin/compare_images.js; ./bin/deploy_results.sh)) notifications: hipchat: diff --git a/Makefile b/Makefile index bfb550aff..fb1c5b3ec 100644 --- a/Makefile +++ b/Makefile @@ -78,8 +78,10 @@ xproj: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache node open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode -iproj: config.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node +iproj-cli: config.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode + +iproj: iproj-cli open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj # build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) diff --git a/README.md b/README.md index b69166aed..9a67c51b5 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,15 @@ implemented in C++11, currently targeting iOS, OS X, and Ubuntu Linux. # Depends - - Modern C++ compiler that supports `-std=c++11` (On OSX clang++, on Linux g++-4.8 or g++-4.9) + - Modern C++ compiler that supports `-std=c++11` (On OS X clang++, on Linux g++-4.8 or g++-4.9) - Boost headers - `libpng` - `libuv` - `glfw3` - `libcurl` (depends on OpenSSL; Linux only) - `libboost_regex` (Linux only) - - Homebrew (for build on OS X) + - Apple Command Line Tools (for build on OS X; available at [Apple Developer](https://developer.apple.com/downloads)) + - [Homebrew](http://brew.sh) (for build on OS X) - Python 2.x (for build only) - Node.js (for build only) @@ -33,6 +34,8 @@ The demo applications use Mapbox vector tiles, which **require a Mapbox account For iOS and OS X use of the demo apps in Xcode, setup the access token by editing the scheme for the application target, then adding an environment variable with the name `MAPBOX_ACCESS_TOKEN`. +![edit scheme](https://cloud.githubusercontent.com/assets/98601/3647749/30f74f26-1102-11e4-84af-f1be853b4e38.png) + ![setting access token in Xcode scheme](https://cloud.githubusercontent.com/assets/52399/3543326/9e7cfbb8-0860-11e4-8def-3684a9028b61.png) ## OS X diff --git a/bin/build-style.js b/bin/build-style.js deleted file mode 100755 index 06d4cc080..000000000 --- a/bin/build-style.js +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -var mkdirp = require('mkdirp'); -var path = require('path'); -var fs = require('fs'); - -var data = JSON.stringify(require(path.join(process.cwd(), process.argv[2]))); -var out = path.join(process.argv[3], 'style.min.js'); - -mkdirp.sync(path.dirname(out)); -fs.writeFileSync(out, data); diff --git a/bin/default.style.json b/bin/default.style.json deleted file mode 100755 index aea2a1a3a..000000000 --- a/bin/default.style.json +++ /dev/null @@ -1,2244 +0,0 @@ -{ - "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/common.gypi b/common.gypi index a38a279ef..513d8688f 100644 --- a/common.gypi +++ b/common.gypi @@ -7,7 +7,7 @@ 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_ENABLE_CPP_RTTI':'YES', - 'OTHER_CPLUSPLUSFLAGS': [ '-Wall', '-Wextra' ], + 'OTHER_CPLUSPLUSFLAGS': [ '-Wall', '-Wextra', '-Wno-variadic-macros' ], 'GCC_WARN_PEDANTIC': 'YES', 'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE' }, diff --git a/common/glfw_view.cpp b/common/glfw_view.cpp index 60d95c8b8..f53090a00 100644 --- a/common/glfw_view.cpp +++ b/common/glfw_view.cpp @@ -1,5 +1,7 @@ #include "glfw_view.hpp" +#include + GLFWView::GLFWView(bool fullscreen) : fullscreen(fullscreen) { #ifdef NVIDIA glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)glfwGetProcAddress("glDiscardFramebufferEXT"); @@ -192,9 +194,15 @@ void GLFWView::make_active() { void GLFWView::swap() { glfwPostEmptyEvent(); + + double lon, lat, zoom; + map->getLonLatZoom(lon, lat, zoom); + const double bearing = map->getBearing(); + const std::string title = mbgl::util::sprintf<128>("Mapbox GL – %.2f/%.6f/%.6f/%.1f", zoom, lat, lon, bearing); + glfwSetWindowTitle(window, title.c_str()); } -void GLFWView::notify_map_change(mbgl::MapChange change, mbgl::timestamp delay) { +void GLFWView::notify_map_change(mbgl::MapChange /*change*/, mbgl::timestamp /*delay*/) { // no-op } diff --git a/common/settings_json.cpp b/common/settings_json.cpp index bceab50da..f2f1248aa 100644 --- a/common/settings_json.cpp +++ b/common/settings_json.cpp @@ -18,7 +18,7 @@ void Settings_JSON::load() { longitude = document[rapidjson::SizeType(0)].GetDouble(); latitude = document[1].GetDouble(); zoom = document[2].GetDouble(); - angle = document[3].GetDouble(); + bearing = document[3].GetDouble(); debug = document[4].GetBool(); } } @@ -32,7 +32,7 @@ void Settings_JSON::save() { writer.Double(longitude); writer.Double(latitude); writer.Double(zoom); - writer.Double(angle); + writer.Double(bearing); writer.Bool(debug); writer.EndArray(); } @@ -41,6 +41,6 @@ void Settings_JSON::clear() { longitude = 0; latitude = 0; zoom = 0; - angle = 0; + bearing = 0; debug = false; } diff --git a/common/settings_json.hpp b/common/settings_json.hpp index 09f7841c9..25c2179ba 100644 --- a/common/settings_json.hpp +++ b/common/settings_json.hpp @@ -14,7 +14,7 @@ public: double longitude = 0; double latitude = 0; double zoom = 0; - double angle = 0; + double bearing = 0; bool debug = false; }; diff --git a/common/settings_nsuserdefaults.hpp b/common/settings_nsuserdefaults.hpp index dcc6ab46b..3533e3da3 100644 --- a/common/settings_nsuserdefaults.hpp +++ b/common/settings_nsuserdefaults.hpp @@ -14,7 +14,7 @@ public: double longitude = 0; double latitude = 0; double zoom = 0; - double angle = 0; + double bearing = 0; bool debug = false; }; diff --git a/common/settings_nsuserdefaults.mm b/common/settings_nsuserdefaults.mm index 24571677f..dfc601bdd 100644 --- a/common/settings_nsuserdefaults.mm +++ b/common/settings_nsuserdefaults.mm @@ -9,7 +9,7 @@ Settings_NSUserDefaults::Settings_NSUserDefaults() [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"longitude" : @(longitude), @"latitude" : @(latitude), @"zoom" : @(zoom), - @"angle" : @(angle), + @"bearing" : @(bearing), @"debug" : @(debug) }]; load(); } @@ -21,7 +21,7 @@ void Settings_NSUserDefaults::load() longitude = [settings[@"longitude"] doubleValue]; latitude = [settings[@"latitude"] doubleValue]; zoom = [settings[@"zoom"] doubleValue]; - angle = [settings[@"angle"] doubleValue]; + bearing = [settings[@"bearing"] doubleValue]; debug = [settings[@"debug"] boolValue]; } @@ -29,8 +29,8 @@ void Settings_NSUserDefaults::save() { [[NSUserDefaults standardUserDefaults] setValuesForKeysWithDictionary:@{ @"longitude" : @(longitude), @"latitude" : @(latitude), - @"zoom" : @(zoom), - @"angle" : @(angle), + @"zoom" : @(zoom), + @"bearing" : @(bearing), @"debug" : @(debug) }]; [[NSUserDefaults standardUserDefaults] synchronize]; } diff --git a/include/mbgl/geometry/icon_buffer.hpp b/include/mbgl/geometry/icon_buffer.hpp index 346b3b5f0..e7e5f4035 100644 --- a/include/mbgl/geometry/icon_buffer.hpp +++ b/include/mbgl/geometry/icon_buffer.hpp @@ -3,16 +3,18 @@ #include "buffer.hpp" +#include + namespace mbgl { class IconVertexBuffer : public Buffer< - 4 + // int16 x/y coordinates per vertex (== 4 bytes) - 4 // uint16 x/y coordinates of icon in sprite (== 4 bytes) + 20 > { public: - typedef int16_t vertex_type; + static const double angleFactor; + + size_t add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float angle, float minzoom, std::array range, float maxzoom, float labelminzoom); - void add(vertex_type x, vertex_type y, uint16_t tx, uint16_t ty); }; } diff --git a/include/mbgl/geometry/interpolate.hpp b/include/mbgl/geometry/interpolate.hpp index cebbcc702..998cba31c 100644 --- a/include/mbgl/geometry/interpolate.hpp +++ b/include/mbgl/geometry/interpolate.hpp @@ -7,7 +7,7 @@ namespace mbgl { Anchors interpolate(const std::vector &vertices, float spacing, - float minScale = 0.0f, int start = 0); + float minScale, float maxScale, float tilePixelRatio, int start = 0); } #endif diff --git a/include/mbgl/geometry/sprite_atlas.hpp b/include/mbgl/geometry/sprite_atlas.hpp index 4b55540cc..dc2378c2f 100644 --- a/include/mbgl/geometry/sprite_atlas.hpp +++ b/include/mbgl/geometry/sprite_atlas.hpp @@ -26,17 +26,20 @@ public: // Changes the pixel ratio. bool resize(float newRatio); - // Update uninitialized sprites in this atlas from the given sprite. + // Update uninitialized (= outdated) sprites in this atlas from the given sprite. void update(const Sprite &sprite); - // Returns the coordinates of a square icon. The getter also *creates* new square icons in the - // atlas if they don't exist, but they'll be default-initialized with a a black circle. - Rect getIcon(int size, const std::string &name); + // Returns the coordinates of an image that is sourced from the sprite image. + // This getter attempts to read the image from the sprite if it is already loaded. + // In that case, it copies it into the sprite atlas and returns the dimensions. + // Otherwise, it returns a 0/0/0/0 rect. + Rect getImage(const std::string &name, const Sprite &sprite); // Returns the coordinates of an image that is sourced from the sprite image. - // This getter does not create images, as the dimension of the texture us unknown if the - // sprite is not yet loaded. Instead, it returns a 0/0/0/0 rect. - Rect getImage(const std::string &name, const Sprite &sprite); + // This getter waits until the sprite image was loaded, copies it into the sprite + // image and returns the dimensions. + // NEVER CALL THIS FUNCTION FROM THE RENDER THREAD! it is blocking. + Rect waitForImage(const std::string &name, const Sprite &sprite); // Binds the image buffer of this sprite atlas to the GPU, and uploads data if it is out // of date. diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 774e5e129..be01b456c 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -1,26 +1,34 @@ - #ifndef MBGL_MAP_MAP #define MBGL_MAP_MAP -#include - -#include #include -#include -#include -#include #include + #include -#include +#include +#include #include -#include -#include +#include +#include +#include +#include +#include namespace mbgl { -class Source; +class GlyphAtlas; +class GlyphStore; +class LayerDescription; class SpriteAtlas; +class Sprite; +class Style; +class StyleLayer; +class StyleLayerGroup; +class StyleSource; +class Texturepool; +class FileSource; +class View; class Map : private util::noncopyable { public: @@ -57,7 +65,8 @@ public: void toggleClass(const std::string &name); const std::vector &getAppliedClasses() const; void setDefaultTransitionDuration(uint64_t duration_milliseconds = 0); - void setStyleJSON(std::string newStyleJSON); + void setStyleURL(const std::string &url); + void setStyleJSON(std::string newStyleJSON, const std::string &base = ""); std::string getStyleJSON() const; void setAccessToken(std::string access_token); std::string getAccessToken() const; @@ -89,9 +98,9 @@ public: // Rotation void rotateBy(double sx, double sy, double ex, double ey, double duration = 0); - void setAngle(double angle, double duration = 0); - void setAngle(double angle, double cx, double cy); - double getAngle() const; + void setBearing(double degrees, double duration = 0); + void setBearing(double degrees, double cx, double cy); + double getBearing() const; void resetNorth(); void startRotating(); void stopRotating(); @@ -104,10 +113,12 @@ public: public: inline const TransformState &getState() const { return state; } - inline std::shared_ptr getStyle() const { return style; } + inline std::shared_ptr getFileSource() const { return fileSource; } + inline std::shared_ptr\n' + - '\n' + - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n'; - -var exitCode = 0; -var failures = 0; - -processFiles(); - -function processFiles() { - if (!files.length) return done(); - - var name = files.shift(); - - var info = require(path.join(base_dir, name)); - - var keys = Object.keys(info); - - processFileTest(); - - function processFileTest() { - if (!keys.length) return processFiles(); - - var key = keys.shift(); - - var base = path.basename(name, '.info.json'); - - var actual = path.join(base_dir, base + '/' + key + '.actual.png'); - var expected = path.join(base_dir, base + '/' + key + '.expected.png'); - var diff = path.join(base_dir, base + '/' + key + '.diff.png'); - - var compare = spawn('compare', ['-metric', 'MAE', actual, expected, diff ]); - var error = ''; - compare.stderr.on('data', function(data) { - error += data.toString(); - }); - compare.on('exit', function(code, signal) { - // The compare program returns 2 on error otherwise 0 if the images are similar or 1 if they are dissimilar. - if (code == 2) { - writeResult(base, key, info[key], error.trim(), Infinity); - exitCode = 2; - } else { - var match = error.match(/^\d+(?:\.\d+)?\s+\(([^\)]+)\)\s*$/); - var difference = match ? parseFloat(match[1]) : Infinity; - writeResult(base, key, info[key], match ? '' : error, difference); - - } - processFileTest(); - }); - compare.stdin.end(); - } -} - -function writeResult(base, key, info, error, difference) { - var color = 'green'; - var allowedDifference = ('diff' in info) ? info.diff : 0.01; - if (difference > allowedDifference) { - color = 'red'; - if (exitCode < 1) { - exitCode = 1; - } - failures++; - } - - html += - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n' - ; -} - -function done() { - html += "
ActualExpectedInfo
\n' + - '

' + base + '/' + key + '

\n' + - (error ? '

' + error + '

\n' : '') + - '
    \n' + - '
  • diff: ' + difference + '
  • \n' + - '
  • zoom: ' + (info.zoom || 0) + '
  • \n' + - '
  • center: ' + (info.center || [0, 0]) + '
  • \n' + - '
  • bearing: ' + (info.bearing || 0) + '
  • \n' + - '
  • width: ' + (info.width || 512) + '
  • \n' + - '
  • height: ' + (info.height || 512) + '
  • \n' + - '
\n' + - '
\n"; - - fs.writeFileSync(path.join(base_dir, 'index.html'), html); - console.warn('Results at: ' + path.join(base_dir, 'index.html')); - if (failures) { - console.warn('\x1B[1m\x1B[31m' + failures + ' ' + (failures == 1 ? 'image doesn\'t' : 'images don\'t') + ' match\x1B[39m\x1B[22m'); - } else { - console.warn('\x1B[1m\x1B[32mAll images match\x1B[39m\x1B[22m'); - } - - process.exit(exitCode); -} \ No newline at end of file diff --git a/scripts/deploy_results.sh b/scripts/deploy_results.sh deleted file mode 100755 index bf13def01..000000000 --- a/scripts/deploy_results.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -aws s3 cp test/fixtures/styles/ s3://mapbox-gl-testing/headless/$TRAVIS_JOB_NUMBER/ --acl public-read --recursive - -echo http://mapbox-gl-testing.s3.amazonaws.com/headless/$TRAVIS_JOB_NUMBER/index.html diff --git a/src/geometry/icon_buffer.cpp b/src/geometry/icon_buffer.cpp index a25b2de06..c571dfa69 100644 --- a/src/geometry/icon_buffer.cpp +++ b/src/geometry/icon_buffer.cpp @@ -1,18 +1,35 @@ #include #include +#include #include -using namespace mbgl; +namespace mbgl { -void IconVertexBuffer::add(vertex_type x, vertex_type y, uint16_t tx, uint16_t ty) { +const double IconVertexBuffer::angleFactor = 128.0 / M_PI; + +size_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t tx, int16_t ty, float angle, float minzoom, std::array range, float maxzoom, float labelminzoom) { + const size_t idx = index(); void *data = addElement(); - vertex_type *vertices = static_cast(data); - vertices[0] = x; - vertices[1] = y; + int16_t *shorts = static_cast(data); + shorts[0] /* pos */ = x; + shorts[1] /* pos */ = y; + shorts[2] /* offset */ = std::round(ox * 64); // use 1/64 pixels for placement + shorts[3] /* offset */ = std::round(oy * 64); + + uint8_t *ubytes = static_cast(data); + ubytes[8] /* labelminzoom */ = labelminzoom * 10; + ubytes[9] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160. + ubytes[10] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160. + ubytes[11] /* angle */ = (int16_t)std::round(angle * angleFactor) % 256; + ubytes[12] /* rangeend */ = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256; + ubytes[13] /* rangestart */ = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256; + + shorts[8] /* tex */ = tx; + shorts[9] /* tex */ = ty; + + return idx; +} - uint16_t *texture = static_cast(data); - texture[2] = tx; - texture[3] = ty; } diff --git a/src/geometry/interpolate.cpp b/src/geometry/interpolate.cpp index d9cfdfa1d..618136ff4 100644 --- a/src/geometry/interpolate.cpp +++ b/src/geometry/interpolate.cpp @@ -1,9 +1,30 @@ #include +#include + +#include + namespace mbgl { +const float minScale = 0.5f; +const std::array, 4> minScaleArrays = {{ + /*1:*/ { minScale }, + /*2:*/ { minScale, 2 }, + /*4:*/ { minScale, 4, 2, 4 }, + /*8:*/ { minScale, 8, 4, 8, 2, 8, 4, 8 } +}}; + + Anchors interpolate(const std::vector &vertices, float spacing, - float minScale, int start) { + const float /*minScale*/, float maxScale, const float tilePixelRatio, + const int start) { + + maxScale = std::round(std::fmax(std::fmin(8.0f, maxScale / 2.0f), 1.0f)); + spacing *= tilePixelRatio / maxScale; + const size_t index = util::clamp(std::floor(std::log(maxScale) / std::log(2)), 0, minScaleArrays.size() - 1); + const std::vector &minScales = minScaleArrays[index]; + const size_t len = minScales.size(); + float distance = 0.0f; float markedDistance = 0.0f; int added = start; @@ -23,9 +44,7 @@ Anchors interpolate(const std::vector &vertices, float spacing, float t = (markedDistance - distance) / segmentDist, x = util::interp(a.x, b.x, t), y = util::interp(a.y, b.y, t), - s = added % 8 == 0 ? minScale : added % 4 == 0 - ? 2 - : added % 2 == 0 ? 4 : 8; + s = minScales[added % len]; if (x >= 0 && x < 4096 && y >= 0 && y < 4096) { points.emplace_back(x, y, angle, s, i); diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp index 8fa3e8388..71d3cbee9 100644 --- a/src/geometry/sprite_atlas.cpp +++ b/src/geometry/sprite_atlas.cpp @@ -88,27 +88,6 @@ void copy_bitmap(const uint32_t *src, const int src_stride, const int src_x, con } } -void draw_circle(uint32_t *dst, const int dst_stride, const int dst_x, const int dst_y, - const int width, const int height, const float blur, - const uint8_t r = 0xFF, const uint8_t g = 0xFF, const uint8_t b = 0xFF) { - const int sprite_stride = dst_stride; - const int radius = util::min(width, height); - for (int y = 0; y < height; y++) { - const int img_y = (dst_y + y) * sprite_stride + dst_x; - for (int x = 0; x < height; x++) { - const float dist = util::length(float(x) / radius - 0.5f, float(y) / radius - 0.5f); - const float t = util::smoothstep(0.5f, 0.5f - blur, dist); - const uint8_t alpha = t * 255; - - uint32_t color = (uint32_t(r * t) << 0) | - (uint32_t(g * t) << 8) | - (uint32_t(b * t) << 16) | - (uint32_t(alpha) << 24); - dst[img_y + x] = color; - } - } -} - Rect SpriteAtlas::allocateImage(size_t width, size_t height) { // We have to allocate a new area in the bin, and store an empty image in it. // Add a 1px border around every image. @@ -125,44 +104,6 @@ Rect SpriteAtlas::allocateImage(size_t width, size_t hei return rect; } -Rect SpriteAtlas::getIcon(const int size, const std::string &name) { - std::lock_guard lock(mtx); - - auto rect_it = images.find(name); - if (rect_it != images.end()) { - return rect_it->second; - } - - Rect rect = allocateImage(size, size); - if (rect.w == 0) { - if (debug::spriteWarnings) { - fprintf(stderr, "[WARNING] sprite atlas bitmap overflow\n"); - } - return rect; - } - - images.emplace(name, rect); - - allocate(); - - // Draw an antialiased circle. - draw_circle( - reinterpret_cast(data), - width * pixelRatio, - rect.x * pixelRatio, - rect.y * pixelRatio, - size * pixelRatio, - size * pixelRatio, - 1.0f / size / pixelRatio - ); - - uninitialized.emplace(name); - - dirty = true; - - return rect; -} - Rect SpriteAtlas::getImage(const std::string &name, const Sprite &sprite) { std::lock_guard lock(mtx); @@ -191,6 +132,12 @@ Rect SpriteAtlas::getImage(const std::string &name, cons return rect; } + +Rect SpriteAtlas::waitForImage(const std::string &name, const Sprite &sprite) { + sprite.waitUntilLoaded(); + return getImage(name, sprite); +} + void SpriteAtlas::allocate() { if (!data) { dimension w = static_cast(width * pixelRatio); diff --git a/src/map/map.cpp b/src/map/map.cpp index c7039cc92..ef7b9548b 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -10,25 +11,36 @@ #include #include #include +#include +#include +#include #include #include +#include #include +#include +#include #include #include #include +#define _USE_MATH_DEFINES +#include + using namespace mbgl; Map::Map(View& view) - : view(view), + : loop(std::make_shared()), + view(view), transform(view), + fileSource(std::make_shared()), style(std::make_shared