diff --git a/.gitmodules b/.gitmodules index ff48ca17c..123f83224 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,78 +1,15 @@ -[submodule "mapbox-gl-js"] - path = mapbox-gl-js - url = https://github.com/mapbox/mapbox-gl-js.git [submodule "platform/ios/vendor/mapbox-events-ios"] path = platform/ios/vendor/mapbox-events-ios url = https://github.com/mapbox/mapbox-events-ios.git [submodule "vendor/nunicode"] path = vendor/nunicode url = https://bitbucket.org/alekseyt/nunicode.git -[submodule "vendor/earcut.hpp"] - path = vendor/earcut.hpp - url = https://github.com/mapbox/earcut.hpp.git -[submodule "vendor/geojson-vt-cpp"] - path = vendor/geojson-vt-cpp - url = https://github.com/mapbox/geojson-vt-cpp.git -[submodule "vendor/polylabel"] - path = vendor/polylabel - url = https://github.com/mapbox/polylabel.git -[submodule "vendor/protozero"] - path = vendor/protozero - url = https://github.com/mapbox/protozero.git -[submodule "vendor/shelf-pack-cpp"] - path = vendor/shelf-pack-cpp - url = https://github.com/mapbox/shelf-pack-cpp.git -[submodule "vendor/vector-tile"] - path = vendor/vector-tile - url = https://github.com/mapbox/vector-tile.git -[submodule "vendor/wagyu"] - path = vendor/wagyu - url = https://github.com/mapbox/wagyu.git [submodule "vendor/expected-lite"] path = vendor/expected url = https://github.com/martinmoene/expected-lite.git -[submodule "vendor/unique_resource"] - path = vendor/unique_resource - url = https://github.com/okdshin/unique_resource.git [submodule "vendor/icu"] path = vendor/icu url = https://github.com/unicode-org/icu.git -[submodule "vendor/boost"] - path = vendor/boost - url = https://github.com/mapbox/mapbox-gl-native-boost.git -[submodule "vendor/benchmark"] - path = vendor/benchmark - url = https://github.com/google/benchmark.git -[submodule "vendor/cheap-ruler-cpp"] - path = vendor/cheap-ruler-cpp - url = https://github.com/mapbox/cheap-ruler-cpp.git -[submodule "vendor/glfw"] - path = vendor/glfw - url = https://github.com/glfw/glfw.git -[submodule "vendor/eternal"] - path = vendor/eternal - url = https://github.com/mapbox/eternal.git -[submodule "platform/android/vendor/mapbox-gestures-android"] - path = platform/android/vendor/mapbox-gestures-android - url = https://github.com/mapbox/mapbox-gestures-android.git -[submodule "platform/android/vendor/mapbox-java"] - path = platform/android/vendor/mapbox-java - url = https://github.com/mapbox/mapbox-java.git -[submodule "platform/android/vendor/mapbox-events-android"] - path = platform/android/vendor/mapbox-events-android - url = https://github.com/mapbox/mapbox-events-android.git [submodule "platform/darwin/docs/theme"] path = platform/darwin/docs/theme url = https://github.com/mapbox/jazzy-theme.git -[submodule "vendor/mvt-fixtures"] - path = vendor/mvt-fixtures - url = https://github.com/mapbox/mvt-fixtures.git -[submodule "vendor/mapbox-gl-styles"] - path = vendor/mapbox-gl-styles - url = https://github.com/mapbox/mapbox-gl-styles.git -[submodule "vendor/mapbox-base"] - path = vendor/mapbox-base - url = https://github.com/mapbox/mapbox-base.git -[submodule "vendor/googletest"] - path = vendor/googletest - url = https://github.com/google/googletest.git diff --git a/.topissuesrc b/.topissuesrc deleted file mode 100644 index c16804cd2..000000000 --- a/.topissuesrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "labels": { - "release blocker": 25, - "beta blocker": 20, - "crash": 5, - "build": 5, - "bug": 2 - }, - "reactions": { - "+1": 1, - "-1": -1, - "laugh": 1, - "hooray": 1, - "confused": 1, - "heart": 1 - } -} diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py deleted file mode 100644 index 63616a1e9..000000000 --- a/.ycm_extra_conf.py +++ /dev/null @@ -1,128 +0,0 @@ -# Version of .ycm_extra_conf.py sample file adapted -# for the Mapbox GL Native project. -# -# This file is NOT licensed under the GPLv3, which is the license for the rest -# of YouCompleteMe. -# -# Here's the license text for this file: -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# For more information, please refer to - -import os -import subprocess -import string -import ycm_core - -compilation_database_folders = [ - 'build/linux-x86_64/Debug', - 'build/qt-linux-x86_64/Debug', - 'build/qt4-linux-x86_64/Debug', - 'build/macos/compdb/Debug', -] - -subprocess.call(['make compdb'], shell=True) - -for folder in compilation_database_folders: - if os.path.exists( folder ): - database = ycm_core.CompilationDatabase( folder ) - -SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] - - -def DirectoryOfThisScript(): - return os.path.dirname( os.path.abspath( __file__ ) ) - - -def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): - if not working_directory: - return list( flags ) - new_flags = [] - make_next_absolute = False - path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] - for flag in flags: - new_flag = flag - - if make_next_absolute: - make_next_absolute = False - if not flag.startswith( '/' ): - new_flag = os.path.join( working_directory, flag ) - - for path_flag in path_flags: - if flag == path_flag: - make_next_absolute = True - break - - if flag.startswith( path_flag ): - path = flag[ len( path_flag ): ] - new_flag = path_flag + os.path.join( working_directory, path ) - break - - if new_flag: - new_flags.append( new_flag ) - return new_flags - - -def IsHeaderFile( filename ): - extension = os.path.splitext( filename )[ 1 ] - return extension in [ '.h', '.hxx', '.hpp', '.hh' ] - - -def GetCompilationInfoForFile( filename ): - # The compilation_commands.json file generated by CMake does not have entries - # for header files. So we do our best by asking the db for flags for a - # corresponding source file, if any. If one exists, the flags for that file - # should be good enough. - if IsHeaderFile( filename ): - basename = os.path.splitext( filename )[ 0 ] - for extension in SOURCE_EXTENSIONS: - replacement_file = basename + extension - if os.path.exists( replacement_file ): - compilation_info = database.GetCompilationInfoForFile( - replacement_file ) - if compilation_info.compiler_flags_: - return compilation_info - return None - return database.GetCompilationInfoForFile( filename ) - - -def FlagsForFile( filename, **kwargs ): - if not database: - return None - - # Bear in mind that compilation_info.compiler_flags_ does NOT return a - # python list, but a "list-like" StringVec object - compilation_info = GetCompilationInfoForFile( filename ) - if not compilation_info: - return None - - final_flags = MakeRelativePathsInFlagsAbsolute( - compilation_info.compiler_flags_, - compilation_info.compiler_working_dir_ ) - - return { - 'flags': final_flags, - 'do_cache': True - } diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md deleted file mode 100644 index 639602020..000000000 --- a/ARCHITECTURE.md +++ /dev/null @@ -1,121 +0,0 @@ -This document aims to outline at a high level the various parts that make up mapbox-gl-native and how they work together. - -# Repository structure - -mapbox-gl-native uses a monolithic that houses both core C++ code and code that wraps the C++ core with SDKs for Android, iOS, macOS, Node.js, and Qt. A "monorepo" allows us to: - - * Make changes to the core API and SDKs simultaneously, ensuring no platform falls behind. - * Ensure that core changes do not inadvertently break SDK tests. - * Centralize discussions about features and defects that affect multiple platforms. - -In the repository, core C++ code is contained in the `include` and `src` directories. The former includes headers that are considered to make up the "public" core C++ API, while the latter includes `.cpp` implementation files and headers that are private to the implementation. Within both directories, files are nested under an `mbgl` directory, which has various subdirectories based on areas of functionality. Both public and private headers therefore can (and should) always be included with the form `#include `. - -Code and build scripts belonging to platform SDKs are contained in the `platform` directory, which has subdirectories for each platform. The `platform/darwin` and `platform/default` directories contain code shared by multiple platform SDKs. - -# Build system - -The mapbox-gl-native build system uses a variety of tools. - -## Make - -GNU Make and a master `Makefile` serves as the coordinating tool for all other build system tools. Most of your interaction with the build system will be via `make` commands. We aim to have a consistent pattern for make targets across platforms: for a given platform, e.g. `ios`, `make ios` builds a reasonable set of end products (though perhaps not all permutations of build options, which can be prohibitively expensive), and `make ios-test` runs a complete test suite for the platform. - -## Git submodules - -Git submodules are used to pull in several dependencies: mason (see below) and several iOS dependencies (though we have plans to phase these out). Initializing these submodules is handled automatically by the necessary `make` targets. - -## npm - -npm is a package manager for Node.js. mapbox-gl-native uses it to pull in several development dependencies that happen to be packaged as node modules -- mainly for testing needs. - -## Mason - -[Mason](https://github.com/mapbox/mason) is Mapbox's own cross platform C/C++ package manager. mapbox-gl-native uses mason packages as a source of precompiled binaries for third-party dependencies such as Boost, RapidJSON, and SQLite, and Mapbox's own C++ modules such as [earcut.hpp](https://github.com/mapbox/earcut.hpp) and [geojson-vt-cpp](https://github.com/mapbox/geojson-vt-cpp). It is also used to obtain a toolchain for Android platform cross-compiliation. - -We track mason dependencies for a given platform in the file `platform//scripts/configure.sh`. The `configure` script at the root handles sourcing this file during the build, running the appropriate mason commands, and writing configuration settings for the subsequent build to a `config.gypi` in the build output directory. - -## gyp - -[gyp](https://gyp.gsrc.io/) is a build system originally created for Chromium and since adopted by Node.js. In mapbox-gl-native it's used to build the core C++ static library, the Node.js platform module, and the shared JNI module for Android. - -## Platform-specific subsystems - -Outside of the core C++ static library, platform SDKs typically rely on platform-native build tooling to complete the job. - -* For iOS and macOS this means Xcode and the xcodebuild command line tool. -* For Android, Gradle and Android Studio. -* For Qt, `qmake`. - -See the relevant platform-specific `README.md` / `INSTALL.md` for details. - -# Major functional components - -## Map -## Style - -The "Style" component of mapbox-gl-native contains an implementation of the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), defining what data to draw, the order to draw it in, and how to style the data when drawing it. - -In addition to supporting styles loaded from a URL, mapbox-gl-native includes a runtime styling API, which allows users to dynamically modify the current style: add and remove layers, modify layer properties, and so on. As appropriate for a C++ API, the runtime styling API API is _strongly typed_: there are subclasses for each layer type, with correctly-typed accessors for each style property. This results in a large API surface area. Fortunately, this is automated, by generating the API – and the regular portion of the implementation – from the style specification. - -The layers API makes a distinction between public API and internal implementation using [the `Impl` idiom](https://github.com/mapbox/mapbox-gl-native/issues/3254) seen elsewhere in the codebase. Here, it takes the form of parallel class hierarchies: - -* `Layer`, `Source`, and their subclasses form the public API. This is the API consumed by SDK bindings. -* `Layer::Impl`, `Source::Impl`, and their subclasses form the internal API. This API is used only by other parts of the core C++ implementation. - -For each subclass of `Layer` or source, there's a corresponding `Impl` subclass. For example, `CircleLayer` and `CircleLayer::Impl`. The base `Layer` class holds a reference to the base `Layer::Impl`, and `CircleLayer` and other subclasses have an `impl()` accessor method that casts this reference to the appropriate subtype. - -## Immutability - -The `Layer::Impl` and `Source::Impl` reference held by `Layer` and `Source` base classes is _immutable_: it's a shared reference to a `const` (read only) pointer. Immutability permits the `Impl` objects to be shared safely between threads when needed -- for example, between the main thread and worker thread that performs computation in the background, or between the main thread and a dedicated renderer thread. See the "Threading" section below for further details on the threading model. - -Immutability is an alternative to several other strategies for safe intra-thread communication. One alternative strategy is to insert locks whenever data is shared between threads and at least one thread may be modifying the data. This strategy is prone to problems such as race conditions (if you forget to use a lock), deadlocks (if locks are acquired in conflicting orders), and poor performance due to lock contention. Another strategy is to copy data whenever it's needed by another thread. For complex structures such as a Mapbox Style, copying can be an expensive operation. With immutability, the approach is to share data without copying, but ensure that any data so shared cannot be modified by any thread, and that the data is not destroyed until the last thread using it relinquishes its reference. - -Immutability is implemented by the `Immutable` template, which acts as a non-nullable shared reference to a `const T`. It has behavior similar to `std::shared_ptr`, but indicates its intent as an immutable reference that is safe to share between threads. - -Immutability is core to the implementation, and yet one of the defining features of Mapbox GL is the ability to manipulate and mutate the style freely at runtime. How can this be possible if everything is immutable? The answer turns on the distinction mentioned in the previous section between public classes such as `Layer` and private implementations such as `Layer::Impl`. In Mapbox GL, the latter is immutable, but the former is not: - -* **Mutable objects**: `Layer`, `Source`, `Image`, `Light` -* **Immutable objects**: `Layer::Impl`, `Source::Impl`, `Image::Impl`, `Light::Impl` - -An instance of a `Layer` subclass such as `CircleLayer` has a reference to an `Immutable`, but is itself mutable -- it has mutating methods such as `setCircleRadius`. Such methods follow a common pattern: - -* Create a new instance of the Impl, copied from the existing Impl. This new instance is temporarily mutable. -* Modify this new instance as needed; e.g. set the radius to a new value. -* "Freeze" the new instance by making it immutable, and then assign that immutable reference to be the new Impl for the `Layer`. - -Two things to note about this process: - -* No existing Impls are modified -- only the newly created copy. -* Only one existing reference to an Impl is modified -- the one held by the `Layer` instance being mutated. Any references to the previous Impl held by other threads remain unchanged. They go on using the previous value for radius until notified by some other means that there has been a change. - -So how do things that are holding references to the previous Impl get notified? The answer is **style diffing**. This is the process by which we determine, from one frame to the next, what parts of the style have changed and therefore what needs to be recalculated in response to those changes in order to draw an updated frame. In parallel to style objects such as `Style`, `Layer`, `Source` and so on, Mapbox GL maintains render objects such as `RenderStyle`, `RenderLayer`, `RenderSource` and so on. These render objects: - -* are mutable -* may live on either the main thread or an independent rendering thread, depending on the SDK -* contain any and all values calculated from the style objects plus state such as the current zoom level and location -- for example, the set of loaded tiles and the buckets calculated from them - -From one frame to the next, these render objects are updated based on the current state of the style objects. In order to permit the render objects to live on a different thread, this state is communicated as immutable Impl references -- in effect, a snapshot of the style state at the time the frame was requested. And it really is a just snapshot -- we don't communicate things like "the radius of this circle layer was changed", "this layer was removed", etc. Instead, that information is reconstructed by `RenderStyle` by comparing the new snapshot to the old snapshot. Immutability allows us to perform this comparison very efficiently: - -* If the "before" and "after" of two immutable references refer to the same object, we know that it hasn't changed. If they're different, we know it has changed in some way. -* We can calculate changes in collections of immutable references (a list of layers or sources) using an efficient [diff algorithm](http://www.xmailserver.org/diff2.pdf). We can further improve this efficiency by making the collections themselves immutable, so that we can avoid running the diff algorithm altogether in the common case where the "before" and "after" collections refer to the same immutable object. - -One final benefit of this approach of diffing immutable objects: we get "smart" updates between two completely independent styles essentially for free. For example, `RenderStyle` doesn't care if the "before" snapshot is from the Mapbox Light style and the "after" snapshot is from the Mapbox Dark style. It will just calculate the difference between the two snapshots, update render data where necessary, and render the next frame. Since those two styles use the same source data and layer IDs, the result will be a fully automatic, seamless transition between light and dark. - -## FileSource -## Layout -## Rendering -## Annotations - -# Threading - -At runtime, mapbox-gl-native uses the following threads: - -* The "main thread" (or other thread on which a `Map` object is created) handles direct `Map` API requests, owns the active `Style` and its associated objects, and renders the map. Since this thread is usually dispatching events triggered by user input, it's important that these duties not require significant computation or perform blocking I/O that would cause UI jank or hangs. -* Many of the tasks that require significant computation are associated with layout and styling of map features: parsing vector tiles, computing text layout, and generating data buffers to be consumed by OpenGL. This work happens on "worker threads" that are spawned by the main thread, four per `Style` object. The `Style` and its associated objects handle dispatching tasks to the workers, typically on a tile-by-tile basis. -* A "FileSource" thread handles network requests for styles, tiles, and other resources, and I/O on the SQLite database used for offline maps and caching. Requests originate from the main thread, are dispatched by a FileSource internally to its thread, and results are returned to the main thread via an asynchronous callback function. (This is implemented with platform-specific hooks into the native message pump for the requesting thread.) - -To minimize data races and invalid memory access, we aim for zero shared memory state between any two threads. Cross-thread communication occurs via one thread requesting the "invocation" of a task on another thread. The parameters for this task should be passed as value objects, so that they are copied, or as ownership-transferring values such as `std::unique_ptr`. (We're [not entirely there yet](https://github.com/mapbox/mapbox-gl-native/issues/667), but that's the goal.) The result (if any) is likewise passed as a value or ownership-transferring parameter to the callback function. - -Invoking a task on another thread itself creates an ownership obligation: the responsibility for the work happening on the other thread. This ownership is represented by the invocation method returning `std::unique_ptr`. Destroying this object indicates that the result of the task is no longer required: the callback is guaranteed not to be called, and the work on the other thread may be aborted (if doing so is convenient). - -All this is implemented by [Thread](https://github.com/mapbox/mapbox-gl-native/blob/master/src/mbgl/util/thread.hpp) and [RunLoop](https://github.com/mapbox/mapbox-gl-native/blob/master/include/mbgl/util/run_loop.hpp). diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2440c3f60..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,90 +0,0 @@ -platform: x64 - -image: -- Visual Studio 2015 -- Visual Studio 2017 - -environment: - PYTHON: C:\python37 - - matrix: - - configuration: Release - - configuration: Debug - -test: off - -clone_depth: 1 - -for: -- - matrix: - only: - - image: Visual Studio 2015 - - environment: - LLVM_VERSION: 5.0.1 - LLVM_HASH: 981543611D719624ACB29A2CFFD6A479CFF36E8AB5EE8A57D8ECA4F9C4C6956F - VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' - QT_PREFIX: 'C:\Qt\latest\msvc2015_64\lib\cmake' - -- - matrix: - only: - - image: Visual Studio 2017 - - environment: - LLVM_VERSION: 7.0.0 - LLVM_HASH: 74b197a3959b0408adf0824be01db8dddfa2f9a967f4085af3fad900ed5fdbf6 - VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat' - QT_PREFIX: 'C:\Qt\latest\msvc2017_64\lib\cmake' - -cache: - - '%APPVEYOR_BUILD_FOLDER%\.git\modules' - - '%APPVEYOR_BUILD_FOLDER%\LLVM-%LLVM_VERSION%-win64.exe' - - '%APPVEYOR_BUILD_FOLDER%\cmake-3.10.1-win64-x64.zip' - - C:\clcache - -install: - - set PATH=%PYTHON%\Scripts;%PYTHON%;%PATH% - - pip install clcache - - git config --system core.longpaths true - - git submodule sync - - git submodule update --init - - git submodule foreach git submodule update --init - - ps: | - if (!(Test-Path "LLVM-$env:LLVM_VERSION-win64.exe")) { - appveyor DownloadFile "https://releases.llvm.org/$env:LLVM_VERSION/LLVM-$env:LLVM_VERSION-win64.exe" - } - scripts\check-sha256.ps1 LLVM-$env:LLVM_VERSION-win64.exe "$env:LLVM_HASH" - Start-Process -FilePath "LLVM-$env:LLVM_VERSION-win64.exe" -ArgumentList '/S',"/D=C:\LLVM-$env:LLVM_VERSION" -Wait - - ps: | - if (!(Test-Path cmake-3.10.1-win64-x64.zip)) { - appveyor DownloadFile https://cmake.org/files/v3.10/cmake-3.10.1-win64-x64.zip - } - scripts\check-sha256.ps1 cmake-3.10.1-win64-x64.zip 8251F70C85B58F3CA1F24E4A3B0637E2D609B5E4A341D00B70E02E89244D5029 - Start-Process -FilePath '7z' -ArgumentList 'x','cmake-3.10.1-win64-x64.zip','-oC:\' -Wait - -before_build: - - set PATH=C:\LLVM-%LLVM_VERSION%\bin;%PATH% - - set PATH=C:\cmake-3.10.1-win64-x64\bin;%PATH% - - set CLCACHE_DIR=c:\clcache - - set CLCACHE_CL=clang-cl - - clcache -z - - set CC=clcache - - set CXX=clcache - - set CTEST_OUTPUT_ON_FAILURE=1 - - mkdir %APPVEYOR_BUILD_FOLDER%\build - - cd %APPVEYOR_BUILD_FOLDER%\build - -build_script: - - call "%VCVARSALL%" amd64 - - cmake -E remove ../next/vendor - - cmake -E copy_directory ../vendor ../next/vendor - - cmake -G "Ninja" - -DCMAKE_BUILD_TYPE=%CONFIGURATION% - -DCMAKE_MAKE_PROGRAM="%APPVEYOR_BUILD_FOLDER%\platform\qt\ninja.exe" - -DCMAKE_PREFIX_PATH=%QT_PREFIX% - -DMBGL_WITH_QT=ON - ../next - - cmake --build . --target qmapboxgl -- -j %NUMBER_OF_PROCESSORS% - - clcache -s diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp deleted file mode 100644 index 5e7fd823e..000000000 --- a/benchmark/api/query.benchmark.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace mbgl; - -namespace { - -class QueryBenchmark { -public: - QueryBenchmark() { - NetworkStatus::Set(NetworkStatus::Status::Offline); - - map.getStyle().loadJSON(util::read_file("benchmark/fixtures/api/style.json")); - map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan - map.getStyle().addImage(std::make_unique("test-icon", - decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0)); - - frontend.render(map); - } - - util::RunLoop loop; - HeadlessFrontend frontend { { 1000, 1000 }, 1 }; - Map map { frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), - ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; - ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; -}; - -} // end namespace - -static void API_queryRenderedFeaturesAll(::benchmark::State& state) { - QueryBenchmark bench; - - while (state.KeepRunning()) { - bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {}); - } -} - -static void API_queryRenderedFeaturesLayerFromLowDensity(::benchmark::State& state) { - QueryBenchmark bench; - - while (state.KeepRunning()) { - bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {{{ "testlayer" }}, {}}); - } -} - -static void API_queryRenderedFeaturesLayerFromHighDensity(::benchmark::State& state) { - QueryBenchmark bench; - - while (state.KeepRunning()) { - bench.frontend.getRenderer()->queryRenderedFeatures(bench.box, {{{"road-street" }}, {}}); - } -} - -BENCHMARK(API_queryRenderedFeaturesAll); -BENCHMARK(API_queryRenderedFeaturesLayerFromLowDensity); -BENCHMARK(API_queryRenderedFeaturesLayerFromHighDensity); diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp deleted file mode 100644 index f192e7d3a..000000000 --- a/benchmark/api/render.benchmark.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace mbgl; - -namespace { - -static std::string cachePath { "benchmark/fixtures/api/cache.db" }; -constexpr double pixelRatio { 1.0 }; -constexpr Size size { 1000, 1000 }; - -class RenderBenchmark { -public: - RenderBenchmark() { - NetworkStatus::Set(NetworkStatus::Status::Offline); - } - - util::RunLoop loop; -}; - -static void prepare(Map& map, optional json = {}) { - map.getStyle().loadJSON(json ? *json : util::read_file("benchmark/fixtures/api/style.json")); - map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan - - auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")); - map.getStyle().addImage(std::make_unique("test-icon", std::move(image), 1.0)); -} - -} // end namespace - -static void API_renderStill_reuse_map(::benchmark::State& state) { - RenderBenchmark bench; - HeadlessFrontend frontend { size, pixelRatio }; - Map map { frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; - prepare(map); - - while (state.KeepRunning()) { - frontend.render(map); - } -} - -static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) { - RenderBenchmark bench; - HeadlessFrontend frontend { size, pixelRatio }; - Map map { frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; - prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json")); - - while (state.KeepRunning()) { - frontend.render(map); - } -} - -static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { - RenderBenchmark bench; - HeadlessFrontend frontend { size, pixelRatio }; - Map map { frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; - - while (state.KeepRunning()) { - prepare(map, { "{}" }); - frontend.render(map); - prepare(map); - frontend.render(map); - } -} - -static void API_renderStill_recreate_map(::benchmark::State& state) { - RenderBenchmark bench; - - while (state.KeepRunning()) { - HeadlessFrontend frontend { size, pixelRatio }; - Map map { frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; - prepare(map); - frontend.render(map); - } -} - -static void API_renderStill_multiple_sources(::benchmark::State& state) { - using namespace mbgl::style; - RenderBenchmark bench; - HeadlessFrontend frontend{size, pixelRatio}; - Map map{frontend, - MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cachePath).withAccessToken("foobar")}; - prepare(map); - auto& style = map.getStyle(); - const int kSourcesCount = 50; - const int kLayersCount = 50; - for (int i = 0; i < kSourcesCount; ++i) { - std::ostringstream sourceOss; - sourceOss << "GeoJSONSource" << i; - std::string sourceId{sourceOss.str()}; - auto source = std::make_unique(sourceId); - style.addSource(std::move(source)); - for (int j = 0; j < kLayersCount; ++j) { - std::ostringstream layerOss; - layerOss << sourceId << '#' << j; - auto layer = std::make_unique(layerOss.str(), sourceId); - style.addLayer(std::move(layer)); - } - } - - while (state.KeepRunning()) { - frontend.render(map); - } -} - -BENCHMARK(API_renderStill_reuse_map); -BENCHMARK(API_renderStill_reuse_map_formatted_labels); -BENCHMARK(API_renderStill_reuse_map_switch_styles); -BENCHMARK(API_renderStill_recreate_map); -BENCHMARK(API_renderStill_multiple_sources); diff --git a/benchmark/benchmark-files.json b/benchmark/benchmark-files.json deleted file mode 100644 index a05fdfc4c..000000000 --- a/benchmark/benchmark-files.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "//": "This file is generated. Do not edit. Regenerate it with scripts/generate-file-lists.js", - "sources": [ - "benchmark/api/query.benchmark.cpp", - "benchmark/api/render.benchmark.cpp", - "benchmark/function/camera_function.benchmark.cpp", - "benchmark/function/composite_function.benchmark.cpp", - "benchmark/function/source_function.benchmark.cpp", - "benchmark/parse/filter.benchmark.cpp", - "benchmark/parse/tile_mask.benchmark.cpp", - "benchmark/parse/vector_tile.benchmark.cpp", - "benchmark/src/mbgl/benchmark/benchmark.cpp", - "benchmark/storage/offline_database.benchmark.cpp", - "benchmark/util/dtoa.benchmark.cpp", - "benchmark/util/tilecover.benchmark.cpp" - ], - "public_headers": { - "mbgl/benchmark.hpp": "benchmark/include/mbgl/benchmark.hpp" - }, - "private_headers": { - "mbgl/benchmark/stub_geometry_tile_feature.hpp": "benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp" - } -} diff --git a/benchmark/fixtures/api/cache.db b/benchmark/fixtures/api/cache.db deleted file mode 100644 index fc51eca3b..000000000 Binary files a/benchmark/fixtures/api/cache.db and /dev/null differ diff --git a/benchmark/fixtures/api/default_marker.png b/benchmark/fixtures/api/default_marker.png deleted file mode 100644 index b112096c1..000000000 Binary files a/benchmark/fixtures/api/default_marker.png and /dev/null differ diff --git a/benchmark/fixtures/api/style.json b/benchmark/fixtures/api/style.json deleted file mode 100644 index cf88aeb6e..000000000 --- a/benchmark/fixtures/api/style.json +++ /dev/null @@ -1,3993 +0,0 @@ -{ - "version": 8, - "name": "Mapbox Streets", - "metadata": { - "mapbox:autocomposite": true, - "mapbox:type": "default", - "mapbox:groups": { - "1444934828655.3389": { "name": "Aeroways", "collapsed": true }, - "1444933322393.2852": { "name": "POI labels (scalerank 1)", "collapsed": true }, - "1444855786460.0557": { "name": "Roads", "collapsed": true }, - "1444933575858.6992": { "name": "Highway shields", "collapsed": true }, - "1444934295202.7542": { "name": "Admin boundaries", "collapsed": true }, - "1444856151690.9143": { "name": "State labels", "collapsed": true }, - "1444933721429.3076": { "name": "Road labels", "collapsed": true }, - "1444933358918.2366": { "name": "POI labels (scalerank 2)", "collapsed": true }, - "1444933808272.805": { "name": "Water labels", "collapsed": true }, - "1444933372896.5967": { "name": "POI labels (scalerank 3)", "collapsed": true }, - "1444855799204.86": { "name": "Bridges", "collapsed": true }, - "1444856087950.3635": { "name": "Marine labels", "collapsed": true }, - "1456969573402.7817": { "name": "Hillshading", "collapsed": true }, - "1444862510685.128": { "name": "City labels", "collapsed": true }, - "1444855769305.6016": { "name": "Tunnels", "collapsed": true }, - "1456970288113.8113": { "name": "Landcover", "collapsed": true }, - "1444856144497.7825": { "name": "Country labels", "collapsed": true }, - "1444933456003.5437": { "name": "POI labels (scalerank 4)", "collapsed": true } - } - }, - "sources": { - "composite": { "url": "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7", "type": "vector" } - }, - "sprite": "mapbox://sprites/mapbox/streets-v10", - "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", - "visibility": "public", - "layers": [ - { - "id": "background", - "type": "background", - "layout": {}, - "paint": { - "background-color": { "base": 1, "stops": [ [ 11, "hsl(35, 32%, 91%)" ], [ 13, "hsl(35, 12%, 89%)" ] ] } - } - }, - { - "id": "landcover_snow", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "filter": [ "==", "class", "snow" ], - "layout": {}, - "paint": { "fill-color": "hsl(0, 0%, 100%)", "fill-opacity": 0.2, "fill-antialias": false } - }, - { - "id": "landcover_wood", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "wood" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_scrub", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "scrub" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_grass", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "grass" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_crop", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "crop" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "national_park", - "type": "fill", - "source": "composite", - "source-layer": "landuse_overlay", - "filter": [ "==", "class", "national_park" ], - "layout": {}, - "paint": { - "fill-color": "hsl(100, 58%, 76%)", - "fill-opacity": { "base": 1, "stops": [ [ 5, 0 ], [ 6, 0.5 ] ] } - } - }, - { - "id": "hospital", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "hospital" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(340, 37%, 87%)" ], [ 16, "hsl(340, 63%, 89%)" ] ] } - } - }, - { - "id": "school", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "school" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(50, 47%, 81%)" ], [ 16, "hsl(50, 63%, 84%)" ] ] } - } - }, - { - "id": "park", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "park" ], - "layout": {}, - "paint": { - "fill-color": "hsl(100, 58%, 76%)", - "fill-opacity": { "base": 1, "stops": [ [ 5, 0 ], [ 6, 1 ] ] } - } - }, - { - "id": "pitch", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "pitch" ], - "layout": {}, - "paint": { "fill-color": "hsl(100, 57%, 72%)" } - }, - { - "id": "pitch-line", - "type": "line", - "source": "composite", - "source-layer": "landuse", - "minzoom": 15, - "filter": [ "==", "class", "pitch" ], - "layout": { "line-join": "miter" }, - "paint": { "line-color": "hsl(75, 57%, 84%)" } - }, - { - "id": "cemetery", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "cemetery" ], - "layout": {}, - "paint": { "fill-color": "hsl(75, 37%, 81%)" } - }, - { - "id": "industrial", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "industrial" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(230, 15%, 86%)" ], [ 16, "hsl(230, 29%, 89%)" ] ] } - } - }, - { - "id": "sand", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "sand" ], - "layout": {}, - "paint": { "fill-color": "hsl(60, 46%, 87%)" } - }, - { - "id": "hillshade_highlight_bright", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 94 ], - "layout": {}, - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-opacity": { "stops": [ [ 14, 0.12 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_highlight_med", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 90 ], - "layout": {}, - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-opacity": { "stops": [ [ 14, 0.12 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_faint", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 89 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.05 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_med", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 78 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.05 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_dark", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 67 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.06 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_extreme", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 56 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.06 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "waterway-river-canal", - "type": "line", - "source": "composite", - "source-layer": "waterway", - "minzoom": 8, - "filter": [ "in", "class", "canal", "river" ], - "layout": { - "line-cap": { "base": 1, "stops": [ [ 0, "butt" ], [ 11, "round" ] ] }, - "line-join": "round" - }, - "paint": { - "line-color": "hsl(205, 87%, 76%)", - "line-width": { "base": 1.3, "stops": [ [ 8.5, 0.1 ], [ 20, 8 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 8, 0 ], [ 8.5, 1 ] ] } - } - }, - { - "id": "waterway-small", - "type": "line", - "source": "composite", - "source-layer": "waterway", - "minzoom": 13, - "filter": [ "!in", "class", "canal", "river" ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-color": "hsl(205, 87%, 76%)", - "line-width": { "base": 1.35, "stops": [ [ 13.5, 0.1 ], [ 20, 3 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13, 0 ], [ 13.5, 1 ] ] } - } - }, - { - "id": "water-shadow", - "type": "fill", - "source": "composite", - "source-layer": "water", - "layout": {}, - "paint": { - "fill-color": "hsl(215, 84%, 69%)", - "fill-translate": { "base": 1.2, "stops": [ [ 7, [ 0, 0 ] ], [ 16, [ -1, -1 ] ] ] }, - "fill-translate-anchor": "viewport", - "fill-opacity": 1 - } - }, - { "id": "water", "ref": "water-shadow", "paint": { "fill-color": "hsl(196, 80%, 70%)" } }, - { - "id": "barrier_line-land-polygon", - "type": "fill", - "source": "composite", - "source-layer": "barrier_line", - "filter": [ "all", [ "==", "$type", "Polygon" ], [ "==", "class", "land" ] ], - "layout": {}, - "paint": { "fill-color": "hsl(35, 12%, 89%)" } - }, - { - "id": "barrier_line-land-line", - "type": "line", - "source": "composite", - "source-layer": "barrier_line", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "class", "land" ] ], - "layout": { "line-cap": "round" }, - "paint": { - "line-width": { "base": 1.99, "stops": [ [ 14, 0.75 ], [ 20, 40 ] ] }, - "line-color": "hsl(35, 12%, 89%)" - } - }, - { - "id": "aeroway-polygon", - "type": "fill", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 11, - "filter": [ "all", [ "==", "$type", "Polygon" ], [ "!=", "type", "apron" ] ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "fill-opacity": { "base": 1, "stops": [ [ 11, 0 ], [ 11.5, 1 ] ] } - } - }, - { - "id": "aeroway-runway", - "type": "line", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 9, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "runway" ] ], - "layout": {}, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 9, 1 ], [ 18, 80 ] ] } - } - }, - { - "id": "aeroway-taxiway", - "type": "line", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 9, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "taxiway" ] ], - "layout": {}, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 10, 0.5 ], [ 18, 20 ] ] } - } - }, - { - "id": "building-line", - "type": "line", - "source": "composite", - "source-layer": "building", - "minzoom": 15, - "filter": [ "all", [ "!=", "type", "building:part" ], [ "==", "underground", "false" ] ], - "layout": {}, - "paint": { - "line-color": "hsl(35, 6%, 79%)", - "line-width": { "base": 1.5, "stops": [ [ 15, 0.75 ], [ 20, 3 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 15.5, 0 ], [ 16, 1 ] ] } - } - }, - { - "id": "building", - "type": "fill", - "source": "composite", - "source-layer": "building", - "minzoom": 15, - "filter": [ "all", [ "!=", "type", "building:part" ], [ "==", "underground", "false" ] ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15, "hsl(35, 11%, 88%)" ], [ 16, "hsl(35, 8%, 85%)" ] ] }, - "fill-opacity": { "base": 1, "stops": [ [ 15.5, 0 ], [ 16, 1 ] ] }, - "fill-outline-color": "hsl(35, 6%, 79%)" - } - }, - { - "id": "tunnel-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "tunnel-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "tunnel-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-street_limited-case", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-street-case", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "secondary", "tertiary" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(230, 19%, 75%)" - } - }, - { - "id": "tunnel-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(230, 19%, 75%)" - } - }, - { - "id": "tunnel-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "trunk_link" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway_link" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "trunk" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": 1, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": 1, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "tunnel-path", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-color": "hsl(35, 26%, 95%)", - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "tunnel-steps", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(35, 26%, 95%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "tunnel-trunk_link", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-trunk_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 77%, 78%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-motorway_link", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-motorway_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 78%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-pedestrian", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "tunnel-service-link-track", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-service-link-track-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-street_limited", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-street", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-secondary-tertiary", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-secondary-tertiary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ], - "line-blur": 0 - } - }, - { - "id": "tunnel-primary", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-primary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ], - "line-blur": 0 - } - }, - { - "id": "tunnel-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "tunnel-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "tunnel-trunk", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "trunk" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 77%, 78%)" - } - }, - { - "id": "tunnel-motorway", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-motorway-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-opacity": 1, - "line-color": "hsl(26, 100%, 78%)", - "line-blur": 0 - } - }, - { - "id": "tunnel-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "ferry", - "type": "line", - "source": "composite", - "source-layer": "road", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "ferry" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(205, 73%, 63%)" ], [ 17, "hsl(230, 73%, 63%)" ] ] }, - "line-opacity": 1, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] }, - "line-dasharray": { "base": 1, "stops": [ [ 12, [ 1, 0 ] ], [ 13, [ 12, 4 ] ] ] } - } - }, - { - "id": "ferry_auto", - "type": "line", - "source": "composite", - "source-layer": "road", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "ferry_auto" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(205, 73%, 63%)" ], [ 17, "hsl(230, 73%, 63%)" ] ] }, - "line-opacity": 1, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "road-path-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!in", "type", "crossing", "sidewalk", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "road-steps-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "!in", "structure", "bridge", "tunnel" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 17, 4.6 ], [ 18, 7 ] ] }, - "line-color": "hsl(230, 17%, 82%)", - "line-dasharray": [ 1, 0 ], - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "road-sidewalk-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "structure", "bridge", "tunnel" ], - [ "in", "type", "crossing", "sidewalk" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 0.75 ] ] } - } - }, - { - "id": "turning-features-outline", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "class", "turning_circle", "turning_loop" ] ], - "layout": { - "icon-image": "turning-circle-outline", - "icon-size": { "base": 1.5, "stops": [ [ 14, 0.122 ], [ 18, 0.969 ], [ 20, 1 ] ] }, - "icon-allow-overlap": true, - "icon-ignore-placement": true, - "icon-padding": 0, - "icon-rotation-alignment": "map" - }, - "paint": {} - }, - { - "id": "road-pedestrian-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 2 ], [ 18, 14.5 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": 0, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11, 0 ], [ 11.25, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "road-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11, 0 ], [ 11.25, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "road-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] } - } - }, - { - "id": "road-street_limited-case", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street-case", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "secondary", "tertiary" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 9.99, 0 ], [ 10, 1 ] ] } - } - }, - { - "id": "road-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 9.99, 0 ], [ 10, 1 ] ] } - } - }, - { - "id": "road-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 10, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway_link" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "road-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "!in", "structure", "bridge", "tunnel" ], [ "==", "type", "trunk_link" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "road-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "trunk" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 6, 0 ], [ 6.1, 1 ] ] } - } - }, - { - "id": "road-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "road-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "road-sidewalks", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-sidewalk-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 1 ] ] } - } - }, - { - "id": "road-path", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-path-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "road-steps", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-steps-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "road-trunk_link", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-trunk_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)", - "line-opacity": 1 - } - }, - { - "id": "road-motorway_link", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-motorway_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)", - "line-opacity": 1 - } - }, - { - "id": "road-pedestrian", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-pedestrian-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "road-pedestrian-polygon-fill", - "type": "fill", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "Polygon" ], - [ "all", [ "in", "class", "path", "pedestrian" ], [ "==", "structure", "none" ] ] - ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 16, "hsl(230, 16%, 94%)" ], [ 16.25, "hsl(230, 50%, 98%)" ] ] }, - "fill-outline-color": "hsl(230, 26%, 88%)", - "fill-opacity": 1 - } - }, - { - "id": "road-pedestrian-polygon-pattern", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-pedestrian-polygon-fill", - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-outline-color": "hsl(35, 10%, 83%)", - "fill-pattern": "pedestrian-polygon", - "fill-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 1 ] ] } - } - }, - { - "id": "road-polygon", - "type": "fill", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "Polygon" ], - [ - "all", - [ "!in", "class", "motorway", "path", "pedestrian", "trunk" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": {}, - "paint": { "fill-color": "hsl(0, 0%, 100%)", "fill-outline-color": "#d6d9e6" } - }, - { - "id": "road-service-link-track", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-service-link-track-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)" - } - }, - { - "id": "road-street_limited", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-secondary-tertiary", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-secondary-tertiary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": { "base": 1, "stops": [ [ 5, "hsl(35, 32%, 91%)" ], [ 8, "hsl(0, 0%, 100%)" ] ] }, - "line-opacity": { "base": 1.2, "stops": [ [ 5, 0 ], [ 5.5, 1 ] ] } - } - }, - { - "id": "road-primary", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-primary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { "base": 1, "stops": [ [ 5, "hsl(35, 32%, 91%)" ], [ 7, "hsl(0, 0%, 100%)" ] ] }, - "line-opacity": 1 - } - }, - { - "id": "road-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "icon-rotation-alignment": "map", - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "road-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "icon-rotation-alignment": "map", - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "road-trunk", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-trunk-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { - "base": 1, - "stops": [ [ 6, "hsl(0, 0%, 100%)" ], [ 6.1, "hsl(46, 80%, 60%)" ], [ 9, "hsl(46, 85%, 67%)" ] ] - } - } - }, - { - "id": "road-motorway", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-motorway-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { "base": 1, "stops": [ [ 8, "hsl(26, 87%, 62%)" ], [ 9, "hsl(26, 100%, 68%)" ] ] } - } - }, - { - "id": "road-rail", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "major_rail", "minor_rail" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "road-rail-tracks", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-rail", - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 4 ], [ 20, 8 ] ] }, - "line-dasharray": [ 0.1, 15 ], - "line-opacity": { "base": 1, "stops": [ [ 13.75, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "level-crossings", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ "all", [ "==", "$type", "Point" ], [ "==", "class", "level_crossing" ] ], - "layout": { "icon-size": 1, "icon-image": "level-crossing", "icon-allow-overlap": true }, - "paint": {} - }, - { - "id": "road-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "turning-features", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "class", "turning_circle", "turning_loop" ] ], - "layout": { - "icon-image": "turning-circle", - "icon-size": { "base": 1.5, "stops": [ [ 14, 0.095 ], [ 18, 1 ] ] }, - "icon-allow-overlap": true, - "icon-ignore-placement": true, - "icon-padding": 0, - "icon-rotation-alignment": "map" - }, - "paint": {} - }, - { - "id": "bridge-path-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 15, 0 ], [ 15.25, 1 ] ] } - } - }, - { - "id": "bridge-steps-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 17, 4.6 ], [ 18, 7 ] ] }, - "line-color": "hsl(230, 17%, 82%)", - "line-dasharray": [ 1, 0 ], - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "bridge-pedestrian-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 2 ], [ 18, 14.5 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": 0, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "bridge-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "bridge-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] } - } - }, - { - "id": "bridge-street_limited-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] } - } - }, - { - "id": "bridge-street-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] } - } - }, - { - "id": "bridge-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "secondary", "tertiary" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-translate": [ 0, 0 ] - } - }, - { - "id": "bridge-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-translate": [ 0, 0 ] - } - }, - { - "id": "bridge-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "bridge-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": 1 - } - }, - { - "id": "bridge-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "bridge-path", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "bridge-steps", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-steps-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "bridge-trunk_link", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway_link", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-pedestrian", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-pedestrian-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "bridge-service-link-track", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)" - } - }, - { - "id": "bridge-street_limited", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-street", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-secondary-tertiary", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "in", "type", "secondary", "tertiary" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1.2, "stops": [ [ 5, 0 ], [ 5.5, 1 ] ] } - } - }, - { - "id": "bridge-primary", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "==", "type", "primary" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1 - } - }, - { - "id": "bridge-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-rotation-alignment": "map", - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "bridge-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-rotation-alignment": "map", - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "bridge-trunk", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-rail", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "major_rail", "minor_rail" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "bridge-rail-tracks", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-rail", - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 4 ], [ 20, 8 ] ] }, - "line-dasharray": [ 0.1, 15 ], - "line-opacity": { "base": 1, "stops": [ [ 13.75, 0 ], [ 20, 1 ] ] } - } - }, - { - "id": "bridge-trunk_link-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "bridge-motorway_link-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": 1 - } - }, - { - "id": "bridge-trunk-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-motorway-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-trunk_link-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway_link-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-trunk-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "aerialway", - "type": "line", - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "class", "aerialway" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": "hsl(230, 10%, 74%)", - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "admin-3-4-boundaries-bg", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "filter": [ "all", [ ">=", "admin_level", 3 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "bevel" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 8, "hsl(35, 12%, 89%)" ], [ 16, "hsl(230, 49%, 90%)" ] ] }, - "line-width": { "base": 1, "stops": [ [ 7, 3.75 ], [ 12, 5.5 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 7, 0 ], [ 8, 0.75 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-translate": [ 0, 0 ], - "line-blur": { "base": 1, "stops": [ [ 3, 0 ], [ 8, 3 ] ] } - } - }, - { - "id": "admin-2-boundaries-bg", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1, "stops": [ [ 3, 3.5 ], [ 10, 8 ] ] }, - "line-color": { "base": 1, "stops": [ [ 6, "hsl(35, 12%, 89%)" ], [ 8, "hsl(230, 49%, 90%)" ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 3, 0 ], [ 4, 0.5 ] ] }, - "line-translate": [ 0, 0 ], - "line-blur": { "base": 1, "stops": [ [ 3, 0 ], [ 10, 2 ] ] } - } - }, - { - "id": "admin-3-4-boundaries", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "filter": [ "all", [ ">=", "admin_level", 3 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-dasharray": { "base": 1, "stops": [ [ 6, [ 2, 0 ] ], [ 7, [ 2, 2, 6, 2 ] ] ] }, - "line-width": { "base": 1, "stops": [ [ 7, 0.75 ], [ 12, 1.5 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 2, 0 ], [ 3, 1 ] ] }, - "line-color": { "base": 1, "stops": [ [ 3, "hsl(230, 14%, 77%)" ], [ 7, "hsl(230, 8%, 62%)" ] ] } - } - }, - { - "id": "admin-2-boundaries", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "disputed", 0 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-color": "hsl(230, 8%, 51%)", - "line-width": { "base": 1, "stops": [ [ 3, 0.5 ], [ 10, 2 ] ] } - } - }, - { - "id": "admin-2-boundaries-dispute", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "disputed", 1 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-dasharray": [ 1.5, 1.5 ], - "line-color": "hsl(230, 8%, 51%)", - "line-width": { "base": 1, "stops": [ [ 3, 0.5 ], [ 10, 2 ] ] } - } - }, - { - "id": "housenum-label", - "type": "symbol", - "source": "composite", - "source-layer": "housenum_label", - "minzoom": 17, - "layout": { - "text-field": "{house_num}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-padding": 4, - "text-max-width": 7, - "text-size": 9.5 - }, - "paint": { - "text-color": "hsl(35, 2%, 69%)", - "text-halo-color": "hsl(35, 8%, 85%)", - "text-halo-width": 0.5, - "text-halo-blur": 0 - } - }, - { - "id": "waterway-label", - "type": "symbol", - "source": "composite", - "source-layer": "waterway_label", - "minzoom": 12, - "filter": [ "in", "class", "canal", "river" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-max-angle": 30, - "text-size": { "base": 1, "stops": [ [ 13, 12 ], [ 18, 16 ] ] } - }, - "paint": { - "text-halo-width": 0.5, - "text-halo-color": "hsl(196, 80%, 70%)", - "text-color": "hsl(230, 48%, 44%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank4-l15", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 17, - "filter": [ - "all", - [ ">=", "localrank", 15 ], - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank4-l1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 15, - "filter": [ - "all", - [ "<=", "localrank", 14 ], - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks_scalerank4", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 15, - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank3", - "type": "symbol", - "metadata": { "mapbox:group": "1444933372896.5967" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 3 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank3", - "type": "symbol", - "metadata": { "mapbox:group": "1444933372896.5967" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 3 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "road-label-small", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "!in", - "class", - "link", - "motorway", - "pedestrian", - "primary", - "secondary", - "street", - "street_limited", - "tertiary", - "trunk" - ] - ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 15, 10 ], [ 20, 13 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": "{name_en}", - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-halo-blur": 1 - } - }, - { - "id": "road-label-medium", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "in", "class", "link", "pedestrian", "street", "street_limited" ] - ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 11, 10 ], [ 20, 14 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": "{name_en}", - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "road-label-large", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ "in", "class", "motorway", "primary", "secondary", "tertiary", "trunk" ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 9, 10 ], [ 20, 16 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": "{name_en}", - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsla(0, 0%, 100%, 0.75)", - "text-halo-width": 1, - "text-halo-blur": 1 - } - }, - { - "id": "road-shields-black", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ - "all", - [ "<=", "reflen", 6 ], - [ - "!in", - "shield", - "at-expressway", - "at-motorway", - "at-state-b", - "bg-motorway", - "bg-national", - "ch-main", - "ch-motorway", - "cz-motorway", - "cz-road", - "de-motorway", - "e-road", - "fi-main", - "gr-motorway", - "gr-national", - "hr-motorway", - "hr-state", - "hu-main", - "hu-motorway", - "nz-state", - "pl-expressway", - "pl-motorway", - "pl-national", - "ro-county", - "ro-motorway", - "ro-national", - "rs-motorway", - "rs-state-1b", - "se-main", - "si-expressway", - "si-motorway", - "sk-highway", - "sk-road", - "us-interstate", - "us-interstate-business", - "us-interstate-duplex", - "us-interstate-truck", - "za-metropolitan", - "za-national", - "za-provincial", - "za-regional" - ] - ], - "layout": { - "text-size": 9, - "icon-image": "{shield}-{reflen}", - "icon-rotation-alignment": "viewport", - "text-max-angle": 38, - "symbol-spacing": { "base": 1, "stops": [ [ 11, 150 ], [ 14, 200 ] ] }, - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "symbol-placement": { "base": 1, "stops": [ [ 10, "point" ], [ 11, "line" ] ] }, - "text-padding": 2, - "text-rotation-alignment": "viewport", - "text-field": "{ref}", - "text-letter-spacing": 0.05, - "icon-padding": 2 - }, - "paint": { - "text-color": "hsl(0, 0%, 7%)", - "icon-halo-color": "rgba(0, 0, 0, 1)", - "icon-halo-width": 1, - "text-opacity": 1, - "icon-color": "white", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0 - } - }, - { - "id": "road-shields-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ - "all", - [ "<=", "reflen", 6 ], - [ - "in", - "shield", - "at-expressway", - "at-motorway", - "at-state-b", - "bg-motorway", - "bg-national", - "ch-main", - "ch-motorway", - "cz-motorway", - "cz-road", - "de-motorway", - "e-road", - "fi-main", - "gr-motorway", - "gr-national", - "hr-motorway", - "hr-state", - "hu-main", - "hu-motorway", - "nz-state", - "pl-expressway", - "pl-motorway", - "pl-national", - "ro-county", - "ro-motorway", - "ro-national", - "rs-motorway", - "rs-state-1b", - "se-main", - "si-expressway", - "si-motorway", - "sk-highway", - "sk-road", - "us-interstate", - "us-interstate-business", - "us-interstate-duplex", - "us-interstate-truck", - "za-metropolitan", - "za-national", - "za-provincial", - "za-regional" - ] - ], - "layout": { - "text-size": 9, - "icon-image": "{shield}-{reflen}", - "icon-rotation-alignment": "viewport", - "text-max-angle": 38, - "symbol-spacing": { "base": 1, "stops": [ [ 11, 150 ], [ 14, 200 ] ] }, - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "symbol-placement": { "base": 1, "stops": [ [ 10, "point" ], [ 11, "line" ] ] }, - "text-padding": 2, - "text-rotation-alignment": "viewport", - "text-field": "{ref}", - "text-letter-spacing": 0.05, - "icon-padding": 2 - }, - "paint": { - "text-color": "hsl(0, 0%, 100%)", - "icon-halo-color": "rgba(0, 0, 0, 1)", - "icon-halo-width": 1, - "text-opacity": 1, - "icon-color": "white", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0 - } - }, - { - "id": "motorway-junction", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "motorway_junction", - "minzoom": 14, - "filter": [ "all", [ ">", "reflen", 0 ], [ "<=", "reflen", 9 ] ], - "layout": { - "text-field": "{ref}", - "text-size": 9, - "icon-image": "motorway-exit-{reflen}", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ] - }, - "paint": { "text-color": "hsl(0, 0%, 100%)", "text-translate": [ 0, 0 ] } - }, - { - "id": "poi-scalerank2", - "type": "symbol", - "metadata": { "mapbox:group": "1444933358918.2366" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 2 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 14, 11 ], [ 20, 14 ] ] }, - "icon-image": { "stops": [ [ 14, "{maki}-11" ], [ 15, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank2", - "type": "symbol", - "metadata": { "mapbox:group": "1444933358918.2366" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 2 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 14, 11 ], [ 20, 14 ] ] }, - "icon-image": { "stops": [ [ 14, "{maki}-11" ], [ 15, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "rail-label", - "type": "symbol", - "source": "composite", - "source-layer": "rail_station_label", - "minzoom": 12, - "filter": [ "!=", "maki", "entrance" ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{network}", - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-offset": [ 0, 0.85 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": { "base": 1, "stops": [ [ 0, "" ], [ 13, "{name_en}" ] ] }, - "text-letter-spacing": 0.01, - "icon-padding": 0, - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(230, 48%, 44%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "icon-halo-width": 4, - "icon-halo-color": "#fff", - "text-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "text-halo-blur": 0.5 - } - }, - { - "id": "water-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444933808272.805" }, - "source": "composite", - "source-layer": "water_label", - "minzoom": 15, - "filter": [ "<=", "area", 10000 ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 16, 13 ], [ 20, 16 ] ] } - }, - "paint": { "text-color": "hsl(230, 48%, 44%)" } - }, - { - "id": "water-label", - "type": "symbol", - "metadata": { "mapbox:group": "1444933808272.805" }, - "source": "composite", - "source-layer": "water_label", - "minzoom": 5, - "filter": [ ">", "area", 10000 ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 13, 13 ], [ 18, 18 ] ] } - }, - "paint": { "text-color": "hsl(230, 48%, 44%)" } - }, - { - "id": "place-residential", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 18, - "filter": [ - "all", - [ "in", "$type", "LineString", "Point", "Polygon" ], - [ "all", [ "<=", "localrank", 10 ], [ "==", "type", "residential" ] ] - ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933322393.2852" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "<=", "scalerank", 1 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "icon-image": { "stops": [ [ 13, "{maki}-11" ], [ 14, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933322393.2852" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "<=", "scalerank", 1 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "icon-image": { "stops": [ [ 13, "{maki}-11" ], [ 14, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "airport-label", - "type": "symbol", - "source": "composite", - "source-layer": "airport_label", - "minzoom": 9, - "filter": [ "<=", "scalerank", 2 ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 12 ], [ 18, 18 ] ] }, - "icon-image": { "stops": [ [ 12, "{maki}-11" ], [ 13, "{maki}-15" ] ] }, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.75 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": { "stops": [ [ 11, "{ref}" ], [ 12, "{name_en}" ] ] }, - "text-letter-spacing": 0.01, - "text-max-width": 9 - }, - "paint": { - "text-color": "hsl(230, 48%, 44%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "place-islet-archipelago-aboriginal", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 16, - "filter": [ "in", "type", "aboriginal_lands", "archipelago", "islet" ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 16 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(230, 29%, 35%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "place-neighbourhood", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "neighbourhood" ], - "layout": { - "text-field": "{name_en}", - "text-transform": "uppercase", - "text-letter-spacing": 0.1, - "text-max-width": 7, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 3, - "text-size": { "base": 1, "stops": [ [ 12, 11 ], [ 16, 16 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-color": "hsl(230, 29%, 35%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "place-suburb", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "suburb" ], - "layout": { - "text-field": "{name_en}", - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-letter-spacing": 0.15, - "text-max-width": 7, - "text-padding": 3, - "text-size": { "base": 1, "stops": [ [ 11, 11 ], [ 15, 18 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-color": "hsl(230, 29%, 35%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "place-hamlet", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "hamlet" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 12, 11.5 ], [ 15, 16 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-color": "hsl(0, 0%, 0%)" - } - }, - { - "id": "place-village", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 8, - "maxzoom": 15, - "filter": [ "==", "type", "village" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 10, 11.5 ], [ 16, 18 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-color": "hsl(0, 0%, 0%)" - } - }, - { - "id": "place-town", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 6, - "maxzoom": 15, - "filter": [ "==", "type", "town" ], - "layout": { - "icon-image": "dot-9", - "text-font": { - "base": 1, - "stops": [ - [ 11, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 12, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7, [ 0, -0.15 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 7, 11.5 ], [ 15, 20 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-island", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 16, - "filter": [ "==", "type", "island" ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 16 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(230, 29%, 35%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "place-city-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ "all", [ "!in", "scalerank", 0, 1, 2, 3, 4, 5 ], [ "==", "type", "city" ] ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 6, 12 ], [ 14, 22 ] ] }, - "icon-image": "dot-9", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.2 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-city-md-s", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "E", "S", "SE", "SW" ], - [ "in", "scalerank", 3, 4, 5 ], - [ "==", "type", "city" ] - ], - "layout": { - "text-field": "{name_en}", - "icon-image": "dot-10", - "text-anchor": { "base": 1, "stops": [ [ 7, "top" ], [ 8, "center" ] ] }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, 0.1 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-size": { "base": 0.9, "stops": [ [ 5, 12 ], [ 12, 22 ] ] } - }, - "paint": { - "text-halo-width": 1, - "text-halo-color": "hsl(0, 0%, 100%)", - "text-color": "hsl(0, 0%, 0%)", - "text-halo-blur": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-city-md-n", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "N", "NE", "NW", "W" ], - [ "in", "scalerank", 3, 4, 5 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-10", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.25 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 5, 12 ], [ 12, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "place-city-lg-s", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "minzoom": 1, - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "E", "S", "SE", "SW" ], - [ "<=", "scalerank", 2 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-11", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, 0.15 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "top" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 4, 12 ], [ 10, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "place-city-lg-n", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "minzoom": 1, - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "N", "NE", "NW", "W" ], - [ "<=", "scalerank", 2 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-11", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.25 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 4, 12 ], [ 10, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-opacity": 1, - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "marine-label-sm-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 3, - "maxzoom": 10, - "filter": [ "all", [ "==", "$type", "LineString" ], [ ">=", "labelrank", 4 ] ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 3, 12 ], [ 6, 16 ] ] }, - "symbol-spacing": { "base": 1, "stops": [ [ 4, 100 ], [ 6, 400 ] ] }, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-field": "{name_en}", - "text-letter-spacing": 0.1, - "text-max-width": 5 - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-sm-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 3, - "maxzoom": 10, - "filter": [ "all", [ "==", "$type", "Point" ], [ ">=", "labelrank", 4 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 5, - "text-letter-spacing": 0.1, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 3, 12 ], [ 6, 16 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-md-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 2, - "maxzoom": 8, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "in", "labelrank", 2, 3 ] ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1.1, "stops": [ [ 2, 12 ], [ 5, 20 ] ] }, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-field": "{name_en}", - "text-letter-spacing": 0.15, - "text-max-width": 5 - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-md-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 2, - "maxzoom": 8, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "labelrank", 2, 3 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 5, - "text-letter-spacing": 0.15, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1.1, "stops": [ [ 2, 14 ], [ 5, 20 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-lg-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 1, - "maxzoom": 4, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "labelrank", 1 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 4, - "text-letter-spacing": 0.25, - "text-line-height": 1.1, - "symbol-placement": "line", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 14 ], [ 4, 30 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-lg-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 1, - "maxzoom": 4, - "filter": [ "all", [ "==", "$type", "Point" ], [ "==", "labelrank", 1 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 4, - "text-letter-spacing": 0.25, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 14 ], [ 4, 30 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "state-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 9, - "filter": [ "<", "area", 20000 ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 6, 10 ], [ 9, 14 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 6, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 5 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "state-label-md", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 8, - "filter": [ "all", [ "<", "area", 80000 ], [ ">=", "area", 20000 ] ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 5, 10 ], [ 8, 16 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 5, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 6 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "state-label-lg", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 7, - "filter": [ ">=", "area", 80000 ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 4, 10 ], [ 7, 18 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-padding": 1, - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 4, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 6 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "country-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 10, - "filter": [ ">=", "scalerank", 5 ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 6, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 0.9, "stops": [ [ 5, 14 ], [ 9, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - }, - { - "id": "country-label-md", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 8, - "filter": [ "in", "scalerank", 3, 4 ], - "layout": { - "text-field": { "base": 1, "stops": [ [ 0, "{code}" ], [ 2, "{name_en}" ] ] }, - "text-max-width": 6, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 3, 10 ], [ 8, 24 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - }, - { - "id": "country-label-lg", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 7, - "filter": [ "in", "scalerank", 1, 2 ], - "layout": { - "text-field": "{name_en}", - "text-max-width": { "base": 1, "stops": [ [ 0, 5 ], [ 3, 6 ] ] }, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 10 ], [ 6, 24 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - } - ] -} \ No newline at end of file diff --git a/benchmark/fixtures/api/style_formatted_labels.json b/benchmark/fixtures/api/style_formatted_labels.json deleted file mode 100644 index c62777038..000000000 --- a/benchmark/fixtures/api/style_formatted_labels.json +++ /dev/null @@ -1,3993 +0,0 @@ -{ - "version": 8, - "name": "Mapbox Streets", - "metadata": { - "mapbox:autocomposite": true, - "mapbox:type": "default", - "mapbox:groups": { - "1444934828655.3389": { "name": "Aeroways", "collapsed": true }, - "1444933322393.2852": { "name": "POI labels (scalerank 1)", "collapsed": true }, - "1444855786460.0557": { "name": "Roads", "collapsed": true }, - "1444933575858.6992": { "name": "Highway shields", "collapsed": true }, - "1444934295202.7542": { "name": "Admin boundaries", "collapsed": true }, - "1444856151690.9143": { "name": "State labels", "collapsed": true }, - "1444933721429.3076": { "name": "Road labels", "collapsed": true }, - "1444933358918.2366": { "name": "POI labels (scalerank 2)", "collapsed": true }, - "1444933808272.805": { "name": "Water labels", "collapsed": true }, - "1444933372896.5967": { "name": "POI labels (scalerank 3)", "collapsed": true }, - "1444855799204.86": { "name": "Bridges", "collapsed": true }, - "1444856087950.3635": { "name": "Marine labels", "collapsed": true }, - "1456969573402.7817": { "name": "Hillshading", "collapsed": true }, - "1444862510685.128": { "name": "City labels", "collapsed": true }, - "1444855769305.6016": { "name": "Tunnels", "collapsed": true }, - "1456970288113.8113": { "name": "Landcover", "collapsed": true }, - "1444856144497.7825": { "name": "Country labels", "collapsed": true }, - "1444933456003.5437": { "name": "POI labels (scalerank 4)", "collapsed": true } - } - }, - "sources": { - "composite": { "url": "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7", "type": "vector" } - }, - "sprite": "mapbox://sprites/mapbox/streets-v10", - "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", - "visibility": "public", - "layers": [ - { - "id": "background", - "type": "background", - "layout": {}, - "paint": { - "background-color": { "base": 1, "stops": [ [ 11, "hsl(35, 32%, 91%)" ], [ 13, "hsl(35, 12%, 89%)" ] ] } - } - }, - { - "id": "landcover_snow", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "filter": [ "==", "class", "snow" ], - "layout": {}, - "paint": { "fill-color": "hsl(0, 0%, 100%)", "fill-opacity": 0.2, "fill-antialias": false } - }, - { - "id": "landcover_wood", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "wood" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_scrub", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "scrub" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_grass", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "grass" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "landcover_crop", - "type": "fill", - "metadata": { "mapbox:group": "1456970288113.8113" }, - "source": "composite", - "source-layer": "landcover", - "maxzoom": 14, - "filter": [ "==", "class", "crop" ], - "layout": {}, - "paint": { - "fill-color": "hsl(75, 62%, 81%)", - "fill-opacity": { "base": 1.5, "stops": [ [ 2, 0.3 ], [ 7, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "national_park", - "type": "fill", - "source": "composite", - "source-layer": "landuse_overlay", - "filter": [ "==", "class", "national_park" ], - "layout": {}, - "paint": { - "fill-color": "hsl(100, 58%, 76%)", - "fill-opacity": { "base": 1, "stops": [ [ 5, 0 ], [ 6, 0.5 ] ] } - } - }, - { - "id": "hospital", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "hospital" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(340, 37%, 87%)" ], [ 16, "hsl(340, 63%, 89%)" ] ] } - } - }, - { - "id": "school", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "school" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(50, 47%, 81%)" ], [ 16, "hsl(50, 63%, 84%)" ] ] } - } - }, - { - "id": "park", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "park" ], - "layout": {}, - "paint": { - "fill-color": "hsl(100, 58%, 76%)", - "fill-opacity": { "base": 1, "stops": [ [ 5, 0 ], [ 6, 1 ] ] } - } - }, - { - "id": "pitch", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "pitch" ], - "layout": {}, - "paint": { "fill-color": "hsl(100, 57%, 72%)" } - }, - { - "id": "pitch-line", - "type": "line", - "source": "composite", - "source-layer": "landuse", - "minzoom": 15, - "filter": [ "==", "class", "pitch" ], - "layout": { "line-join": "miter" }, - "paint": { "line-color": "hsl(75, 57%, 84%)" } - }, - { - "id": "cemetery", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "cemetery" ], - "layout": {}, - "paint": { "fill-color": "hsl(75, 37%, 81%)" } - }, - { - "id": "industrial", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "industrial" ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15.5, "hsl(230, 15%, 86%)" ], [ 16, "hsl(230, 29%, 89%)" ] ] } - } - }, - { - "id": "sand", - "type": "fill", - "source": "composite", - "source-layer": "landuse", - "filter": [ "==", "class", "sand" ], - "layout": {}, - "paint": { "fill-color": "hsl(60, 46%, 87%)" } - }, - { - "id": "hillshade_highlight_bright", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 94 ], - "layout": {}, - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-opacity": { "stops": [ [ 14, 0.12 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_highlight_med", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 90 ], - "layout": {}, - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-opacity": { "stops": [ [ 14, 0.12 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_faint", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 89 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.05 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_med", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 78 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.05 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_dark", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 67 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.06 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "hillshade_shadow_extreme", - "type": "fill", - "metadata": { "mapbox:group": "1456969573402.7817" }, - "source": "composite", - "source-layer": "hillshade", - "maxzoom": 16, - "filter": [ "==", "level", 56 ], - "layout": {}, - "paint": { - "fill-color": "hsl(56, 59%, 22%)", - "fill-opacity": { "stops": [ [ 14, 0.06 ], [ 16, 0 ] ] }, - "fill-antialias": false - } - }, - { - "id": "waterway-river-canal", - "type": "line", - "source": "composite", - "source-layer": "waterway", - "minzoom": 8, - "filter": [ "in", "class", "canal", "river" ], - "layout": { - "line-cap": { "base": 1, "stops": [ [ 0, "butt" ], [ 11, "round" ] ] }, - "line-join": "round" - }, - "paint": { - "line-color": "hsl(205, 87%, 76%)", - "line-width": { "base": 1.3, "stops": [ [ 8.5, 0.1 ], [ 20, 8 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 8, 0 ], [ 8.5, 1 ] ] } - } - }, - { - "id": "waterway-small", - "type": "line", - "source": "composite", - "source-layer": "waterway", - "minzoom": 13, - "filter": [ "!in", "class", "canal", "river" ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-color": "hsl(205, 87%, 76%)", - "line-width": { "base": 1.35, "stops": [ [ 13.5, 0.1 ], [ 20, 3 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13, 0 ], [ 13.5, 1 ] ] } - } - }, - { - "id": "water-shadow", - "type": "fill", - "source": "composite", - "source-layer": "water", - "layout": {}, - "paint": { - "fill-color": "hsl(215, 84%, 69%)", - "fill-translate": { "base": 1.2, "stops": [ [ 7, [ 0, 0 ] ], [ 16, [ -1, -1 ] ] ] }, - "fill-translate-anchor": "viewport", - "fill-opacity": 1 - } - }, - { "id": "water", "ref": "water-shadow", "paint": { "fill-color": "hsl(196, 80%, 70%)" } }, - { - "id": "barrier_line-land-polygon", - "type": "fill", - "source": "composite", - "source-layer": "barrier_line", - "filter": [ "all", [ "==", "$type", "Polygon" ], [ "==", "class", "land" ] ], - "layout": {}, - "paint": { "fill-color": "hsl(35, 12%, 89%)" } - }, - { - "id": "barrier_line-land-line", - "type": "line", - "source": "composite", - "source-layer": "barrier_line", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "class", "land" ] ], - "layout": { "line-cap": "round" }, - "paint": { - "line-width": { "base": 1.99, "stops": [ [ 14, 0.75 ], [ 20, 40 ] ] }, - "line-color": "hsl(35, 12%, 89%)" - } - }, - { - "id": "aeroway-polygon", - "type": "fill", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 11, - "filter": [ "all", [ "==", "$type", "Polygon" ], [ "!=", "type", "apron" ] ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "fill-opacity": { "base": 1, "stops": [ [ 11, 0 ], [ 11.5, 1 ] ] } - } - }, - { - "id": "aeroway-runway", - "type": "line", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 9, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "runway" ] ], - "layout": {}, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 9, 1 ], [ 18, 80 ] ] } - } - }, - { - "id": "aeroway-taxiway", - "type": "line", - "metadata": { "mapbox:group": "1444934828655.3389" }, - "source": "composite", - "source-layer": "aeroway", - "minzoom": 9, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "taxiway" ] ], - "layout": {}, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(230, 23%, 82%)" ], [ 16, "hsl(230, 37%, 84%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 10, 0.5 ], [ 18, 20 ] ] } - } - }, - { - "id": "building-line", - "type": "line", - "source": "composite", - "source-layer": "building", - "minzoom": 15, - "filter": [ "all", [ "!=", "type", "building:part" ], [ "==", "underground", "false" ] ], - "layout": {}, - "paint": { - "line-color": "hsl(35, 6%, 79%)", - "line-width": { "base": 1.5, "stops": [ [ 15, 0.75 ], [ 20, 3 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 15.5, 0 ], [ 16, 1 ] ] } - } - }, - { - "id": "building", - "type": "fill", - "source": "composite", - "source-layer": "building", - "minzoom": 15, - "filter": [ "all", [ "!=", "type", "building:part" ], [ "==", "underground", "false" ] ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 15, "hsl(35, 11%, 88%)" ], [ 16, "hsl(35, 8%, 85%)" ] ] }, - "fill-opacity": { "base": 1, "stops": [ [ 15.5, 0 ], [ 16, 1 ] ] }, - "fill-outline-color": "hsl(35, 6%, 79%)" - } - }, - { - "id": "tunnel-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "tunnel-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "tunnel-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-street_limited-case", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-street-case", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 19%, 75%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "secondary", "tertiary" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(230, 19%, 75%)" - } - }, - { - "id": "tunnel-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-dasharray": [ 3, 3 ], - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(230, 19%, 75%)" - } - }, - { - "id": "tunnel-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "trunk_link" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway_link" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "trunk" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": 1, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": 1, - "line-dasharray": [ 3, 3 ] - } - }, - { - "id": "tunnel-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "tunnel-path", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-color": "hsl(35, 26%, 95%)", - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "tunnel-steps", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "tunnel" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(35, 26%, 95%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "tunnel-trunk_link", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-trunk_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 77%, 78%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-motorway_link", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-motorway_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 78%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-pedestrian", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "tunnel-service-link-track", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-service-link-track-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": [ 1, 0 ] - } - }, - { - "id": "tunnel-street_limited", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-street", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "tunnel-secondary-tertiary", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-secondary-tertiary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ], - "line-blur": 0 - } - }, - { - "id": "tunnel-primary", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-primary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": [ 1, 0 ], - "line-blur": 0 - } - }, - { - "id": "tunnel-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "tunnel-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "tunnel-trunk", - "type": "line", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "trunk" ], [ "==", "structure", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 77%, 78%)" - } - }, - { - "id": "tunnel-motorway", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "ref": "tunnel-motorway-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-opacity": 1, - "line-color": "hsl(26, 100%, 78%)", - "line-blur": 0 - } - }, - { - "id": "tunnel-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855769305.6016" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "tunnel" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "ferry", - "type": "line", - "source": "composite", - "source-layer": "road", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "ferry" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(205, 73%, 63%)" ], [ 17, "hsl(230, 73%, 63%)" ] ] }, - "line-opacity": 1, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] }, - "line-dasharray": { "base": 1, "stops": [ [ 12, [ 1, 0 ] ], [ 13, [ 12, 4 ] ] ] } - } - }, - { - "id": "ferry_auto", - "type": "line", - "source": "composite", - "source-layer": "road", - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "type", "ferry_auto" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 15, "hsl(205, 73%, 63%)" ], [ 17, "hsl(230, 73%, 63%)" ] ] }, - "line-opacity": 1, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "road-path-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!in", "type", "crossing", "sidewalk", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "road-steps-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "!in", "structure", "bridge", "tunnel" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 17, 4.6 ], [ 18, 7 ] ] }, - "line-color": "hsl(230, 17%, 82%)", - "line-dasharray": [ 1, 0 ], - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "road-sidewalk-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "structure", "bridge", "tunnel" ], - [ "in", "type", "crossing", "sidewalk" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 0.75 ] ] } - } - }, - { - "id": "turning-features-outline", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "class", "turning_circle", "turning_loop" ] ], - "layout": { - "icon-image": "turning-circle-outline", - "icon-size": { "base": 1.5, "stops": [ [ 14, 0.122 ], [ 18, 0.969 ], [ 20, 1 ] ] }, - "icon-allow-overlap": true, - "icon-ignore-placement": true, - "icon-padding": 0, - "icon-rotation-alignment": "map" - }, - "paint": {} - }, - { - "id": "road-pedestrian-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 2 ], [ 18, 14.5 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": 0, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11, 0 ], [ 11.25, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "road-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11, 0 ], [ 11.25, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "road-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] } - } - }, - { - "id": "road-street_limited-case", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street-case", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "secondary", "tertiary" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 9.99, 0 ], [ 10, 1 ] ] } - } - }, - { - "id": "road-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 9.99, 0 ], [ 10, 1 ] ] } - } - }, - { - "id": "road-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 10, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway_link" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "road-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "!in", "structure", "bridge", "tunnel" ], [ "==", "type", "trunk_link" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "road-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "trunk" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 6, 0 ], [ 6.1, 1 ] ] } - } - }, - { - "id": "road-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "motorway" ], [ "!in", "structure", "bridge", "tunnel" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "road-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "none" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "road-sidewalks", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-sidewalk-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 1 ] ] } - } - }, - { - "id": "road-path", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-path-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "road-steps", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-steps-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "road-trunk_link", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-trunk_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)", - "line-opacity": 1 - } - }, - { - "id": "road-motorway_link", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-motorway_link-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)", - "line-opacity": 1 - } - }, - { - "id": "road-pedestrian", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-pedestrian-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "road-pedestrian-polygon-fill", - "type": "fill", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "Polygon" ], - [ "all", [ "in", "class", "path", "pedestrian" ], [ "==", "structure", "none" ] ] - ], - "layout": {}, - "paint": { - "fill-color": { "base": 1, "stops": [ [ 16, "hsl(230, 16%, 94%)" ], [ 16.25, "hsl(230, 50%, 98%)" ] ] }, - "fill-outline-color": "hsl(230, 26%, 88%)", - "fill-opacity": 1 - } - }, - { - "id": "road-pedestrian-polygon-pattern", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-pedestrian-polygon-fill", - "paint": { - "fill-color": "hsl(0, 0%, 100%)", - "fill-outline-color": "hsl(35, 10%, 83%)", - "fill-pattern": "pedestrian-polygon", - "fill-opacity": { "base": 1, "stops": [ [ 16, 0 ], [ 16.25, 1 ] ] } - } - }, - { - "id": "road-polygon", - "type": "fill", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 12, - "filter": [ - "all", - [ "==", "$type", "Polygon" ], - [ - "all", - [ "!in", "class", "motorway", "path", "pedestrian", "trunk" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": {}, - "paint": { "fill-color": "hsl(0, 0%, 100%)", "fill-outline-color": "#d6d9e6" } - }, - { - "id": "road-service-link-track", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-service-link-track-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)" - } - }, - { - "id": "road-street_limited", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-street", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "road-secondary-tertiary", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-secondary-tertiary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": { "base": 1, "stops": [ [ 5, "hsl(35, 32%, 91%)" ], [ 8, "hsl(0, 0%, 100%)" ] ] }, - "line-opacity": { "base": 1.2, "stops": [ [ 5, 0 ], [ 5.5, 1 ] ] } - } - }, - { - "id": "road-primary", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-primary-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { "base": 1, "stops": [ [ 5, "hsl(35, 32%, 91%)" ], [ 7, "hsl(0, 0%, 100%)" ] ] }, - "line-opacity": 1 - } - }, - { - "id": "road-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "icon-rotation-alignment": "map", - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "road-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "icon-rotation-alignment": "map", - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "road-trunk", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-trunk-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { - "base": 1, - "stops": [ [ 6, "hsl(0, 0%, 100%)" ], [ 6.1, "hsl(46, 80%, 60%)" ], [ 9, "hsl(46, 85%, 67%)" ] ] - } - } - }, - { - "id": "road-motorway", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-motorway-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": { "base": 1, "stops": [ [ 8, "hsl(26, 87%, 62%)" ], [ 9, "hsl(26, 100%, 68%)" ] ] } - } - }, - { - "id": "road-rail", - "type": "line", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "major_rail", "minor_rail" ], - [ "!in", "structure", "bridge", "tunnel" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "road-rail-tracks", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "ref": "road-rail", - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 4 ], [ 20, 8 ] ] }, - "line-dasharray": [ 0.1, 15 ], - "line-opacity": { "base": 1, "stops": [ [ 13.75, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "level-crossings", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ "all", [ "==", "$type", "Point" ], [ "==", "class", "level_crossing" ] ], - "layout": { "icon-size": 1, "icon-image": "level-crossing", "icon-allow-overlap": true }, - "paint": {} - }, - { - "id": "road-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "!in", "structure", "bridge", "tunnel" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "icon-padding": 2, - "symbol-spacing": 200 - }, - "paint": {} - }, - { - "id": "turning-features", - "type": "symbol", - "metadata": { "mapbox:group": "1444855786460.0557" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "class", "turning_circle", "turning_loop" ] ], - "layout": { - "icon-image": "turning-circle", - "icon-size": { "base": 1.5, "stops": [ [ 14, 0.095 ], [ 18, 1 ] ] }, - "icon-allow-overlap": true, - "icon-ignore-placement": true, - "icon-padding": 0, - "icon-rotation-alignment": "map" - }, - "paint": {} - }, - { - "id": "bridge-path-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 18, 7 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-color": "hsl(230, 17%, 82%)", - "line-blur": 0, - "line-opacity": { "base": 1, "stops": [ [ 15, 0 ], [ 15.25, 1 ] ] } - } - }, - { - "id": "bridge-steps-bg", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "==", "type", "steps" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 2 ], [ 17, 4.6 ], [ 18, 7 ] ] }, - "line-color": "hsl(230, 17%, 82%)", - "line-dasharray": [ 1, 0 ], - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 0.75 ] ] } - } - }, - { - "id": "bridge-pedestrian-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "pedestrian" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 2 ], [ 18, 14.5 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": 0, - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-street-low", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "bridge-street_limited-low", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "stops": [ [ 11.5, 0 ], [ 12, 1 ], [ 14, 1 ], [ 14.01, 0 ] ] } - } - }, - { - "id": "bridge-service-link-track-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] } - } - }, - { - "id": "bridge-street_limited-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street_limited" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] } - } - }, - { - "id": "bridge-street-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "street" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-gap-width": { "base": 1.5, "stops": [ [ 13, 0 ], [ 14, 2 ], [ 18, 18 ] ] } - } - }, - { - "id": "bridge-secondary-tertiary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "secondary", "tertiary" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.2, "stops": [ [ 10, 0.75 ], [ 18, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-translate": [ 0, 0 ] - } - }, - { - "id": "bridge-primary-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "primary" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-translate": [ 0, 0 ] - } - }, - { - "id": "bridge-trunk_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "bridge-motorway_link-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": 1 - } - }, - { - "id": "bridge-trunk-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-motorway-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-construction", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "class", "construction" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(230, 24%, 87%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "line-dasharray": { - "base": 1, - "stops": [ - [ 14, [ 0.4, 0.8 ] ], - [ 15, [ 0.3, 0.6 ] ], - [ 16, [ 0.2, 0.3 ] ], - [ 17, [ 0.2, 0.25 ] ], - [ 18, [ 0.15, 0.15 ] ] - ] - } - } - }, - { - "id": "bridge-path", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "path" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "steps" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 18, 4 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 1, 0.5 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "bridge-steps", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-steps-bg", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 15, 1 ], [ 16, 1.6 ], [ 18, 6 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-dasharray": { - "base": 1, - "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.75, 1 ] ], [ 16, [ 1, 0.75 ] ], [ 17, [ 0.3, 0.3 ] ] ] - }, - "line-opacity": { "base": 1, "stops": [ [ 14, 0 ], [ 14.25, 1 ] ] } - } - }, - { - "id": "bridge-trunk_link", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway_link", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-pedestrian", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-pedestrian-case", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1, - "line-dasharray": { "base": 1, "stops": [ [ 14, [ 1, 0 ] ], [ 15, [ 1.5, 0.4 ] ], [ 16, [ 1, 0.2 ] ] ] } - } - }, - { - "id": "bridge-service-link-track", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 14, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "service", "track" ], - [ "==", "structure", "bridge" ], - [ "!=", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 18, 12 ] ] }, - "line-color": "hsl(0, 0%, 100%)" - } - }, - { - "id": "bridge-street_limited", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-street_limited-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(35, 14%, 93%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-street", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-street-low", - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12.5, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] } - } - }, - { - "id": "bridge-secondary-tertiary", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "in", "type", "secondary", "tertiary" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 8.5, 0.5 ], [ 10, 0.75 ], [ 18, 26 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": { "base": 1.2, "stops": [ [ 5, 0 ], [ 5.5, 1 ] ] } - } - }, - { - "id": "bridge-primary", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "==", "structure", "bridge" ], [ "==", "type", "primary" ] ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-opacity": 1 - } - }, - { - "id": "bridge-oneway-arrows-blue-minor", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "path", "pedestrian", "service", "track" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 17, "oneway-small" ], [ 18, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-rotation-alignment": "map", - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "bridge-oneway-arrows-blue-major", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "primary", "secondary", "street", "street_limited", "tertiary" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-small" ], [ 17, "oneway-large" ] ] }, - "symbol-spacing": 200, - "icon-rotation-alignment": "map", - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "bridge-trunk", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ "!in", "layer", 2, 3, 4, 5 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-rail", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "all", [ "in", "class", "major_rail", "minor_rail" ], [ "==", "structure", "bridge" ] ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "bridge-rail-tracks", - "metadata": { "mapbox:group": "1444855799204.86" }, - "ref": "bridge-rail", - "paint": { - "line-color": { "stops": [ [ 13, "hsl(50, 17%, 82%)" ], [ 16, "hsl(230, 10%, 74%)" ] ] }, - "line-width": { "base": 1.5, "stops": [ [ 14, 4 ], [ 20, 8 ] ] }, - "line-dasharray": [ 0.1, 15 ], - "line-opacity": { "base": 1, "stops": [ [ 13.75, 0 ], [ 20, 1 ] ] } - } - }, - { - "id": "bridge-trunk_link-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 10.99, 0 ], [ 11, 1 ] ] } - } - }, - { - "id": "bridge-motorway_link-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.75 ], [ 20, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-opacity": 1 - } - }, - { - "id": "bridge-trunk-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-motorway-2-case", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 10, 1 ], [ 16, 2 ] ] }, - "line-color": "hsl(0, 0%, 100%)", - "line-gap-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] } - } - }, - { - "id": "bridge-trunk_link-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ], - [ "==", "type", "trunk_link" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway_link-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway_link" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 12, 0.5 ], [ 14, 2 ], [ 18, 18 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-trunk-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "trunk" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(46, 85%, 67%)" - } - }, - { - "id": "bridge-motorway-2", - "type": "line", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "==", "class", "motorway" ], - [ ">=", "layer", 2 ], - [ "==", "structure", "bridge" ] - ] - ], - "layout": { "line-cap": "round", "line-join": "round" }, - "paint": { - "line-width": { "base": 1.5, "stops": [ [ 5, 0.75 ], [ 18, 32 ] ] }, - "line-color": "hsl(26, 100%, 68%)" - } - }, - { - "id": "bridge-oneway-arrows-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444855799204.86" }, - "source": "composite", - "source-layer": "road", - "minzoom": 16, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "all", - [ "in", "class", "link", "motorway", "motorway_link", "trunk" ], - [ "==", "oneway", "true" ], - [ "==", "structure", "bridge" ], - [ "!in", "type", "primary_link", "secondary_link", "tertiary_link" ] - ] - ], - "layout": { - "symbol-placement": "line", - "icon-image": { "base": 1, "stops": [ [ 16, "oneway-white-small" ], [ 17, "oneway-white-large" ] ] }, - "symbol-spacing": 200, - "icon-padding": 2 - }, - "paint": {} - }, - { - "id": "aerialway", - "type": "line", - "source": "composite", - "source-layer": "road", - "minzoom": 13, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "class", "aerialway" ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-color": "hsl(230, 10%, 74%)", - "line-width": { "base": 1.5, "stops": [ [ 14, 0.5 ], [ 20, 1 ] ] } - } - }, - { - "id": "admin-3-4-boundaries-bg", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "filter": [ "all", [ ">=", "admin_level", 3 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "bevel" }, - "paint": { - "line-color": { "base": 1, "stops": [ [ 8, "hsl(35, 12%, 89%)" ], [ 16, "hsl(230, 49%, 90%)" ] ] }, - "line-width": { "base": 1, "stops": [ [ 7, 3.75 ], [ 12, 5.5 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 7, 0 ], [ 8, 0.75 ] ] }, - "line-dasharray": [ 1, 0 ], - "line-translate": [ 0, 0 ], - "line-blur": { "base": 1, "stops": [ [ 3, 0 ], [ 8, 3 ] ] } - } - }, - { - "id": "admin-2-boundaries-bg", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "miter" }, - "paint": { - "line-width": { "base": 1, "stops": [ [ 3, 3.5 ], [ 10, 8 ] ] }, - "line-color": { "base": 1, "stops": [ [ 6, "hsl(35, 12%, 89%)" ], [ 8, "hsl(230, 49%, 90%)" ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 3, 0 ], [ 4, 0.5 ] ] }, - "line-translate": [ 0, 0 ], - "line-blur": { "base": 1, "stops": [ [ 3, 0 ], [ 10, 2 ] ] } - } - }, - { - "id": "admin-3-4-boundaries", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "filter": [ "all", [ ">=", "admin_level", 3 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-dasharray": { "base": 1, "stops": [ [ 6, [ 2, 0 ] ], [ 7, [ 2, 2, 6, 2 ] ] ] }, - "line-width": { "base": 1, "stops": [ [ 7, 0.75 ], [ 12, 1.5 ] ] }, - "line-opacity": { "base": 1, "stops": [ [ 2, 0 ], [ 3, 1 ] ] }, - "line-color": { "base": 1, "stops": [ [ 3, "hsl(230, 14%, 77%)" ], [ 7, "hsl(230, 8%, 62%)" ] ] } - } - }, - { - "id": "admin-2-boundaries", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "disputed", 0 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round", "line-cap": "round" }, - "paint": { - "line-color": "hsl(230, 8%, 51%)", - "line-width": { "base": 1, "stops": [ [ 3, 0.5 ], [ 10, 2 ] ] } - } - }, - { - "id": "admin-2-boundaries-dispute", - "type": "line", - "metadata": { "mapbox:group": "1444934295202.7542" }, - "source": "composite", - "source-layer": "admin", - "minzoom": 1, - "filter": [ "all", [ "==", "admin_level", 2 ], [ "==", "disputed", 1 ], [ "==", "maritime", 0 ] ], - "layout": { "line-join": "round" }, - "paint": { - "line-dasharray": [ 1.5, 1.5 ], - "line-color": "hsl(230, 8%, 51%)", - "line-width": { "base": 1, "stops": [ [ 3, 0.5 ], [ 10, 2 ] ] } - } - }, - { - "id": "housenum-label", - "type": "symbol", - "source": "composite", - "source-layer": "housenum_label", - "minzoom": 17, - "layout": { - "text-field": "{house_num}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-padding": 4, - "text-max-width": 7, - "text-size": 9.5 - }, - "paint": { - "text-color": "hsl(35, 2%, 69%)", - "text-halo-color": "hsl(35, 8%, 85%)", - "text-halo-width": 0.5, - "text-halo-blur": 0 - } - }, - { - "id": "waterway-label", - "type": "symbol", - "source": "composite", - "source-layer": "waterway_label", - "minzoom": 12, - "filter": [ "in", "class", "canal", "river" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-max-angle": 30, - "text-size": { "base": 1, "stops": [ [ 13, 12 ], [ 18, 16 ] ] } - }, - "paint": { - "text-halo-width": 0.5, - "text-halo-color": "hsl(196, 80%, 70%)", - "text-color": "hsl(230, 48%, 44%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank4-l15", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 17, - "filter": [ - "all", - [ ">=", "localrank", 15 ], - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank4-l1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 15, - "filter": [ - "all", - [ "<=", "localrank", 14 ], - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks_scalerank4", - "type": "symbol", - "metadata": { "mapbox:group": "1444933456003.5437" }, - "source": "composite", - "source-layer": "poi_label", - "minzoom": 15, - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 4 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank3", - "type": "symbol", - "metadata": { "mapbox:group": "1444933372896.5967" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 3 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 1, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank3", - "type": "symbol", - "metadata": { "mapbox:group": "1444933372896.5967" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 3 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{maki}-11", - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "road-label-small", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "minzoom": 15, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ - "!in", - "class", - "link", - "motorway", - "pedestrian", - "primary", - "secondary", - "street", - "street_limited", - "tertiary", - "trunk" - ] - ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 15, 10 ], [ 20, 13 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": "{name_en}", - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-halo-blur": 1 - } - }, - { - "id": "road-label-medium", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "minzoom": 11, - "filter": [ - "all", - [ "==", "$type", "LineString" ], - [ "in", "class", "link", "pedestrian", "street", "street_limited" ] - ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 11, 10 ], [ 20, 14 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": ["format", ["get", "name_en"], {"text-color": "green"}], - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "road-label-large", - "type": "symbol", - "metadata": { "mapbox:group": "1444933721429.3076" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ "in", "class", "motorway", "primary", "secondary", "tertiary", "trunk" ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 9, 10 ], [ 20, 16 ] ] }, - "text-max-angle": 30, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-padding": 1, - "text-rotation-alignment": "map", - "text-field": "{name_en}", - "text-letter-spacing": 0.01 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsla(0, 0%, 100%, 0.75)", - "text-halo-width": 1, - "text-halo-blur": 1 - } - }, - { - "id": "road-shields-black", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ - "all", - [ "<=", "reflen", 6 ], - [ - "!in", - "shield", - "at-expressway", - "at-motorway", - "at-state-b", - "bg-motorway", - "bg-national", - "ch-main", - "ch-motorway", - "cz-motorway", - "cz-road", - "de-motorway", - "e-road", - "fi-main", - "gr-motorway", - "gr-national", - "hr-motorway", - "hr-state", - "hu-main", - "hu-motorway", - "nz-state", - "pl-expressway", - "pl-motorway", - "pl-national", - "ro-county", - "ro-motorway", - "ro-national", - "rs-motorway", - "rs-state-1b", - "se-main", - "si-expressway", - "si-motorway", - "sk-highway", - "sk-road", - "us-interstate", - "us-interstate-business", - "us-interstate-duplex", - "us-interstate-truck", - "za-metropolitan", - "za-national", - "za-provincial", - "za-regional" - ] - ], - "layout": { - "text-size": 9, - "icon-image": "{shield}-{reflen}", - "icon-rotation-alignment": "viewport", - "text-max-angle": 38, - "symbol-spacing": { "base": 1, "stops": [ [ 11, 150 ], [ 14, 200 ] ] }, - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "symbol-placement": { "base": 1, "stops": [ [ 10, "point" ], [ 11, "line" ] ] }, - "text-padding": 2, - "text-rotation-alignment": "viewport", - "text-field": "{ref}", - "text-letter-spacing": 0.05, - "icon-padding": 2 - }, - "paint": { - "text-color": "hsl(0, 0%, 7%)", - "icon-halo-color": "rgba(0, 0, 0, 1)", - "icon-halo-width": 1, - "text-opacity": 1, - "icon-color": "white", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0 - } - }, - { - "id": "road-shields-white", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "road_label", - "filter": [ - "all", - [ "<=", "reflen", 6 ], - [ - "in", - "shield", - "at-expressway", - "at-motorway", - "at-state-b", - "bg-motorway", - "bg-national", - "ch-main", - "ch-motorway", - "cz-motorway", - "cz-road", - "de-motorway", - "e-road", - "fi-main", - "gr-motorway", - "gr-national", - "hr-motorway", - "hr-state", - "hu-main", - "hu-motorway", - "nz-state", - "pl-expressway", - "pl-motorway", - "pl-national", - "ro-county", - "ro-motorway", - "ro-national", - "rs-motorway", - "rs-state-1b", - "se-main", - "si-expressway", - "si-motorway", - "sk-highway", - "sk-road", - "us-interstate", - "us-interstate-business", - "us-interstate-duplex", - "us-interstate-truck", - "za-metropolitan", - "za-national", - "za-provincial", - "za-regional" - ] - ], - "layout": { - "text-size": 9, - "icon-image": "{shield}-{reflen}", - "icon-rotation-alignment": "viewport", - "text-max-angle": 38, - "symbol-spacing": { "base": 1, "stops": [ [ 11, 150 ], [ 14, 200 ] ] }, - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "symbol-placement": { "base": 1, "stops": [ [ 10, "point" ], [ 11, "line" ] ] }, - "text-padding": 2, - "text-rotation-alignment": "viewport", - "text-field": "{ref}", - "text-letter-spacing": 0.05, - "icon-padding": 2 - }, - "paint": { - "text-color": "hsl(0, 0%, 100%)", - "icon-halo-color": "rgba(0, 0, 0, 1)", - "icon-halo-width": 1, - "text-opacity": 1, - "icon-color": "white", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0 - } - }, - { - "id": "motorway-junction", - "type": "symbol", - "metadata": { "mapbox:group": "1444933575858.6992" }, - "source": "composite", - "source-layer": "motorway_junction", - "minzoom": 14, - "filter": [ "all", [ ">", "reflen", 0 ], [ "<=", "reflen", 9 ] ], - "layout": { - "text-field": "{ref}", - "text-size": 9, - "icon-image": "motorway-exit-{reflen}", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ] - }, - "paint": { "text-color": "hsl(0, 0%, 100%)", "text-translate": [ 0, 0 ] } - }, - { - "id": "poi-scalerank2", - "type": "symbol", - "metadata": { "mapbox:group": "1444933358918.2366" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 2 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 14, 11 ], [ 20, 14 ] ] }, - "icon-image": { "stops": [ [ 14, "{maki}-11" ], [ 15, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank2", - "type": "symbol", - "metadata": { "mapbox:group": "1444933358918.2366" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "==", "scalerank", 2 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 14, 11 ], [ 20, 14 ] ] }, - "icon-image": { "stops": [ [ 14, "{maki}-11" ], [ 15, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "rail-label", - "type": "symbol", - "source": "composite", - "source-layer": "rail_station_label", - "minzoom": 12, - "filter": [ "!=", "maki", "entrance" ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 16, 11 ], [ 20, 13 ] ] }, - "icon-image": "{network}", - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-offset": [ 0, 0.85 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": { "base": 1, "stops": [ [ 0, "" ], [ 13, "{name_en}" ] ] }, - "text-letter-spacing": 0.01, - "icon-padding": 0, - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(230, 48%, 44%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "icon-halo-width": 4, - "icon-halo-color": "#fff", - "text-opacity": { "base": 1, "stops": [ [ 13.99, 0 ], [ 14, 1 ] ] }, - "text-halo-blur": 0.5 - } - }, - { - "id": "water-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444933808272.805" }, - "source": "composite", - "source-layer": "water_label", - "minzoom": 15, - "filter": [ "<=", "area", 10000 ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 16, 13 ], [ 20, 16 ] ] } - }, - "paint": { "text-color": "hsl(230, 48%, 44%)" } - }, - { - "id": "water-label", - "type": "symbol", - "metadata": { "mapbox:group": "1444933808272.805" }, - "source": "composite", - "source-layer": "water_label", - "minzoom": 5, - "filter": [ ">", "area", 10000 ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 13, 13 ], [ 18, 18 ] ] } - }, - "paint": { "text-color": "hsl(230, 48%, 44%)" } - }, - { - "id": "place-residential", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 18, - "filter": [ - "all", - [ "in", "$type", "LineString", "Point", "Polygon" ], - [ "all", [ "<=", "localrank", 10 ], [ "==", "type", "residential" ] ] - ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-parks-scalerank1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933322393.2852" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "<=", "scalerank", 1 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "icon-image": { "stops": [ [ 13, "{maki}-11" ], [ 14, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(100, 100%, 20%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "poi-scalerank1", - "type": "symbol", - "metadata": { "mapbox:group": "1444933322393.2852" }, - "source": "composite", - "source-layer": "poi_label", - "filter": [ - "all", - [ - "!in", - "maki", - "campsite", - "cemetery", - "dog-park", - "garden", - "golf", - "park", - "picnic-site", - "playground", - "zoo" - ], - [ "<=", "scalerank", 1 ] - ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 14 ] ] }, - "icon-image": { "stops": [ [ 13, "{maki}-11" ], [ 14, "{maki}-15" ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.65 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(26, 25%, 32%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "airport-label", - "type": "symbol", - "source": "composite", - "source-layer": "airport_label", - "minzoom": 9, - "filter": [ "<=", "scalerank", 2 ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 10, 12 ], [ 18, 18 ] ] }, - "icon-image": { "stops": [ [ 12, "{maki}-11" ], [ 13, "{maki}-15" ] ] }, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0.75 ], - "text-rotation-alignment": "viewport", - "text-anchor": "top", - "text-field": { "stops": [ [ 11, "{ref}" ], [ 12, "{name_en}" ] ] }, - "text-letter-spacing": 0.01, - "text-max-width": 9 - }, - "paint": { - "text-color": "hsl(230, 48%, 44%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 0.5, - "text-halo-blur": 0.5 - } - }, - { - "id": "place-islet-archipelago-aboriginal", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 16, - "filter": [ "in", "type", "aboriginal_lands", "archipelago", "islet" ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 16 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 8 - }, - "paint": { - "text-color": "hsl(230, 29%, 35%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "place-neighbourhood", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "neighbourhood" ], - "layout": { - "text-field": "{name_en}", - "text-transform": "uppercase", - "text-letter-spacing": 0.1, - "text-max-width": 7, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 3, - "text-size": { "base": 1, "stops": [ [ 12, 11 ], [ 16, 16 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-color": "hsl(230, 29%, 35%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "place-suburb", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "suburb" ], - "layout": { - "text-field": "{name_en}", - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-letter-spacing": 0.15, - "text-max-width": 7, - "text-padding": 3, - "text-size": { "base": 1, "stops": [ [ 11, 11 ], [ 15, 18 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "text-color": "hsl(230, 29%, 35%)", - "text-halo-blur": 0.5 - } - }, - { - "id": "place-hamlet", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 10, - "maxzoom": 16, - "filter": [ "==", "type", "hamlet" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 12, 11.5 ], [ 15, 16 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-color": "hsl(0, 0%, 0%)" - } - }, - { - "id": "place-village", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 8, - "maxzoom": 15, - "filter": [ "==", "type", "village" ], - "layout": { - "text-field": "{name_en}", - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 10, 11.5 ], [ 16, 18 ] ] } - }, - "paint": { - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "text-color": "hsl(0, 0%, 0%)" - } - }, - { - "id": "place-town", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "minzoom": 6, - "maxzoom": 15, - "filter": [ "==", "type", "town" ], - "layout": { - "icon-image": "dot-9", - "text-font": { - "base": 1, - "stops": [ - [ 11, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 12, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7, [ 0, -0.15 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 1, "stops": [ [ 7, 11.5 ], [ 15, 20 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-island", - "type": "symbol", - "source": "composite", - "source-layer": "place_label", - "maxzoom": 16, - "filter": [ "==", "type", "island" ], - "layout": { - "text-line-height": 1.2, - "text-size": { "base": 1, "stops": [ [ 10, 11 ], [ 18, 16 ] ] }, - "text-max-angle": 38, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ], - "text-padding": 2, - "text-offset": [ 0, 0 ], - "text-rotation-alignment": "viewport", - "text-field": "{name_en}", - "text-letter-spacing": 0.01, - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(230, 29%, 35%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "place-city-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ "all", [ "!in", "scalerank", 0, 1, 2, 3, 4, 5 ], [ "==", "type", "city" ] ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 6, 12 ], [ 14, 22 ] ] }, - "icon-image": "dot-9", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.2 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7 - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1.25, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-city-md-s", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "E", "S", "SE", "SW" ], - [ "in", "scalerank", 3, 4, 5 ], - [ "==", "type", "city" ] - ], - "layout": { - "text-field": "{name_en}", - "icon-image": "dot-10", - "text-anchor": { "base": 1, "stops": [ [ 7, "top" ], [ 8, "center" ] ] }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, 0.1 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-size": { "base": 0.9, "stops": [ [ 5, 12 ], [ 12, 22 ] ] } - }, - "paint": { - "text-halo-width": 1, - "text-halo-color": "hsl(0, 0%, 100%)", - "text-color": "hsl(0, 0%, 0%)", - "text-halo-blur": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] } - } - }, - { - "id": "place-city-md-n", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "N", "NE", "NW", "W" ], - [ "in", "scalerank", 3, 4, 5 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-10", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.25 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 5, 12 ], [ 12, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "place-city-lg-s", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "minzoom": 1, - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "E", "S", "SE", "SW" ], - [ "<=", "scalerank", 2 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-11", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, 0.15 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "top" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 4, 12 ], [ 10, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "place-city-lg-n", - "type": "symbol", - "metadata": { "mapbox:group": "1444862510685.128" }, - "source": "composite", - "source-layer": "place_label", - "minzoom": 1, - "maxzoom": 14, - "filter": [ - "all", - [ "in", "ldir", "N", "NE", "NW", "W" ], - [ "<=", "scalerank", 2 ], - [ "==", "type", "city" ] - ], - "layout": { - "icon-image": "dot-11", - "text-font": { - "base": 1, - "stops": [ - [ 7, [ "DIN Offc Pro Regular", "Arial Unicode MS Regular" ] ], - [ 8, [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ] ] - ] - }, - "text-offset": { "base": 1, "stops": [ [ 7.99, [ 0, -0.25 ] ], [ 8, [ 0, 0 ] ] ] }, - "text-anchor": { "base": 1, "stops": [ [ 7, "bottom" ], [ 8, "center" ] ] }, - "text-field": "{name_en}", - "text-max-width": 7, - "text-size": { "base": 0.9, "stops": [ [ 4, 12 ], [ 10, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-opacity": 1, - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1, - "icon-opacity": { "base": 1, "stops": [ [ 7.99, 1 ], [ 8, 0 ] ] }, - "text-halo-blur": 1 - } - }, - { - "id": "marine-label-sm-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 3, - "maxzoom": 10, - "filter": [ "all", [ "==", "$type", "LineString" ], [ ">=", "labelrank", 4 ] ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1, "stops": [ [ 3, 12 ], [ 6, 16 ] ] }, - "symbol-spacing": { "base": 1, "stops": [ [ 4, 100 ], [ 6, 400 ] ] }, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-field": "{name_en}", - "text-letter-spacing": 0.1, - "text-max-width": 5 - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-sm-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 3, - "maxzoom": 10, - "filter": [ "all", [ "==", "$type", "Point" ], [ ">=", "labelrank", 4 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 5, - "text-letter-spacing": 0.1, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 3, 12 ], [ 6, 16 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-md-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 2, - "maxzoom": 8, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "in", "labelrank", 2, 3 ] ], - "layout": { - "text-line-height": 1.1, - "text-size": { "base": 1.1, "stops": [ [ 2, 12 ], [ 5, 20 ] ] }, - "symbol-spacing": 250, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "symbol-placement": "line", - "text-field": "{name_en}", - "text-letter-spacing": 0.15, - "text-max-width": 5 - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-md-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 2, - "maxzoom": 8, - "filter": [ "all", [ "==", "$type", "Point" ], [ "in", "labelrank", 2, 3 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 5, - "text-letter-spacing": 0.15, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1.1, "stops": [ [ 2, 14 ], [ 5, 20 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-lg-ln", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 1, - "maxzoom": 4, - "filter": [ "all", [ "==", "$type", "LineString" ], [ "==", "labelrank", 1 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 4, - "text-letter-spacing": 0.25, - "text-line-height": 1.1, - "symbol-placement": "line", - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 14 ], [ 4, 30 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "marine-label-lg-pt", - "type": "symbol", - "metadata": { "mapbox:group": "1444856087950.3635" }, - "source": "composite", - "source-layer": "marine_label", - "minzoom": 1, - "maxzoom": 4, - "filter": [ "all", [ "==", "$type", "Point" ], [ "==", "labelrank", 1 ] ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 4, - "text-letter-spacing": 0.25, - "text-line-height": 1.5, - "text-font": [ "DIN Offc Pro Italic", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 14 ], [ 4, 30 ] ] } - }, - "paint": { "text-color": "hsl(205, 83%, 88%)" } - }, - { - "id": "state-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 9, - "filter": [ "<", "area", 20000 ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 6, 10 ], [ 9, 14 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 6, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 5 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "state-label-md", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 8, - "filter": [ "all", [ "<", "area", 80000 ], [ ">=", "area", 20000 ] ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 5, 10 ], [ 8, 16 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 5, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 6 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "state-label-lg", - "type": "symbol", - "metadata": { "mapbox:group": "1444856151690.9143" }, - "source": "composite", - "source-layer": "state_label", - "minzoom": 3, - "maxzoom": 7, - "filter": [ ">=", "area", 80000 ], - "layout": { - "text-size": { "base": 1, "stops": [ [ 4, 10 ], [ 7, 18 ] ] }, - "text-transform": "uppercase", - "text-font": [ "DIN Offc Pro Bold", "Arial Unicode MS Bold" ], - "text-padding": 1, - "text-field": { "base": 1, "stops": [ [ 0, "{abbr}" ], [ 4, "{name_en}" ] ] }, - "text-letter-spacing": 0.15, - "text-max-width": 6 - }, - "paint": { - "text-opacity": 1, - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": "hsl(0, 0%, 100%)", - "text-halo-width": 1 - } - }, - { - "id": "country-label-sm", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 10, - "filter": [ ">=", "scalerank", 5 ], - "layout": { - "text-field": "{name_en}", - "text-max-width": 6, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 0.9, "stops": [ [ 5, 14 ], [ 9, 22 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - }, - { - "id": "country-label-md", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 8, - "filter": [ "in", "scalerank", 3, 4 ], - "layout": { - "text-field": { "base": 1, "stops": [ [ 0, "{code}" ], [ 2, "{name_en}" ] ] }, - "text-max-width": 6, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 3, 10 ], [ 8, 24 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - }, - { - "id": "country-label-lg", - "type": "symbol", - "metadata": { "mapbox:group": "1444856144497.7825" }, - "source": "composite", - "source-layer": "country_label", - "minzoom": 1, - "maxzoom": 7, - "filter": [ "in", "scalerank", 1, 2 ], - "layout": { - "text-field": "{name_en}", - "text-max-width": { "base": 1, "stops": [ [ 0, 5 ], [ 3, 6 ] ] }, - "text-font": [ "DIN Offc Pro Medium", "Arial Unicode MS Regular" ], - "text-size": { "base": 1, "stops": [ [ 1, 10 ], [ 6, 24 ] ] } - }, - "paint": { - "text-color": "hsl(0, 0%, 0%)", - "text-halo-color": { "base": 1, "stops": [ [ 2, "rgba(255,255,255,0.75)" ], [ 3, "hsl(0, 0%, 100%)" ] ] }, - "text-halo-width": 1.25 - } - } - ] -} \ No newline at end of file diff --git a/benchmark/function/camera_function.benchmark.cpp b/benchmark/function/camera_function.benchmark.cpp deleted file mode 100644 index 0ce7d7c76..000000000 --- a/benchmark/function/camera_function.benchmark.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -#include -#include -#include -#include - -using namespace mbgl; -using namespace mbgl::style; - -static std::string createFunctionJSON(size_t stopCount) { - std::string stops = "["; - for (size_t i = 0; i < stopCount; i++) { - std::string value = std::to_string(24.0f / stopCount * i); - if (stops.size() > 1) stops += ","; - stops += "[" + value + ", " + value + "]"; - } - stops += "]"; - return R"({"type": "exponential", "base": 2, "stops": )" + stops + "}"; -} - -static void Parse_CameraFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - - while (state.KeepRunning()) { - conversion::Error error; - state.PauseTiming(); - auto doc = createFunctionJSON(stopCount); - state.ResumeTiming(); - optional> result = conversion::convertJSON>(doc, error, false, false); - if (!result) { - state.SkipWithError(error.message.c_str()); - } - } - state.SetLabel(std::to_string(stopCount).c_str()); -} - -static void Evaluate_CameraFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - auto doc = createFunctionJSON(stopCount); - conversion::Error error; - optional> function = conversion::convertJSON>(doc, error, false, false); - if (!function) { - state.SkipWithError(error.message.c_str()); - } - - while(state.KeepRunning()) { - float z = 24.0f * static_cast(rand() % 100) / 100; - function->asExpression().evaluate(z); - } - - state.SetLabel(std::to_string(stopCount).c_str()); -} - -BENCHMARK(Parse_CameraFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - -BENCHMARK(Evaluate_CameraFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - - diff --git a/benchmark/function/composite_function.benchmark.cpp b/benchmark/function/composite_function.benchmark.cpp deleted file mode 100644 index 8064d548f..000000000 --- a/benchmark/function/composite_function.benchmark.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include - -#include - -#include -#include -#include -#include - -using namespace mbgl; -using namespace mbgl::style; - -static std::string createFunctionJSON(size_t stopCount) { - std::string stops = "["; - for (size_t outerStop = 0; outerStop < stopCount; outerStop++) { - for (size_t innerStop = 0; innerStop < stopCount; innerStop++) { - std::string zoom = std::to_string(24.0f / stopCount * outerStop); - std::string value = std::to_string(100.0f / stopCount * innerStop); - - if (stops.size() > 1) stops += ","; - stops += R"([{"zoom":)" + zoom + R"(,"value":)" + value + "}, " + value + "]"; - } - } - stops += "]"; - return R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"; -} - -static void Parse_CompositeFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - - while (state.KeepRunning()) { - conversion::Error error; - state.PauseTiming(); - auto doc = createFunctionJSON(stopCount); - state.ResumeTiming(); - optional> result = conversion::convertJSON>(doc, error, true, false); - if (!result) { - state.SkipWithError(error.message.c_str()); - } - } - state.SetLabel(std::to_string(stopCount).c_str()); -} - -static void Evaluate_CompositeFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - auto doc = createFunctionJSON(stopCount); - conversion::Error error; - optional> function = conversion::convertJSON>(doc, error, true, false); - if (!function) { - state.SkipWithError(error.message.c_str()); - } - - while(state.KeepRunning()) { - float z = 24.0f * static_cast(rand() % 100) / 100; - function->asExpression().evaluate(z, StubGeometryTileFeature(PropertyMap { { "x", static_cast(rand() % 100) } }), -1.0f); - } - - state.SetLabel(std::to_string(stopCount).c_str()); -} - -BENCHMARK(Parse_CompositeFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - -BENCHMARK(Evaluate_CompositeFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - - diff --git a/benchmark/function/source_function.benchmark.cpp b/benchmark/function/source_function.benchmark.cpp deleted file mode 100644 index b75cc143d..000000000 --- a/benchmark/function/source_function.benchmark.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -#include - -#include -#include -#include - -using namespace mbgl; -using namespace mbgl::style; - -static std::string createFunctionJSON(size_t stopCount) { - std::string stops = "["; - for (size_t i = 0; i < stopCount; i++) { - std::string value = std::to_string(100.0f / stopCount * i); - if (stops.size() > 1) stops += ","; - stops += "[" + value + ", " + value + "]"; - } - stops += "]"; - return R"({"type": "exponential", "base": 2, "stops": )" + stops + R"(, "property": "x"})"; -} - -static void Parse_SourceFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - - while (state.KeepRunning()) { - conversion::Error error; - state.PauseTiming(); - auto doc = createFunctionJSON(stopCount); - state.ResumeTiming(); - optional> result = conversion::convertJSON>(doc, error, true, false); - if (!result) { - state.SkipWithError(error.message.c_str()); - } - } - state.SetLabel(std::to_string(stopCount).c_str()); -} - -static void Evaluate_SourceFunction(benchmark::State& state) { - size_t stopCount = state.range(0); - auto doc = createFunctionJSON(stopCount); - conversion::Error error; - optional> function = conversion::convertJSON>(doc, error, true, false); - if (!function) { - state.SkipWithError(error.message.c_str()); - } - - while(state.KeepRunning()) { - function->asExpression().evaluate(StubGeometryTileFeature(PropertyMap { { "x", static_cast(rand() % 100) } }), -1.0f); - } - - state.SetLabel(std::to_string(stopCount).c_str()); -} - -BENCHMARK(Parse_SourceFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - -BENCHMARK(Evaluate_SourceFunction) - ->Arg(1)->Arg(2)->Arg(4)->Arg(6)->Arg(8)->Arg(10)->Arg(12); - - diff --git a/benchmark/include/mbgl/benchmark.hpp b/benchmark/include/mbgl/benchmark.hpp deleted file mode 100644 index f68c847a7..000000000 --- a/benchmark/include/mbgl/benchmark.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -MBGL_EXPORT int runBenchmark(int argc, char* argv[]); - -} // namespace mbgl diff --git a/benchmark/parse/filter.benchmark.cpp b/benchmark/parse/filter.benchmark.cpp deleted file mode 100644 index 7f94d9d74..000000000 --- a/benchmark/parse/filter.benchmark.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include - -using namespace mbgl; - -style::Filter parse(const char* expression) { - style::conversion::Error error; - return *style::conversion::convertJSON(expression, error); -} - -static void Parse_Filter(benchmark::State& state) { - while (state.KeepRunning()) { - parse(R"FILTER(["==", "foo", "bar"])FILTER"); - } -} - -static void Parse_EvaluateFilter(benchmark::State& state) { - const style::Filter filter = parse(R"FILTER(["==", "foo", "bar"])FILTER"); - const StubGeometryTileFeature feature = { {}, FeatureType::Unknown , {}, {{ "foo", std::string("bar") }} }; - const style::expression::EvaluationContext context(&feature); - - while (state.KeepRunning()) { - filter(context); - } -} - -BENCHMARK(Parse_Filter); -BENCHMARK(Parse_EvaluateFilter); diff --git a/benchmark/parse/tile_mask.benchmark.cpp b/benchmark/parse/tile_mask.benchmark.cpp deleted file mode 100644 index a31e0b5ea..000000000 --- a/benchmark/parse/tile_mask.benchmark.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include - -using namespace mbgl; - -class FakeTile { -public: - FakeTile(TileMask mask_) - : mask(std::move(mask_)) { - } - void setMask(TileMask mask_) { - mask = std::move(mask_); - } - - const bool usedByRenderedLayers = true; - TileMask mask; -}; - -static void TileMaskGeneration(benchmark::State& state) { - std::map renderables = { - { UnwrappedTileID{ 12, 1028, 1456 }, TileMask{} }, - { UnwrappedTileID{ 13, 2056, 2912 }, TileMask{} }, - { UnwrappedTileID{ 13, 2056, 2913 }, TileMask{} }, - { UnwrappedTileID{ 14, 4112, 5824 }, TileMask{} }, - { UnwrappedTileID{ 14, 4112, 5827 }, TileMask{} }, - { UnwrappedTileID{ 14, 4114, 5824 }, TileMask{} }, - { UnwrappedTileID{ 14, 4114, 5825 }, TileMask{} }, - }; - - while (state.KeepRunning()) { - algorithm::updateTileMasks(renderables); - } -} - -BENCHMARK(TileMaskGeneration); diff --git a/benchmark/parse/vector_tile.benchmark.cpp b/benchmark/parse/vector_tile.benchmark.cpp deleted file mode 100644 index 24623dbda..000000000 --- a/benchmark/parse/vector_tile.benchmark.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#include -#include - -using namespace mbgl; - -static void Parse_VectorTile(benchmark::State& state) { - auto data = std::make_shared(util::read_file("test/fixtures/api/assets/streets/10-163-395.vector.pbf")); - - while (state.KeepRunning()) { - std::size_t length = 0; - VectorTileData tile(data); - for (const auto& name : tile.layerNames()) { - if (auto layer = tile.getLayer(name)) { - const std::size_t count = layer->featureCount(); - for (std::size_t i = 0; i < count; i++) { - if (auto feature = layer->getFeature(i)) { - length += feature->getGeometries().size(); - length += feature->getProperties().size(); - } - } - } - } - } -} - -BENCHMARK(Parse_VectorTile); diff --git a/benchmark/src/mbgl/benchmark/benchmark.cpp b/benchmark/src/mbgl/benchmark/benchmark.cpp deleted file mode 100644 index d408e7c5e..000000000 --- a/benchmark/src/mbgl/benchmark/benchmark.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -#include - -namespace mbgl { - -int runBenchmark(int argc, char* argv[]) { - ::benchmark::Initialize(&argc, argv); - ::benchmark::RunSpecifiedBenchmarks(); - return 0; -} - -} // namespace mbgl diff --git a/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp b/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp deleted file mode 100644 index b8f2ffb5b..000000000 --- a/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include - -using namespace mbgl; - -class StubGeometryTileFeature : public GeometryTileFeature { -public: - StubGeometryTileFeature(PropertyMap properties_) - : properties(std::move(properties_)) { - } - - StubGeometryTileFeature(FeatureIdentifier id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_) - : properties(std::move(properties_)), - id(std::move(id_)), - type(type_), - geometry(std::move(geometry_)) { - } - - PropertyMap properties; - FeatureIdentifier id; - FeatureType type = FeatureType::Point; - GeometryCollection geometry; - - FeatureType getType() const override { - return type; - } - - FeatureIdentifier getID() const override { - return id; - } - - optional getValue(const std::string& key) const override { - return properties.count(key) ? properties.at(key) : optional(); - } - - const GeometryCollection& getGeometries() const override { - return geometry; - } -}; diff --git a/benchmark/storage/offline_database.benchmark.cpp b/benchmark/storage/offline_database.benchmark.cpp deleted file mode 100644 index afdf6db4f..000000000 --- a/benchmark/storage/offline_database.benchmark.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include - -#include - -class OfflineDatabase : public benchmark::Fixture { -public: - void SetUp(const ::benchmark::State&) override { - using namespace std::chrono_literals; - - db.setOfflineMapboxTileCountLimit(100000); - - response.data = std::make_shared(50 * 1024, 0); - response.mustRevalidate = false; - response.expires = mbgl::util::now() + 1h; - - resetAmbientTiles(); - resetRegion(); - } - - void resetAmbientTiles() { - using namespace mbgl; - - db.clearAmbientCache(); - - for (unsigned i = 0; i < tileCount; ++i) { - const Resource ambient = Resource::tile("mapbox://tile_ambient" + util::toString(i), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.put(ambient, response); - } - } - - void resetRegion() { - using namespace mbgl; - - auto regions = db.listRegions().value(); - if (!regions.empty()) { - db.deleteRegion(std::move(regions[0])); - } - - OfflineTilePyramidRegionDefinition definition{ "mapbox://style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0, true }; - OfflineRegionMetadata metadata{{ 1, 2, 3 }}; - - auto region = db.createRegion(definition, metadata); - regionID = region->getID(); - - for (unsigned i = 0; i < tileCount; ++i) { - const Resource offline = Resource::tile("mapbox://tile_offline_region" + util::toString(i), 1.0, 0, 0, 0, Tileset::Scheme::XYZ); - db.putRegionResource(regionID, offline, response); - } - } - - mbgl::Response response; - mbgl::OfflineDatabase db{":memory:"}; - - const unsigned tileCount = 100; - int64_t regionID = 0; -}; - -BENCHMARK_F(OfflineDatabase, InvalidateRegion)(benchmark::State& state) { - while (state.KeepRunning()) { - db.invalidateRegion(regionID); - } -} - -BENCHMARK_F(OfflineDatabase, DeleteRegion)(benchmark::State& state) { - while (state.KeepRunning()) { - resetRegion(); - } -} - -BENCHMARK_F(OfflineDatabase, InsertTileRegion)(benchmark::State& state) { - using namespace mbgl; - - while (state.KeepRunning()) { - const Resource offline = Resource::tile("mapbox://InsertTileRegion" + - util::toString(state.iterations()), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.putRegionResource(regionID, offline, response); - } -} -BENCHMARK_F(OfflineDatabase, InvalidateAmbientCache)(benchmark::State& state) { - while (state.KeepRunning()) { - db.invalidateAmbientCache(); - } -} - -BENCHMARK_F(OfflineDatabase, ClearAmbientCache)(benchmark::State& state) { - while (state.KeepRunning()) { - resetAmbientTiles(); - } -} - -BENCHMARK_F(OfflineDatabase, InsertTileCache)(benchmark::State& state) { - using namespace mbgl; - - while (state.KeepRunning()) { - const Resource ambient = Resource::tile("mapbox://InsertTileCache" + - util::toString(state.iterations()), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.put(ambient, response); - } -} - -BENCHMARK_F(OfflineDatabase, InsertBigTileCache)(benchmark::State& state) { - using namespace mbgl; - - Response big; - big.data = std::make_shared(util::DEFAULT_MAX_CACHE_SIZE / 100, 0); - - while (state.KeepRunning()) { - const Resource ambient = Resource::tile("mapbox://InsertTileCache" + - util::toString(state.iterations()), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.put(ambient, big); - } -} - -BENCHMARK_F(OfflineDatabase, GetTile)(benchmark::State& state) { - using namespace mbgl; - - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_int_distribution<> dis(0, tileCount - 1); - - while (state.KeepRunning()) { - auto res = db.get(Resource::tile("mapbox://tile_ambient" + util::toString(dis(gen)), 1, 0, 0, 0, Tileset::Scheme::XYZ)); - assert(res != nullopt); - } -} - -BENCHMARK_F(OfflineDatabase, AddTilesToFullDatabase)(benchmark::State& state) { - using namespace mbgl; - - Log::setObserver(std::make_unique()); - db.setMaximumAmbientCacheSize(50 * 1024 * 5); - - while (state.KeepRunning()) { - const Resource ambient = Resource::tile("mapbox://AddTilesToFullDatabase" + - util::toString(state.iterations()), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.put(ambient, response); - } - - Log::removeObserver(); -} - -BENCHMARK_F(OfflineDatabase, AddTilesToDisabledDatabase)(benchmark::State& state) { - using namespace mbgl; - - auto regions = db.listRegions().value(); - if (!regions.empty()) { - db.deleteRegion(std::move(regions[0])); - } - - // Disables the ambient cache. - db.setMaximumAmbientCacheSize(0); - - while (state.KeepRunning()) { - const Resource ambient = Resource::tile("mapbox://AddTilesToFullDatabase" + - util::toString(state.iterations()), 1, 0, 0, 0, Tileset::Scheme::XYZ); - db.put(ambient, response); - } -} - -BENCHMARK_F(OfflineDatabase, GetTileFromDisabledDatabase)(benchmark::State& state) { - using namespace mbgl; - - auto regions = db.listRegions().value(); - if (!regions.empty()) { - db.deleteRegion(std::move(regions[0])); - } - - // Disables the ambient cache. - db.setMaximumAmbientCacheSize(0); - - while (state.KeepRunning()) { - auto res = db.get(Resource::tile("mapbox://tile_ambient", 1, 0, 0, 0, Tileset::Scheme::XYZ)); - assert(res == nullopt); - } -} - -BENCHMARK_F(OfflineDatabase, ResizeDatabase)(benchmark::State& state) { - uint64_t size = 25 * 1024 * 1024; - - while (state.KeepRunning()) { - db.setMaximumAmbientCacheSize(size); - - size -= response.data->size(); - - if (size < response.data->size()) { - size = 25 * 1024 * 1024; - } - } -} diff --git a/benchmark/util/dtoa.benchmark.cpp b/benchmark/util/dtoa.benchmark.cpp deleted file mode 100644 index 0009c6dd1..000000000 --- a/benchmark/util/dtoa.benchmark.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include - -#include - -#include -#include - -using namespace mbgl; - -static void Util_dtoa(::benchmark::State& state) { - while (state.KeepRunning()) { - util::dtoa(0.); - util::dtoa(M_E); - util::dtoa(M_LOG2E); - util::dtoa(M_LOG10E); - util::dtoa(M_LN2); - util::dtoa(M_LN10); - util::dtoa(M_PI); - util::dtoa(M_PI_2); - util::dtoa(M_PI_4); - util::dtoa(M_1_PI); - util::dtoa(M_2_PI); - util::dtoa(M_2_SQRTPI); - util::dtoa(M_SQRT2); - util::dtoa(M_SQRT1_2); - } -} - -static void Util_standardDtoa(::benchmark::State& state) { - while (state.KeepRunning()) { - std::to_string(0.); - std::to_string(M_E); - std::to_string(M_LOG2E); - std::to_string(M_LOG10E); - std::to_string(M_LN2); - std::to_string(M_LN10); - std::to_string(M_PI); - std::to_string(M_PI_2); - std::to_string(M_PI_4); - std::to_string(M_1_PI); - std::to_string(M_2_PI); - std::to_string(M_2_SQRTPI); - std::to_string(M_SQRT2); - std::to_string(M_SQRT1_2); - } -} - -static void Util_dtoaLimits(::benchmark::State& state) { - while (state.KeepRunning()) { - util::dtoa(DBL_MIN); - util::dtoa(DBL_MAX); - } -} - -static void Util_standardDtoaLimits(::benchmark::State& state) { - while (state.KeepRunning()) { - std::to_string(DBL_MIN); - std::to_string(DBL_MAX); - } -} - -BENCHMARK(Util_dtoa); -BENCHMARK(Util_standardDtoa); - -BENCHMARK(Util_dtoaLimits); -BENCHMARK(Util_standardDtoaLimits); diff --git a/benchmark/util/tilecover.benchmark.cpp b/benchmark/util/tilecover.benchmark.cpp deleted file mode 100644 index e966875a6..000000000 --- a/benchmark/util/tilecover.benchmark.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include -#include -#include -#include - -using namespace mbgl; - -static const LatLngBounds sanFrancisco = - LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); - -static void TileCountBounds(benchmark::State& state) { - std::size_t length = 0; - while (state.KeepRunning()) { - auto count = util::tileCount(sanFrancisco, 10); - length += count; - } -} - -static void TileCoverPitchedViewport(benchmark::State& state) { - Transform transform; - transform.resize({ 512, 512 }); - // slightly offset center so that tile order is better defined - transform.jumpTo(CameraOptions().withCenter(LatLng { 0.1, -0.1 }).withZoom(8.0).withBearing(5.0).withPitch(40.0)); - - std::size_t length = 0; - while (state.KeepRunning()) { - auto tiles = util::tileCover(transform.getState(), 8); - length += tiles.size(); - } -} - -static void TileCoverBounds(benchmark::State& state) { - std::size_t length = 0; - while (state.KeepRunning()) { - auto tiles = util::tileCover(sanFrancisco, 8); - length += tiles.size(); - } -} - -static const auto geomPolygon = Polygon{ - { - {-122.5143814086914,37.779127216982424}, - {-122.50811576843262,37.72721239056709}, - {-122.50313758850099,37.70820178063929}, - {-122.3938751220703,37.707454835665274}, - {-122.37567901611328,37.70663997801684}, - {-122.36297607421874,37.71343018466285}, - {-122.354736328125,37.727280276860036}, - {-122.36469268798828,37.73868429065797}, - {-122.38014221191408,37.75442980295571}, - {-122.38391876220702,37.78753873820529}, - {-122.35919952392578,37.8065289741725}, - {-122.35679626464844,37.820632846207864}, - {-122.3712158203125,37.835276322922695}, - {-122.3818588256836,37.82958198283902}, - {-122.37190246582031,37.80788523279169}, - {-122.38735198974608,37.791337175930686}, - {-122.40966796874999,37.812767557570204}, - {-122.46425628662108,37.807071480609274}, - {-122.46803283691405,37.810326435534755}, - {-122.47901916503906,37.81168262440736}, - {-122.48966217041016,37.78916666399649}, - {-122.50579833984375,37.78781006166096}, - {-122.5143814086914,37.779127216982424} - } -}; - -static void TileCoverPolygon(benchmark::State& state) { - std::size_t length = 0; - - while (state.KeepRunning()) { - auto tiles = util::tileCover(geomPolygon, 8); - length += tiles.size(); - } -} - -static void TileCountPolygon(benchmark::State& state) { - std::size_t length = 0; - - while (state.KeepRunning()) { - auto tiles = util::tileCount(geomPolygon, 16); - length += tiles; - } -} - -BENCHMARK(TileCountBounds); -BENCHMARK(TileCountPolygon); -BENCHMARK(TileCoverPitchedViewport); -BENCHMARK(TileCoverBounds); -BENCHMARK(TileCoverPolygon); - diff --git a/bin/offline.cpp b/bin/offline.cpp deleted file mode 100644 index fcc6adc3e..000000000 --- a/bin/offline.cpp +++ /dev/null @@ -1,272 +0,0 @@ -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace std::literals::chrono_literals; - -std::string readFile(const std::string& fileName) { - std::ifstream stream(fileName.c_str()); - if (!stream.good()) { - throw std::runtime_error("Cannot read file: " + fileName); - } - - std::stringstream buffer; - buffer << stream.rdbuf(); - stream.close(); - - return buffer.str(); -} - -mapbox::geometry::geometry parseGeometry(const std::string& json) { - using namespace mapbox::geojson; - auto geojson = parse(json); - return geojson.match( - [](const geometry& geom) { - return geom; - }, - [](const feature& feature) { - return feature.geometry; - }, - [](const feature_collection& featureCollection) { - if (featureCollection.size() < 1) { - throw std::runtime_error("No features in feature collection"); - } - geometry_collection geometries; - - for (auto feature : featureCollection) { - geometries.push_back(feature.geometry); - } - - return geometries; - }); -} - -std::ostream& operator<<(std::ostream& os, mbgl::Response::Error::Reason r) { - switch (r) { - case mbgl::Response::Error::Reason::Success: - return os << "Response::Error::Reason::Success"; - case mbgl::Response::Error::Reason::NotFound: - return os << "Response::Error::Reason::NotFound"; - case mbgl::Response::Error::Reason::Server: - return os << "Response::Error::Reason::Server"; - case mbgl::Response::Error::Reason::Connection: - return os << "Response::Error::Reason::Connection"; - case mbgl::Response::Error::Reason::RateLimit: - return os << "Response::Error::Reason::RateLimit"; - case mbgl::Response::Error::Reason::Other: - return os << "Response::Error::Reason::Other"; - } - - // The above switch is exhaustive, but placate GCC nonetheless: - assert(false); - return os; -} - -int main(int argc, char *argv[]) { - args::ArgumentParser argumentParser("Mapbox GL offline tool"); - args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", {'h', "help"}); - - args::ValueFlag tokenValue(argumentParser, "key", "Mapbox access token", {'t', "token"}); - args::ValueFlag styleValue(argumentParser, "URL", "Map stylesheet", {'s', "style"}); - args::ValueFlag outputValue(argumentParser, "file", "Output database file name", {'o', "output"}); - args::ValueFlag apiBaseValue(argumentParser, "URL", "API Base URL", {'a', "apiBaseURL"}); - - args::Group mergeGroup(argumentParser, "Merge databases:", args::Group::Validators::AllOrNone); - args::ValueFlag mergePathValue(mergeGroup, "merge", "Database to merge from", {'m', "merge"}); - args::ValueFlag inputValue(mergeGroup, "input", "Database to merge into. Use with --merge option.", {'i', "input"}); - - // LatLngBounds - args::Group latLngBoundsGroup(argumentParser, "LatLng bounds:", args::Group::Validators::AllOrNone); - args::ValueFlag northValue(latLngBoundsGroup, "degrees", "North latitude", {"north"}); - args::ValueFlag westValue(latLngBoundsGroup, "degrees", "West longitude", {"west"}); - args::ValueFlag southValue(latLngBoundsGroup, "degrees", "South latitude", {"south"}); - args::ValueFlag eastValue(latLngBoundsGroup, "degrees", "East longitude", {"east"}); - - // Geometry - args::Group geoJSONGroup(argumentParser, "GeoJson geometry:", args::Group::Validators::AllOrNone); - args::ValueFlag geometryValue(geoJSONGroup, "file", "GeoJSON Feature file containing the region geometry (can't be a FeatureCollection)", {"geojson"}); - - args::ValueFlag minZoomValue(argumentParser, "number", "Min zoom level", {"minZoom"}); - args::ValueFlag maxZoomValue(argumentParser, "number", "Max zoom level", {"maxZoom"}); - args::ValueFlag pixelRatioValue(argumentParser, "number", "Pixel ratio", {"pixelRatio"}); - args::ValueFlag includeIdeographsValue(argumentParser, "boolean", "Include CJK glyphs", {"includeIdeographs"}); - - try { - argumentParser.ParseCLI(argc, argv); - } catch (const args::Help&) { - std::cout << argumentParser; - exit(0); - } catch (const args::ParseError& e) { - std::cerr << e.what() << std::endl; - std::cerr << argumentParser; - exit(1); - } catch (const args::ValidationError& e) { - std::cerr << e.what() << std::endl; - std::cerr << argumentParser; - exit(2); - } - - std::string style = styleValue ? args::get(styleValue) : mbgl::util::default_styles::streets.url; - - mbgl::optional mergePath = {}; - if (mergePathValue) mergePath = args::get(mergePathValue); - mbgl::optional inputDb = {}; - if (inputValue) inputDb = args::get(inputValue); - - const double minZoom = minZoomValue ? args::get(minZoomValue) : 0.0; - const double maxZoom = maxZoomValue ? args::get(maxZoomValue) : 15.0; - const double pixelRatio = pixelRatioValue ? args::get(pixelRatioValue) : 1.0; - const bool includeIdeographs = includeIdeographsValue ? args::get(includeIdeographsValue) : false; - const std::string output = outputValue ? args::get(outputValue) : "offline.db"; - - using namespace mbgl; - - OfflineRegionDefinition definition = [&]() { - if (geometryValue) { - try { - std::string json = readFile(geometryValue.Get()); - auto geometry = parseGeometry(json); - return OfflineRegionDefinition{ OfflineGeometryRegionDefinition(style, geometry, minZoom, maxZoom, pixelRatio, includeIdeographs) }; - } catch(const std::runtime_error& e) { - std::cerr << "Could not parse geojson file " << geometryValue.Get() << ": " << e.what() << std::endl; - exit(1); - } - } else { - // Bay area - const double north = northValue ? args::get(northValue) : 37.2; - const double west = westValue ? args::get(westValue) : -122.8; - const double south = southValue ? args::get(southValue) : 38.1; - const double east = eastValue ? args::get(eastValue) : -121.7; - LatLngBounds boundingBox = LatLngBounds::hull(LatLng(north, west), LatLng(south, east)); - return OfflineRegionDefinition{ OfflineTilePyramidRegionDefinition(style, boundingBox, minZoom, maxZoom, pixelRatio, includeIdeographs) }; - } - }(); - - const char* tokenEnv = getenv("MAPBOX_ACCESS_TOKEN"); - const std::string token = tokenValue ? args::get(tokenValue) : (tokenEnv ? tokenEnv : std::string()); - - const std::string apiBaseURL = apiBaseValue ? args::get(apiBaseValue) : mbgl::util::API_BASE_URL; - - - util::RunLoop loop; - DefaultFileSource fileSource(output, "."); - std::unique_ptr region; - - fileSource.setAccessToken(token); - fileSource.setAPIBaseURL(apiBaseURL); - - if (inputDb && mergePath) { - DefaultFileSource inputSource(*inputDb, "."); - inputSource.setAccessToken(token); - inputSource.setAPIBaseURL(apiBaseURL); - - int retCode = 0; - std::cout << "Start Merge" << std::endl; - inputSource.mergeOfflineRegions(*mergePath, [&] (mbgl::expected, std::exception_ptr> result) { - - if (!result) { - std::cerr << "Error merging database: " << util::toString(result.error()) << std::endl; - retCode = 1; - } else { - std::cout << " Added " << result->size() << " Regions" << std::endl; - std::cout << "Finished Merge" << std::endl; - } - loop.stop(); - }); - loop.run(); - return retCode; - } - - OfflineRegionMetadata metadata; - - class Observer : public OfflineRegionObserver { - public: - Observer(OfflineRegion& region_, DefaultFileSource& fileSource_, util::RunLoop& loop_, mbgl::optional mergePath_) - : region(region_), - fileSource(fileSource_), - loop(loop_), - mergePath(std::move(mergePath_)), - start(util::now()) { - } - - void statusChanged(OfflineRegionStatus status) override { - if (status.downloadState == OfflineRegionDownloadState::Inactive) { - std::cout << "stopped" << std::endl; - loop.stop(); - return; - } - - std::string bytesPerSecond = "-"; - - auto elapsedSeconds = (util::now() - start) / 1s; - if (elapsedSeconds != 0) { - bytesPerSecond = util::toString(status.completedResourceSize / elapsedSeconds); - } - - std::cout << status.completedResourceCount << " / " << status.requiredResourceCount - << " resources" - << status.completedTileCount << " / " << status.requiredTileCount - << "tiles" - << (status.requiredResourceCountIsPrecise ? "; " : " (indeterminate); ") - << status.completedResourceSize << " bytes downloaded" - << " (" << bytesPerSecond << " bytes/sec)" - << std::endl; - - if (status.complete()) { - std::cout << "Finished Download" << std::endl; - loop.stop(); - } - } - - void responseError(Response::Error error) override { - std::cerr << error.reason << " downloading resource: " << error.message << std::endl; - } - - void mapboxTileCountLimitExceeded(uint64_t limit) override { - std::cerr << "Error: reached limit of " << limit << " offline tiles" << std::endl; - } - - OfflineRegion& region; - DefaultFileSource& fileSource; - util::RunLoop& loop; - mbgl::optional mergePath; - Timestamp start; - }; - - static auto stop = [&] { - if (region) { - std::cout << "Stopping download... "; - fileSource.setOfflineRegionDownloadState(*region, OfflineRegionDownloadState::Inactive); - } - }; - - std::signal(SIGINT, [] (int) { stop(); }); - - fileSource.createOfflineRegion(definition, metadata, [&] (mbgl::expected region_) { - if (!region_) { - std::cerr << "Error creating region: " << util::toString(region_.error()) << std::endl; - loop.stop(); - exit(1); - } else { - assert(region_); - region = std::make_unique(std::move(*region_)); - fileSource.setOfflineRegionObserver(*region, std::make_unique(*region, fileSource, loop, mergePath)); - fileSource.setOfflineRegionDownloadState(*region, OfflineRegionDownloadState::Active); - } - }); - - loop.run(); - return 0; -} diff --git a/bin/offline.sh b/bin/offline.sh deleted file mode 100755 index 99ce2185e..000000000 --- a/bin/offline.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -OFFLINE=./build/macos/Release/mbgl-offline - -# Barcelona -$OFFLINE --north 41.4664 --west 2.0407 --south 41.2724 --east 2.2680 --output barcelona.db -$OFFLINE --north 41.4664 --west 2.0407 --south 41.2724 --east 2.2680 --output barcelona_sat.db --style mapbox://styles/mapbox/satellite-v8 - -# Greater London within the M25 at zoom levels 0–15 -$OFFLINE --north 51.6777 --west -0.5026 --south 51.3237 --east 0.2527 --maxZoom 15 --output london.db -$OFFLINE --north 51.6777 --west -0.5026 --south 51.3237 --east 0.2527 --maxZoom 15 --output london_sat.db --style mapbox://styles/mapbox/satellite-v8 - -# The contiguous United States at zoom levels 0–9 -$OFFLINE --north 49.6107 --west -125.5078 --south 24.2870 --east -66.3574 --maxZoom 9 --output us.db -$OFFLINE --north 49.6107 --west -125.5078 --south 24.2870 --east -66.3574 --maxZoom 9 --output us_sat.db --style mapbox://styles/mapbox/satellite-v8 diff --git a/bin/render.cpp b/bin/render.cpp deleted file mode 100644 index 85231c8cb..000000000 --- a/bin/render.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -int main(int argc, char *argv[]) { - args::ArgumentParser argumentParser("Mapbox GL render tool"); - args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", {"help"}); - - args::ValueFlag backendValue(argumentParser, "Backend", "Rendering backend", {"backend"}); - args::ValueFlag tokenValue(argumentParser, "key", "Mapbox access token", {'t', "token"}); - args::ValueFlag styleValue(argumentParser, "URL", "Map stylesheet", {'s', "style"}); - args::ValueFlag outputValue(argumentParser, "file", "Output file name", {'o', "output"}); - args::ValueFlag cacheValue(argumentParser, "file", "Cache database file name", {'c', "cache"}); - args::ValueFlag assetsValue(argumentParser, "file", "Directory to which asset:// URLs will resolve", {'a', "assets"}); - - args::Flag debugFlag(argumentParser, "debug", "Debug mode", {"debug"}); - - args::ValueFlag pixelRatioValue(argumentParser, "number", "Image scale factor", {'r', "ratio"}); - - args::ValueFlag zoomValue(argumentParser, "number", "Zoom level", {'z', "zoom"}); - - args::ValueFlag lonValue(argumentParser, "degrees", "Longitude", {'x', "lon"}); - args::ValueFlag latValue(argumentParser, "degrees", "Latitude", {'y', "lat"}); - args::ValueFlag bearingValue(argumentParser, "degrees", "Bearing", {'b', "bearing"}); - args::ValueFlag pitchValue(argumentParser, "degrees", "Pitch", {'p', "pitch"}); - args::ValueFlag widthValue(argumentParser, "pixels", "Image width", {'w', "width"}); - args::ValueFlag heightValue(argumentParser, "pixels", "Image height", {'h', "height"}); - - try { - argumentParser.ParseCLI(argc, argv); - } catch (const args::Help&) { - std::cout << argumentParser; - exit(0); - } catch (const args::ParseError& e) { - std::cerr << e.what() << std::endl; - std::cerr << argumentParser; - exit(1); - } catch (const args::ValidationError& e) { - std::cerr << e.what() << std::endl; - std::cerr << argumentParser; - exit(2); - } - - std::string style = styleValue ? args::get(styleValue) : mbgl::util::default_styles::streets.url; - const double lat = latValue ? args::get(latValue) : 0; - const double lon = lonValue ? args::get(lonValue) : 0; - const double zoom = zoomValue ? args::get(zoomValue) : 0; - const double bearing = bearingValue ? args::get(bearingValue) : 0; - const double pitch = pitchValue ? args::get(pitchValue) : 0; - const double pixelRatio = pixelRatioValue ? args::get(pixelRatioValue) : 1; - - const uint32_t width = widthValue ? args::get(widthValue) : 512; - const uint32_t height = heightValue ? args::get(heightValue) : 512; - const std::string output = outputValue ? args::get(outputValue) : "out.png"; - const std::string cache_file = cacheValue ? args::get(cacheValue) : "cache.sqlite"; - const std::string asset_root = assetsValue ? args::get(assetsValue) : "."; - - // Try to load the token from the environment. - const char* tokenEnv = getenv("MAPBOX_ACCESS_TOKEN"); - const std::string token = tokenValue ? args::get(tokenValue) : (tokenEnv ? tokenEnv : std::string()); - - const bool debug = debugFlag ? args::get(debugFlag) : false; - - using namespace mbgl; - - util::RunLoop loop; - - HeadlessFrontend frontend({ width, height }, pixelRatio); - Map map(frontend, MapObserver::nullObserver(), - MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(pixelRatio), - ResourceOptions().withCachePath(cache_file).withAssetPath(asset_root).withAccessToken(std::string(token))); - - if (style.find("://") == std::string::npos) { - style = std::string("file://") + style; - } - - map.getStyle().loadURL(style); - map.jumpTo(CameraOptions() - .withCenter(LatLng { lat, lon }) - .withZoom(zoom) - .withBearing(bearing) - .withPitch(pitch)); - - if (debug) { - map.setDebug(debug ? mbgl::MapDebugOptions::TileBorders | mbgl::MapDebugOptions::ParseStatus : mbgl::MapDebugOptions::NoDebug); - } - - try { - std::ofstream out(output, std::ios::binary); - out << encodePNG(frontend.render(map)); - out.close(); - } catch(std::exception& e) { - std::cout << "Error: " << e.what() << std::endl; - exit(1); - } - - return 0; -} diff --git a/cmake/benchmark.cmake b/cmake/benchmark.cmake deleted file mode 100644 index 7bca681f8..000000000 --- a/cmake/benchmark.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# Run scripts/generate-file-lists.js to change the source files for this target. -load_sources_list(MBGL_BENCHMARK_FILES benchmark/benchmark-files.json) -add_executable(mbgl-benchmark ${MBGL_BENCHMARK_FILES}) - -target_include_directories(mbgl-benchmark - PRIVATE src - PRIVATE benchmark/include - PRIVATE benchmark/src - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-benchmark - PRIVATE mbgl-core - PRIVATE mbgl-vendor-benchmark -) - -mbgl_platform_benchmark() - -create_source_groups(mbgl-benchmark) - -set_target_properties(mbgl-benchmark PROPERTIES FOLDER "Executables") - -initialize_xcode_cxx_build_settings(mbgl-benchmark) - -xcode_create_scheme( - TARGET mbgl-benchmark - OPTIONAL_ARGS - "--benchmark_filter=Category.*" - "--benchmark_repetitions=1" -) diff --git a/cmake/core.cmake b/cmake/core.cmake deleted file mode 100644 index 342731de9..000000000 --- a/cmake/core.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# scripts/generate-file-lists.js to change the source files for this target. -load_sources_list(MBGL_CORE_FILES src/core-files.json) -add_library(mbgl-core STATIC ${MBGL_CORE_FILES}) - -target_include_directories(mbgl-core - PUBLIC include - PRIVATE src -) - -target_link_libraries(mbgl-core PRIVATE - mbgl-vendor-earcut.hpp - mbgl-vendor-eternal - mbgl-vendor-expected - mbgl-vendor-geojson-vt-cpp - mbgl-vendor-shelf-pack-cpp - mbgl-vendor-unique_resource - mbgl-vendor-wagyu -) - -# linux uses ICU from mason, other platforms use vendored ICU -if(NOT MBGL_PLATFORM STREQUAL "linux") - set(ICU_LIBRARY "mbgl-vendor-icu") -endif() - -# FIXME: We should not leak these many -# libraries in our public interface. -target_link_libraries(mbgl-core PUBLIC - mbgl-vendor-boost - mapbox-base-extras - mapbox-base - ${ICU_LIBRARY} - mbgl-vendor-polylabel - mbgl-vendor-protozero - Mapbox::Base::Extras::rapidjson - mbgl-vendor-vector-tile -) - -mbgl_platform_core() - -create_source_groups(mbgl-core) - -set_target_properties(mbgl-core PROPERTIES FOLDER "Core") - -xcode_create_scheme(TARGET mbgl-core) - -initialize_xcode_cxx_build_settings(mbgl-core) diff --git a/cmake/doxygen.cmake b/cmake/doxygen.cmake deleted file mode 100644 index b61e878f8..000000000 --- a/cmake/doxygen.cmake +++ /dev/null @@ -1,18 +0,0 @@ -find_package(Doxygen) -if(DOXYGEN_FOUND) - set(DOXYGEN_PROJECT_NAME "Mapbox GL Native") - set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs") - set(DOXYGEN_GENERATE_XML TRUE) - set(DOXYGEN_QUIET YES) - set(DOXYGEN_WARN_LOGFILE ${CMAKE_BINARY_DIR}/doxygen_warn.log) - - doxygen_add_docs(generate_xml_doxygen - ${CMAKE_SOURCE_DIR}/include - ) - - add_custom_target(doxygen_coverage - COMMAND ${CMAKE_SOURCE_DIR}/scripts/doxy-coverage.py --quiet --noerror --json="${CMAKE_BINARY_DIR}/doxygen-coverage.json" "${CMAKE_BINARY_DIR}/docs/xml" - COMMENT "Checking documentation coverage" - DEPENDS generate_xml_doxygen - ) -endif() diff --git a/cmake/empty.cpp b/cmake/empty.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/cmake/executable.xcscheme b/cmake/executable.xcscheme deleted file mode 100644 index 44146a621..000000000 --- a/cmake/executable.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - ${XCSCHEME_COMMAND_LINE_ARGS} - - - - - - - - - - - - - - - - - - - diff --git a/cmake/expression-test.cmake b/cmake/expression-test.cmake deleted file mode 100644 index da4f90d75..000000000 --- a/cmake/expression-test.cmake +++ /dev/null @@ -1,29 +0,0 @@ -add_executable(mbgl-expression-test - expression-test/main.cpp - expression-test/expression_test_parser.cpp - expression-test/expression_test_runner.cpp - expression-test/expression_test_logger.cpp - expression-test/test_runner_common.cpp - expression-test/test_runner_common.hpp -) - -if(APPLE) - target_link_libraries(mbgl-expression-test PRIVATE mbgl-loop-darwin) -else() - target_link_libraries(mbgl-expression-test PRIVATE mbgl-loop-uv) -endif() - -target_include_directories(mbgl-expression-test - PRIVATE src - PRIVATE expression-test - PRIVATE render-test -) - -target_link_libraries(mbgl-expression-test PRIVATE - mbgl-core - Mapbox::Base::Extras::args - Mapbox::Base::Extras::filesystem - Mapbox::Base::Extras::rapidjson -) - -add_definitions(-DTEST_RUNNER_ROOT_PATH="${CMAKE_SOURCE_DIR}") diff --git a/cmake/filesource.cmake b/cmake/filesource.cmake deleted file mode 100644 index 4d7febdd7..000000000 --- a/cmake/filesource.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# Modify platform/default/filesource-files.json to change the source files for this target. -load_sources_list(MBGL_FILESOURCE_FILES platform/default/filesource-files.json) -add_library(mbgl-filesource STATIC ${MBGL_FILESOURCE_FILES}) - -target_include_directories(mbgl-filesource - PRIVATE include - PRIVATE src - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-filesource - PUBLIC mbgl-core - PUBLIC mbgl-vendor-expected -) - -mbgl_filesource() - -create_source_groups(mbgl-filesource) - -set_target_properties(mbgl-filesource PROPERTIES FOLDER "Core") - -xcode_create_scheme(TARGET mbgl-filesource) - -initialize_xcode_cxx_build_settings(mbgl-filesource) diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake deleted file mode 100644 index 89a7768ad..000000000 --- a/cmake/glfw.cmake +++ /dev/null @@ -1,49 +0,0 @@ -add_executable(mbgl-glfw - platform/glfw/main.cpp -) - -target_sources(mbgl-glfw - PRIVATE platform/glfw/glfw_view.hpp - PRIVATE platform/glfw/glfw_view.cpp - PRIVATE platform/glfw/glfw_backend.hpp - PRIVATE platform/glfw/glfw_gl_backend.hpp - PRIVATE platform/glfw/glfw_gl_backend.cpp - PRIVATE platform/glfw/glfw_renderer_frontend.hpp - PRIVATE platform/glfw/glfw_renderer_frontend.cpp - PRIVATE platform/glfw/settings_json.hpp - PRIVATE platform/glfw/settings_json.cpp -) - -target_include_directories(mbgl-glfw - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-glfw - PRIVATE mbgl-core - PRIVATE glfw - PRIVATE mbgl-vendor-cheap-ruler-cpp - PRIVATE Mapbox::Base::Extras::args -) - -mbgl_platform_glfw() - -create_source_groups(mbgl-glfw) - -set_target_properties(mbgl-glfw PROPERTIES FOLDER "Executables") - -initialize_xcode_cxx_build_settings(mbgl-glfw) - -xcode_create_scheme( - TARGET mbgl-glfw - OPTIONAL_ARGS - "--style=file.json" - "--cache=/tmp/mbgl-cache.db" - "--lon=0" - "--lat=0" - "--zoom=1" - "--bearing=0" - "--pitch=0" - "--fullscreen" - "--offline" - "--benchmark" -) diff --git a/cmake/library.xcscheme b/cmake/library.xcscheme deleted file mode 100644 index 320a2f851..000000000 --- a/cmake/library.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake deleted file mode 100644 index 9e52639c5..000000000 --- a/cmake/loop-darwin.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# Modify platform/darwin/loop-files.json to change the source files for this target. -load_sources_list(MBGL_LOOP_DARWIN_FILES platform/darwin/loop-files.json) -add_library(mbgl-loop-darwin STATIC ${MBGL_LOOP_DARWIN_FILES}) - -target_include_directories(mbgl-loop-darwin - PRIVATE include - PRIVATE src -) - -target_link_libraries(mbgl-loop-darwin PUBLIC - mapbox-base -) - -create_source_groups(mbgl-loop-darwin) - -set_target_properties(mbgl-loop-darwin PROPERTIES FOLDER "Core") - -initialize_xcode_cxx_build_settings(mbgl-loop-darwin) - -xcode_create_scheme(TARGET mbgl-loop-darwin) diff --git a/cmake/loop-uv.cmake b/cmake/loop-uv.cmake deleted file mode 100644 index 320545b3c..000000000 --- a/cmake/loop-uv.cmake +++ /dev/null @@ -1,14 +0,0 @@ -add_library(mbgl-loop-uv INTERFACE) - -target_sources(mbgl-loop-uv INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/async_task.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/run_loop.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/timer.cpp -) - -target_include_directories(mbgl-loop-uv INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_SOURCE_DIR}/src -) - -create_source_groups(mbgl-loop-uv) diff --git a/cmake/mason-dependencies.cmake b/cmake/mason-dependencies.cmake deleted file mode 100644 index 5ec6a44a7..000000000 --- a/cmake/mason-dependencies.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# All dependencies in a single separate file so its checksum can be used in a CI cache key name - -if(MBGL_PLATFORM STREQUAL "android") - # noop -elseif(MBGL_PLATFORM STREQUAL "ios") - # noop -elseif(MBGL_PLATFORM STREQUAL "linux") - mason_use(libuv VERSION 1.9.1) - mason_use(libpng VERSION 1.6.25) - mason_use(libjpeg-turbo VERSION 1.5.0) - mason_use(icu VERSION 63.1-min-static-data) - - if(WITH_EGL) - mason_use(swiftshader VERSION 2018-05-31) - endif() -elseif(MBGL_PLATFORM STREQUAL "macos") - if(WITH_EGL) - mason_use(swiftshader VERSION 2018-05-31) - endif() -elseif(MBGL_PLATFORM STREQUAL "qt") - if(NOT WITH_QT_DECODERS) - mason_use(libjpeg-turbo VERSION 1.5.0) - mason_use(libpng VERSION 1.6.25) - endif() -endif() diff --git a/cmake/mason.cmake b/cmake/mason.cmake deleted file mode 100644 index c0795d962..000000000 --- a/cmake/mason.cmake +++ /dev/null @@ -1,227 +0,0 @@ -# Mason CMake - -include(CMakeParseArguments) - -function(mason_detect_platform) - # Determine platform - if(NOT MASON_PLATFORM) - # we call uname -s manually here since - # CMAKE_HOST_SYSTEM_NAME will not be defined before the project() call - execute_process( - COMMAND uname -s - OUTPUT_VARIABLE UNAME - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if (UNAME STREQUAL "Darwin") - set(MASON_PLATFORM "osx" PARENT_SCOPE) - else() - set(MASON_PLATFORM "linux" PARENT_SCOPE) - endif() - endif() - - # Determine platform version string - if(NOT MASON_PLATFORM_VERSION) - # Android Studio only passes ANDROID_ABI, but we need to adjust that to the Mason - if(MASON_PLATFORM STREQUAL "android" AND NOT MASON_PLATFORM_VERSION) - if (ANDROID_ABI STREQUAL "armeabi-v7a") - set(MASON_PLATFORM_VERSION "arm-v7-14" PARENT_SCOPE) - elseif (ANDROID_ABI STREQUAL "arm64-v8a") - set(MASON_PLATFORM_VERSION "arm-v8-21" PARENT_SCOPE) - elseif (ANDROID_ABI STREQUAL "x86") - set(MASON_PLATFORM_VERSION "x86-14" PARENT_SCOPE) - elseif (ANDROID_ABI STREQUAL "x86_64") - set(MASON_PLATFORM_VERSION "x86-64-21" PARENT_SCOPE) - else() - message(FATAL_ERROR "Unknown ANDROID_ABI '${ANDROID_ABI}'.") - endif() - elseif(MASON_PLATFORM STREQUAL "ios") - set(MASON_PLATFORM_VERSION "8.0" PARENT_SCOPE) - else() - execute_process( - COMMAND uname -m - OUTPUT_VARIABLE MASON_PLATFORM_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(MASON_PLATFORM_VERSION "${MASON_PLATFORM_VERSION}" PARENT_SCOPE) - endif() - endif() -endfunction() - -function(mason_use _PACKAGE) - if(NOT _PACKAGE) - message(FATAL_ERROR "[Mason] No package name given") - endif() - - cmake_parse_arguments("" "HEADER_ONLY" "VERSION" "" ${ARGN}) - - if(_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "[Mason] mason_use() called with unrecognized arguments: ${_UNPARSED_ARGUMENTS}") - endif() - - if(NOT _VERSION) - message(FATAL_ERROR "[Mason] Specifying a version is required") - endif() - - if(MASON_PACKAGE_${_PACKAGE}_INVOCATION STREQUAL "${MASON_INVOCATION}") - # Check that the previous invocation of mason_use didn't select another version of this package - if(NOT MASON_PACKAGE_${_PACKAGE}_VERSION STREQUAL ${_VERSION}) - message(FATAL_ERROR "[Mason] Already using ${_PACKAGE} ${MASON_PACKAGE_${_PACKAGE}_VERSION}. Cannot select version ${_VERSION}.") - endif() - else() - if(_HEADER_ONLY) - set(_PLATFORM_ID "headers") - else() - set(_PLATFORM_ID "${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}") - endif() - - set(_SLUG "${_PLATFORM_ID}/${_PACKAGE}/${_VERSION}") - set(_INSTALL_PATH "${MASON_PACKAGE_DIR}/${_SLUG}") - file(RELATIVE_PATH _INSTALL_PATH_RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${_INSTALL_PATH}") - - if(NOT EXISTS "${_INSTALL_PATH}") - set(_CACHE_PATH "${MASON_PACKAGE_DIR}/.binaries/${_SLUG}.tar.gz") - if (NOT EXISTS "${_CACHE_PATH}") - # Download the package - set(_URL "${MASON_REPOSITORY}/${_SLUG}.tar.gz") - message("[Mason] Downloading package ${_URL}...") - - set(_STATUS) - get_filename_component(_CACHE_DIR "${_CACHE_PATH}" DIRECTORY) - file(MAKE_DIRECTORY "${_CACHE_DIR}") - file(DOWNLOAD "${_URL}" "${_CACHE_PATH}.tmp" STATUS _STATUS TLS_VERIFY ON) - - list(GET _STATUS 0 _STATUS_CODE) - list(GET _STATUS 1 _STATUS_STRING) - if(NOT _STATUS_CODE EQUAL 0) - message(FATAL_ERROR "[Mason] Failed to download ${_URL}: ${_STATUS_STRING}") - else() - # We downloaded to a temporary file to prevent half-finished downloads - file(RENAME "${_CACHE_PATH}.tmp" "${_CACHE_PATH}") - endif() - endif() - - # Unpack the package - message("[Mason] Unpacking package to ${_INSTALL_PATH_RELATIVE}...") - file(MAKE_DIRECTORY "${_INSTALL_PATH}") - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzf "${_CACHE_PATH}" - WORKING_DIRECTORY "${_INSTALL_PATH}") - endif() - - # Error out if there is no config file. - if(NOT EXISTS "${_INSTALL_PATH}/mason.ini") - message(FATAL_ERROR "[Mason] Could not find mason.ini for package ${_PACKAGE} ${_VERSION}") - endif() - - set(MASON_PACKAGE_${_PACKAGE}_PREFIX "${_INSTALL_PATH}" CACHE STRING "${_PACKAGE} ${_INSTALL_PATH}" FORCE) - mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_PREFIX) - - # Load the configuration from the ini file - file(STRINGS "${_INSTALL_PATH}/mason.ini" _CONFIG_FILE) - foreach(_LINE IN LISTS _CONFIG_FILE) - string(REGEX MATCH "^([a-z_]+) *= *" _KEY "${_LINE}") - if (_KEY) - string(LENGTH "${_KEY}" _KEY_LENGTH) - string(SUBSTRING "${_LINE}" ${_KEY_LENGTH} -1 _VALUE) - string(REGEX REPLACE ";.*$" "" _VALUE "${_VALUE}") # Trim trailing commas - string(REPLACE "{prefix}" "${_INSTALL_PATH}" _VALUE "${_VALUE}") - string(STRIP "${_VALUE}" _VALUE) - string(REPLACE "=" "" _KEY "${_KEY}") - string(STRIP "${_KEY}" _KEY) - string(TOUPPER "${_KEY}" _KEY) - if(_KEY STREQUAL "INCLUDE_DIRS" OR _KEY STREQUAL "STATIC_LIBS" ) - separate_arguments(_VALUE) - endif() - set(MASON_PACKAGE_${_PACKAGE}_${_KEY} "${_VALUE}" CACHE STRING "${_PACKAGE} ${_KEY}" FORCE) - mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_${_KEY}) - endif() - endforeach() - - # Compare version in the package to catch errors early on - if(NOT _VERSION STREQUAL MASON_PACKAGE_${_PACKAGE}_VERSION) - message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has version '${MASON_PACKAGE_${_PACKAGE}_VERSION}', but required '${_VERSION}'") - endif() - - if(NOT _PACKAGE STREQUAL MASON_PACKAGE_${_PACKAGE}_NAME) - message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has name '${MASON_PACKAGE_${_PACKAGE}_NAME}', but required '${_NAME}'") - endif() - - if(NOT _HEADER_ONLY) - if(NOT MASON_PLATFORM STREQUAL MASON_PACKAGE_${_PACKAGE}_PLATFORM) - message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has platform '${MASON_PACKAGE_${_PACKAGE}_PLATFORM}', but required '${MASON_PLATFORM}'") - endif() - - if(NOT MASON_PLATFORM_VERSION STREQUAL MASON_PACKAGE_${_PACKAGE}_PLATFORM_VERSION) - message(FATAL_ERROR "[Mason] Package at ${_INSTALL_PATH_RELATIVE} has platform version '${MASON_PACKAGE_${_PACKAGE}_PLATFORM_VERSION}', but required '${MASON_PLATFORM_VERSION}'") - endif() - endif() - - # Concatenate the static libs and libraries - set(_LIBRARIES) - list(APPEND _LIBRARIES ${MASON_PACKAGE_${_PACKAGE}_STATIC_LIBS} ${MASON_PACKAGE_${_PACKAGE}_LDFLAGS}) - set(MASON_PACKAGE_${_PACKAGE}_LIBRARIES "${_LIBRARIES}" CACHE STRING "${_PACKAGE} _LIBRARIES" FORCE) - mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_LIBRARIES) - - if(NOT _HEADER_ONLY) - string(REGEX MATCHALL "(^| +)-L *([^ ]+)" MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LDFLAGS}") - string(REGEX REPLACE "(^| +)-L *" "\\1" MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}") - set(MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS "${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}" CACHE STRING "${_PACKAGE} ${MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS}" FORCE) - mark_as_advanced(MASON_PACKAGE_${_PACKAGE}_LIBRARY_DIRS) - endif() - - # Store invocation ID to prevent different versions of the same package in one invocation - set(MASON_PACKAGE_${_PACKAGE}_INVOCATION "${MASON_INVOCATION}" CACHE INTERNAL "${_PACKAGE} invocation ID" FORCE) - endif() -endfunction() - -macro(target_add_mason_package _TARGET _VISIBILITY _PACKAGE) - if (NOT MASON_PACKAGE_${_PACKAGE}_INVOCATION) - message(FATAL_ERROR "[Mason] Package ${_PACKAGE} has not been initialized yet") - endif() - - target_include_directories(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_INCLUDE_DIRS}") - target_compile_definitions(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_DEFINITIONS}") - target_compile_options(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_OPTIONS}") - target_link_libraries(${_TARGET} ${_VISIBILITY} "${MASON_PACKAGE_${_PACKAGE}_LIBRARIES}") -endmacro() - -# Setup - -string(RANDOM LENGTH 16 MASON_INVOCATION) - -# Read environment variables if CMake is run in command mode -if (CMAKE_ARGC) - set(MASON_PLATFORM "$ENV{MASON_PLATFORM}") - set(MASON_PLATFORM_VERSION "$ENV{MASON_PLATFORM_VERSION}") - set(MASON_PACKAGE_DIR "$ENV{MASON_PACKAGE_DIR}") - set(MASON_REPOSITORY "$ENV{MASON_REPOSITORY}") -endif() - -# Directory where Mason packages are located; typically ends with mason_packages -if (NOT MASON_PACKAGE_DIR) - set(MASON_PACKAGE_DIR "${CMAKE_SOURCE_DIR}/mason_packages") -endif() - -# URL prefix of where packages are located. -if (NOT MASON_REPOSITORY) - set(MASON_REPOSITORY "https://mason-binaries.s3.amazonaws.com") -endif() - -mason_detect_platform() - -# Execute commands if CMake is run in command mode\ -if (CMAKE_ARGC AND "${CMAKE_SCRIPT_MODE_FILE}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}/mason.cmake") - # Collect remaining arguments for passing to mason_use - set(_MASON_ARGS) - foreach(I RANGE 4 ${CMAKE_ARGC}) - list(APPEND _MASON_ARGS "${CMAKE_ARGV${I}}") - endforeach() - - # Install the package - mason_use(${_MASON_ARGS}) - - # Optionally print variables - if(DEFINED MASON_PACKAGE_${CMAKE_ARGV4}_${CMAKE_ARGV3}) - # CMake can't write to stdout with message() - execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${MASON_PACKAGE_${CMAKE_ARGV4}_${CMAKE_ARGV3}}") - endif() -endif() diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake deleted file mode 100644 index 1b4338a0b..000000000 --- a/cmake/mbgl.cmake +++ /dev/null @@ -1,232 +0,0 @@ -if (NOT MBGL_PLATFORM) - if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") - set(MBGL_PLATFORM "macos") - else() - set(MBGL_PLATFORM "linux") - endif() -endif() - -if(WITH_NODEJS) - find_program(NodeJS_EXECUTABLE NAMES nodejs node) - if (NOT NodeJS_EXECUTABLE) - message(FATAL_ERROR "Could not find Node.js") - endif() - - find_program(npm_EXECUTABLE NAMES npm) - if (NOT npm_EXECUTABLE) - message(FATAL_ERROR "Could not find npm") - endif() - - execute_process( - COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.node)" - RESULT_VARIABLE _STATUS_CODE - OUTPUT_VARIABLE NodeJS_VERSION - ERROR_VARIABLE _STATUS_MESSAGE - ) - if(NOT _STATUS_CODE EQUAL 0) - message(FATAL_ERROR "Could not detect Node.js version: ${_STATUS_MESSAGE}") - endif() - - execute_process( - COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.modules)" - RESULT_VARIABLE _STATUS_CODE - OUTPUT_VARIABLE NodeJS_ABI - ERROR_VARIABLE _STATUS_MESSAGE - ) - if(NOT _STATUS_CODE EQUAL 0) - message(FATAL_ERROR "Could not detect Node.js ABI version: ${_STATUS_MESSAGE}") - endif() - - function(_npm_install DIRECTORY NAME ADDITIONAL_DEPS) - SET(NPM_INSTALL_FAILED FALSE) - if("${DIRECTORY}/package.json" IS_NEWER_THAN "${DIRECTORY}/node_modules/.${NAME}.stamp") - message(STATUS "Running 'npm install' for ${NAME}...") - execute_process( - COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --verbose --ignore-scripts - WORKING_DIRECTORY "${DIRECTORY}" - RESULT_VARIABLE NPM_INSTALL_FAILED - OUTPUT_VARIABLE NPM_OUTPUT - ERROR_VARIABLE NPM_OUTPUT) - message(STATUS "Finished 'npm install' for ${NAME}...") - if(NOT NPM_INSTALL_FAILED) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${DIRECTORY}/node_modules/.${NAME}.stamp") - else() - message(FATAL_ERROR "NPM install failed:\n${NPM_OUTPUT}") - endif() - endif() - - add_custom_command( - OUTPUT "${DIRECTORY}/node_modules/.${NAME}.stamp" - COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --ignore-scripts - COMMAND ${CMAKE_COMMAND} -E touch "${DIRECTORY}/node_modules/.${NAME}.stamp" - WORKING_DIRECTORY "${DIRECTORY}" - DEPENDS ${ADDITIONAL_DEPS} "${DIRECTORY}/package.json" - COMMENT "Running 'npm install' for ${NAME}...") - endfunction() - - # Run submodule update - set(MBGL_SUBMODULES mapbox-gl-js) - if(MBGL_PLATFORM STREQUAL "ios") - list(APPEND MBGL_SUBMODULES platform/ios/vendor/mapbox-events-ios) - endif() - if(MBGL_PLATFORM STREQUAL "ios" OR MBGL_PLATFORM STREQUAL "macos") - list(APPEND MBGL_SUBMODULES platform/darwin/docs/theme) - endif() - - message(STATUS "Updating submodules...") - execute_process( - COMMAND git submodule update --init ${MBGL_SUBMODULES} - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") - - if(NOT EXISTS "${CMAKE_SOURCE_DIR}/mapbox-gl-js/node_modules") - # Symlink mapbox-gl-js/node_modules so that the modules that are - # about to be installed get cached between CI runs. - execute_process( - COMMAND ln -sF ../node_modules . - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/mapbox-gl-js") - endif() - - # Add target for running submodule update during builds - add_custom_target( - update-submodules ALL - COMMAND git submodule update --init ${MBGL_SUBMODULES} - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - COMMENT "Updating submodules..." - ) - set_target_properties(update-submodules PROPERTIES FOLDER "Misc") - - # Run npm install for both directories, and add custom commands, and a target that depends on them. - _npm_install("${CMAKE_SOURCE_DIR}" mapbox-gl-native update-submodules) - _npm_install("${CMAKE_SOURCE_DIR}/mapbox-gl-js/test/integration" mapbox-gl-js "${CMAKE_SOURCE_DIR}/node_modules/.mapbox-gl-native.stamp") - add_custom_target( - npm-install ALL - DEPENDS "${CMAKE_SOURCE_DIR}/node_modules/.mapbox-gl-js.stamp" - ) - set_target_properties(npm-install PROPERTIES FOLDER "Misc") -endif() - -# Generate source groups so the files are properly sorted in IDEs like Xcode. -function(create_source_groups target) - get_target_property(type ${target} TYPE) - if(type AND type STREQUAL "INTERFACE_LIBRARY") - get_target_property(sources ${target} INTERFACE_SOURCES) - else() - get_target_property(sources ${target} SOURCES) - endif() - foreach(file ${sources}) - get_filename_component(file "${file}" ABSOLUTE) - string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" group "${file}") - get_filename_component(group "${group}" DIRECTORY) - string(REPLACE "/" "\\" group "${group}") - source_group("${group}" FILES "${file}") - endforeach() -endfunction() - -function(load_sources_list VAR FILELIST) - set(_FILES) - file(READ "${FILELIST}" _LINES) - # Note: this isn't really parsing JSON, but it's good enough for our purposes. - set(_REGEX "(^|\n) *(\"([^\"]+)\" *: *)?\"([^\"]+)\",?(\n|$)") - string(REGEX MATCHALL "${_REGEX}" _MATCHES "${_LINES}") - foreach(_MATCH IN LISTS _MATCHES) - string(REGEX MATCH "${_REGEX}" _FILE "${_MATCH}") - if (_FILE AND NOT CMAKE_MATCH_3 STREQUAL "//") - list(APPEND _FILES "${CMAKE_SOURCE_DIR}/${CMAKE_MATCH_4}") - endif() - endforeach() - set(${VAR} "${_FILES}" PARENT_SCOPE) - set_property(DIRECTORY "${CMAKE_SOURCE_DIR}" APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${FILELIST}") -endfunction() - -function(target_sources_from_file TARGET TYPE FILELIST) - load_sources_list(_FILELIST "${FILELIST}") - target_sources(${TARGET} ${TYPE} "${_FILELIST}") -endfunction() - -# Creates a library target for a vendored dependency -function(add_vendor_target NAME TYPE) - set(INCLUDE_TYPE "INTERFACE") - set(SOURCE_TYPE "INTERFACE") - if (TYPE STREQUAL "STATIC" OR TYPE STREQUAL "SHARED") - add_library(${NAME} ${TYPE} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/empty.cpp") - set(INCLUDE_TYPE "PUBLIC") - set(SOURCE_TYPE "PRIVATE") - set_target_properties(${NAME} PROPERTIES SOURCES "") - else() - add_library(${NAME} ${TYPE}) - endif() - set_target_properties(${NAME} PROPERTIES INTERFACE_SOURCES "") - file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/${NAME}/files.txt" FILES) - foreach(FILE IN LISTS FILES) - target_sources(${NAME} ${SOURCE_TYPE} "${CMAKE_CURRENT_SOURCE_DIR}/vendor/${NAME}/${FILE}") - endforeach() - target_include_directories(${NAME} SYSTEM ${INCLUDE_TYPE} "${CMAKE_CURRENT_SOURCE_DIR}/vendor/${NAME}/include") - create_source_groups(${NAME}) -endfunction() - -# This little macro lets you set any XCode specific property -macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) - set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) -endmacro (set_xcode_property) - -function(set_xcconfig_target_properties target) - # Create a list of linked libraries for use in the xcconfig generation script. - get_property(result TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES) - string(GENEX_STRIP "${result}" result) - # Remove target names from the list of linker flags, since Xcode can't deal with them. - set(link_flags) - foreach(item IN LISTS result) - if (NOT TARGET ${item}) - list(APPEND link_flags ${item}) - endif() - endforeach() - string(REGEX REPLACE "(^|;)-framework " "\\1-framework;" link_flags "${link_flags}") - string(REPLACE ";" "\" \"" link_flags "${link_flags}") - set_xcode_property(${target} XCCONFIG_LINK_LIBRARIES "${link_flags}") -endfunction() - -# Set Xcode project build settings to be consistent with the CXX flags we're -# using. (Otherwise, Xcode's defaults may override some of these.) -function(initialize_xcode_cxx_build_settings target) - # -Wall - set_xcode_property(${target} GCC_WARN_SIGN_COMPARE YES) - set_xcode_property(${target} GCC_WARN_UNINITIALIZED_AUTOS YES) - set_xcode_property(${target} GCC_WARN_UNKNOWN_PRAGMAS YES) - set_xcode_property(${target} GCC_WARN_UNUSED_FUNCTION YES) - set_xcode_property(${target} GCC_WARN_UNUSED_LABEL YES) - set_xcode_property(${target} GCC_WARN_UNUSED_PARAMETER YES) - set_xcode_property(${target} GCC_WARN_UNUSED_VARIABLE YES) - - # -Wextra - set_xcode_property(${target} CLANG_WARN_EMPTY_BODY YES) - set_xcode_property(${target} GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS YES) - - # -Wshadow - set_xcode_property(${target} GCC_WARN_SHADOW YES) - - # -Wnon-virtual-dtor - set_xcode_property(${target} GCC_WARN_NON_VIRTUAL_DESTRUCTOR YES) - - # -Wnon-literal-conversion - set_xcode_property(${target} CLANG_WARN_NON_LITERAL_NULL_CONVERSION YES) - - # -Wrange-loop-analysis - set_xcode_property(${target} CLANG_WARN_RANGE_LOOP_ANALYSIS YES) - - # -flto - set_xcode_property(${target} LLVM_LTO $<$,$>:YES>) - - # Make all build configurations debuggable — except Release. - set_xcode_property(${target} GCC_GENERATE_DEBUGGING_SYMBOLS $<$>:YES>) - - # -Wunguarded-availability - set_xcode_property(${target} CLANG_WARN_UNGUARDED_AVAILABILITY YES_AGGRESSIVE) - - if (DEFINED ENV{CI}) - set_xcode_property(${target} COMPILER_INDEX_STORE_ENABLE NO) - endif() -endfunction() - -# CMake 3.1 does not have this yet. -set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") -set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") diff --git a/cmake/node.cmake b/cmake/node.cmake deleted file mode 100644 index edea4df71..000000000 --- a/cmake/node.cmake +++ /dev/null @@ -1,142 +0,0 @@ -# Load Node.js -set(NODE_MODULE_CACHE_DIR "${CMAKE_SOURCE_DIR}/build/headers") -include(node_modules/@mapbox/cmake-node-module/module.cmake) - -add_library(mbgl-loop-node INTERFACE) - -target_sources(mbgl-loop-node INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/async_task.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/run_loop.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/src/mbgl/util/timer.cpp -) - -target_include_directories(mbgl-loop-node INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${CMAKE_CURRENT_SOURCE_DIR}/src -) - -create_source_groups(mbgl-loop-node) - - -add_node_module(mbgl-node - INSTALL_PATH "lib/{node_abi}/mbgl.node" - NAN_VERSION "2.14.0" - - # Don't build for Node 4.x, 5.x, 7.x, 9.x, 11.x and 12.x - # See https://nodejs.org/en/download/releases/ for mapping of Node version to ABI number. - # Changes to this property should happen in tandem with updates to the version targets - # in platform/node/scripts/publish.sh and the "node" engines property in package.json. - EXCLUDE_NODE_ABIS 46 47 51 59 67 72 -) - -target_sources(mbgl-node INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_mapbox_gl_native.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_mapbox_gl_native.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_logging.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_logging.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_conversion.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_map.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_map.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_request.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_request.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_feature.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_feature.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_expression.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/node_expression.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform/node/src/util/async_queue.hpp -) - -target_include_directories(mbgl-node INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/platform/default/include -) - -target_link_libraries(mbgl-node INTERFACE - mbgl-core - mbgl-loop-node -) - -set_target_properties(mbgl-node.all PROPERTIES FOLDER "Node.js") - -add_custom_target(mbgl-node.active DEPENDS mbgl-node.abi-${NodeJS_ABI}) -set_target_properties(mbgl-node.active PROPERTIES FOLDER "Node.js") - -mbgl_platform_node() - -create_source_groups(mbgl-node) - -foreach(ABI IN LISTS mbgl-node::abis) - initialize_xcode_cxx_build_settings(mbgl-node.abi-${ABI}) - set_target_properties(mbgl-node.abi-${ABI} PROPERTIES FOLDER "Node.js") - xcode_create_scheme( - TARGET mbgl-node.abi-${ABI} - NAME "mbgl-node (ABI ${ABI})" - ) -endforeach() - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE library - NAME "mbgl-node (Active ABI)" -) - -xcode_create_scheme( - TARGET mbgl-node.all - TYPE library - NAME "mbgl-node (All ABIs)" -) - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE node - NAME "node tests (Active ABI)" - ARGS - "node_modules/.bin/tape platform/node/test/js/**/*.test.js" -) - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE node - NAME "node render tests (Active ABI)" - ARGS - "-r esm" - "platform/node/test/render.test.js" - OPTIONAL_ARGS - "group" - "test" -) - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE node - NAME "node query tests (Active ABI)" - ARGS - "-r esm" - "platform/node/test/query.test.js" - OPTIONAL_ARGS - "group" - "test" -) - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE node - NAME "node expression tests (Active ABI)" - ARGS - "-r esm" - "platform/node/test/expression.test.js" - OPTIONAL_ARGS - "group" - "test" -) - -xcode_create_scheme( - TARGET mbgl-node.active - TYPE node - NAME "node-benchmark (Active ABI)" - ARGS - "-r esm" - "platform/node/test/benchmark.js" - OPTIONAL_ARGS - "group" - "test" -) diff --git a/cmake/node.xcscheme b/cmake/node.xcscheme deleted file mode 100644 index d873a3d61..000000000 --- a/cmake/node.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - ${XCSCHEME_COMMAND_LINE_ARGS} - - - - - - - - - - - - - - - - - - - diff --git a/cmake/offline.cmake b/cmake/offline.cmake deleted file mode 100644 index 5a6d4e04c..000000000 --- a/cmake/offline.cmake +++ /dev/null @@ -1,35 +0,0 @@ -add_executable(mbgl-offline - bin/offline.cpp -) - -target_include_directories(mbgl-offline - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-offline - PRIVATE mbgl-core - PRIVATE Mapbox::Base::Extras::args -) - -mbgl_platform_offline() - -create_source_groups(mbgl-offline) - -initialize_xcode_cxx_build_settings(mbgl-offline) - -set_target_properties(mbgl-offline PROPERTIES FOLDER "Executables") - -xcode_create_scheme( - TARGET mbgl-offline - OPTIONAL_ARGS - "--style=file.json" - "--north=37.2" - "--west=-122.8" - "--south=38.1" - "--east=-121.7" - "--minZoom=0.0" - "--maxZoom=15.0" - "--pixelRatio=1.0" - "--token=" - "--output=offline.db" -) diff --git a/cmake/render-test.cmake b/cmake/render-test.cmake deleted file mode 100644 index 8726fb465..000000000 --- a/cmake/render-test.cmake +++ /dev/null @@ -1,60 +0,0 @@ -add_executable( - mbgl-render-test - expression-test/test_runner_common.cpp - expression-test/test_runner_common.hpp - platform/default/src/mbgl/render-test/main.cpp - render-test/allocation_index.cpp - render-test/allocation_index.hpp - render-test/filesystem.hpp - render-test/filesystem.hpp - render-test/include/mbgl/render_test.hpp - render-test/metadata.hpp - render-test/parser.cpp - render-test/parser.hpp - render-test/render_test.cpp - render-test/runner.cpp - render-test/runner.hpp -) - -if(APPLE) - target_link_libraries( - mbgl-render-test - PRIVATE mbgl-loop-darwin - ) -else() - target_link_libraries( - mbgl-render-test - PRIVATE mbgl-loop-uv - ) -endif() - -target_include_directories( - mbgl-render-test - PRIVATE src - PRIVATE platform/default/include - PRIVATE render-test -) - -target_include_directories( - mbgl-render-test - PUBLIC render-test/include - PUBLIC include -) - -target_link_libraries( - mbgl-render-test - PRIVATE - mbgl-core - mbgl-filesource - Mapbox::Base::Extras::args - mbgl-vendor-expected - Mapbox::Base::Extras::filesystem - Mapbox::Base::pixelmatch-cpp - Mapbox::Base::Extras::rapidjson -) - -create_source_groups(mbgl-render-test) - -set_target_properties(mbgl-render-test PROPERTIES FOLDER "Executables") - -add_definitions(-DTEST_RUNNER_ROOT_PATH="${CMAKE_SOURCE_DIR}") diff --git a/cmake/render.cmake b/cmake/render.cmake deleted file mode 100644 index e9c6d89c8..000000000 --- a/cmake/render.cmake +++ /dev/null @@ -1,39 +0,0 @@ -add_executable(mbgl-render - bin/render.cpp -) - -target_include_directories(mbgl-render - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-render - PRIVATE mbgl-core - PRIVATE Mapbox::Base::Extras::args -) - -mbgl_platform_render() - -create_source_groups(mbgl-render) - -initialize_xcode_cxx_build_settings(mbgl-render) - -set_target_properties(mbgl-render PROPERTIES FOLDER "Executables") - -xcode_create_scheme( - TARGET mbgl-render - OPTIONAL_ARGS - "--style=file.json" - "--lon=0" - "--lat=0" - "--zoom=0" - "--bearing=0" - "--pitch=0" - "--width=512" - "--height=512" - "--ratio=1" - "--token=" - "--debug" - "--output=out.png" - "--cache=cache.sqlite" - "--assets=." -) diff --git a/cmake/sqlite.cmake b/cmake/sqlite.cmake deleted file mode 100644 index cc579b22a..000000000 --- a/cmake/sqlite.cmake +++ /dev/null @@ -1,47 +0,0 @@ -add_vendor_target(sqlite STATIC) - -target_compile_definitions(sqlite - PRIVATE "-DVERSION=\"3.24.0\"" - PRIVATE "-DSTDC_HEADERS=int" - PRIVATE "-DHAVE_SYS_TYPES_H=1" - PRIVATE "-DHAVE_SYS_STAT_H=1" - PRIVATE "-DHAVE_STDLIB_H=1" - PRIVATE "-DHAVE_STRING_H=1" - PRIVATE "-DHAVE_MEMORY_H=1" - PRIVATE "-DHAVE_STRINGS_H=1" - PRIVATE "-DHAVE_INTTYPES_H=1" - PRIVATE "-DHAVE_STDINT_H=1" - PRIVATE "-DHAVE_UNISTD_H=1" - PRIVATE "-DHAVE_DLFCN_H=1" - PRIVATE "-DHAVE_FDATASYNC=1" - PRIVATE "-DHAVE_USLEEP=1" - PRIVATE "-DHAVE_LOCALTIME_R=1" - PRIVATE "-DHAVE_GMTIME_R=1" - PRIVATE "-DHAVE_DECL_STRERROR_R=1" - PRIVATE "-DHAVE_STRERROR_R=1" - PRIVATE "-DHAVE_ZLIB_H=1" - PRIVATE "-D_REENTRANT=1" - PRIVATE "-DSQLITE_THREADSAFE=1" - PRIVATE "-DSQLITE_HAVE_ZLIB" - - # These are disabled on purpose, since we're not using these features. - # PRIVATE "-DSQLITE_ENABLE_FTS5" - # PRIVATE "-DSQLITE_ENABLE_JSON1" - # PRIVATE "-DSQLITE_ENABLE_FTS3" - # PRIVATE "-DSQLITE_ENABLE_RTREE" -) - -target_compile_options(sqlite - PRIVATE "-Wno-int-conversion" - PRIVATE "-Wno-implicit-fallthrough" -) - -if(CMAKE_COMPILER_IS_GNUCXX) - if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) - target_compile_options(sqlite PRIVATE "-Wno-cast-function-type") - else() - target_compile_options(sqlite PRIVATE "-Wno-bad-function-cast") - endif() -elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") - target_compile_options(sqlite PRIVATE "-Wno-cast-function-type") -endif() diff --git a/cmake/test.cmake b/cmake/test.cmake deleted file mode 100644 index 405552423..000000000 --- a/cmake/test.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# scripts/generate-file-lists.js to change the source files for this target. -load_sources_list(MBGL_TEST_FILES test/test-files.json) -if (MBGL_TEST_TARGET_TYPE STREQUAL "library") - add_library(mbgl-test SHARED ${MBGL_TEST_FILES}) -else() - add_executable(mbgl-test ${MBGL_TEST_FILES}) -endif() - -# GCC 8+ trips over GTest's way of defining Test functions -target_compile_options(mbgl-test PRIVATE -Wno-shadow) - -if(NOT WITH_NODEJS) - target_compile_definitions(mbgl-test PRIVATE "-DTEST_HAS_SERVER=0") -endif() - -set_source_files_properties(test/src/mbgl/test/util.cpp PROPERTIES COMPILE_FLAGS -DNODE_EXECUTABLE="${NodeJS_EXECUTABLE}") - -target_include_directories(mbgl-test - PRIVATE src - PRIVATE test/include - PRIVATE test/src - PRIVATE platform/default/include -) - -target_link_libraries(mbgl-test PRIVATE - mbgl-vendor-googletest - Mapbox::Base::Extras::args - mbgl-core - mbgl-vendor-shelf-pack-cpp - mbgl-vendor-unique_resource - Mapbox::Base::pixelmatch-cpp -) - -mbgl_platform_test() - -create_source_groups(mbgl-test) - -initialize_xcode_cxx_build_settings(mbgl-test) - -set_target_properties(mbgl-test PROPERTIES FOLDER "Executables") - -xcode_create_scheme( - TARGET mbgl-test - OPTIONAL_ARGS - "--gtest_filter=Category.*" - "--gtest_repeat=0" - "--gtest_shuffle=0" - "--gtest_break_on_failure=0" - "--gtest_throw_on_failure=0" - "--gtest_catch_exceptions=0" - ) diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake deleted file mode 100644 index b996aa2b7..000000000 --- a/cmake/vendor.cmake +++ /dev/null @@ -1,29 +0,0 @@ -execute_process( - COMMAND git submodule update --init . - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/vendor -) - -include(${CMAKE_SOURCE_DIR}/vendor/benchmark.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/boost.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/cheap-ruler-cpp.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/earcut.hpp.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/eternal.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/expected.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/geojson-vt-cpp.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/googletest.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/icu.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/nunicode.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/polylabel.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/protozero.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/shelf-pack-cpp.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/unique_resource.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/vector-tile.cmake) -include(${CMAKE_SOURCE_DIR}/vendor/wagyu.cmake) - -if(NOT TARGET mapbox-base) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vendor/mapbox-base ${CMAKE_BINARY_DIR}/.build-mapbox-gl-native-mapbox-base EXCLUDE_FROM_ALL) -endif() - -if(MBGL_PLATFORM STREQUAL "linux" OR MBGL_PLATFORM STREQUAL "macos") - include(${CMAKE_SOURCE_DIR}/vendor/glfw.cmake) -endif() diff --git a/cmake/xcode.cmake b/cmake/xcode.cmake deleted file mode 100644 index 353700933..000000000 --- a/cmake/xcode.cmake +++ /dev/null @@ -1,75 +0,0 @@ -function(get_target_filename OUTPUT TARGET) - get_target_property(_TYPE "${TARGET}" TYPE) - get_target_property(_PREFIX "${TARGET}" PREFIX) - if(NOT _PREFIX AND NOT _PREFIX STREQUAL "") - set(_PREFIX "${CMAKE_${_TYPE}_PREFIX}") - endif() - get_target_property(_BASENAME "${TARGET}" OUTPUT_NAME) - if(NOT _BASENAME) - get_target_property(_BASENAME "${TARGET}" NAME) - endif() - get_target_property(_SUFFIX "${TARGET}" SUFFIX) - if(NOT _SUFFIX AND NOT _SUFFIX STREQUAL "") - set(_SUFFIX "${CMAKE_${_TYPE}_SUFFIX}") - endif() - set(${OUTPUT} "${_PREFIX}${_BASENAME}${_SUFFIX}" PARENT_SCOPE) -endfunction() - -function(xcode_create_scheme) - if (NOT CMAKE_GENERATOR STREQUAL "Xcode") - return() - endif() - - cmake_parse_arguments(XCSCHEME "" "TARGET;TYPE;NAME" "ARGS;OPTIONAL_ARGS" ${ARGN}) - - if(XCSCHEME_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "xcode_create_scheme() called with unrecognized arguments: ${XCSCHEME_UNPARSED_ARGUMENTS}") - endif() - - if(NOT XCSCHEME_TARGET) - message(FATAL_ERROR "xcode_create_scheme() called without required argument TARGET") - endif() - - if(NOT XCSCHEME_TYPE) - get_target_property(_TYPE "${XCSCHEME_TARGET}" TYPE) - if (_TYPE MATCHES "^.*_LIBRARY$") - set(XCSCHEME_TYPE "library") - elseif(_TYPE STREQUAL "EXECUTABLE") - set(XCSCHEME_TYPE "executable") - else() - message(FATAL_ERROR "xcode_create_scheme() could not determine type of ${XCSCHEME_TARGET}") - endif() - endif() - - if(NOT XCSCHEME_NAME) - set(XCSCHEME_NAME "${XCSCHEME_TARGET}") - endif() - - set(XCODEPROJ_PATH "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.xcodeproj") - set(XCSCHEME_OUTPUT_FILE "${XCODEPROJ_PATH}/xcshareddata/xcschemes/${XCSCHEME_NAME}.xcscheme") - - # Prevent overwriting of the scheme file on every CMake rerun. - if (EXISTS "${XCSCHEME_OUTPUT_FILE}") - return() - endif() - - file(RELATIVE_PATH XCSCHEME_CONTAINER "${CMAKE_SOURCE_DIR}" "${XCODEPROJ_PATH}") - string(RANDOM LENGTH 24 ALPHABET "0123456789ABCDEF" XCSCHEME_BLUEPRINT_ID) - get_target_filename(XCSCHEME_BUILDABLE_NAME "${XCSCHEME_TARGET}") - set(XCSCHEME_BLUEPRINT_NAME "${XCSCHEME_TARGET}") - set(XCSCHEME_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") - set(XCSCHEME_NODE_EXECUTABLE "${NodeJS_EXECUTABLE}") - get_filename_component(XCSCHEME_NODE_PATH "${NodeJS_EXECUTABLE}" DIRECTORY) - - set(XCSCHEME_COMMAND_LINE_ARGS "") - foreach(_ARG IN LISTS XCSCHEME_ARGS) - set(XCSCHEME_COMMAND_LINE_ARGS "${XCSCHEME_COMMAND_LINE_ARGS}\n \n ") - endforeach() - foreach(_ARG IN LISTS XCSCHEME_OPTIONAL_ARGS) - set(XCSCHEME_COMMAND_LINE_ARGS "${XCSCHEME_COMMAND_LINE_ARGS}\n \n ") - endforeach() - - configure_file( - "${CMAKE_SOURCE_DIR}/cmake/${XCSCHEME_TYPE}.xcscheme" - "${XCSCHEME_OUTPUT_FILE}") -endfunction() diff --git a/expression-test/expression_test_logger.cpp b/expression-test/expression_test_logger.cpp deleted file mode 100644 index 9127a6d7a..000000000 --- a/expression-test/expression_test_logger.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "expression_test_logger.hpp" -#include "expression_test_runner.hpp" -#include "filesystem.hpp" - -#include -#include - -#include - -using namespace mbgl; -using namespace std::literals; - -namespace { - -const char* resultsStyle = R"HTML( - -)HTML"; - -const char* resultsHeaderButtons = R"HTML( - - - - -)HTML"; - -const char* resultsScript = R"HTML( - -)HTML"; - -std::string createResultItem(const TestRunOutput& result, const std::string& status, bool shouldHide) { - std::ostringstream html; - html << "
\n"; - html << R"(

)" << status << " " << result.id << "

\n"; - - html << "

"s << result.expression << "

\n"s; - if (result.passed) { - html << "Serialized:

"s << result.serialized << "

\n"s; - } else { - html << "

Difference:

" << result.text << "

\n"; - } - html << "
\n"; - - return html.str(); -} - -std::string createResultPage(const TestStats& stats, bool shuffle, uint32_t seed) { - const std::size_t unsuccessfulCount = stats.errored.size() + stats.failed.size(); - const bool unsuccessful = unsuccessfulCount > 0; - std::ostringstream resultsPage; - - // Style - resultsPage << resultsStyle; - - // Header with buttons - if (unsuccessful) { - resultsPage << R"HTML(

)HTML"; - resultsPage << util::toString(unsuccessfulCount) << " tests failed."; - } else { - resultsPage << R"HTML(

)HTML"; - resultsPage << "All tests passed!"; - } - - resultsPage << resultsHeaderButtons; - - // Test sequence - { - resultsPage << "
\n"; - - // Failed tests - if (unsuccessful) { - resultsPage << "

Failed tests:"; - for (const auto& failed : stats.failed) { - resultsPage << failed.id << " "; - } - resultsPage << "

Errored tests:"; - for (const auto& errored : stats.errored) { - resultsPage << errored.id << " "; - } - resultsPage << "

\n"; - } - - // Test sequence - resultsPage << "

Test sequence: "; - for (const auto& id : stats.ids) { - resultsPage << id << " "; - } - resultsPage << "

\n"; - - // Shuffle - if (shuffle) { - resultsPage << "

Shuffle seed: " << util::toString(seed) << "

\n"; - } - - resultsPage << "
\n"; - } - - // Script - resultsPage << resultsScript; - - // Tests - resultsPage << "
\n"; - const auto appendResult = [&] (const auto& results, const std::string& status, bool hide = false) { - for (const auto& result : results) { - resultsPage << createResultItem(result, status, hide); - } - }; - - appendResult(stats.passed, "passed"s, unsuccessful); - appendResult(stats.failed, "failed"s); - appendResult(stats.errored, "errored"s); - appendResult(stats.ignorePassed, "ignored passed"s, unsuccessful); - appendResult(stats.ignoreFailed, "ignored"s, true); - resultsPage << "
\n"; - - return resultsPage.str(); -} - -} // namespace - -void printStats(const TestStats& stats) { - const std::size_t count = stats.testCount(); - if (std::size_t passedTests = stats.passed.size()) { - printf(ANSI_COLOR_GREEN "%zu passed (%.1lf%%)" ANSI_COLOR_RESET "\n", passedTests, 100.0 * passedTests / count); - } - if (std::size_t ignorePassedTests = stats.ignorePassed.size()) { - printf(ANSI_COLOR_YELLOW "%zu passed but were ignored (%.1lf%%)" ANSI_COLOR_RESET "\n", ignorePassedTests, 100.0 * ignorePassedTests / count); - } - if (std::size_t ignoreFailedTests = stats.ignoreFailed.size()) { - printf(ANSI_COLOR_LIGHT_GRAY "%zu ignored (%.1lf%%)" ANSI_COLOR_RESET "\n", ignoreFailedTests, 100.0 * ignoreFailedTests / count); - } - if (std::size_t failedTests = stats.failed.size()) { - printf(ANSI_COLOR_RED "%zu failed (%.1lf%%)" ANSI_COLOR_RESET "\n", failedTests, 100.0 * failedTests / count); - } - if (std::size_t erroredTests = stats.errored.size()) { - printf(ANSI_COLOR_RED "%zu errored (%.1lf%%)" ANSI_COLOR_RESET "\n", erroredTests, 100.0 * erroredTests / count); - } -} - -void writeHTMLResults(const TestStats& stats, const std::string& rootPath, bool shuffle, uint32_t seed) { - filesystem::path path = filesystem::path(rootPath) / "index.html"s; - try { - util::write_file(path.string(), createResultPage(stats, shuffle, seed)); - printf("Results at: %s\n", path.string().c_str()); - } catch (std::exception&) { - printf(ANSI_COLOR_RED "* ERROR can't write result page %s" ANSI_COLOR_RESET "\n", path.string().c_str()); - } -} diff --git a/expression-test/expression_test_logger.hpp b/expression-test/expression_test_logger.hpp deleted file mode 100644 index 95b0697cb..000000000 --- a/expression-test/expression_test_logger.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -#define ANSI_COLOR_RED "\x1b[31m" -#define ANSI_COLOR_GREEN "\x1b[32m" -#define ANSI_COLOR_YELLOW "\x1b[33m" -#define ANSI_COLOR_LIGHT_GRAY "\x1b[90m" -#define ANSI_COLOR_RESET "\x1b[0m" - -class TestStats; - -void printStats(const TestStats&); -void writeHTMLResults(const TestStats&, const std::string&, bool, uint32_t); diff --git a/expression-test/expression_test_parser.cpp b/expression-test/expression_test_parser.cpp deleted file mode 100644 index 3b40eeb3b..000000000 --- a/expression-test/expression_test_parser.cpp +++ /dev/null @@ -1,511 +0,0 @@ -#include "expression_test_parser.hpp" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -using namespace mbgl; -using namespace mbgl::style; -using namespace mbgl::style::conversion; -using namespace std::literals; - -namespace { - -void writeJSON(rapidjson::PrettyWriter& writer, const Value& value) { - value.match( - [&] (const NullValue&) { writer.Null(); }, - [&] (bool b) { writer.Bool(b); }, - [&] (uint64_t u) { writer.Uint64(u); }, - [&] (int64_t i) { writer.Int64(i); }, - [&] (double d) { d == std::floor(d) ? writer.Int64(d) : writer.Double(d); }, - [&] (const std::string& s) { writer.String(s); }, - [&] (const std::vector& arr) { - writer.StartArray(); - for(const auto& item : arr) { - writeJSON(writer, item); - } - writer.EndArray(); - }, - [&] (const std::unordered_map& obj) { - writer.StartObject(); - for(const auto& entry : obj) { - writer.Key(entry.first.c_str()); - writeJSON(writer, entry.second); - } - writer.EndObject(); - } - ); -} - -using ErrorMessage = std::string; -using JSONReply = variant; -JSONReply readJson(const filesystem::path& jsonPath) { - auto maybeJSON = util::readFile(jsonPath); - if (!maybeJSON) { - return { "Unable to open file "s + jsonPath.string() }; - } - - JSDocument document; - document.Parse(*maybeJSON); - if (document.HasParseError()) { - return { formatJSONParseError(document) }; - } - - return { std::move(document) }; -} - -std::string toString(const JSValue& value) { - assert(value.IsString()); - return { value.GetString(), value.GetStringLength() }; -} - -optional toValue(const JSValue& jsvalue) { - if (jsvalue.IsNull()) { - return Value{}; - } - - if (jsvalue.IsArray()) { - std::vector values; - values.reserve(jsvalue.GetArray().Size()); - for (const auto& v : jsvalue.GetArray()) { - if (auto value = toValue(v)) { - values.emplace_back(std::move(*value)); - } - } - return {std::move(values)}; - } - - if (jsvalue.IsObject()) { - std::unordered_map value_map; - for (const auto& pair : jsvalue.GetObject()) { - if (auto value = toValue(pair.value)) { - value_map.emplace(toString(pair.name), std::move(*value)); - } - } - return {std::move(value_map)}; - } - - if (!jsvalue.IsArray() && !jsvalue.IsObject()) { - return toValue(Convertible(&jsvalue)); - } - - return nullopt; -} - -style::expression::type::Type stringToType(const std::string& type) { - using namespace style::expression; - if (type == "string"s || type == "number-format"s || - type == "image"s) { // TODO: replace once we implement image expressions - return type::String; - } else if (type == "number"s) { - return type::Number; - } else if (type == "boolean"s) { - return type::Boolean; - } else if (type == "object"s) { - return type::Object; - } else if (type == "color"s) { - return type::Color; - } else if (type == "value"s) { - return type::Value; - } else if (type == "formatted"s) { - return type::Formatted; - } - - // Should not reach. - assert(false); - return type::Null; -} - -optional toExpressionType(const PropertySpec& spec) { - using namespace style::expression; - if (spec.type == "array") { - type::Type itemType = spec.value.empty() ? type::Value : stringToType(spec.value); - if (spec.length) { - return {type::Array(itemType, spec.length)}; - } - return {type::Array(itemType)}; - } - - if (spec.type == "enum") { - return {type::String}; - } - - return spec.type.empty() ? nullopt : optional{stringToType(spec.type)}; -} - -void parseCompiled(const JSValue& compiledValue, TestData& data) { - const auto& compiled = compiledValue.GetObject(); - assert(compiled.HasMember("result")); - assert(compiled["result"].IsString()); - const std::string& result = toString(compiled["result"]); - data.expected.compiled.success = result == "success"; - - if (compiled.HasMember("isFeatureConstant")) { - assert(compiled["isFeatureConstant"].IsBool()); - data.expected.compiled.isFeatureConstant = compiled["isFeatureConstant"].GetBool(); - } - - if (compiled.HasMember("isZoomConstant")) { - assert(compiled["isZoomConstant"].IsBool()); - data.expected.compiled.isZoomConstant = compiled["isZoomConstant"].GetBool(); - } - - if (compiled.HasMember("type")) { - assert(compiled["type"].IsString()); - data.expected.compiled.serializedType = toString(compiled["type"]); - } - - if (compiled.HasMember("errors")) { - assert(compiled["errors"].IsArray()); - for (const auto& errorVal : compiled["errors"].GetArray()) { - assert(errorVal.IsObject()); - const auto& errorObject = errorVal.GetObject(); - assert(errorObject.HasMember("key")); - assert(errorObject.HasMember("error")); - - std::unordered_map errorMap; - errorMap.emplace("key"s, Value{toString(errorObject["key"])}); - errorMap.emplace("error"s, Value{toString(errorObject["error"])}); - data.expected.compiled.errors.emplace_back(Value{std::move(errorMap)}); - } - } -} - -void parseExpected(const JSValue& expectedValue, TestData& data) { - assert(expectedValue.IsObject()); - const auto& expected = expectedValue.GetObject(); - assert(expected.HasMember("compiled")); - parseCompiled(expected["compiled"], data); - - // set outputs - if (expected.HasMember("outputs")) { - data.expected.outputs = toValue(expected["outputs"]); - } - - // set serialized - if (expected.HasMember("serialized")) { - data.expected.serialized = toValue(expected["serialized"]); - } -} - -void parsePropertySpec(const JSValue& value, TestData& data) { - const auto& propertySpec = value.GetObject(); - PropertySpec spec; - - if (propertySpec.HasMember("type")) { - assert(propertySpec["type"].IsString()); - spec.type = toString(propertySpec["type"]); - } - - if (propertySpec.HasMember("value")) { - assert(propertySpec["value"].IsString()); - spec.value = toString(propertySpec["value"]); - } - - if (propertySpec.HasMember("length")) { - assert(propertySpec["length"].IsNumber()); - spec.length = propertySpec["length"].GetDouble(); - } - - if (propertySpec.HasMember("property-type")) { - assert(propertySpec["property-type"].IsString()); - spec.isDataDriven = true; - } - - if (propertySpec.HasMember("expression")) { - assert(propertySpec["expression"].IsObject()); - spec.expression = toValue(propertySpec["expression"]); - } - - data.spec = std::move(spec); -} - -bool parseInputs(const JSValue& inputsValue, TestData& data) { - assert(inputsValue.IsArray()); - for (const auto& input : inputsValue.GetArray()) { - assert(input.IsArray()); - assert(input.Size() == 2); - assert(input[0].IsObject()); - assert(input[1].IsObject()); - - // Parse evaluation context, zoom. - optional zoom; - const auto& evaluationContext = input[0].GetObject(); - if (evaluationContext.HasMember("zoom")) { - assert(evaluationContext["zoom"].IsNumber()); - zoom = evaluationContext["zoom"].GetDouble(); - } - - // Parse heatmap density - optional heatmapDensity; - if (evaluationContext.HasMember("heatmapDensity")) { - assert(evaluationContext["heatmapDensity"].IsNumber()); - heatmapDensity = evaluationContext["heatmapDensity"].GetDouble(); - } - - // Parse feature properties - Feature feature(mapbox::geometry::point(0.0, 0.0)); - const auto& featureObject = input[1].GetObject(); - if (featureObject.HasMember("properties")) { - assert(featureObject["properties"].IsObject()); - feature.properties = mapbox::geojson::convert(featureObject["properties"]); - } - - if (featureObject.HasMember("geometry")) { - assert(featureObject["geometry"].IsObject()); - feature.geometry = mapbox::geojson::convert>(featureObject["geometry"]); - } - - if (featureObject.HasMember("id")) { - assert(featureObject["id"].IsNumber() || featureObject["id"].IsString()); - feature.id = mapbox::geojson::convert(featureObject["id"]); - } - - data.inputs.emplace_back(std::move(zoom), std::move(heatmapDensity), std::move(feature)); - } - return true; -} - -} // namespace - -std::tuple, bool, uint32_t> parseArguments(int argc, char** argv) { - args::ArgumentParser argumentParser("Mapbox GL Expression Test Runner"); - - args::HelpFlag helpFlag(argumentParser, "help", "Display this help menu", { 'h', "help" }); - args::Flag shuffleFlag(argumentParser, "shuffle", "Toggle shuffling the tests order", - { 's', "shuffle" }); - args::ValueFlag seedValue(argumentParser, "seed", "Shuffle seed (default: random)", - { "seed" }); - args::PositionalList testNameValues(argumentParser, "URL", "Test name(s)"); - - try { - argumentParser.ParseCLI(argc, argv); - } catch (const args::Help&) { - std::ostringstream stream; - stream << argumentParser; - Log::Info(Event::General, stream.str()); - exit(0); - } catch (const args::ParseError& e) { - std::ostringstream stream; - stream << argumentParser; - Log::Info(Event::General, stream.str()); - Log::Error(Event::General, e.what()); - exit(1); - } catch (const args::ValidationError& e) { - std::ostringstream stream; - stream << argumentParser; - Log::Info(Event::General, stream.str()); - Log::Error(Event::General, e.what()); - exit(2); - } - - filesystem::path rootPath {std::string(TEST_RUNNER_ROOT_PATH).append("/mapbox-gl-js/test/integration/expression-tests")}; - if (!filesystem::exists(rootPath)) { - Log::Error(Event::General, "Test path '%s' does not exist.", rootPath.string().c_str()); - exit(3); - } - - std::vector paths; - for (const auto& testName : args::get(testNameValues)) { - paths.emplace_back(rootPath.string() + "/" + testName); - } - - if (paths.empty()) { - paths.emplace_back(rootPath); - } - - // Recursively traverse through the test paths and collect test directories containing "test.json". - std::vector testPaths; - testPaths.reserve(paths.size()); - for (const auto& path : paths) { - if (!filesystem::exists(path)) { - Log::Warning(Event::General, "Provided test folder '%s' does not exist.", path.string().c_str()); - continue; - } - - for (auto& testPath : filesystem::recursive_directory_iterator(path)) { - if (testPath.path().filename() == "test.json") { - testPaths.emplace_back(testPath.path()); - } - } - } - - return Arguments{ std::move(rootPath), - std::move(testPaths), - shuffleFlag ? args::get(shuffleFlag) : false, - seedValue ? args::get(seedValue) : 1u }; -} - -Ignores parseExpressionIgnores() { - Ignores ignores; - const auto mainIgnoresPath = filesystem::path(TEST_RUNNER_ROOT_PATH).append("platform/node/test/ignores.json"); - auto maybeIgnores = readJson(mainIgnoresPath); - if (!maybeIgnores.is()) { // NOLINT - return {}; - } - - for (const auto& property : maybeIgnores.get().GetObject()) { - std::string id{ toString(property.name) }; - // Keep only expression-test ignores - if (id.rfind("expression-tests", 0) != 0) { - continue; - } - std::string reason{ toString(property.value) }; - ignores.emplace_back(std::move(id), std::move(reason)); - } - - return ignores; -} - -optional parseTestData(const filesystem::path& path) { - TestData data; - auto maybeJson = readJson(path.string()); - if (!maybeJson.is()) { // NOLINT - Log::Error(Event::General, "Cannot parse test '%s'.", path.string().c_str()); - return nullopt; - } - - data.document = std::move(maybeJson.get()); - - // Check that mandatory test data members are present. - if (!data.document.HasMember("expression") || !data.document.HasMember("expected")) { - Log::Error(Event::General, "Test fixture '%s' does not contain required data.", path.string().c_str()); - return nullopt; - } - - // Parse propertySpec - if (data.document.HasMember("propertySpec")) { - assert(data.document["propertySpec"].IsObject()); - parsePropertySpec(data.document["propertySpec"], data); - } - - // Parse expected - parseExpected(data.document["expected"], data); - - // Parse inputs - if (data.document.HasMember("inputs") && !parseInputs(data.document["inputs"], data)) { - Log::Error(Event::General,"Can't convert inputs value for '%s'", path.string().c_str()); - return nullopt; - } - - return {std::move(data)}; -} - -std::string toJSON(const Value& value, unsigned indent, bool singleLine) { - rapidjson::StringBuffer buffer; - rapidjson::PrettyWriter writer(buffer); - if (singleLine) { - writer.SetFormatOptions(rapidjson::kFormatSingleLineArray); - } - writer.SetIndent(' ', indent); - writeJSON(writer, value); - return buffer.GetString(); -} - -JSDocument toDocument(const Value& value) { - JSDocument document; - document.Parse(toJSON(value)); - return document; -} - -Value toValue(const Compiled& compiled) { - std::unordered_map compiledObject; - compiledObject.emplace("result", compiled.success ? "success"s : "error"s); - if (compiled.success) { - compiledObject.emplace("isFeatureConstant", compiled.isFeatureConstant); - compiledObject.emplace("isZoomConstant", compiled.isZoomConstant); - compiledObject.emplace("type", compiled.serializedType); - } else { - compiledObject.emplace("errors", compiled.errors); - } - return {std::move(compiledObject)}; -} - -// Serializes native expression types to JS format. -// Color and Formatted are exceptions. -// TODO: harmonize serialized format to remove this conversion. -optional toValue(const expression::Value& exprValue) { - return exprValue.match( - [](const Color& c) -> optional { - std::vector color { double(c.r), double(c.g), double(c.b), double(c.a) }; - return {Value{std::move(color)}}; - }, - [](const expression::Formatted& formatted) -> optional { return {formatted.toObject()}; }, - [](const std::vector& values) -> optional { - std::vector mbglValues; - for (const auto& value : values) { - if (auto converted = expression::fromExpressionValue(value)) { - mbglValues.emplace_back(std::move(*converted)); - } - } - return {Value{std::move(mbglValues)}}; - }, - [](const std::unordered_map& valueMap) -> optional { - std::unordered_map mbglValueMap; - for (const auto& pair : valueMap) { - if (auto converted = expression::fromExpressionValue(pair.second)) { - mbglValueMap.emplace(pair.first, std::move(*converted)); - } - } - return {Value{std::move(mbglValueMap)}}; - }, - [](const auto& v) { return expression::fromExpressionValue(v); }); -} - -std::unique_ptr parseExpression(const JSValue& value, - optional& spec, - TestResult& result) { - optional expected = spec ? toExpressionType(*spec) : nullopt; - expression::ParsingContext ctx = expected ? expression::ParsingContext(*expected) : - expression::ParsingContext(); - Convertible convertible(&value); - expression::ParseResult parsed; - if (value.IsObject() && !value.IsArray() && expected){ - Error error; - parsed = convertFunctionToExpression(*expected, convertible, error, false /*convert tokens*/); - if (!parsed) { - // TODO: should the error message be checked for function conversion? - } - } else { - parsed = ctx.parseLayerPropertyExpression(convertible); - if (!parsed) { - for (const auto& parsingError : ctx.getErrors()) { - std::unordered_map errorMap; - errorMap.emplace("key"s, Value{parsingError.key}); - errorMap.emplace("error"s, Value{parsingError.message}); - result.compiled.errors.emplace_back(Value{std::move(errorMap)}); - } - } - } - - result.expression = toValue(value); - result.compiled.success = bool(parsed); - if (parsed) { - result.compiled.isFeatureConstant = expression::isFeatureConstant(**parsed); - result.compiled.isZoomConstant = expression::isZoomConstant(**parsed); - result.compiled.serializedType = style::expression::type::toString((*parsed)->getType()); - result.serialized = (*parsed)->serialize(); - return std::move(*parsed); - } - - return nullptr; -} - -std::unique_ptr parseExpression(const optional& value, - optional& spec, - TestResult& result) { - assert(value); - auto document = toDocument(*value); - assert(!document.HasParseError()); - return parseExpression(document, spec, result); -} diff --git a/expression-test/expression_test_parser.hpp b/expression-test/expression_test_parser.hpp deleted file mode 100644 index 561ccd964..000000000 --- a/expression-test/expression_test_parser.hpp +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "filesystem.hpp" - -#include -#include -#include -#include - -#include -#include - -using namespace mbgl; - -struct Input { - Input(optional zoom_, optional heatmapDensity_, Feature feature_) - : zoom(std::move(zoom_)), - heatmapDensity(std::move(heatmapDensity_)), - feature(std::move(feature_)) {} - optional zoom; - optional heatmapDensity; - Feature feature; -}; - -struct Compiled { - bool operator==(const Compiled& other) const { - bool typeEqual = success == other.success && - isFeatureConstant == other.isFeatureConstant && - isZoomConstant == other.isZoomConstant && - serializedType == other.serializedType && - errors == other.errors; - return typeEqual; - } - - bool success = false; - bool isFeatureConstant = false; - bool isZoomConstant = false; - std::string serializedType; - std::vector errors; -}; - -struct TestResult { - Compiled compiled; - optional expression; - optional outputs; - optional serialized; -}; - -struct PropertySpec { - std::string type; - std::string value; - std::size_t length = 0; - bool isDataDriven = false; - optional expression; -}; - -class TestData { -public: - std::vector inputs; - TestResult expected; - TestResult result; - TestResult recompiled; - optional spec; - JSDocument document; -}; - -struct Ignore { - Ignore(std::string id_, std::string reason_) - : id(std::move(id_)), - reason(std::move(reason_)) {} - - std::string id; - std::string reason; -}; - -using Arguments = std::tuple, bool, uint32_t>; -Arguments parseArguments(int argc, char** argv); - -using Ignores = std::vector; -Ignores parseExpressionIgnores(); -optional parseTestData(const filesystem::path&); - -std::string toJSON(const Value& value, unsigned indent = 0, bool singleLine = false); -JSDocument toDocument(const Value&); -Value toValue(const Compiled&); -optional toValue(const style::expression::Value&); - -std::unique_ptr parseExpression(const JSValue&, - optional&, - TestResult&); -std::unique_ptr parseExpression(const optional&, - optional&, - TestResult&); - diff --git a/expression-test/expression_test_runner.cpp b/expression-test/expression_test_runner.cpp deleted file mode 100644 index c8a39f07c..000000000 --- a/expression-test/expression_test_runner.cpp +++ /dev/null @@ -1,197 +0,0 @@ -#include "expression_test_runner.hpp" -#include "expression_test_logger.hpp" -#include "expression_test_parser.hpp" -#include "filesystem.hpp" -#include "test_runner_common.hpp" - -#include - -#include -#include -#include - -#include -#include - -using namespace std::literals; - -namespace { - -std::string simpleDiff(const Value& result, const Value& expected) { - std::vector resultTokens {tokenize(toJSON(result, 2, true))}; - std::vector expectedTokens {tokenize(toJSON(expected, 2, true))}; - std::size_t maxLength = std::max(resultTokens.size(), expectedTokens.size()); - std::ostringstream diff; - const auto flush = [] (const std::vector& vec, std::size_t pos, std::ostringstream& out, std::string separator) { - for (std::size_t j = pos; j < vec.size(); ++j) { - out << separator << vec[j] << std::endl; - } - }; - - for (std::size_t i = 0; i < maxLength; ++i) { - if (resultTokens.size() <= i) { - flush(expectedTokens, i, diff, "-"s); - break; - } - - if (expectedTokens.size() <= i) { - flush(resultTokens, i, diff, "+"s); - break; - } - - if (resultTokens[i] != expectedTokens[i]) { - diff << "-"s << expectedTokens[i] << std::endl; - diff << "+"s << resultTokens[i] << std::endl; - } else { - diff << resultTokens[i] << std::endl; - } - } - return diff.str(); -} - -void rewriteRoundtrippedType(const std::string& expected, std::string& actual) { - if (!expected.rfind("array", 0) && !actual.rfind("array", 0)) { - actual = expected; - } -} - -void updateTest(TestData& data) { - assert(data.document["expected"].IsObject()); - auto& expected = data.document["expected"]; - auto compiled = toDocument(toValue(data.result.compiled)); - assert(!compiled.HasParseError()); - expected["compiled"].Swap(compiled); - - if (data.result.outputs) { - auto outputs = toDocument(stripPrecision(data.result.outputs.value_or(Value{}))); - assert(!outputs.HasParseError()); - expected["outputs"].Swap(outputs); - } else { - expected.RemoveMember("outputs"); - } - - if (data.result.serialized) { - auto serialized = toDocument(*data.result.serialized); - assert(!serialized.HasParseError()); - expected["serialized"].Swap(serialized); - } else { - expected.RemoveMember("serialized"); - } -} - -void writeTestData(const JSDocument& document, const std::string& rootPath, const std::string& id) { - rapidjson::StringBuffer buffer; - rapidjson::PrettyWriter writer(buffer); - writer.SetFormatOptions(rapidjson::kFormatSingleLineArray); - writer.SetIndent(' ', 2); - document.Accept(writer); - buffer.Put('\n'); - filesystem::path path = filesystem::path(rootPath) / id / "test.json"s; - try { - util::write_file(path.string(), {buffer.GetString(), buffer.GetSize()}); - } catch (std::exception&) { - printf(ANSI_COLOR_RED "* ERROR can't update '%s' test" ANSI_COLOR_RESET "\n", id.c_str()); - } -} - -} // namespace - -TestRunOutput runExpressionTest(TestData& data, const std::string& rootPath, const std::string& id) { - TestRunOutput output(id); - const auto evaluateExpression = [&data](std::unique_ptr& expression, - TestResult& result) { - assert(expression); - std::vector outputs; - if (!data.inputs.empty()) { - for (const auto& input : data.inputs) { - auto evaluationResult = expression->evaluate(input.zoom, input.feature, input.heatmapDensity); - if (!evaluationResult) { - std::unordered_map error{{"error", Value{evaluationResult.error().message}}}; - outputs.emplace_back(Value{std::move(error)}); - } else { - auto value = toValue(*evaluationResult); - assert(value); - outputs.emplace_back(Value{*value}); - } - } - } - result.outputs = {Value{std::move(outputs)}}; - }; - - // Parse expression - auto parsedExpression = parseExpression(data.document["expression"], data.spec, data.result); - output.expression = toJSON(data.result.expression.value_or(Value{}), 2, true); - - // Evaluate expression - if (parsedExpression) { - evaluateExpression(parsedExpression, data.result); - output.serialized = toJSON(data.result.serialized.value_or(Value{}), 2, true); - - // round trip - auto recompiledExpression = parseExpression(data.result.serialized, data.spec, data.recompiled); - if (recompiledExpression) { - evaluateExpression(recompiledExpression, data.recompiled); - rewriteRoundtrippedType(data.expected.compiled.serializedType, - data.recompiled.compiled.serializedType); - } - } - - if (getenv("UPDATE")) { - output.passed = true; - updateTest(data); - writeTestData(data.document, rootPath, id); - return output; - } - - bool compileOk = data.result.compiled == data.expected.compiled; - bool evalOk = compileOk && deepEqual(data.result.outputs, data.expected.outputs); - - bool recompileOk = true; - bool roundTripOk = true; - bool serializationOk = true; - - if (data.expected.compiled.success) { - serializationOk = compileOk && deepEqual(data.result.serialized, data.expected.serialized); - recompileOk = compileOk && data.recompiled.compiled == data.expected.compiled; - roundTripOk = recompileOk && deepEqual(data.recompiled.outputs, data.expected.outputs); - } - - output.passed = compileOk && evalOk && recompileOk && roundTripOk && serializationOk; - - if (!compileOk) { - auto resultValue = toValue(data.result.compiled); - auto expectedValue = toValue(data.expected.compiled); - output.text += "Compiled expression difference:\n"s + - simpleDiff(resultValue, expectedValue) + - "\n"s; - } - - if (compileOk && !serializationOk) { - auto diff = simpleDiff(data.expected.serialized.value_or(Value{}), - data.result.serialized.value_or(Value{})); - output.text += "Serialized expression difference:\n"s + diff + "\n"s; - } - - if (compileOk && !recompileOk) { - auto recompiledValue = toValue(data.recompiled.compiled); - auto expectedValue = toValue(data.expected.compiled); - output.text += "Recompiled expression difference:\n"s + - simpleDiff(recompiledValue, expectedValue) + - "\n"s; - } - - if (compileOk && !evalOk) { - auto diff = simpleDiff(data.expected.outputs.value_or(Value{}), - data.result.outputs.value_or(Value{})); - output.text += "Expression outputs difference:\n"s + diff + "\n"s; - } - - if (recompileOk && !roundTripOk) { - auto diff = simpleDiff(data.expected.outputs.value_or(Value{}), - data.recompiled.outputs.value_or(Value{})); - output.text += "Roundtripped through serialize expression outputs difference:\n"s + - diff + "\n"s; - } - - return output; -} diff --git a/expression-test/expression_test_runner.hpp b/expression-test/expression_test_runner.hpp deleted file mode 100644 index 596d5c11b..000000000 --- a/expression-test/expression_test_runner.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include - -class TestData; - -struct TestRunOutput { - TestRunOutput(std::string id_) : id(std::move(id_)) {} - std::string id; - bool passed = false; - std::string text; - std::string expression; - std::string serialized; -}; - -class TestStats { -public: - std::size_t testCount() const { - return passed.size() + failed.size() + errored.size() + - ignorePassed.size() + ignoreFailed.size(); - } - - std::vector passed; - std::vector failed; - std::vector errored; - std::vector ignorePassed; - std::vector ignoreFailed; - std::vector ids; -}; - -TestRunOutput runExpressionTest(TestData&, const std::string& rootPath, const std::string& id); diff --git a/expression-test/filesystem.hpp b/expression-test/filesystem.hpp deleted file mode 100644 index cee7e9d91..000000000 --- a/expression-test/filesystem.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -namespace filesystem = ghc::filesystem; - -} // namespace mbgl diff --git a/expression-test/main.cpp b/expression-test/main.cpp deleted file mode 100644 index db468dffe..000000000 --- a/expression-test/main.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "expression_test_parser.hpp" -#include "expression_test_runner.hpp" -#include "expression_test_logger.hpp" - -#include - -int main(int argc, char** argv) { - // Parse args - std::vector testPaths; - mbgl::filesystem::path rootPath; - bool shuffle; - uint32_t seed; - std::tie(rootPath, testPaths, shuffle, seed) = parseArguments(argc, argv); - - // Parse ignores - const auto ignores = parseExpressionIgnores(); - - if (shuffle) { - printf(ANSI_COLOR_YELLOW "Shuffle seed: %d" ANSI_COLOR_RESET "\n", seed); - std::seed_seq sequence { seed }; - std::mt19937 shuffler(sequence); - std::shuffle(testPaths.begin(), testPaths.end(), shuffler); - } - - // Run tests, collect stats and output of each run. - TestStats stats; - for (const auto& path : testPaths) { - const auto& expectation = path.parent_path().string(); - std::string id = expectation.substr(rootPath.string().length() + 1, expectation.length() - rootPath.string().length()); - stats.ids.emplace_back(id); - - bool shouldIgnore = false; - std::string ignoreReason; - const std::string ignoreName = "expression-tests/" + id; - const auto it = std::find_if(ignores.cbegin(), ignores.cend(), [&ignoreName] (const auto& ignore) { return ignore.id == ignoreName; }); - if (it != ignores.end()) { - shouldIgnore = true; - ignoreReason = (*it).reason; - } - - optional testRun; - if (auto testData = parseTestData(path)) { - testRun = runExpressionTest(*testData, rootPath.string(), id); - } - - if (!testRun) { - stats.errored.emplace_back(id); - printf(ANSI_COLOR_RED "* ERROR can't parse '%s' test" ANSI_COLOR_RESET "\n", id.c_str()); - continue; - } - - if (shouldIgnore) { - if (testRun->passed) { - stats.ignorePassed.emplace_back(std::move(*testRun)); - printf(ANSI_COLOR_YELLOW "* PASSED ignored test %s (%s)" ANSI_COLOR_RESET "\n", id.c_str(), ignoreReason.c_str()); - } else { - stats.ignoreFailed.emplace_back(std::move(*testRun)); - printf(ANSI_COLOR_LIGHT_GRAY "* FAILED ignored test %s (%s)" ANSI_COLOR_RESET "\n", id.c_str(), ignoreReason.c_str()); - } - } else { - if (testRun->passed) { - stats.passed.emplace_back(std::move(*testRun)); - printf(ANSI_COLOR_GREEN "* PASSED %s" ANSI_COLOR_RESET "\n", id.c_str()); - } else { - printf(ANSI_COLOR_RED "* FAILED %s\n%s" ANSI_COLOR_RESET, id.c_str(), testRun->text.c_str()); - stats.failed.emplace_back(std::move(*testRun)); - } - } - } - - printStats(stats); - writeHTMLResults(stats, rootPath.string(), shuffle, seed); - - return stats.errored.size() + stats.failed.size() == 0 ? 0 : 1; -} diff --git a/expression-test/test_runner_common.cpp b/expression-test/test_runner_common.cpp deleted file mode 100644 index 745ef9fce..000000000 --- a/expression-test/test_runner_common.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "test_runner_common.hpp" - -#include -#include - -using namespace mbgl; - -// Strip precision for numbers, so that we can compare evaluated results with fixtures. -// Copied from JS expression harness. -Value stripPrecision(const Value& value) { - const double decimalSigFigs = 6; - if (auto num = numericValue(value)) { - if (*num == 0) { - return *num; - } - - const double multiplier = std::pow(10, std::max(0.0, decimalSigFigs - std::ceil(std::log10(std::fabs(*num))))); - - // We strip precision twice in a row here to avoid cases where - // stripping an already stripped number will modify its value - // due to bad floating point precision luck - // eg `Math.floor(8.16598 * 100000) / 100000` -> 8.16597 - const double firstStrip = std::floor(*num * multiplier) / multiplier; - return std::floor(firstStrip * multiplier) / multiplier; - } - - if (value.is>()) { - std::vector stripped; - const auto& vec = value.get>(); - stripped.reserve(vec.size()); - for (const auto& val : vec) { - stripped.emplace_back(stripPrecision(val)); - } - return stripped; - } else if (value.is>()) { - std::unordered_map stripped; - const auto& map = value.get>(); - for (const auto& pair : map) { - stripped.emplace(pair.first, stripPrecision(pair.second)); - } - return stripped; - } - - return value; -} - -std::vector tokenize(std::string str) { - std::vector tokens; - std::regex re("\n"); - std::copy(std::regex_token_iterator(str.begin(), str.end(), re, -1), - std::regex_token_iterator(), - std::back_inserter(tokens)); - return tokens; -} - -bool deepEqual(const Value& a, const Value& b) { - const auto& anum = numericValue(a); - const auto& bnum = numericValue(b); - if (anum && bnum) { - return stripPrecision(*anum) == stripPrecision(*bnum); - } - - if (a.which() != b.which()) { - return false; - } - - if (a.getArray() && b.getArray()) { - const auto& avec = *a.getArray(); - const auto& bvec = *b.getArray(); - if (avec.size() != bvec.size()) { - return false; - } - for (std::size_t i = 0; i < avec.size(); ++i) { - if (!deepEqual(avec[i], bvec[i])) { - return false; - } - } - return true; - } - - if (a.getObject() && b.getObject()) { - const auto& amap = *a.getObject(); - const auto& bmap = *b.getObject(); - if (amap.size() != bmap.size()) { - return false; - } - for (const auto& pair : amap) { - auto it = bmap.find(pair.first); - if (it == bmap.end()) { - return false; - } - if (!deepEqual(pair.second, it->second)) { - return false; - } - } - return true; - } - - if (a == b) { - return true; - } - - if (a.getString() && b.getString()) { - const auto& strA = *a.getString(); - const auto& strB = *b.getString(); - if (strA == strB) { - return true; - } - - try { - double numA = std::stod(strA); - double numB = std::stod(strB); - return stripPrecision(numA) == stripPrecision(numB); - } catch (...) { - } - } - - return false; -} - -bool deepEqual(const optional& a, const optional& b) { - if ((a && !b) || (!a && b)) { - return false; - } - - if (a && b) { - return deepEqual(*a, *b); - } - - return true; -} diff --git a/expression-test/test_runner_common.hpp b/expression-test/test_runner_common.hpp deleted file mode 100644 index b30d1a145..000000000 --- a/expression-test/test_runner_common.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -#include -#include - -using namespace mbgl; - -Value stripPrecision(const Value& value); -std::vector tokenize(std::string str); -bool deepEqual(const Value& a, const Value& b); -bool deepEqual(const optional& a, const optional& b); diff --git a/include/mbgl/actor/actor.hpp b/include/mbgl/actor/actor.hpp deleted file mode 100644 index 97964ae53..000000000 --- a/include/mbgl/actor/actor.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace mbgl { - -/* - An `Actor` is an owning reference to an asynchronous object of type `O`: an "actor". - Communication with an actor happens via message passing: you send a message to the object - (using `invoke`), passing a pointer to the member function to call and arguments which - are then forwarded to the actor. - - The actor receives messages sent to it asynchronously, in a manner defined its `Scheduler`. - To store incoming messages before their receipt, each actor has a `Mailbox`, which acts as - a FIFO queue. Messages sent from actor S to actor R are guaranteed to be processed in the - order sent. However, relative order of messages sent by two *different* actors S1 and S2 - to R is *not* guaranteed (and can't be: S1 and S2 may be acting asynchronously with respect - to each other). - - An `Actor` can be converted to an `ActorRef`, a non-owning value object representing - a (weak) reference to the actor. Messages can be sent via the `Ref` as well. - - It's safe -- and encouraged -- to pass `Ref`s between actors via messages. This is how two-way - communication and other forms of collaboration between multiple actors is accomplished. - - It's safe for a `Ref` to outlive its `Actor` -- the reference is "weak", and does not extend - the lifetime of the owning Actor, and sending a message to a `Ref` whose `Actor` has died is - a no-op. (In the future, a dead-letters queue or log may be implemented.) - - Construction and destruction of an Actor is synchronous: the corresponding `O` - object is constructed synchronously by the `Actor` constructor, and destructed synchronously - by the `~Actor` destructor, after ensuring that the `O` is not currently receiving an - asynchronous message. The constructor of `O` is passed an `ActorRef` referring to itself - (which it can use to self-send messages), followed by the forwarded arguments passed to - `Actor`. Asynchronous object construction can be accomplished by directly using the - lower-level types, `AspiringActor` and `EstablishedActor`. - - Please don't send messages that contain shared pointers or references. That subverts the - purpose of the actor model: prohibiting direct concurrent access to shared state. -*/ -template -class Actor { -public: - template - Actor(Scheduler& scheduler, Args&&... args) - : target(scheduler, parent, std::forward(args)...) {} - - template - Actor(std::shared_ptr scheduler, Args&&... args) - : retainer(std::move(scheduler)), target(*retainer, parent, std::forward(args)...) {} - - Actor(const Actor&) = delete; - - ActorRef> self() { - return parent.self(); - } - -private: - std::shared_ptr retainer; - AspiringActor parent; - EstablishedActor target; -}; - -} // namespace mbgl diff --git a/include/mbgl/actor/actor_ref.hpp b/include/mbgl/actor/actor_ref.hpp deleted file mode 100644 index d700a86d1..000000000 --- a/include/mbgl/actor/actor_ref.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { - -/* - An `ActorRef` is a *non*-owning, weak reference to an actor of type `O`. You can send it - messages just like an `Actor`. It's a value object: safe to copy and pass between actors - via messages. - - An `ActorRef` does not extend the lifetime of the corresponding `Actor`. That's determined - entirely by whichever object owns the `Actor` -- the actor's "supervisor". - - It's safe for a `Ref` to outlive its `Actor` -- the reference is "weak", and does not extend - the lifetime of the owning Actor, and sending a message to a `Ref` whose `Actor` has died is - a no-op. (In the future, a dead-letters queue or log may be implemented.) -*/ - -template -class ActorRef { -public: - ActorRef(Object& object_, std::weak_ptr weakMailbox_) - : object(&object_), - weakMailbox(std::move(weakMailbox_)) { - } - - template - void invoke(Fn fn, Args&&... args) const { - if (auto mailbox = weakMailbox.lock()) { - mailbox->push(actor::makeMessage(*object, fn, std::forward(args)...)); - } - } - - template - auto ask(Fn fn, Args&&... args) const { - // Result type is deduced from the function's return type - using ResultType = typename std::result_of::type; - - std::promise promise; - auto future = promise.get_future(); - - if (auto mailbox = weakMailbox.lock()) { - mailbox->push( - actor::makeMessage( - std::move(promise), *object, fn, std::forward(args)... - ) - ); - } else { - promise.set_exception(std::make_exception_ptr(std::runtime_error("Actor has gone away"))); - } - - return future; - } - -private: - Object* object; - std::weak_ptr weakMailbox; -}; - -} // namespace mbgl diff --git a/include/mbgl/actor/aspiring_actor.hpp b/include/mbgl/actor/aspiring_actor.hpp deleted file mode 100644 index 6c410cdfc..000000000 --- a/include/mbgl/actor/aspiring_actor.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace mbgl { - -template -class EstablishedActor; - -template -class Actor; - -/* - An `AspiringActor` is one half of the pair of types that comprise an actor (see `Actor`), - the other half being `EstablishedActor`. It is responsible for: - - ownership of the actor's `Mailbox` - - allocating the memory for (but *not* constructing) the target object `O` - - Using these two pieces--the mailbox and a stable address for `O`--an `AspiringActor` can - accept messages for the target object, or provide `ActorRef`s that do so, before the object - has actually been constructed by the corresponding `EstablishedActor`. (Such messages are - queued in the mailbox until after the object is constructed.) - - This allows for an `AspiringActor` to be created and safely used by a thread other than the - one on which the target object will (eventually) live. -*/ -template -class AspiringActor { -public: - AspiringActor() : mailbox(std::make_shared()) { - // mailbox starts closed because the `Object` hasn't yet been constructed - assert(!mailbox->isOpen()); - } - - AspiringActor(const AspiringActor&) = delete; - - ActorRef> self() { - return ActorRef>(object(), mailbox); - } - -private: - std::shared_ptr mailbox; - std::aligned_storage_t objectStorage; - - Object& object() { - return *reinterpret_cast(&objectStorage); - } - - friend class EstablishedActor; - friend class Actor; -}; - -} // namespace mbgl diff --git a/include/mbgl/actor/established_actor.hpp b/include/mbgl/actor/established_actor.hpp deleted file mode 100644 index da0d8ac70..000000000 --- a/include/mbgl/actor/established_actor.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace mbgl { - -/* - An `EstablishedActor` is one half of the pair of types that comprise an actor (see `Actor`), - the other half being `AspiringActor`. It is responsible for managing the lifetime of the - target object `O` and the open/closed state of the parent's `mailbox`. - - The `O` object's lifetime is contained by that of its owning `EstablishedActor`: the - `EstablishedActor` constructor executes the `O` constructor via "placement new", constructing - it at the address provided by the parent `AspiringActor`, and the `~EstablishedActor` destructor - similarly executes the `~O` destructor (after closing the mailbox). `EstablishedActor` should - therefore live entirely on the thread intended to own `O`. -*/ - -template -class EstablishedActor { -public: - // Construct the Object from a parameter pack `args` (i.e. `Object(args...)`) - template ::value || - std::is_constructible, Args...>::value - >::type * = nullptr> - EstablishedActor(Scheduler& scheduler, AspiringActor& parent_, Args&& ... args) - : parent(parent_) { - emplaceObject(std::forward(args)...); - parent.mailbox->open(scheduler); - } - - // Construct the `Object` from a tuple containing the constructor arguments (i.e. - // `Object(std::get<0>(args), std::get<1>(args), ...)`) - template >::value> - EstablishedActor(Scheduler& scheduler, AspiringActor& parent_, ArgsTuple&& args) - : parent(parent_) { - emplaceObject(std::forward(args), std::make_index_sequence{}); - parent.mailbox->open(scheduler); - } - - EstablishedActor(const EstablishedActor&) = delete; - - ~EstablishedActor() { - parent.mailbox->close(); - parent.object().~Object(); - } - -private: - // Enabled for Objects with a constructor taking ActorRef as the first parameter - template , Args...>::value>::type * = nullptr> - void emplaceObject(Args&&... args_) { - new (&parent.objectStorage) Object(parent.self(), std::forward(args_)...); - } - - // Enabled for plain Objects - template ::value>::type * = nullptr> - void emplaceObject(Args&&... args_) { - new (&parent.objectStorage) Object(std::forward(args_)...); - } - - // Used to expand a tuple holding the constructor arguments - template - void emplaceObject(ArgsTuple&& args, std::index_sequence) { - emplaceObject(std::move(std::get(std::forward(args)))...); - (void) args; // mark args as used: if it's empty tuple, it's not actually used above. - } - - AspiringActor& parent; -}; - -} // namespace mbgl diff --git a/include/mbgl/actor/mailbox.hpp b/include/mbgl/actor/mailbox.hpp deleted file mode 100644 index 2b9838ef2..000000000 --- a/include/mbgl/actor/mailbox.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include - -#include -#include -#include -#include - -namespace mbgl { - -class Scheduler; -class Message; - -class Mailbox : public std::enable_shared_from_this { -public: - - // Create a "holding" mailbox, messages to which will remain queued, - // unconsumed, until the mailbox is associated with a Scheduler using - // start(). This allows a Mailbox object to be created on one thread and - // later transferred to a different target thread that may not yet exist. - Mailbox(); - - Mailbox(Scheduler&); - - // Attach the given scheduler to this mailbox and begin processing messages - // sent to it. The mailbox must be a "holding" mailbox, as created by the - // default constructor Mailbox(). - void open(Scheduler& scheduler_); - void close(); - - bool isOpen() const; - - void push(std::unique_ptr); - void receive(); - - static void maybeReceive(std::weak_ptr); - static std::function makeClosure(std::weak_ptr); - -private: - optional scheduler; - - std::recursive_mutex receivingMutex; - std::mutex pushingMutex; - - bool closed { false }; - - std::mutex queueMutex; - std::queue> queue; -}; - -} // namespace mbgl diff --git a/include/mbgl/actor/message.hpp b/include/mbgl/actor/message.hpp deleted file mode 100644 index 0a2099335..000000000 --- a/include/mbgl/actor/message.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { - -// A movable type-erasing function wrapper. This allows to store arbitrary invokable -// things (like std::function<>, or the result of a movable-only std::bind()) in the queue. -// Source: http://stackoverflow.com/a/29642072/331379 -class Message { -public: - virtual ~Message() = default; - virtual void operator()() = 0; -}; - -template -class MessageImpl : public Message { -public: - MessageImpl(Object& object_, MemberFn memberFn_, ArgsTuple argsTuple_) - : object(object_), - memberFn(memberFn_), - argsTuple(std::move(argsTuple_)) { - } - - void operator()() override { - invoke(std::make_index_sequence::value>()); - } - - template - void invoke(std::index_sequence) { - (object.*memberFn)(std::move(std::get(argsTuple))...); - } - - Object& object; - MemberFn memberFn; - ArgsTuple argsTuple; -}; - -template -class AskMessageImpl : public Message { -public: - AskMessageImpl(std::promise promise_, Object& object_, MemberFn memberFn_, ArgsTuple argsTuple_) - : object(object_), - memberFn(memberFn_), - argsTuple(std::move(argsTuple_)), - promise(std::move(promise_)) { - } - - void operator()() override { - promise.set_value(ask(std::make_index_sequence::value>())); - } - - template - ResultType ask(std::index_sequence) { - return (object.*memberFn)(std::move(std::get(argsTuple))...); - } - - Object& object; - MemberFn memberFn; - ArgsTuple argsTuple; - std::promise promise; -}; - -template -class AskMessageImpl : public Message { -public: - AskMessageImpl(std::promise promise_, Object& object_, MemberFn memberFn_, ArgsTuple argsTuple_) - : object(object_), - memberFn(memberFn_), - argsTuple(std::move(argsTuple_)), - promise(std::move(promise_)) { - } - - void operator()() override { - ask(std::make_index_sequence::value>()); - promise.set_value(); - } - - template - void ask(std::index_sequence) { - (object.*memberFn)(std::move(std::get(argsTuple))...); - } - - Object& object; - MemberFn memberFn; - ArgsTuple argsTuple; - std::promise promise; -}; - -namespace actor { - -template -std::unique_ptr makeMessage(Object& object, MemberFn memberFn, Args&&... args) { - auto tuple = std::make_tuple(std::forward(args)...); - return std::make_unique>(object, memberFn, std::move(tuple)); -} - -template -std::unique_ptr makeMessage(std::promise&& promise, Object& object, MemberFn memberFn, Args&&... args) { - auto tuple = std::make_tuple(std::forward(args)...); - return std::make_unique>(std::move(promise), object, memberFn, std::move(tuple)); -} - -} // namespace actor -} // namespace mbgl diff --git a/include/mbgl/actor/scheduler.hpp b/include/mbgl/actor/scheduler.hpp deleted file mode 100644 index bb2cf124b..000000000 --- a/include/mbgl/actor/scheduler.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { - -class Mailbox; - -/* - A `Scheduler` is responsible for coordinating the processing of messages by - one or more actors via their mailboxes. It's an abstract interface. Currently, - the following concrete implementations exist: - - * `ThreadPool` can coordinate an unlimited number of actors over any number of - threads via a pool, preserving the following behaviors: - - - Messages from each individual mailbox are processed in order - - Only a single message from a mailbox is processed at a time; there is no - concurrency within a mailbox - - Subject to these constraints, processing can happen on whatever thread in the - pool is available. - - * `Scheduler::GetCurrent()` is typically used to create a mailbox and `ActorRef` - for an object that lives on the main thread and is not itself wrapped an - `Actor`. The underlying implementation of this Scheduler should usually be - a `RunLoop` - auto mailbox = std::make_shared(*Scheduler::Get()); - Actor worker(threadPool, ActorRef(*this, mailbox)); -*/ -class Scheduler { -public: - virtual ~Scheduler() = default; - - // Enqueues a function for execution. - virtual void schedule(std::function) = 0; - // Makes a weak pointer to this Scheduler. - virtual mapbox::base::WeakPtr makeWeakPtr() = 0; - - // Returns a closure wrapping the given one. - // - // When the returned closure is invoked for the first time, it schedules - // the given closure to this scheduler, the consequent calls of the - // returned closure are ignored. - // - // If this scheduler is already deleted by the time the returnded closure is - // first invoked, the call is ignored. - std::function bindOnce(std::function); - - // Set/Get the current Scheduler for this thread - static Scheduler* GetCurrent(); - static void SetCurrent(Scheduler*); - - // Get the scheduler for asynchronous tasks. This method - // will lazily initialize a shared worker pool when ran - // from the first time. - static std::shared_ptr GetBackground(); -}; - -} // namespace mbgl diff --git a/include/mbgl/annotation/annotation.hpp b/include/mbgl/annotation/annotation.hpp deleted file mode 100644 index 0d67e90d7..000000000 --- a/include/mbgl/annotation/annotation.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { - -using AnnotationID = uint64_t; -using AnnotationIDs = std::vector; - -class SymbolAnnotation { -public: - SymbolAnnotation(Point geometry_, std::string icon_ = {}) : geometry(geometry_), icon(std::move(icon_)) {} - - Point geometry; - std::string icon; -}; - -using ShapeAnnotationGeometry = variant< - LineString, - Polygon, - MultiLineString, - MultiPolygon>; - -class LineAnnotation { -public: - LineAnnotation(ShapeAnnotationGeometry geometry_, - style::PropertyValue opacity_ = 1.0f, - style::PropertyValue width_ = 1.0f, - style::PropertyValue color_ = Color::black()) - : geometry(std::move(geometry_)), - opacity(std::move(opacity_)), - width(std::move(width_)), - color(std::move(color_)) {} - - ShapeAnnotationGeometry geometry; - style::PropertyValue opacity; - style::PropertyValue width; - style::PropertyValue color; -}; - -class FillAnnotation { -public: - FillAnnotation(ShapeAnnotationGeometry geometry_, - style::PropertyValue opacity_ = 1.0f, - style::PropertyValue color_ = Color::black(), - style::PropertyValue outlineColor_ = {}) - : geometry(std::move(geometry_)), - opacity(std::move(opacity_)), - color(std::move(color_)), - outlineColor(std::move(outlineColor_)) {} - - ShapeAnnotationGeometry geometry; - style::PropertyValue opacity; - style::PropertyValue color; - style::PropertyValue outlineColor; -}; - -using Annotation = variant< - SymbolAnnotation, - LineAnnotation, - FillAnnotation>; - -} // namespace mbgl diff --git a/include/mbgl/gfx/backend.hpp b/include/mbgl/gfx/backend.hpp deleted file mode 100644 index eed63dfcb..000000000 --- a/include/mbgl/gfx/backend.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace gfx { - -class Backend { -public: - enum class Type : uint8_t { - OpenGL, - }; - - static constexpr Type DefaultType = Type::OpenGL; - - static void SetType(const Type value) { - if (Value(value) != value) { - abort(); // SetType must be called prior to any GetType calls. - } - } - - static Type GetType() { - return Value(DefaultType); - } - - template - static std::unique_ptr Create(Args... args) { - return Create(std::forward(args)...); - } - -private: - template - static std::unique_ptr Create(Args...); - - static Type Value(Type value) { - static const Type type = value; - return type; - } -}; - -} // namespace gfx -} // namespace mbgl diff --git a/include/mbgl/gfx/backend_scope.hpp b/include/mbgl/gfx/backend_scope.hpp deleted file mode 100644 index ae42123e9..000000000 --- a/include/mbgl/gfx/backend_scope.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -namespace mbgl { -namespace gfx { - -class RendererBackend; - -class BackendScope { -public: - // There are two types of scopes: Creating an "Implicit" scope tells Mapbox GL that the - // supporting windowing system has already activated the GL Backend and that no further actions - // are required. Creating an "Explicit" scope actually enables the GL Backend, and disables it - // when the BackendScope is destroyed. - enum class ScopeType : bool { - Implicit, - Explicit, - }; - - BackendScope(RendererBackend&, ScopeType = ScopeType::Explicit); - ~BackendScope(); - - // Returns true when there is currently a BackendScope active in this thread. - static bool exists(); - -private: - void activate(); - void deactivate(); - - BackendScope* priorScope; - BackendScope* nextScope; - RendererBackend& backend; - const ScopeType scopeType; - bool activated = false; -}; - -} // namespace gfx -} // namespace mbgl diff --git a/include/mbgl/gfx/renderable.hpp b/include/mbgl/gfx/renderable.hpp deleted file mode 100644 index 1aca5a789..000000000 --- a/include/mbgl/gfx/renderable.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { -namespace gfx { - -class RenderableResource { -protected: - explicit RenderableResource() = default; - -public: - virtual ~RenderableResource() = default; - RenderableResource(const RenderableResource&) = delete; - RenderableResource& operator=(const RenderableResource&) = delete; -}; - -class Renderable { -protected: - Renderable(const Size size_, std::unique_ptr resource_) - : size(size_), resource(std::move(resource_)) { - } - virtual ~Renderable() = default; - -public: - Size getSize() const { - return size; - } - - template - T& getResource() const { - assert(resource); - return static_cast(*resource); - } - - virtual void wait() {} - -protected: - Size size; - std::unique_ptr resource; -}; - -} // namespace gfx -} // namespace mbgl diff --git a/include/mbgl/gfx/renderer_backend.hpp b/include/mbgl/gfx/renderer_backend.hpp deleted file mode 100644 index aa76d7e50..000000000 --- a/include/mbgl/gfx/renderer_backend.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { -namespace gfx { - -class Context; -class Renderable; -class BackendScope; - -// We can make some optimizations if we know that the drawing context is not shared with other code. -enum class ContextMode : bool { - Unique, - Shared, -}; - -class RendererBackend { -protected: - explicit RendererBackend(ContextMode); - -public: - virtual ~RendererBackend(); - RendererBackend(const RendererBackend&) = delete; - RendererBackend& operator=(const RendererBackend&) = delete; - - // Returns the device's context. - Context& getContext(); - - template - T& getContext() { - return static_cast(getContext()); - } - - bool contextIsShared() const { - return contextMode == ContextMode::Shared; - } - - // Returns a reference to the default surface that should be rendered on. - virtual Renderable& getDefaultRenderable() = 0; - -protected: - virtual std::unique_ptr createContext() = 0; - - // Called when the backend's GL context needs to be made active or inactive. These are called, - // as a matched pair, exclusively through BackendScope, in two situations: - // - // 1. When releasing GL resources during Renderer destruction - // (Including calling CustomLayerHost::deinitialize during RenderCustomLayer destruction) - // 2. When renderering through Renderer::render() - // (Including calling CustomLayerHost::initialize for newly added custom layers and - // CustomLayerHost::deinitialize on layer removal) - virtual void activate() = 0; - virtual void deactivate() = 0; - -protected: - std::unique_ptr context; - const ContextMode contextMode; - std::once_flag initialized; - - friend class BackendScope; -}; - -MBGL_CONSTEXPR bool operator==(const RendererBackend& a, const RendererBackend& b) { - return &a == &b; -} - -} // namespace gfx -} // namespace mbgl diff --git a/include/mbgl/gl/renderable_resource.hpp b/include/mbgl/gl/renderable_resource.hpp deleted file mode 100644 index 958526927..000000000 --- a/include/mbgl/gl/renderable_resource.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { -namespace gl { - -class RenderableResource : public gfx::RenderableResource { -protected: - explicit RenderableResource() = default; - -public: - virtual void bind() = 0; - - virtual void swap() { - // Renderable resources that require a swap function to be called explicitly - // can override this method. - } -}; - -} // namespace gl -} // namespace mbgl diff --git a/include/mbgl/gl/renderer_backend.hpp b/include/mbgl/gl/renderer_backend.hpp deleted file mode 100644 index cfa28ddae..000000000 --- a/include/mbgl/gl/renderer_backend.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { -namespace gl { - -class Context; -using ProcAddress = void (*)(); -using FramebufferID = uint32_t; - -class RendererBackend : public gfx::RendererBackend { -public: - RendererBackend(gfx::ContextMode); - ~RendererBackend() override; - - // Called prior to rendering to update the internally assumed OpenGL state. - virtual void updateAssumedState() = 0; - -protected: - std::unique_ptr createContext() override; - - // Called with the name of an OpenGL extension that should be loaded. RendererBackend implementations - // must call the API-specific version that obtains the function pointer for this function, - // or a null pointer if unsupported/unavailable. - virtual ProcAddress getExtensionFunctionPointer(const char*) = 0; - - // Reads the color pixel data from the currently bound framebuffer. - PremultipliedImage readFramebuffer(const Size&); - - // A constant to signal that a framebuffer is bound, but with an unknown ID. - static constexpr const FramebufferID ImplicitFramebufferBinding = - std::numeric_limits::max(); - - // Tells the renderer that OpenGL state has already been set by the windowing toolkit. - // It sets the internal assumed state to the supplied values. - void assumeFramebufferBinding(FramebufferID fbo); - void assumeViewport(int32_t x, int32_t y, const Size&); - void assumeScissorTest(bool); - - // Returns true when assumed framebuffer binding hasn't changed from the implicit binding. - bool implicitFramebufferBound(); - -public: - // Triggers an OpenGL state update if the internal assumed state doesn't match the - // supplied values. - void setFramebufferBinding(FramebufferID fbo); - void setViewport(int32_t x, int32_t y, const Size&); - void setScissorTest(bool); -}; - -} // namespace gl -} // namespace mbgl diff --git a/include/mbgl/i18n/collator.hpp b/include/mbgl/i18n/collator.hpp deleted file mode 100644 index 9db1f804a..000000000 --- a/include/mbgl/i18n/collator.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { -namespace platform { - -class Collator { -public: - explicit Collator(bool caseSensitive, bool diacriticSensitive, optional locale = nullopt); - int compare(const std::string& lhs, const std::string& rhs) const; - std::string resolvedLocale() const; - bool operator==(const Collator& other) const; - -private: - class Impl; - std::shared_ptr impl; -}; - -} // namespace platform -} // namespace mbgl diff --git a/include/mbgl/i18n/number_format.hpp b/include/mbgl/i18n/number_format.hpp deleted file mode 100644 index cb1e94c7b..000000000 --- a/include/mbgl/i18n/number_format.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace platform { - -std::string formatNumber(double number, - const std::string& localeId, - const std::string& currency, - uint8_t minFractionDigits, - uint8_t maxFractionDigits); - -} // namespace platform -} // namespace mbgl diff --git a/include/mbgl/layermanager/background_layer_factory.hpp b/include/mbgl/layermanager/background_layer_factory.hpp deleted file mode 100644 index f2fa2f7a5..000000000 --- a/include/mbgl/layermanager/background_layer_factory.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class BackgroundLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/circle_layer_factory.hpp b/include/mbgl/layermanager/circle_layer_factory.hpp deleted file mode 100644 index 51135d338..000000000 --- a/include/mbgl/layermanager/circle_layer_factory.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class CircleLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createBucket(const BucketParameters&, const std::vector>&) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/custom_layer_factory.hpp b/include/mbgl/layermanager/custom_layer_factory.hpp deleted file mode 100644 index 963a3dc2f..000000000 --- a/include/mbgl/layermanager/custom_layer_factory.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { - -class CustomLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp b/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp deleted file mode 100644 index fbaa5c125..000000000 --- a/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class FillExtrusionLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createLayout(const LayoutParameters&, std::unique_ptr, const std::vector>&) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/fill_layer_factory.hpp b/include/mbgl/layermanager/fill_layer_factory.hpp deleted file mode 100644 index 09afb0dc3..000000000 --- a/include/mbgl/layermanager/fill_layer_factory.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class FillLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createLayout(const LayoutParameters&, std::unique_ptr, const std::vector>&) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/heatmap_layer_factory.hpp b/include/mbgl/layermanager/heatmap_layer_factory.hpp deleted file mode 100644 index 2d0e1a5a0..000000000 --- a/include/mbgl/layermanager/heatmap_layer_factory.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class HeatmapLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createBucket(const BucketParameters&, const std::vector>&) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/hillshade_layer_factory.hpp b/include/mbgl/layermanager/hillshade_layer_factory.hpp deleted file mode 100644 index 25b4f6c2c..000000000 --- a/include/mbgl/layermanager/hillshade_layer_factory.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class HillshadeLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/layer_factory.hpp b/include/mbgl/layermanager/layer_factory.hpp deleted file mode 100644 index f3cfef6bb..000000000 --- a/include/mbgl/layermanager/layer_factory.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { - -namespace style { -class LayerProperties; -} // namespace style -class Bucket; -class BucketParameters; -class GeometryTileLayer; -class Layout; -class LayoutParameters; -class RenderLayer; - -/** - * @brief The LayerFactory abstract class - * - * This class is responsible for creation of the layer objects that belong to a concrete layer type. - */ -class LayerFactory { -public: - virtual ~LayerFactory() = default; - /// Returns the layer type data. - virtual const style::LayerTypeInfo* getTypeInfo() const noexcept = 0; - /// Returns a new Layer instance on success call; returns `nullptr` otherwise. - virtual std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept = 0; - /// Returns a new RenderLayer instance. - virtual std::unique_ptr createRenderLayer(Immutable) noexcept = 0; - /// Returns a new Bucket instance on success call; returns `nullptr` otherwise. - virtual std::unique_ptr createBucket(const BucketParameters&, const std::vector>&) noexcept; - /// Returns a new Layout instance on success call; returns `nullptr` otherwise. - virtual std::unique_ptr createLayout(const LayoutParameters&, std::unique_ptr, const std::vector>&) noexcept; - -protected: - optional getSource(const style::conversion::Convertible& value) const noexcept; - bool initSourceLayerAndFilter(style::Layer*, const style::conversion::Convertible& value) const noexcept; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/layer_manager.hpp b/include/mbgl/layermanager/layer_manager.hpp deleted file mode 100644 index c6802dbb4..000000000 --- a/include/mbgl/layermanager/layer_manager.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { -namespace style { -class LayerProperties; -} // namespace style -class GeometryTileLayer; -class LayerFactory; -class RenderLayer; -class Bucket; -class BucketParameters; -class Layout; -class LayoutParameters; - -/** - * @brief A singleton class responsible for creating layer instances. - * - * The LayerManager has implementation per platform. The LayerManager implementation - * defines what layer types are available and it can also disable annotations. - * - * Linker excludes the unreachable code for the disabled annotations and layers - * from the binaries, significantly reducing their size. - */ -class LayerManager { -public: - /** - * @brief A singleton getter. - * - * @return LayerManager* - */ - static LayerManager* get() noexcept; - - /// Returns a new Layer instance on success call; returns `nullptr` otherwise. - std::unique_ptr createLayer(const std::string& type, const std::string& id, - const style::conversion::Convertible& value, style::conversion::Error& error) noexcept; - /// Returns a new RenderLayer instance on success call; returns `nullptr` otherwise. - std::unique_ptr createRenderLayer(Immutable) noexcept; - /// Returns a new Bucket instance on success call; returns `nullptr` otherwise. - std::unique_ptr createBucket(const BucketParameters&, const std::vector>&) noexcept; - /// Returns a new Layout instance on success call; returns `nullptr` otherwise. - std::unique_ptr createLayout(const LayoutParameters&, std::unique_ptr, - const std::vector>&) noexcept; - - /** - * @brief a build-time flag to enable/disable annotations in mapbox-gl-native core. - * - * At the moment, the annotations implementation in core is creating concrete - * layer instances apart from LayerManager/LayerFactory code path. - * - * So, annotations must be disabled if the LayerManager implementation does - * not provide line, fill or symbol layers (those, used by the annotations - * implementation). - * - * Note: in future, annotations implemantation will be moved from the core to platform - * SDK (see https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-annotation) - * and this flag won't be needed any more. - */ - static const bool annotationsEnabled; - -protected: - virtual ~LayerManager() = default; - virtual LayerFactory* getFactory(const std::string& type) noexcept = 0; - virtual LayerFactory* getFactory(const style::LayerTypeInfo*) noexcept = 0; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/line_layer_factory.hpp b/include/mbgl/layermanager/line_layer_factory.hpp deleted file mode 100644 index 803f550e5..000000000 --- a/include/mbgl/layermanager/line_layer_factory.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class LineLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createLayout(const LayoutParameters& parameters, - std::unique_ptr tileLayer, - const std::vector>& group) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/raster_layer_factory.hpp b/include/mbgl/layermanager/raster_layer_factory.hpp deleted file mode 100644 index d82137ee8..000000000 --- a/include/mbgl/layermanager/raster_layer_factory.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class RasterLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/layermanager/symbol_layer_factory.hpp b/include/mbgl/layermanager/symbol_layer_factory.hpp deleted file mode 100644 index 38f382e96..000000000 --- a/include/mbgl/layermanager/symbol_layer_factory.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class SymbolLayerFactory : public LayerFactory { -protected: - const style::LayerTypeInfo* getTypeInfo() const noexcept final; - std::unique_ptr createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; - std::unique_ptr createLayout(const LayoutParameters& parameters, - std::unique_ptr tileLayer, - const std::vector>& group) noexcept final; - std::unique_ptr createRenderLayer(Immutable) noexcept final; -}; - -} // namespace mbgl diff --git a/include/mbgl/map/bound_options.hpp b/include/mbgl/map/bound_options.hpp deleted file mode 100644 index 69d353a30..000000000 --- a/include/mbgl/map/bound_options.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -/** - * @brief Holds options to limit what parts of a map are visible. All fields are - * optional. - */ -struct BoundOptions { - /// Sets the latitude and longitude bounds to which the camera center are constrained - BoundOptions& withLatLngBounds(LatLngBounds b) { bounds = b; return *this; } - /// Sets the minimum zoom level - BoundOptions& withMinZoom(double z) { minZoom = z; return *this; } - /// Sets the maximum zoom level - BoundOptions& withMaxZoom(double z) { maxZoom = z; return *this; } - - /// Constrain the center of the camera to be within these bounds. - optional bounds; - - /// Maximum zoom level allowed. - optional maxZoom; - - /// Minimum zoom level allowed. - optional minZoom; -}; - -} // namespace mbgl diff --git a/include/mbgl/map/camera.hpp b/include/mbgl/map/camera.hpp deleted file mode 100644 index c8b665fc1..000000000 --- a/include/mbgl/map/camera.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include - -namespace mbgl { - -/** Various options for describing the viewpoint of a map. All fields are - optional. - Anchor and center points are mutually exclusive, with preference for the - center point when both are set. - */ -struct CameraOptions { - CameraOptions& withCenter(const optional& o) { center = o; return *this; } - CameraOptions& withPadding(const optional& p) { padding = p; return *this; } - CameraOptions& withAnchor(const optional& o) { anchor = o; return *this; } - CameraOptions& withZoom(const optional& o) { zoom = o; return *this; } - CameraOptions& withBearing(const optional& o) { bearing = o; return *this; } - CameraOptions& withPitch(const optional& o) { pitch = o; return *this; } - - /** Coordinate at the center of the map. */ - optional center; - - /** Padding around the interior of the view that affects the frame of - reference for `center`. */ - optional padding; - - /** Point of reference for `zoom` and `angle`, assuming an origin at the - top-left corner of the view. */ - optional anchor; - - /** Zero-based zoom level. Constrained to the minimum and maximum zoom - levels. */ - optional zoom; - - /** Bearing, measured in degrees from true north. Wrapped to [0, 360). */ - optional bearing; - - /** Pitch toward the horizon measured in degrees , with 0 deg resulting in a - two-dimensional map. */ - optional pitch; -}; - -constexpr bool operator==(const CameraOptions& a, const CameraOptions& b) { - return a.center == b.center - && a.padding == b.padding - && a.anchor == b.anchor - && a.zoom == b.zoom - && a.bearing == b.bearing - && a.pitch == b.pitch; -} - -constexpr bool operator!=(const CameraOptions& a, const CameraOptions& b) { - return !(a == b); -} - -/** Various options for describing a transition between viewpoints with - animation. All fields are optional; the default values depend on how this - struct is used. */ -struct AnimationOptions { - /** Time to animate to the viewpoint defined herein. */ - optional duration; - - /** Average velocity of a flyTo() transition, measured in screenfuls per - second, assuming a linear timing curve. - - A screenful is the visible span in pixels. It does not correspond - to a fixed physical distance but rather varies by zoom level. */ - optional velocity; - - /** Zero-based zoom level at the peak of the flyTo() transition’s flight - path. */ - optional minZoom; - - /** The easing timing curve of the transition. */ - optional easing; - - /** A function that is called on each frame of the transition, just before a - screen update, except on the last frame. The first parameter indicates - the elapsed time as a percentage of the duration. */ - std::function transitionFrameFn; - - /** A function that is called once on the last frame of the transition, just - before the corresponding screen update. */ - std::function transitionFinishFn; - - /** Creates an animation with no options specified. */ - AnimationOptions() {} - - /** Creates an animation with the specified duration. */ - AnimationOptions(Duration d) - : duration(d) {} -}; - -} // namespace mbgl diff --git a/include/mbgl/map/change.hpp b/include/mbgl/map/change.hpp deleted file mode 100644 index 3925d655a..000000000 --- a/include/mbgl/map/change.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -enum MapChange : uint8_t { - MapChangeRegionWillChange = 0, - MapChangeRegionWillChangeAnimated = 1, - MapChangeRegionIsChanging = 2, - MapChangeRegionDidChange = 3, - MapChangeRegionDidChangeAnimated = 4, - MapChangeWillStartLoadingMap = 5, - MapChangeDidFinishLoadingMap = 6, - MapChangeDidFailLoadingMap = 7, - MapChangeWillStartRenderingFrame = 8, - MapChangeDidFinishRenderingFrame = 9, - MapChangeDidFinishRenderingFrameFullyRendered = 10, - MapChangeWillStartRenderingMap = 11, - MapChangeDidFinishRenderingMap = 12, - MapChangeDidFinishRenderingMapFullyRendered = 13, - MapChangeDidFinishLoadingStyle = 14, - MapChangeSourceDidChange = 15 -}; - -} // namespace mbgl diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp deleted file mode 100644 index ac0a398d2..000000000 --- a/include/mbgl/map/map.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace mbgl { - -class RendererFrontend; - -namespace style { -class Image; -class Style; -} // namespace style - -class Map : private util::noncopyable { -public: - explicit Map(RendererFrontend&, - MapObserver&, - const MapOptions&, - const ResourceOptions&); - ~Map(); - - // Register a callback that will get called (on the render thread) when all resources have - // been loaded and a complete render occurs. - using StillImageCallback = std::function; - void renderStill(StillImageCallback); - void renderStill(const CameraOptions&, MapDebugOptions, StillImageCallback); - - // Triggers a repaint. - void triggerRepaint(); - - style::Style& getStyle(); - const style::Style& getStyle() const; - - void setStyle(std::unique_ptr); - - // Transition - void cancelTransitions(); - void setGestureInProgress(bool); - bool isGestureInProgress() const; - bool isRotating() const; - bool isScaling() const; - bool isPanning() const; - - // Camera - CameraOptions getCameraOptions(optional = {}) const; - void jumpTo(const CameraOptions&); - void easeTo(const CameraOptions&, const AnimationOptions&); - void flyTo(const CameraOptions&, const AnimationOptions&); - void moveBy(const ScreenCoordinate&, const AnimationOptions& = {}); - void scaleBy(double scale, optional anchor, const AnimationOptions& animation = {}); - void pitchBy(double pitch, const AnimationOptions& animation = {}); - void rotateBy(const ScreenCoordinate& first, const ScreenCoordinate& second, const AnimationOptions& = {}); - CameraOptions cameraForLatLngBounds(const LatLngBounds&, const EdgeInsets&, optional bearing = {}, optional pitch = {}) const; - CameraOptions cameraForLatLngs(const std::vector&, const EdgeInsets&, optional bearing = {}, optional pitch = {}) const; - CameraOptions cameraForGeometry(const Geometry&, const EdgeInsets&, optional bearing = {}, optional pitch = {}) const; - LatLngBounds latLngBoundsForCamera(const CameraOptions&) const; - - /// @name Bounds - /// @{ - - void setBounds(const BoundOptions& options); - - /// Returns the current map bound options. All optional fields in BoundOptions are set. - BoundOptions getBounds() const; - - /// @} - - // Map Options - void setNorthOrientation(NorthOrientation); - void setConstrainMode(ConstrainMode); - void setViewportMode(ViewportMode); - void setSize(Size); - MapOptions getMapOptions() const; - - //Projection Mode - void setProjectionMode(const ProjectionMode&); - ProjectionMode getProjectionMode() const; - - // Projection - ScreenCoordinate pixelForLatLng(const LatLng&) const; - LatLng latLngForPixel(const ScreenCoordinate&) const; - - // Annotations - void addAnnotationImage(std::unique_ptr); - void removeAnnotationImage(const std::string&); - double getTopOffsetPixelsForAnnotationImage(const std::string&); - - AnnotationID addAnnotation(const Annotation&); - void updateAnnotation(AnnotationID, const Annotation&); - void removeAnnotation(AnnotationID); - - // Tile prefetching - // - // When loading a map, if `PrefetchZoomDelta` is set to any number greater than 0, the map will - // first request a tile for `zoom - delta` in a attempt to display a full map at lower - // resolution as quick as possible. It will get clamped at the tile source minimum zoom. The - // default `delta` is 4. - void setPrefetchZoomDelta(uint8_t delta); - uint8_t getPrefetchZoomDelta() const; - - // Debug - void setDebug(MapDebugOptions); - void cycleDebugOptions(); - MapDebugOptions getDebug() const; - - bool isFullyLoaded() const; - void dumpDebugLogs() const; - -protected: - class Impl; - const std::unique_ptr impl; - - // For testing only. - Map(std::unique_ptr); -}; - -} // namespace mbgl diff --git a/include/mbgl/map/map_observer.hpp b/include/mbgl/map/map_observer.hpp deleted file mode 100644 index 258699a2a..000000000 --- a/include/mbgl/map/map_observer.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { - -enum class MapLoadError { - StyleParseError, - StyleLoadError, - NotFoundError, - UnknownError, -}; - -class MapObserver { -public: - virtual ~MapObserver() = default; - - static MapObserver& nullObserver() { - static MapObserver mapObserver; - return mapObserver; - } - - enum class CameraChangeMode : uint32_t { - Immediate, - Animated - }; - - enum class RenderMode : uint32_t { - Partial, - Full - }; - - struct RenderFrameStatus { - RenderMode mode; - bool needsRepaint; // In continous mode, shows that there are ongoig transitions. - bool placementChanged; - }; - - virtual void onCameraWillChange(CameraChangeMode) {} - virtual void onCameraIsChanging() {} - virtual void onCameraDidChange(CameraChangeMode) {} - virtual void onWillStartLoadingMap() {} - virtual void onDidFinishLoadingMap() {} - virtual void onDidFailLoadingMap(MapLoadError, const std::string&) {} - virtual void onWillStartRenderingFrame() {} - virtual void onDidFinishRenderingFrame(RenderFrameStatus) {} - virtual void onWillStartRenderingMap() {} - virtual void onDidFinishRenderingMap(RenderMode) {} - virtual void onDidFinishLoadingStyle() {} - virtual void onSourceChanged(style::Source&) {} - virtual void onDidBecomeIdle() {} - virtual void onStyleImageMissing(const std::string&) {} - // This method should return true if unused image can be removed, - // false otherwise. By default, unused image will be removed. - virtual bool onCanRemoveUnusedStyleImage(const std::string&) { return true; } -}; - -} // namespace mbgl diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp deleted file mode 100644 index fcb8c8f32..000000000 --- a/include/mbgl/map/map_options.hpp +++ /dev/null @@ -1,142 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { - -/** - * @brief Holds values for Map options. - */ -class MapOptions final { -public: - /** - * @brief Constructs a MapOptions object with default values. - */ - MapOptions(); - ~MapOptions(); - - MapOptions(MapOptions&&) noexcept; - - /** - * @brief Sets the map rendering mode. By default, it is set to Continuous - * so the map will render as data arrives from the network and react - * immediately to state changes. - * - * @param mode Map rendering mode. - * @return MapOptions for chaining options together. - */ - MapOptions& withMapMode(MapMode mode); - - /** - * @brief Gets the previously set (or default) map mode. - * - * @return map mode. - */ - MapMode mapMode() const; - - /** - * @brief Sets the map constrain mode. This can be used to limit the map - * to wrap around the globe horizontally. By default, it is set to - * HeightOnly. - * - * @param mode Map constrain mode. - * @return MapOptions for chaining options together. - */ - MapOptions& withConstrainMode(ConstrainMode mode); - - /** - * @brief Gets the previously set (or default) constrain mode. - * - * @return constrain mode. - */ - ConstrainMode constrainMode() const; - - /** - * @brief Sets the viewport mode. This can be used to flip the vertical - * orientation of the map as some devices may use inverted orientation. - * - * @param mode Viewport mode. - * @return MapOptions for chaining options together. - */ - MapOptions& withViewportMode(ViewportMode mode); - - /** - * @brief Gets the previously set (or default) viewport mode. - * - * @return viewport mode. - */ - ViewportMode viewportMode() const; - - /** - * @brief Specify whether to enable cross-source symbol collision detection - * or not. By default, it is set to true. - * - * @param enableCollisions true to enable, false to disable - * @return MapOptions for chaining options together. - */ - MapOptions& withCrossSourceCollisions(bool enableCollisions); - - /** - * @brief Gets the previously set (or default) crossSourceCollisions value. - * - * @return true if ecross-source symbol collision detection enabled, - * false otherwise. - */ - bool crossSourceCollisions() const; - - /** - * @brief Sets the orientation of the Map. By default, it is set to - * Upwards. - * - * @param orientation Orientation of the Map. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withNorthOrientation(NorthOrientation orientation); - - /** - * @brief Gets the previously set (or default) orientation. - * - * @return Map orientation. - */ - NorthOrientation northOrientation() const; - - /** - * @brief Sets the size to resize the map object and renderer backend. - * - * @param size_ A size given in logical pixels. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withSize(Size size_); - - /** - * @brief Gets the previously set size. - * - * @return Size. - */ - Size size() const; - - /** - * @brief Sets the custom pixel ratio. By default, it is set to 1. - * - * @param ratio Pixel ratio value. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withPixelRatio(float ratio); - - /** - * @brief Gets the previously set (or default) pixel ratio value. - * - * @return pixel ratio value. - */ - float pixelRatio() const; - -private: - class Impl; - std::unique_ptr impl_; -}; - -} // namespace mbgl diff --git a/include/mbgl/map/mode.hpp b/include/mbgl/map/mode.hpp deleted file mode 100644 index 11dd8583a..000000000 --- a/include/mbgl/map/mode.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { - -using EnumType = uint32_t; - -enum class MapMode : EnumType { - Continuous, // continually updating map - Static, // a once-off still image of an arbitrary viewport - Tile // a once-off still image of a single tile -}; - -// We can choose to constrain the map both horizontally or vertically, or only -// vertically e.g. while panning. -enum class ConstrainMode : EnumType { - None, - HeightOnly, - WidthAndHeight, -}; - -// Satisfies embedding platforms that requires the viewport coordinate systems -// to be set according to its standards. -enum class ViewportMode : EnumType { - Default, - FlippedY, -}; - -enum class MapDebugOptions : EnumType { - NoDebug = 0, - TileBorders = 1 << 1, - ParseStatus = 1 << 2, - Timestamps = 1 << 3, - Collision = 1 << 4, - Overdraw = 1 << 5, - StencilClip = 1 << 6, - DepthBuffer = 1 << 7, -}; - -MBGL_CONSTEXPR MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) { - return MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs)); -} - -MBGL_CONSTEXPR MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) { - return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs))); -} - -MBGL_CONSTEXPR bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) { - return mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs); -} - -MBGL_CONSTEXPR MapDebugOptions& operator&=(MapDebugOptions& lhs, MapDebugOptions rhs) { - return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs))); -} - -MBGL_CONSTEXPR MapDebugOptions operator~(MapDebugOptions value) { - return MapDebugOptions(~mbgl::underlying_type(value)); -} - -} // namespace mbgl diff --git a/include/mbgl/map/projection_mode.hpp b/include/mbgl/map/projection_mode.hpp deleted file mode 100644 index 4617371e1..000000000 --- a/include/mbgl/map/projection_mode.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { - -/** - * @brief Holds values for Axonometric rendering. All fields are - * optional. - */ -struct ProjectionMode { - ProjectionMode& withAxonometric(bool o) { axonometric = o; return *this; } - ProjectionMode& withXSkew(double o) { xSkew = o; return *this; } - ProjectionMode& withYSkew(double o) { ySkew = o; return *this; } - - /** - * @brief Set to True to enable axonometric rendering, false otherwise. - */ - optional axonometric; - - /** - * @brief The X skew value represents how much to skew on the x-axis. - */ - optional xSkew; - - /** - * @brief The Y skew value represents how much to skew on the y-axis. - */ - optional ySkew; -}; - -} // namespace mbgl diff --git a/include/mbgl/math/clamp.hpp b/include/mbgl/math/clamp.hpp deleted file mode 100644 index 38d430547..000000000 --- a/include/mbgl/math/clamp.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -template -T clamp(T value, T min_, T max_) { - return max(min_, min(max_, value)); -} - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/math/log2.hpp b/include/mbgl/math/log2.hpp deleted file mode 100644 index 4f5fde60d..000000000 --- a/include/mbgl/math/log2.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include - -#if defined(__ANDROID__) -#include -#endif - -namespace mbgl { -namespace util { - -// Computes the log2(x) rounded up to the next integer. -// (== number of bits required to store x) -uint32_t ceil_log2(uint64_t x); - -template -T log2(T x) { -// log2() is producing wrong results on ARMv5 binaries -// running on ARMv7+ CPUs. -#if defined(__ANDROID__) - return ::log(x) / M_LN2; -#else - return ::log2(x); -#endif -} - -} // namespace util -} // namespace mbgl - -// log2 is not available on Android before API 18. -#if defined(__ANDROID__) && defined(__GNUC__) && \ - defined(__ANDROID_API__) && __ANDROID_API__ < 18 - -template -typename std::enable_if_t::value, T> log2(T x) { - return ::log(x) / M_LN2; -} - -#endif diff --git a/include/mbgl/math/minmax.hpp b/include/mbgl/math/minmax.hpp deleted file mode 100644 index e8c50a39c..000000000 --- a/include/mbgl/math/minmax.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace util { - -template -typename std::enable_if_t::value, T> max(T a, T b) { - return std::max(a, b); -} - -template -typename std::enable_if_t::value, T> max(T a, T b) { - return ::fmax(a, b); -} - -template -typename std::enable_if_t::value, T> max(T a, T b, Ts... args) { - return max(a, max(b, args...)); -} - -template -typename std::enable_if_t::value, T> min(T a, T b) { - return std::min(a, b); -} - -template -typename std::enable_if_t::value, T> min(T a, T b) { - return ::fmin(a, b); -} - -template -typename std::enable_if_t::value, T> min(T a, T b, Ts... args) { - return min(a, min(b, args...)); -} - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/math/wrap.hpp b/include/mbgl/math/wrap.hpp deleted file mode 100644 index 307622538..000000000 --- a/include/mbgl/math/wrap.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -// Constrains n to the given range (including min, excluding max) via modular -// arithmetic. -template -T wrap(T value, T min, T max) { - if (value >= min && value < max) { - return value; - } else if (value == max) { - return min; - } - - const T delta = max - min; - const T wrapped = min + std::fmod(value - min, delta); - return value < min ? wrapped + delta : wrapped; -} - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/platform/gl_functions.hpp b/include/mbgl/platform/gl_functions.hpp deleted file mode 100644 index fab3e3aa3..000000000 --- a/include/mbgl/platform/gl_functions.hpp +++ /dev/null @@ -1,337 +0,0 @@ -#pragma once - -#include - -// Pointers to OpenGL ES 2.0 functions. They must be -// initialized by the platform at linking time. - -#ifndef NDEBUG -#define MBGL_CHECK_ERROR(cmd) ([&]() { struct __MBGL_CHECK_ERROR { ~__MBGL_CHECK_ERROR() noexcept(false) { mbgl::platform::glCheckError(#cmd, __FILE__, __LINE__); } } __MBGL_CHECK_ERROR; return cmd; }()) -#else -#define MBGL_CHECK_ERROR(cmd) (cmd) -#endif - -namespace mbgl { -namespace platform { - -using GLbitfield = unsigned int; -using GLboolean = unsigned char; -using GLchar = char; -using GLdouble = double; -using GLenum = unsigned int; -using GLfloat = float; -using GLint = int; -using GLsizei = int; -using GLubyte = unsigned char; -using GLuint = unsigned int; -using GLvoid = void; - -#if defined(_WIN32) -using GLintptr = long long; -using GLsizeiptr = long long; -#else -using GLintptr = long; -using GLsizeiptr = long; -#endif - -/// Pointer to glActiveTexture OpenGL function. -extern void (* const glActiveTexture)(GLenum); -/// Pointer to glAttachShader OpenGL function. -extern void (* const glAttachShader)(GLuint, GLuint); -/// Pointer to glBindAttribLocation OpenGL function. -extern void (* const glBindAttribLocation)(GLuint, GLuint, const GLchar *); -/// Pointer to glBindBuffer OpenGL function. -extern void (* const glBindBuffer)(GLenum, GLuint); -/// Pointer to glBindFramebuffer OpenGL function. -extern void (* const glBindFramebuffer)(GLenum, GLuint); -/// Pointer to glBindRenderbuffer OpenGL function. -extern void (* const glBindRenderbuffer)(GLenum, GLuint); -/// Pointer to glBindTexture OpenGL function. -extern void (* const glBindTexture)(GLenum, GLuint); -/// Pointer to glBlendColor OpenGL function. -extern void (* const glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat); -/// Pointer to glBlendEquation OpenGL function. -extern void (* const glBlendEquation)(GLenum); -/// Pointer to glBlendEquationSeparate OpenGL function. -extern void (* const glBlendEquationSeparate)(GLenum, GLenum); -/// Pointer to glBlendFunc OpenGL function. -extern void (* const glBlendFunc)(GLenum, GLenum); -/// Pointer to glBlendFuncSeparate OpenGL function. -extern void (* const glBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum); -/// Pointer to glBufferData OpenGL function. -extern void (* const glBufferData)(GLenum, GLsizeiptr, const void *, GLenum); -/// Pointer to glBufferSubData OpenGL function. -extern void (* const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *); -/// Pointer to glCheckFramebufferStatus OpenGL function. -extern GLenum (* const glCheckFramebufferStatus)(GLenum); -/// Pointer to glClear OpenGL function. -extern void (* const glClear)(GLbitfield); -/// Pointer to glClearColor OpenGL function. -extern void (* const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat); -/// Pointer to glClearDepthf OpenGL function. -extern void (* const glClearDepthf)(GLfloat); -/// Pointer to glClearStencil OpenGL function. -extern void (* const glClearStencil)(GLint); -/// Pointer to glColorMask OpenGL function. -extern void (* const glColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); -/// Pointer to glCompileShader OpenGL function. -extern void (* const glCompileShader)(GLuint); -/// Pointer to glCompressedTexImage2D OpenGL function. -extern void (* const glCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *); -/// Pointer to glCompressedTexSubImage2D OpenGL function. -extern void (* const glCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *); -/// Pointer to glCopyTexImage2D OpenGL function. -extern void (* const glCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); -/// Pointer to glCopyTexSubImage2D OpenGL function. -extern void (* const glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); -/// Pointer to glCreateProgram OpenGL function. -extern GLuint (* const glCreateProgram)(); -/// Pointer to glCreateShader OpenGL function. -extern GLuint (* const glCreateShader)(GLenum); -/// Pointer to glCullFace OpenGL function. -extern void (* const glCullFace)(GLenum); -/// Pointer to glDeleteBuffers OpenGL function. -extern void (* const glDeleteBuffers)(GLsizei, const GLuint *); -/// Pointer to glDeleteFramebuffers OpenGL function. -extern void (* const glDeleteFramebuffers)(GLsizei, const GLuint *); -/// Pointer to glDeleteProgram OpenGL function. -extern void (* const glDeleteProgram)(GLuint); -/// Pointer to glDeleteRenderbuffers OpenGL function. -extern void (* const glDeleteRenderbuffers)(GLsizei, const GLuint *); -/// Pointer to glDeleteShader OpenGL function. -extern void (* const glDeleteShader)(GLuint); -/// Pointer to glDeleteTextures OpenGL function. -extern void (* const glDeleteTextures)(GLsizei, const GLuint *); -/// Pointer to glDepthFunc OpenGL function. -extern void (* const glDepthFunc)(GLenum); -/// Pointer to glDepthMask OpenGL function. -extern void (* const glDepthMask)(GLboolean); -/// Pointer to glDepthRangef OpenGL function. -extern void (* const glDepthRangef)(GLfloat, GLfloat); -/// Pointer to glDetachShader OpenGL function. -extern void (* const glDetachShader)(GLuint, GLuint); -/// Pointer to glDisable OpenGL function. -extern void (* const glDisable)(GLenum); -/// Pointer to glDisableVertexAttribArray OpenGL function. -extern void (* const glDisableVertexAttribArray)(GLuint); -/// Pointer to glDrawArrays OpenGL function. -extern void (* const glDrawArrays)(GLenum, GLint, GLsizei); -/// Pointer to glDrawElements OpenGL function. -extern void (* const glDrawElements)(GLenum, GLsizei, GLenum, const void *); -/// Pointer to glEnable OpenGL function. -extern void (* const glEnable)(GLenum); -/// Pointer to glEnableVertexAttribArray OpenGL function. -extern void (* const glEnableVertexAttribArray)(GLuint); -/// Pointer to glFinish OpenGL function. -extern void (* const glFinish)(); -/// Pointer to glFlush OpenGL function. -extern void (* const glFlush)(); -/// Pointer to glFramebufferRenderbuffer OpenGL function. -extern void (* const glFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint); -/// Pointer to glFramebufferTexture2D OpenGL function. -extern void (* const glFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint); -/// Pointer to glFrontFace OpenGL function. -extern void (* const glFrontFace)(GLenum); -/// Pointer to glGenBuffers OpenGL function. -extern void (* const glGenBuffers)(GLsizei, GLuint *); -/// Pointer to glGenerateMipmap OpenGL function. -extern void (* const glGenerateMipmap)(GLenum); -/// Pointer to glGenFramebuffers OpenGL function. -extern void (* const glGenFramebuffers)(GLsizei, GLuint *); -/// Pointer to glGenRenderbuffers OpenGL function. -extern void (* const glGenRenderbuffers)(GLsizei, GLuint *); -/// Pointer to glGenTextures OpenGL function. -extern void (* const glGenTextures)(GLsizei, GLuint *); -/// Pointer to glGetActiveAttrib OpenGL function. -extern void (* const glGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -/// Pointer to glGetActiveUniform OpenGL function. -extern void (* const glGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); -/// Pointer to glGetAttachedShaders OpenGL function. -extern void (* const glGetAttachedShaders)(GLuint, GLsizei, GLsizei *, GLuint *); -/// Pointer to glGetAttribLocation OpenGL function. -extern GLint (* const glGetAttribLocation)(GLuint, const GLchar *); -/// Pointer to glGetBooleanv OpenGL function. -extern void (* const glGetBooleanv)(GLenum, GLboolean *); -/// Pointer to glGetBufferParameteriv OpenGL function. -extern void (* const glGetBufferParameteriv)(GLenum, GLenum, GLint *); -/// Pointer to glGetError OpenGL function. -extern GLenum (* const glGetError)(); -/// Pointer to glGetFloatv OpenGL function. -extern void (* const glGetFloatv)(GLenum, GLfloat *); -/// Pointer to glGetFramebufferAttachmentParameteriv OpenGL function. -extern void (* const glGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint *); -/// Pointer to glGetIntegerv OpenGL function. -extern void (* const glGetIntegerv)(GLenum, GLint *); -/// Pointer to glGetProgramInfoLog OpenGL function. -extern void (* const glGetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); -/// Pointer to glGetProgramiv OpenGL function. -extern void (* const glGetProgramiv)(GLuint, GLenum, GLint *); -/// Pointer to glGetRenderbufferParameteriv OpenGL function. -extern void (* const glGetRenderbufferParameteriv)(GLenum, GLenum, GLint *); -/// Pointer to glGetShaderInfoLog OpenGL function. -extern void (* const glGetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *); -/// Pointer to glGetShaderiv OpenGL function. -extern void (* const glGetShaderiv)(GLuint, GLenum, GLint *); -/// Pointer to glGetShaderSource OpenGL function. -extern void (* const glGetShaderSource)(GLuint, GLsizei, GLsizei *, GLchar *); -/// Pointer to glGetString OpenGL function. -extern const GLubyte *(*glGetString)(GLenum); -/// Pointer to glGetTexParameterfv OpenGL function. -extern void (* const glGetTexParameterfv)(GLenum, GLenum, GLfloat *); -/// Pointer to glGetTexParameteriv OpenGL function. -extern void (* const glGetTexParameteriv)(GLenum, GLenum, GLint *); -/// Pointer to glGetUniformfv OpenGL function. -extern void (* const glGetUniformfv)(GLuint, GLint, GLfloat *); -/// Pointer to glGetUniformiv OpenGL function. -extern void (* const glGetUniformiv)(GLuint, GLint, GLint *); -/// Pointer to glGetUniformLocation OpenGL function. -extern GLint (* const glGetUniformLocation)(GLuint, const GLchar *); -/// Pointer to glGetVertexAttribfv OpenGL function. -extern void (* const glGetVertexAttribfv)(GLuint, GLenum, GLfloat *); -/// Pointer to glGetVertexAttribiv OpenGL function. -extern void (* const glGetVertexAttribiv)(GLuint, GLenum, GLint *); -/// Pointer to glGetVertexAttribPointerv OpenGL function. -extern void (* const glGetVertexAttribPointerv)(GLuint, GLenum, void **); -/// Pointer to glHint OpenGL function. -extern void (* const glHint)(GLenum, GLenum); -/// Pointer to glIsBuffer OpenGL function. -extern GLboolean (* const glIsBuffer)(GLuint); -/// Pointer to glIsEnabled OpenGL function. -extern GLboolean (* const glIsEnabled)(GLenum); -/// Pointer to glIsFramebuffer OpenGL function. -extern GLboolean (* const glIsFramebuffer)(GLuint); -/// Pointer to glIsProgram OpenGL function. -extern GLboolean (* const glIsProgram)(GLuint); -/// Pointer to glIsRenderbuffer OpenGL function. -extern GLboolean (* const glIsRenderbuffer)(GLuint); -/// Pointer to glIsShader OpenGL function. -extern GLboolean (* const glIsShader)(GLuint); -/// Pointer to glIsTexture OpenGL function. -extern GLboolean (* const glIsTexture)(GLuint); -/// Pointer to glLineWidth OpenGL function. -extern void (* const glLineWidth)(GLfloat); -/// Pointer to glLinkProgram OpenGL function. -extern void (* const glLinkProgram)(GLuint); -/// Pointer to glPixelStorei OpenGL function. -extern void (* const glPixelStorei)(GLenum, GLint); -/// Pointer to glPolygonOffset OpenGL function. -extern void (* const glPolygonOffset)(GLfloat, GLfloat); -/// Pointer to glReadPixels OpenGL function. -extern void (* const glReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *); -/// Pointer to glRenderbufferStorage OpenGL function. -extern void (* const glRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei); -/// Pointer to glSampleCoverage OpenGL function. -extern void (* const glSampleCoverage)(GLfloat, GLboolean); -/// Pointer to glScissor OpenGL function. -extern void (* const glScissor)(GLint, GLint, GLsizei, GLsizei); -/// Pointer to glShaderSource OpenGL function. -extern void (* const glShaderSource)(GLuint, GLsizei, const GLchar * const*, const GLint *); -/// Pointer to glStencilFunc OpenGL function. -extern void (* const glStencilFunc)(GLenum, GLint, GLuint); -/// Pointer to glStencilFuncSeparate OpenGL function. -extern void (* const glStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint); -/// Pointer to glStencilMask OpenGL function. -extern void (* const glStencilMask)(GLuint); -/// Pointer to glStencilMaskSeparate OpenGL function. -extern void (* const glStencilMaskSeparate)(GLenum, GLuint); -/// Pointer to glStencilOp OpenGL function. -extern void (* const glStencilOp)(GLenum, GLenum, GLenum); -/// Pointer to glStencilOpSeparate OpenGL function. -extern void (* const glStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum); -/// Pointer to glTexImage2D OpenGL function. -extern void (* const glTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *); -/// Pointer to glTexParameterf OpenGL function. -extern void (* const glTexParameterf)(GLenum, GLenum, GLfloat); -/// Pointer to glTexParameterfv OpenGL function. -extern void (* const glTexParameterfv)(GLenum, GLenum, const GLfloat *); -/// Pointer to glTexParameteri OpenGL function. -extern void (* const glTexParameteri)(GLenum, GLenum, GLint); -/// Pointer to glTexParameteriv OpenGL function. -extern void (* const glTexParameteriv)(GLenum, GLenum, const GLint *); -/// Pointer to glTexSubImage2D OpenGL function. -extern void (* const glTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *); -/// Pointer to glUniform1f OpenGL function. -extern void (* const glUniform1f)(GLint, GLfloat); -/// Pointer to glUniform1fv OpenGL function. -extern void (* const glUniform1fv)(GLint, GLsizei, const GLfloat *); -/// Pointer to glUniform1i OpenGL function. -extern void (* const glUniform1i)(GLint, GLint); -/// Pointer to glUniform1iv OpenGL function. -extern void (* const glUniform1iv)(GLint, GLsizei, const GLint *); -/// Pointer to glUniform2f OpenGL function. -extern void (* const glUniform2f)(GLint, GLfloat, GLfloat); -/// Pointer to glUniform2fv OpenGL function. -extern void (* const glUniform2fv)(GLint, GLsizei, const GLfloat *); -/// Pointer to glUniform2i OpenGL function. -extern void (* const glUniform2i)(GLint, GLint, GLint); -/// Pointer to glUniform2iv OpenGL function. -extern void (* const glUniform2iv)(GLint, GLsizei, const GLint *); -/// Pointer to glUniform3f OpenGL function. -extern void (* const glUniform3f)(GLint, GLfloat, GLfloat, GLfloat); -/// Pointer to glUniform3fv OpenGL function. -extern void (* const glUniform3fv)(GLint, GLsizei, const GLfloat *); -/// Pointer to glUniform3i OpenGL function. -extern void (* const glUniform3i)(GLint, GLint, GLint, GLint); -/// Pointer to glUniform3iv OpenGL function. -extern void (* const glUniform3iv)(GLint, GLsizei, const GLint *); -/// Pointer to glUniform4f OpenGL function. -extern void (* const glUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat); -/// Pointer to glUniform4fv OpenGL function. -extern void (* const glUniform4fv)(GLint, GLsizei, const GLfloat *); -/// Pointer to glUniform4i OpenGL function. -extern void (* const glUniform4i)(GLint, GLint, GLint, GLint, GLint); -/// Pointer to glUniform4iv OpenGL function. -extern void (* const glUniform4iv)(GLint, GLsizei, const GLint *); -/// Pointer to glUniformMatrix2fv OpenGL function. -extern void (* const glUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat *); -/// Pointer to glUniformMatrix3fv OpenGL function. -extern void (* const glUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *); -/// Pointer to glUniformMatrix4fv OpenGL function. -extern void (* const glUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat *); -/// Pointer to glUseProgram OpenGL function. -extern void (* const glUseProgram)(GLuint); -/// Pointer to glValidateProgram OpenGL function. -extern void (* const glValidateProgram)(GLuint); -/// Pointer to glVertexAttrib1f OpenGL function. -extern void (* const glVertexAttrib1f)(GLuint, GLfloat); -/// Pointer to glVertexAttrib1fv OpenGL function. -extern void (* const glVertexAttrib1fv)(GLuint, const GLfloat *); -/// Pointer to glVertexAttrib2f OpenGL function. -extern void (* const glVertexAttrib2f)(GLuint, GLfloat, GLfloat); -/// Pointer to glVertexAttrib2fv OpenGL function. -extern void (* const glVertexAttrib2fv)(GLuint, const GLfloat *); -/// Pointer to glVertexAttrib3f OpenGL function. -extern void (* const glVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat); -/// Pointer to glVertexAttrib3fv OpenGL function. -extern void (* const glVertexAttrib3fv)(GLuint, const GLfloat *); -/// Pointer to glVertexAttrib4f OpenGL function. -extern void (* const glVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -/// Pointer to glVertexAttrib4fv OpenGL function. -extern void (* const glVertexAttrib4fv)(GLuint, const GLfloat *); -/// Pointer to glVertexAttribPointer OpenGL function. -extern void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *); -/// Pointer to glViewport OpenGL function. -extern void (* const glViewport)(GLint, GLint, GLsizei, GLsizei); - -#ifndef MBGL_USE_GLES2 -/// Pointer to glDrawPixels OpenGL function. -extern void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -/// Pointer to glGetDoublev OpenGL function. -extern void (* const glGetDoublev)(GLenum, GLdouble *); -/// Pointer to glPixelTransferf OpenGL function. -extern void (* const glPixelTransferf)(GLenum, GLfloat); -/// Pointer to glPixelZoom OpenGL function. -extern void (* const glPixelZoom)(GLfloat, GLfloat); -/// Pointer to glPointSize OpenGL function. -extern void (* const glPointSize)(GLfloat); -/// Pointer to glRasterPos4d OpenGL function. -extern void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble); -#endif - -#ifndef NDEBUG -/// Check for GL errors and print on the console. -void glCheckError(const char *cmd, const char *file, int line); -#endif - -} // namespace platform -} // namespace mbgl \ No newline at end of file diff --git a/include/mbgl/platform/thread.hpp b/include/mbgl/platform/thread.hpp deleted file mode 100644 index 72899a4fd..000000000 --- a/include/mbgl/platform/thread.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -namespace mbgl { -namespace platform { - -// Called when a thread is created -void attachThread(); - -// Called when a thread is destroyed -void detachThread(); - -} // namespace platform -} // namespace mbgl diff --git a/include/mbgl/renderer/query.hpp b/include/mbgl/renderer/query.hpp deleted file mode 100644 index 4cadf4f01..000000000 --- a/include/mbgl/renderer/query.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { - -/** - * Options for query rendered features. - */ -class RenderedQueryOptions { -public: - RenderedQueryOptions(optional> layerIDs_ = {}, - optional filter_ = {}) - : layerIDs(std::move(layerIDs_)), - filter(std::move(filter_)) {} - - /** layerIDs to include in the query */ - optional> layerIDs; - - optional filter; -}; - -/** - * Options for query source features - */ -class SourceQueryOptions { -public: - SourceQueryOptions(optional> sourceLayers_ = {}, - optional filter_ = {}) - : sourceLayers(std::move(sourceLayers_)), - filter(std::move(filter_)) {} - - // Required for VectorSource, ignored for GeoJSONSource - optional> sourceLayers; - - optional filter; -}; - -} // namespace mbgl diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp deleted file mode 100644 index 7a1ddde1c..000000000 --- a/include/mbgl/renderer/renderer.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include - -namespace mbgl { - -class RendererObserver; -class RenderedQueryOptions; -class SourceQueryOptions; -class UpdateParameters; - -namespace gfx { -class RendererBackend; -} // namespace gfx - -class Renderer { -public: - Renderer(gfx::RendererBackend&, float pixelRatio_, - const optional localFontFamily = {}); - ~Renderer(); - - void markContextLost(); - - void setObserver(RendererObserver*); - - void render(const UpdateParameters&); - - // Feature queries - std::vector queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions& options = {}) const; - std::vector queryRenderedFeatures(const ScreenCoordinate& point, const RenderedQueryOptions& options = {}) const; - std::vector queryRenderedFeatures(const ScreenBox& box, const RenderedQueryOptions& options = {}) const; - std::vector querySourceFeatures(const std::string& sourceID, const SourceQueryOptions& options = {}) const; - AnnotationIDs queryPointAnnotations(const ScreenBox& box) const; - AnnotationIDs queryShapeAnnotations(const ScreenBox& box) const; - AnnotationIDs getAnnotationIDs(const std::vector&) const; - - // Feature extension query - FeatureExtensionValue queryFeatureExtensions(const std::string& sourceID, - const Feature& feature, - const std::string& extension, - const std::string& extensionField, - const optional>& args = {}) const; - - void setFeatureState(const std::string& sourceID, const optional& sourceLayerID, - const std::string& featureID, const FeatureState& state); - - void getFeatureState(FeatureState& state, const std::string& sourceID, const optional& sourceLayerID, - const std::string& featureID) const; - - void removeFeatureState(const std::string& sourceID, const optional& sourceLayerID, - const optional& featureID, const optional& stateKey); - - // Debug - void dumpDebugLogs(); - - // Memory - void reduceMemoryUse(); - -private: - class Impl; - std::unique_ptr impl; -}; - -} // namespace mbgl diff --git a/include/mbgl/renderer/renderer_frontend.hpp b/include/mbgl/renderer/renderer_frontend.hpp deleted file mode 100644 index f72b0ccdd..000000000 --- a/include/mbgl/renderer/renderer_frontend.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class RendererObserver; -class UpdateParameters; - -// The RenderFrontend is the bridge between the Map and -// platform used to update and observer the Renderer -// -// It hides any threading specifics and always replies on -// the original thread. -class RendererFrontend { -public: - - virtual ~RendererFrontend() = default; - - // Must synchronously clean up the Renderer if set - virtual void reset() = 0; - - // Implementer must bind the renderer observer to the renderer in a - // appropriate manner so that the callbacks occur on the main thread - virtual void setObserver(RendererObserver&) = 0; - - // Coalescing updates is up to the implementer - virtual void update(std::shared_ptr) = 0; -}; - -} // namespace mbgl diff --git a/include/mbgl/renderer/renderer_observer.hpp b/include/mbgl/renderer/renderer_observer.hpp deleted file mode 100644 index e0fc84215..000000000 --- a/include/mbgl/renderer/renderer_observer.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -class RendererObserver { -public: - virtual ~RendererObserver() = default; - - enum class RenderMode : uint32_t { - Partial, - Full - }; - - // Signals that a repaint is required - virtual void onInvalidate() {} - - // Resource failed to download / parse - virtual void onResourceError(std::exception_ptr) {} - - // First frame - virtual void onWillStartRenderingMap() {} - - // Start of frame, initial is the first frame for this map - virtual void onWillStartRenderingFrame() {} - - // End of frame, booleans flags that a repaint is required and that placement changed. - virtual void onDidFinishRenderingFrame(RenderMode, bool /*repaint*/, bool /*placementChanged*/) {} - - // Final frame - virtual void onDidFinishRenderingMap() {} - - // Style is missing an image - using StyleImageMissingCallback = std::function; - virtual void onStyleImageMissing(const std::string&, StyleImageMissingCallback done) { done(); } - virtual void onRemoveUnusedStyleImages(const std::vector&) {} -}; - -} // namespace mbgl diff --git a/include/mbgl/renderer/renderer_state.hpp b/include/mbgl/renderer/renderer_state.hpp deleted file mode 100644 index 71011389e..000000000 --- a/include/mbgl/renderer/renderer_state.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -class UpdateParameters; - -/** - * RendererState acts as a Memento object that is able to extract data out of UpdateParameters (an opaque object - * from the public API perspective). - */ -class RendererState { -public: - - // Obtains a CameraOptions out of a given UpdateParameters object. - static CameraOptions getCameraOptions(const UpdateParameters&, const EdgeInsets& = {}); - - // Returns whether an image with the given ID exists from a given UpdateParamters object. - static bool hasImage(const UpdateParameters&, const std::string& id); - - // Returns whether a layer with the given ID exists from a given UpdateParamters object. - static bool hasLayer(const UpdateParameters&, const std::string& id); - - // Returns whether a source with the given ID exists from a given UpdateParamters object. - static bool hasSource(const UpdateParameters&, const std::string& id); - - // Obtains the geographical coordinate out of a given screen coordinate. - static ScreenCoordinate pixelForLatLng(const UpdateParameters&, const LatLng&); - - // Obtains the screen coordinate out of a given geographical coordinate. - static LatLng latLngForPixel(const UpdateParameters&, const ScreenCoordinate&); -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp deleted file mode 100644 index 4f4c7136c..000000000 --- a/include/mbgl/storage/default_file_source.hpp +++ /dev/null @@ -1,251 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace mbgl { - -namespace util { -template class Thread; -} // namespace util - -class ResourceTransform; - -// TODO: the callback should include a potential error info when https://github.com/mapbox/mapbox-gl-native/issues/14759 is resolved -using PathChangeCallback = std::function; - -class DefaultFileSource : public FileSource { -public: - DefaultFileSource(const std::string& cachePath, const std::string& assetPath, bool supportCacheOnlyRequests = true); - DefaultFileSource(const std::string& cachePath, std::unique_ptr&& assetFileSource, bool supportCacheOnlyRequests = true); - ~DefaultFileSource() override; - - bool supportsCacheOnlyRequests() const override; - - void setAPIBaseURL(const std::string&); - std::string getAPIBaseURL(); - - void setAccessToken(const std::string&); - std::string getAccessToken(); - - void setResourceTransform(optional>&&); - - void setResourceCachePath(const std::string&, optional>&&); - - std::unique_ptr request(const Resource&, Callback) override; - - /* - * Retrieve all regions in the offline database. - * - * The query will be executed asynchronously and the results passed to the given - * callback, which will be executed on the database thread; it is the responsibility - * of the SDK bindings to re-execute a user-provided callback on the main thread. - */ - void listOfflineRegions(std::function)>); - - /* - * Create an offline region in the database. - * - * When the initial database queries have completed, the provided callback will be - * executed on the database thread; it is the responsibility of the SDK bindings - * to re-execute a user-provided callback on the main thread. - * - * Note that the resulting region will be in an inactive download state; to begin - * downloading resources, call `setOfflineRegionDownloadState(OfflineRegionDownloadState::Active)`, - * optionally registering an `OfflineRegionObserver` beforehand. - */ - void createOfflineRegion(const OfflineRegionDefinition& definition, - const OfflineRegionMetadata& metadata, - std::function)>); - - /* - * Update an offline region metadata in the database. - */ - void updateOfflineMetadata(const int64_t regionID, - const OfflineRegionMetadata& metadata, - std::function)>); - /* - * Register an observer to be notified when the state of the region changes. - */ - void setOfflineRegionObserver(OfflineRegion&, std::unique_ptr); - - /* - * Pause or resume downloading of regional resources. - */ - void setOfflineRegionDownloadState(OfflineRegion&, OfflineRegionDownloadState); - - /* - * Retrieve the current status of the region. The query will be executed - * asynchronously and the results passed to the given callback, which will be - * executed on the database thread; it is the responsibility of the SDK bindings - * to re-execute a user-provided callback on the main thread. - */ - void getOfflineRegionStatus( - OfflineRegion&, - std::function)>) const; - - /* - * Merge offline regions from a secondary database into the main offline database. - * - * When the database merge is completed, the provided callback will be - * executed on the database thread; it is the responsibility of the SDK bindings - * to re-execute a user-provided callback on the main thread. - * - * The secondary database may need to be upgraded to the latest schema. This is done - * in-place and requires write-access to `sideDatabasePath`; it is the - * responsibility of the SDK bindings to ensure that this path is writeable. - * - * Only resources and tiles that belong to a region will be copied over. Identical - * regions will be flattened into a single new region in the main database. - * - * Invokes the callback with a `MapboxOfflineTileCountExceededException` error if - * the merge operation would result in the offline tile count limit being exceeded. - * - * Merged regions may not be in a completed status if the secondary database - * does not contain all the tiles or resources required by the region definition. - */ - void mergeOfflineRegions(const std::string& sideDatabasePath, - std::function)>); - - /* - * Remove an offline region from the database and perform any resources evictions - * necessary as a result. - * - * Eviction works by removing the least-recently requested resources not also required - * by other regions, until the database shrinks below a certain size. - * - * Note that this method takes ownership of the input, reflecting the fact that once - * region deletion is initiated, it is not legal to perform further actions with the - * region. - * - * When the operation is complete or encounters an error, the given callback will be - * executed on the database thread; it is the responsibility of the SDK bindings - * to re-execute a user-provided callback on the main thread. - */ - void deleteOfflineRegion(OfflineRegion&&, std::function); - - /* - * Invalidate all the tiles from an offline region forcing Mapbox GL to revalidate - * the tiles with the server before using. This is more efficient than deleting the - * offline region and downloading it again because if the data on the cache matches - * the server, no new data gets transmitted. - */ - void invalidateOfflineRegion(OfflineRegion&, std::function); - - /* - * Changing or bypassing this limit without permission from Mapbox is prohibited - * by the Mapbox Terms of Service. - */ - void setOfflineMapboxTileCountLimit(uint64_t) const; - - /* - * Pause file request activity. - * - * If pause is called then no revalidation or network request activity - * will occur. - */ - void pause(); - - /* - * Resume file request activity. - * - * Calling resume will unpause the file source and process any tasks that - * expired while the file source was paused. - */ - void resume(); - - /* - * Insert the provided resource into the ambient cache - * - * Consumers of the resource will expect the uncompressed version; the - * OfflineDatabase will determine whether to compress the data on disk. - * This call is asynchronous: the data may not be immediately available - * for in-progress requests, although subsequent requests should have - * access to the cached data. - */ - void put(const Resource&, const Response&); - - /* - * Delete existing database and re-initialize. - * - * When the operation is complete or encounters an error, the given callback will be - * executed on the database thread; it is the responsibility of the SDK bindings - * to re-execute a user-provided callback on the main thread. - */ - void resetDatabase(std::function); - - /* - * Forces revalidation of the ambient cache. - * - * Forces Mapbox GL Native to revalidate resources stored in the ambient - * cache with the tile server before using them, making sure they - * are the latest version. This is more efficient than cleaning the - * cache because if the resource is considered valid after the server - * lookup, it will not get downloaded again. - * - * Resources overlapping with offline regions will not be affected - * by this call. - */ - void invalidateAmbientCache(std::function); - - /* - * Erase resources from the ambient cache, freeing storage space. - * - * Erases the ambient cache, freeing resources. This operation can be - * potentially slow because it will trigger a VACUUM on SQLite, - * forcing the database to move pages on the filesystem. - * - * Resources overlapping with offline regions will not be affected - * by this call. - */ - void clearAmbientCache(std::function); - - /* - * Sets the maximum size in bytes for the ambient cache. - * - * This call is potentially expensive because it will try - * to trim the data in case the database is larger than the - * size defined. The size of offline regions are not affected - * by this settings, but the ambient cache will always try - * to not exceed the maximum size defined, taking into account - * the current size for the offline regions. - * - * If the maximum size is set to 50 MB and 40 MB are already - * used by offline regions, the cache size will be effectively - * 10 MB. - * - * Setting the size to 0 will disable the cache if there is no - * offline region on the database. - * - * This method should always be called before using the database, - * otherwise the default maximum size will be used. - */ - void setMaximumAmbientCacheSize(uint64_t size, std::function callback); - - // For testing only. - void setOnlineStatus(bool); - - class Impl; - -private: - // Shared so destruction is done on this thread - const std::shared_ptr assetFileSource; - const std::unique_ptr> impl; - - std::mutex cachedBaseURLMutex; - std::string cachedBaseURL = mbgl::util::API_BASE_URL; - - std::mutex cachedAccessTokenMutex; - std::string cachedAccessToken; - - const bool supportCacheOnlyRequests; -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp deleted file mode 100644 index 2270038c4..000000000 --- a/include/mbgl/storage/file_source.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include -#include - -namespace mbgl { - -class ResourceOptions; -class ResourceTransform; - -class FileSource { -public: - FileSource(const FileSource&) = delete; - FileSource& operator=(const FileSource&) = delete; - virtual ~FileSource() = default; - - using Callback = std::function; - - // Request a resource. The callback will be called asynchronously, in the same - // thread as the request was made. This thread must have an active RunLoop. The - // request may be cancelled before completion by releasing the returned AsyncRequest. - // If the request is cancelled before the callback is executed, the callback will - // not be executed. - virtual std::unique_ptr request(const Resource&, Callback) = 0; - - // When a file source supports consulting a local cache only, it must return true. - // Cache-only requests are requests that aren't as urgent, but could be useful, e.g. - // to cover part of the map while loading. The FileSource should only do cheap actions to - // retrieve the data, e.g. load it from a cache, but not from the internet. - virtual bool supportsCacheOnlyRequests() const { - return false; - } - - // Singleton for obtaining the shared platform-specific file source. A single instance of a file source is provided - // for each unique combination of a Mapbox API base URL, access token, cache path and platform context. - static std::shared_ptr getSharedFileSource(const ResourceOptions&); - -protected: - FileSource() = default; - // Factory for creating a platform-specific file source. - static std::shared_ptr createPlatformFileSource(const ResourceOptions&); -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/network_status.hpp b/include/mbgl/storage/network_status.hpp deleted file mode 100644 index 0d1ae54ec..000000000 --- a/include/mbgl/storage/network_status.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { - -namespace util { -class AsyncTask; -} // namespace util - -class NetworkStatus { -public: - enum class Status : uint8_t { - Online, - Offline, - }; - - static Status Get(); - static void Set(Status); - - static void Reachable(); - - static void Subscribe(util::AsyncTask* async); - static void Unsubscribe(util::AsyncTask* async); - -private: - static std::atomic online; - static std::mutex mtx; - static std::unordered_set observers; -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/offline.hpp b/include/mbgl/storage/offline.hpp deleted file mode 100644 index baf43dc5f..000000000 --- a/include/mbgl/storage/offline.hpp +++ /dev/null @@ -1,241 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { - -class TileID; - -/* - * An offline region defined by a style URL, geographic bounding box, zoom range, and - * device pixel ratio. - * - * Both minZoom and maxZoom must be ≥ 0, and maxZoom must be ≥ minZoom. - * - * maxZoom may be ∞, in which case for each tile source, the region will include - * tiles from minZoom up to the maximum zoom level provided by that source. - * - * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. - */ -class OfflineTilePyramidRegionDefinition { -public: - OfflineTilePyramidRegionDefinition(std::string, LatLngBounds, double, double, float, bool); - - /* Private */ - const std::string styleURL; - const LatLngBounds bounds; - const double minZoom; - const double maxZoom; - const float pixelRatio; - const bool includeIdeographs; -}; - -/* - * An offline region defined by a style URL, geometry, zoom range, and - * device pixel ratio. - * - * Both minZoom and maxZoom must be ≥ 0, and maxZoom must be ≥ minZoom. - * - * maxZoom may be ∞, in which case for each tile source, the region will include - * tiles from minZoom up to the maximum zoom level provided by that source. - * - * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. - */ -class OfflineGeometryRegionDefinition { -public: - OfflineGeometryRegionDefinition(std::string styleURL, Geometry, double minZoom, double maxZoom, float pixelRatio, bool includeIdeographs); - - /* Private */ - const std::string styleURL; - const Geometry geometry; - const double minZoom; - const double maxZoom; - const float pixelRatio; - const bool includeIdeographs; -}; - -/* - * The offline region definition types supported - */ -using OfflineRegionDefinition = variant; - -/* - * The encoded format is private. - */ -std::string encodeOfflineRegionDefinition(const OfflineRegionDefinition&); -OfflineRegionDefinition decodeOfflineRegionDefinition(const std::string&); - -/* - * Arbitrary binary region metadata. The contents are opaque to the mbgl implementation; - * it just stores and retrieves a BLOB. SDK bindings should leave the interpretation of - * this data up to the application; they _should not_ enforce a higher-level data format. - * In the future we want offline database to be portable across target platforms, and a - * platform-specific metadata format would prevent that. - */ -using OfflineRegionMetadata = std::vector; - -/* - * A region is either inactive (not downloading, but previously-downloaded - * resources are available for use), or active (resources are being downloaded - * or will be downloaded, if necessary, when network access is available). - * - * This state is independent of whether or not the complete set of resources - * is currently available for offline use. To check if that is the case, use - * `OfflineRegionStatus::complete()`. - */ -enum class OfflineRegionDownloadState { - Inactive, - Active -}; - -/* - * A region's status includes its active/inactive state as well as counts - * of the number of resources that have completed downloading, their total - * size in bytes, and the total number of resources that are required. - * - * Note that the total required size in bytes is not currently available. A - * future API release may provide an estimate of this number. - */ -class OfflineRegionStatus { -public: - OfflineRegionDownloadState downloadState = OfflineRegionDownloadState::Inactive; - - /** - * The number of resources that have been fully downloaded and are ready for - * offline access. - */ - uint64_t completedResourceCount = 0; - - /** - * The cumulative size, in bytes, of all resources (inclusive of tiles) that have - * been fully downloaded. - */ - uint64_t completedResourceSize = 0; - - /** - * The number of tiles that are known to be required for this region. This is a - * subset of `completedResourceCount`. - */ - uint64_t completedTileCount = 0; - - /** - * The number of tiles that are known to be required for this region. - */ - uint64_t requiredTileCount = 0; - - /** - * The cumulative size, in bytes, of all tiles that have been fully downloaded. - * This is a subset of `completedResourceSize`. - */ - uint64_t completedTileSize = 0; - - /** - * The number of resources that are known to be required for this region. See the - * documentation for `requiredResourceCountIsPrecise` for an important caveat - * about this number. - */ - uint64_t requiredResourceCount = 0; - - /** - * This property is true when the value of requiredResourceCount is a precise - * count of the number of required resources, and false when it is merely a lower - * bound. - * - * Specifically, it is false during early phases of an offline download. Once - * style and tile sources have been downloaded, it is possible to calculate the - * precise number of required resources, at which point it is set to true. - */ - bool requiredResourceCountIsPrecise = false; - - bool complete() const { - return completedResourceCount >= requiredResourceCount; - } -}; - -/* - * A region can have a single observer, which gets notified whenever a change - * to the region's status occurs. - */ -class OfflineRegionObserver { -public: - virtual ~OfflineRegionObserver() = default; - - /* - * Implement this method to be notified of a change in the status of an - * offline region. Status changes include any change in state of the members - * of OfflineRegionStatus. - * - * Note that this method will be executed on the database thread; it is the - * responsibility of the SDK bindings to wrap this object in an interface that - * re-executes the user-provided implementation on the main thread. - */ - virtual void statusChanged(OfflineRegionStatus) {} - - /* - * Implement this method to be notified of errors encountered while downloading - * regional resources. Such errors may be recoverable; for example the implementation - * will attempt to re-request failed resources based on an exponential backoff - * algorithm, or when it detects that network access has been restored. - * - * Note that this method will be executed on the database thread; it is the - * responsibility of the SDK bindings to wrap this object in an interface that - * re-executes the user-provided implementation on the main thread. - */ - virtual void responseError(Response::Error) {} - - /* - * Implement this method to be notified when the limit on the number of Mapbox - * tiles stored for offline regions has been reached. - * - * Once the limit has been reached, the SDK will not download further offline - * tiles from Mapbox APIs until existing tiles have been removed. - * - * This limit does not apply to non-Mapbox tile sources. - * - * Note that this method will be executed on the database thread; it is the - * responsibility of the SDK bindings to wrap this object in an interface that - * re-executes the user-provided implementation on the main thread. - */ - virtual void mapboxTileCountLimitExceeded(uint64_t /* limit */) {} -}; - -class OfflineRegion { -public: - // Move-only; not publicly constructible. - OfflineRegion(OfflineRegion&&); - ~OfflineRegion(); - - OfflineRegion() = delete; - OfflineRegion(const OfflineRegion&) = delete; - OfflineRegion& operator=(OfflineRegion&&) = delete; - OfflineRegion& operator=(const OfflineRegion&) = delete; - - int64_t getID() const; - const OfflineRegionDefinition& getDefinition() const; - const OfflineRegionMetadata& getMetadata() const; - -private: - friend class OfflineDatabase; - - OfflineRegion(int64_t id, - OfflineRegionDefinition, - OfflineRegionMetadata); - - const int64_t id; - const OfflineRegionDefinition definition; - const OfflineRegionMetadata metadata; -}; - -using OfflineRegions = std::vector; - -} // namespace mbgl diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp deleted file mode 100644 index b2e9b43e5..000000000 --- a/include/mbgl/storage/online_file_source.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { - -class ResourceTransform; - -class OnlineFileSource : public FileSource { -public: - OnlineFileSource(); - ~OnlineFileSource() override; - - void setAPIBaseURL(const std::string& t) { apiBaseURL = t; } - std::string getAPIBaseURL() const { return apiBaseURL; } - - void setAccessToken(const std::string& t) { accessToken = t; } - std::string getAccessToken() const { return accessToken; } - - void setResourceTransform(optional>&&); - - std::unique_ptr request(const Resource&, Callback) override; - - void setMaximumConcurrentRequests(uint32_t); - uint32_t getMaximumConcurrentRequests() const; - - // For testing only. - void setOnlineStatus(bool); - -private: - friend class OnlineFileRequest; - - class Impl; - const std::unique_ptr impl; - std::string accessToken; - std::string apiBaseURL = mbgl::util::API_BASE_URL; -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/resource.hpp b/include/mbgl/storage/resource.hpp deleted file mode 100644 index d00f33666..000000000 --- a/include/mbgl/storage/resource.hpp +++ /dev/null @@ -1,104 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include - -namespace mbgl { - -class Resource { -public: - enum Kind : uint8_t { - Unknown = 0, - Style, - Source, - Tile, - Glyphs, - SpriteImage, - SpriteJSON, - Image - }; - - enum class Priority : bool { - Regular, - Low - }; - - enum class Usage : bool { - Online, - Offline - }; - - struct TileData { - std::string urlTemplate; - uint8_t pixelRatio; - int32_t x; - int32_t y; - int8_t z; - }; - - enum class LoadingMethod : uint8_t { - None = 0b00, - Cache = 0b01, - Network = 0b10, - - CacheOnly = Cache, - NetworkOnly = Network, - All = Cache | Network, - }; - - Resource(Kind kind_, - std::string url_, - optional tileData_ = {}, - LoadingMethod loadingMethod_ = LoadingMethod::All) - : kind(kind_), - loadingMethod(loadingMethod_), - url(std::move(url_)), - tileData(std::move(tileData_)) { - } - - void setPriority(Priority p) { priority = p; } - void setUsage(Usage u) { usage = u; } - - bool hasLoadingMethod(LoadingMethod method); - - static Resource style(const std::string& url); - static Resource source(const std::string& url); - static Resource tile(const std::string& urlTemplate, - float pixelRatio, - int32_t x, - int32_t y, - int8_t z, - Tileset::Scheme scheme, - LoadingMethod = LoadingMethod::All); - static Resource glyphs(const std::string& urlTemplate, - const FontStack& fontStack, - const std::pair& glyphRange); - static Resource spriteImage(const std::string& base, float pixelRatio); - static Resource spriteJSON(const std::string& base, float pixelRatio); - static Resource image(const std::string& url); - - Kind kind; - LoadingMethod loadingMethod; - Usage usage{ Usage::Online }; - Priority priority{ Priority::Regular }; - std::string url; - - // Includes auxiliary data if this is a tile request. - optional tileData; - - optional priorModified = {}; - optional priorExpires = {}; - optional priorEtag = {}; - std::shared_ptr priorData; -}; - -inline bool Resource::hasLoadingMethod(Resource::LoadingMethod method) { - return (loadingMethod & method); -} - -} // namespace mbgl diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp deleted file mode 100644 index 00dc6e10d..000000000 --- a/include/mbgl/storage/resource_options.hpp +++ /dev/null @@ -1,137 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -/** - * @brief Holds values for resource options. - */ -class ResourceOptions final { -public: - /** - * @brief Constructs a ResourceOptions object with default values. - */ - ResourceOptions(); - ~ResourceOptions(); - - ResourceOptions(ResourceOptions&&) noexcept; - - ResourceOptions clone() const; - - /** - * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. - * - * @param token Mapbox access token. - * @return ResourceOptions for chaining options together. - */ - ResourceOptions& withAccessToken(std::string token); - - /** - * @brief Gets the previously set (or default) Mapbox access token. - * - * @return const std::string& Mapbox access token. - */ - const std::string& accessToken() const; - - /** - * @brief Sets the API base URL. Default is https://api.mapbox.com for Mapbox. - * - * @param baseURL API base URL. - * @return ResourceOptions for chaining options together. - */ - ResourceOptions& withBaseURL(std::string baseURL); - - /** - * @brief Gets the previously set (or default) API base URL. - * - * @return const std::string& API base URL. - */ - const std::string& baseURL() const; - - /** - * @brief Sets the cache path. - * - * @param path Cache path. - * @return ResourceOptions for chaining options together. - */ - ResourceOptions& withCachePath(std::string path); - - /** - * @brief Gets the previously set (or default) cache path. - * - * @return cache path - */ - const std::string& cachePath() const; - - /** - * @brief Sets the asset path, which is the root directory from where - * the asset:// scheme gets resolved in a style. - * - * @param path Asset path. - * @return ResourceOptions for chaining options together. - */ - ResourceOptions& withAssetPath(std::string path); - - /** - * @brief Gets the previously set (or default) asset path. - * - * @return asset path - */ - const std::string& assetPath() const; - - /** - * @brief Sets the maximum cache size. - * - * @param size Cache maximum size in bytes. - * @return reference to ResourceOptions for chaining options together. - */ - ResourceOptions& withMaximumCacheSize(uint64_t size); - - /** - * @brief Gets the previously set (or default) maximum allowed cache size. - * - * @return maximum allowed cache database size in bytes. - */ - uint64_t maximumCacheSize() const; - - /** - * @brief Sets whether to support cache-only requests. - * - * @return Whether or not cache-only requests are supported. - */ - bool supportsCacheOnlyRequests() const; - - /** - * @brief Gets the previously set (or default) support for cache-only requests. - * - * @param cacheOnly Whether or not cache-only requests are supported. - * @return reference to ResourceOptions for chaining options together. - */ - ResourceOptions& withCacheOnlyRequestsSupport(bool cacheOnly); - - /** - * @brief Sets the platform context. A platform context is usually an object - * that assists the creation of a file source. - * - * @param context Platform context. - * @return reference to ResourceOptions for chaining options together. - */ - ResourceOptions& withPlatformContext(void* context); - - /** - * @brief Gets the previously set (or default) platform context. - * - * @return Platform context. - */ - void* platformContext() const; - -private: - ResourceOptions(const ResourceOptions&); - - class Impl; - std::unique_ptr impl_; -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/resource_transform.hpp b/include/mbgl/storage/resource_transform.hpp deleted file mode 100644 index b8e3dbac7..000000000 --- a/include/mbgl/storage/resource_transform.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { - -class Mailbox; - -class ResourceTransform { -public: - using TransformCallback = std::function; - using FinishedCallback = std::function; - - ResourceTransform(ActorRef, TransformCallback&&); - - void transform(Resource::Kind, const std::string& url, FinishedCallback&&); - -private: - TransformCallback transformCallback; -}; - -} // namespace mbgl diff --git a/include/mbgl/storage/response.hpp b/include/mbgl/storage/response.hpp deleted file mode 100644 index 07b059e43..000000000 --- a/include/mbgl/storage/response.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { - -class Response { -public: - Response() = default; - Response(const Response&); - Response& operator=(const Response&); - -public: - class Error; - // When this object is empty, the response was successful. - std::unique_ptr error; - - // This is set to true for 204 Not Modified responses, and, for backward compatibility, - // for 404 Not Found responses for tiles. - bool noContent = false; - - // This is set to true for 304 Not Modified responses. - bool notModified = false; - - // This is set to true when the server requested that no expired resources be used by - // specifying "Cache-Control: must-revalidate". - bool mustRevalidate = false; - - // The actual data of the response. Present only for non-error, non-notModified responses. - std::shared_ptr data; - - optional modified; - optional expires; - optional etag; - - bool isFresh() const { - return expires ? *expires > util::now() : !error; - } - - // Indicates whether we are allowed to use this response according to HTTP caching rules. - // It may or may not be stale. - bool isUsable() const { - return !mustRevalidate || (expires && *expires > util::now()); - } -}; - -class Response::Error { -public: - enum class Reason : uint8_t { - Success = 1, - NotFound = 2, - Server = 3, - Connection = 4, - RateLimit = 5, - Other = 6, - } reason = Reason::Other; - - // An error message from the request handler, e.g. a server message or a system message - // informing the user about the reason for the failure. - std::string message; - - optional retryAfter; - -public: - Error(Reason, std::string = "", optional = {}); -}; - -} // namespace mbgl diff --git a/include/mbgl/style/color_ramp_property_value.hpp b/include/mbgl/style/color_ramp_property_value.hpp deleted file mode 100644 index bc5639c89..000000000 --- a/include/mbgl/style/color_ramp_property_value.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { - -/* - * Special-case implementation of (a subset of) the PropertyValue interface - * used for building the HeatmapColor paint property traits class. - */ -class ColorRampPropertyValue { -private: - std::shared_ptr value; - - friend bool operator==(const ColorRampPropertyValue& lhs, const ColorRampPropertyValue& rhs) { - return (lhs.isUndefined() && rhs.isUndefined()) || (lhs.value && rhs.value && *(lhs.value) == *(rhs.value)); - } - - friend bool operator!=(const ColorRampPropertyValue& lhs, const ColorRampPropertyValue& rhs) { - return !(lhs == rhs); - } - -public: - ColorRampPropertyValue() : value(nullptr) {} - ColorRampPropertyValue(std::shared_ptr value_) : value(std::move(value_)) {} - - bool isUndefined() const { return value.get() == nullptr; } - - // noop, needed for batch evaluation of paint property values to compile - template - Color evaluate(const Evaluator&, TimePoint = {}) const { return {}; } - - Color evaluate(double rampEvaluationParameter) const { - const auto result = value->evaluate(expression::EvaluationContext({}, nullptr, {rampEvaluationParameter})); - return *expression::fromExpressionValue(*result); - } - - bool isDataDriven() const { return false; } - bool hasDataDrivenPropertyDifference(const ColorRampPropertyValue&) const { return false; } - - const expression::Expression& getExpression() const { return *value; } -}; - - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion.hpp b/include/mbgl/style/conversion.hpp deleted file mode 100644 index 29af9fac9..000000000 --- a/include/mbgl/style/conversion.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace style { -namespace conversion { - -// This is a forward-declaration only header intended to minimize dependencies and to improve -// compilation speed. In order to specialize implementations and get access to the actual -// implementation, include . - -struct Error { std::string message; }; - -template -class ConversionTraits; - -class Convertible; - -template -struct Converter; - -template -struct ValueFactory; - -} // namespace conversion -} // namespace style -} // namespace mbgl - diff --git a/include/mbgl/style/conversion/color_ramp_property_value.hpp b/include/mbgl/style/conversion/color_ramp_property_value.hpp deleted file mode 100644 index 17aa17742..000000000 --- a/include/mbgl/style/conversion/color_ramp_property_value.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error, bool /* allowDataExpressions */ = false, bool /* convertTokens */ = false) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/constant.hpp b/include/mbgl/style/conversion/constant.hpp deleted file mode 100644 index 3a5833be6..000000000 --- a/include/mbgl/style/conversion/constant.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -template -struct Converter::value>> { - optional operator()(const Convertible& value, Error& error) const; -}; - -template -struct Converter, typename std::enable_if_t::value>> { - optional> operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -template -struct Converter> { - optional> operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct Converter> { - optional> operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct Converter> { - optional> operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/coordinate.hpp b/include/mbgl/style/conversion/coordinate.hpp deleted file mode 100644 index 1346ed738..000000000 --- a/include/mbgl/style/conversion/coordinate.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template<> -struct Converter { -public: - optional operator() (const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/custom_geometry_source_options.hpp b/include/mbgl/style/conversion/custom_geometry_source_options.hpp deleted file mode 100644 index 090e5b623..000000000 --- a/include/mbgl/style/conversion/custom_geometry_source_options.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/filter.hpp b/include/mbgl/style/conversion/filter.hpp deleted file mode 100644 index 2d7ad0afc..000000000 --- a/include/mbgl/style/conversion/filter.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { -public: - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/function.hpp b/include/mbgl/style/conversion/function.hpp deleted file mode 100644 index 47ce6843b..000000000 --- a/include/mbgl/style/conversion/function.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -bool hasTokens(const std::string&); -std::unique_ptr convertTokenStringToFormatExpression(const std::string&); -std::unique_ptr convertTokenStringToExpression(const std::string&); - -optional> convertFunctionToExpression(expression::type::Type, const Convertible&, Error&, bool convertTokens); - -template -optional> convertFunctionToExpression(const Convertible& value, Error& error, bool convertTokens); - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/geojson.hpp b/include/mbgl/style/conversion/geojson.hpp deleted file mode 100644 index 90c1d6419..000000000 --- a/include/mbgl/style/conversion/geojson.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -// Workaround until https://github.com/mapbox/mapbox-gl-native/issues/5623 is done. -optional parseGeoJSON(const std::string&, Error&); - -template <> -struct Converter { -public: - optional operator()(const Convertible&, Error&) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/geojson_options.hpp b/include/mbgl/style/conversion/geojson_options.hpp deleted file mode 100644 index 89511848d..000000000 --- a/include/mbgl/style/conversion/geojson_options.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/get_json_type.hpp b/include/mbgl/style/conversion/get_json_type.hpp deleted file mode 100644 index f7efebccc..000000000 --- a/include/mbgl/style/conversion/get_json_type.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -std::string getJSONType(const Convertible& value); - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/layer.hpp b/include/mbgl/style/conversion/layer.hpp deleted file mode 100644 index 9cf019378..000000000 --- a/include/mbgl/style/conversion/layer.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter> { -public: - optional> operator()(const Convertible& value, Error& error) const; -}; - -optional setPaintProperties(Layer& layer, const Convertible& value); - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/light.hpp b/include/mbgl/style/conversion/light.hpp deleted file mode 100644 index 2f6f8628b..000000000 --- a/include/mbgl/style/conversion/light.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { -public: - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/position.hpp b/include/mbgl/style/conversion/position.hpp deleted file mode 100644 index 10db5c6ec..000000000 --- a/include/mbgl/style/conversion/position.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/property_value.hpp b/include/mbgl/style/conversion/property_value.hpp deleted file mode 100644 index 9d619f7a0..000000000 --- a/include/mbgl/style/conversion/property_value.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template -struct Converter> { - optional> operator()(const Convertible& value, Error& error, bool allowDataExpressions, bool convertTokens) const; - - template - PropertyValue maybeConvertTokens(const S& t) const { - return PropertyValue(t); - }; - - PropertyValue maybeConvertTokens(const std::string& t) const { - return hasTokens(t) - ? PropertyValue(PropertyExpression(convertTokenStringToExpression(t))) - : PropertyValue(t); - } - - PropertyValue maybeConvertTokens(const expression::Formatted& t) const { - // This only works with a single-section `Formatted` created automatically - // by parsing a plain-text `text-field` property. - // Token conversion happens later than the initial string->Formatted conversion - // General purpose `format` expressions with embedded tokens are not supported - const std::string& firstUnformattedSection = t.sections[0].text; - return hasTokens(firstUnformattedSection) - ? PropertyValue(PropertyExpression(convertTokenStringToFormatExpression(firstUnformattedSection))) - : PropertyValue(t); - } -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/source.hpp b/include/mbgl/style/conversion/source.hpp deleted file mode 100644 index 19bc1ce6b..000000000 --- a/include/mbgl/style/conversion/source.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter> { -public: - optional> operator()(const Convertible& value, Error& error, const std::string& id) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/tileset.hpp b/include/mbgl/style/conversion/tileset.hpp deleted file mode 100644 index 88661c358..000000000 --- a/include/mbgl/style/conversion/tileset.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { -public: - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion/transition_options.hpp b/include/mbgl/style/conversion/transition_options.hpp deleted file mode 100644 index a72d757d3..000000000 --- a/include/mbgl/style/conversion/transition_options.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -template <> -struct Converter { -public: - optional operator()(const Convertible& value, Error& error) const; -}; - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/conversion_impl.hpp b/include/mbgl/style/conversion_impl.hpp deleted file mode 100644 index 3e1b8455e..000000000 --- a/include/mbgl/style/conversion_impl.hpp +++ /dev/null @@ -1,378 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace conversion { - -/* - The `conversion` namespace defines conversions from JSON structures conforming to the schema defined by - the Mapbox Style Specification, to the various C++ types that form the C++ model of that domain: - - * `std::unique_ptr` - * `std::unique_ptr` - * `Filter` - * `PropertyValue` - - A single template function serves as the public interface: - - template - optional convert(const Convertible& input, Error& error); - - Where `T` is one of the above types. If the conversion fails, the result is empty, and the - error parameter includes diagnostic text suitable for presentation to a library user. Otherwise, - a filled optional is returned. - - `Convertible` is a type that encapsulates a special form of polymorphism over various underlying types that - can serve as input to the conversion algorithm. For instance, on macOS, we need to support - conversion from both RapidJSON types, and a JSON structure represented with `NSArray`/`NSDictionary`/etc. - On Qt, we need to support conversion from RapidJSON types and QVariant. - - We don't want to use traditional forms of polymorphism to accomplish this: - - * Compile time polymorphism using a template parameter for the actual value type leads to - excessive code bloat and long compile times. - * Runtime polymorphism using virtual methods requires extra heap allocation and ubiquitous - use of std::unique_ptr, unsuitable for this performance-sensitive code. - - Therefore, we're using a custom implementation of runtime polymorphism where we manually create and - dispatch through a table of function pointers (vtable), while keeping the storage for any of the possible - underlying types inline on the stack, using `std::aligned_storage`. - - For a given underlying type T, an explicit specialization of `ConversionTraits` must be provided. This - specialization must provide the following static methods: - - * `isUndefined(v)` -- returns a boolean indication whether `v` is undefined or a JSON null - - * `isArray(v)` -- returns a boolean indicating whether `v` represents a JSON array - * `arrayLength(v)` -- called only if `isArray(v)`; returns a size_t length - * `arrayMember(v)` -- called only if `isArray(v)`; returns `V` or `V&` - - * `isObject(v)` -- returns a boolean indicating whether `v` represents a JSON object - * `objectMember(v, name)` -- called only if `isObject(v)`; `name` is `const char *`; return value: - * is true when evaluated in a boolean context iff the named member exists - * is convertable to a `V` or `V&` when dereferenced - * `eachMember(v, [] (const std::string&, const V&) -> optional {...})` -- called - only if `isObject(v)`; calls the provided lambda once for each key and value of the object; - short-circuits if any call returns an `Error` - - * `toBool(v)` -- returns `optional`, absence indicating `v` is not a JSON boolean - * `toNumber(v)` -- returns `optional`, absence indicating `v` is not a JSON number - * `toDouble(v)` -- returns `optional`, absence indicating `v` is not a JSON number - * `toString(v)` -- returns `optional`, absence indicating `v` is not a JSON string - * `toValue(v)` -- returns `optional`, a variant type, for generic conversion, - absence indicating `v` is not a boolean, number, or string. Numbers should be converted to - unsigned integer, signed integer, or floating point, in descending preference. - - In addition, the type T must be move-constructable. And finally, `Convertible::Storage`, a typedef for - `std::aligned_storage_t`, must be large enough to satisfy the memory requirements for any of the - possible underlying types. (A static assert will fail if this is not the case.) - - `Convertible` itself is movable, but not copyable. A moved-from `Convertible` is in an invalid state; - you must not do anything with it except let it go out of scope. -*/ - -template -class ConversionTraits; - -class Convertible { -public: - template - Convertible(T&& value) : vtable(vtableForType>()) { - static_assert(sizeof(Storage) >= sizeof(std::decay_t), "Storage must be large enough to hold value type"); - new (static_cast(&storage)) std::decay_t(std::forward(value)); - } - - Convertible(Convertible&& v) : vtable(v.vtable) { - // NOLINTNEXTLINE(performance-move-const-arg) - vtable->move(std::move(v.storage), storage); - } - - ~Convertible() { - vtable->destroy(storage); - } - - Convertible& operator=(Convertible&& v) { - if (this != &v) { - vtable->destroy(storage); - vtable = v.vtable; - // NOLINTNEXTLINE(performance-move-const-arg) - vtable->move(std::move(v.storage), storage); - } - return *this; - } - - Convertible() = delete; - Convertible(const Convertible&) = delete; - Convertible& operator=(const Convertible&) = delete; - - friend inline bool isUndefined(const Convertible& v) { - assert(v.vtable); - return v.vtable->isUndefined(v.storage); - } - - friend inline bool isArray(const Convertible& v) { - assert(v.vtable); - return v.vtable->isArray(v.storage); - } - - friend inline std::size_t arrayLength(const Convertible& v) { - assert(v.vtable); - return v.vtable->arrayLength(v.storage); - } - - friend inline Convertible arrayMember(const Convertible& v, std::size_t i) { - assert(v.vtable); - return v.vtable->arrayMember(v.storage, i); - } - - friend inline bool isObject(const Convertible& v) { - assert(v.vtable); - return v.vtable->isObject(v.storage); - } - - friend inline optional objectMember(const Convertible& v, const char * name) { - assert(v.vtable); - return v.vtable->objectMember(v.storage, name); - } - - friend inline optional eachMember(const Convertible& v, const std::function (const std::string&, const Convertible&)>& fn) { - assert(v.vtable); - return v.vtable->eachMember(v.storage, fn); - } - - friend inline optional toBool(const Convertible& v) { - assert(v.vtable); - return v.vtable->toBool(v.storage); - } - - friend inline optional toNumber(const Convertible& v) { - assert(v.vtable); - return v.vtable->toNumber(v.storage); - } - - friend inline optional toDouble(const Convertible& v) { - assert(v.vtable); - return v.vtable->toDouble(v.storage); - } - - friend inline optional toString(const Convertible& v) { - assert(v.vtable); - return v.vtable->toString(v.storage); - } - - friend inline optional toValue(const Convertible& v) { - assert(v.vtable); - return v.vtable->toValue(v.storage); - } - - friend inline optional toGeoJSON(const Convertible& v, Error& error) { - assert(v.vtable); - return v.vtable->toGeoJSON(v.storage, error); - } - -private: -#if __ANDROID__ - // Android: JSValue* or mbgl::android::Value - using Storage = std::aligned_storage_t<32, 8>; -#elif __QT__ - // Qt: JSValue* or QVariant - using Storage = std::aligned_storage_t<32, 8>; -#else - // Node: JSValue* or v8::Local - // iOS/macOS: JSValue* or id - using Storage = std::aligned_storage_t<8, 8>; -#endif - - struct VTable { - void (*move) (Storage&& src, Storage& dest); - void (*destroy) (Storage&); - - bool (*isUndefined) (const Storage&); - - bool (*isArray) (const Storage&); - std::size_t (*arrayLength) (const Storage&); - Convertible (*arrayMember) (const Storage&, std::size_t); - - bool (*isObject) (const Storage&); - optional (*objectMember) (const Storage&, const char *); - optional (*eachMember) (const Storage&, const std::function (const std::string&, const Convertible&)>&); - - optional (*toBool) (const Storage&); - optional (*toNumber) (const Storage&); - optional (*toDouble) (const Storage&); - optional (*toString) (const Storage&); - optional (*toValue) (const Storage&); - - // https://github.com/mapbox/mapbox-gl-native/issues/5623 - optional (*toGeoJSON) (const Storage&, Error&); - }; - - // Extracted this function from the table below to work around a GCC bug with differing - // visibility settings for capturing lambdas: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80947 - template - static auto vtableEachMember(const Storage& s, const std::function(const std::string&, const Convertible&)>& fn) { - return ConversionTraits::eachMember(reinterpret_cast(s), [&](const std::string& k, T&& v) { - return fn(k, Convertible(std::move(v))); - }); - } - - template - static VTable* vtableForType() { - using Traits = ConversionTraits; - static VTable vtable = { - [] (Storage&& src, Storage& dest) { - new (static_cast(&dest)) T(reinterpret_cast(src)); - }, - [] (Storage& s) { - reinterpret_cast(s).~T(); - }, - [] (const Storage& s) { - return Traits::isUndefined(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::isArray(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::arrayLength(reinterpret_cast(s)); - }, - [] (const Storage& s, std::size_t i) { - return Convertible(Traits::arrayMember(reinterpret_cast(s), i)); - }, - [] (const Storage& s) { - return Traits::isObject(reinterpret_cast(s)); - }, - [] (const Storage& s, const char * key) { - optional member = Traits::objectMember(reinterpret_cast(s), key); - if (member) { - return optional(Convertible(std::move(*member))); - } else { - return optional(); - } - }, - vtableEachMember, - [] (const Storage& s) { - return Traits::toBool(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::toNumber(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::toDouble(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::toString(reinterpret_cast(s)); - }, - [] (const Storage& s) { - return Traits::toValue(reinterpret_cast(s)); - }, - [] (const Storage& s, Error& err) { - return Traits::toGeoJSON(reinterpret_cast(s), err); - } - }; - return &vtable; - } - - VTable* vtable; - Storage storage; -}; - -template -optional convert(const Convertible& value, Error& error, Args&&...args) { - return Converter()(value, error, std::forward(args)...); -} - -template <> -struct ValueFactory { - static Value make(const ColorRampPropertyValue& value) { return value.getExpression().serialize(); } -}; - -template <> -struct ValueFactory { - static Value make(const TransitionOptions& value) { - return mapbox::base::ValueArray{ - {std::chrono::duration_cast(value.duration.value_or(mbgl::Duration::zero())) - .count(), - std::chrono::duration_cast(value.delay.value_or(mbgl::Duration::zero())) - .count(), - value.enablePlacementTransitions}}; - } -}; - -template <> -struct ValueFactory { - static Value make(const Color& color) { return color.toObject(); } -}; - -template -struct ValueFactory::value && !is_linear_container::value)>::type> { - static Value make(const T& arg) { return {arg}; } -}; - -template -struct ValueFactory::value>::type> { - static Value make(T arg) { return {Enum::toString(arg)}; } -}; - -template -struct ValueFactory::value>::type> { - static Value make(const T& arg) { - mapbox::base::ValueArray result; - result.reserve(arg.size()); - for (const auto& item : arg) { - result.emplace_back(ValueFactory>::make(item)); - } - return result; - } -}; - -template <> -struct ValueFactory { - static Value make(const Position& position) { - return ValueFactory>::make(position.getSpherical()); - } -}; - -template -Value makeValue(T&& arg) { - return ValueFactory>::make(std::forward(arg)); -} - -template -StyleProperty makeStyleProperty(const PropertyValue& value) { - return value.match([](const Undefined&) -> StyleProperty { return {}; }, - [](const T& t) -> StyleProperty { - return {makeValue(t), StyleProperty::Kind::Constant}; - }, - [](const PropertyExpression& fn) -> StyleProperty { - return {fn.getExpression().serialize(), StyleProperty::Kind::Expression}; - }); -} - -inline StyleProperty makeStyleProperty(const TransitionOptions& value) { - return {makeValue(value), StyleProperty::Kind::Transition}; -} - -inline StyleProperty makeStyleProperty(const ColorRampPropertyValue& value) { - return {makeValue(value), StyleProperty::Kind::Expression}; -} - -} // namespace conversion -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/assertion.hpp b/include/mbgl/style/expression/assertion.hpp deleted file mode 100644 index 0dec89dac..000000000 --- a/include/mbgl/style/expression/assertion.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Assertion : public Expression { -public: - Assertion(type::Type type_, std::vector> inputs_); - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - mbgl::Value serialize() const override; - std::string getOperator() const override; - -private: - std::vector> inputs; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/at.hpp b/include/mbgl/style/expression/at.hpp deleted file mode 100644 index f0dbccb79..000000000 --- a/include/mbgl/style/expression/at.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class At : public Expression { -public: - At(std::unique_ptr index_, std::unique_ptr input_) : - Expression(Kind::At, input_->getType().get().itemType), - index(std::move(index_)), - input(std::move(input_)) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function&) const override; - - bool operator==(const Expression& e) const override { - if (e.getKind() == Kind::At) { - auto rhs = static_cast(&e); - return *index == *(rhs->index) && *input == *(rhs->input); - } - return false; - } - - std::vector> possibleOutputs() const override { - return { nullopt }; - } - - std::string getOperator() const override { return "at"; } - -private: - std::unique_ptr index; - std::unique_ptr input; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/boolean_operator.hpp b/include/mbgl/style/expression/boolean_operator.hpp deleted file mode 100644 index d25474751..000000000 --- a/include/mbgl/style/expression/boolean_operator.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Any : public Expression { -public: - Any(std::vector> inputs_) : - Expression(Kind::Any, type::Boolean), - inputs(std::move(inputs_)) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - bool operator==(const Expression& e) const override; - std::vector> possibleOutputs() const override; - - std::string getOperator() const override { return "any"; } -private: - std::vector> inputs; -}; - -class All : public Expression { -public: - All(std::vector> inputs_) : - Expression(Kind::All, type::Boolean), - inputs(std::move(inputs_)) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - bool operator==(const Expression& e) const override; - std::vector> possibleOutputs() const override; - - std::string getOperator() const override { return "all"; } -private: - std::vector> inputs; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/case.hpp b/include/mbgl/style/expression/case.hpp deleted file mode 100644 index 7cd007d3c..000000000 --- a/include/mbgl/style/expression/case.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Case : public Expression { -public: - using Branch = std::pair, std::unique_ptr>; - - Case(type::Type type_, std::vector branches_, std::unique_ptr otherwise_) - : Expression(Kind::Case, type_), branches(std::move(branches_)), otherwise(std::move(otherwise_)) { - } - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - std::string getOperator() const override { return "case"; } -private: - std::vector branches; - std::unique_ptr otherwise; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/check_subtype.hpp b/include/mbgl/style/expression/check_subtype.hpp deleted file mode 100644 index 90e5169de..000000000 --- a/include/mbgl/style/expression/check_subtype.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { -namespace type { - -optional checkSubtype(const Type& expected, const Type& t); - -} // namespace type -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/coalesce.hpp b/include/mbgl/style/expression/coalesce.hpp deleted file mode 100644 index c4216f234..000000000 --- a/include/mbgl/style/expression/coalesce.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Coalesce : public Expression { -public: - using Args = std::vector>; - Coalesce(const type::Type& type_, Args args_) : - Expression(Kind::Coalesce, type_), - args(std::move(args_)) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - - EvaluationResult evaluate(const EvaluationContext& params) const override; - - void eachChild(const std::function& visit) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - std::size_t getLength() const { - return args.size(); - } - - Expression* getChild(std::size_t i) const { - return args.at(i).get(); - } - - std::string getOperator() const override { return "coalesce"; } -private: - Args args; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/coercion.hpp b/include/mbgl/style/expression/coercion.hpp deleted file mode 100644 index 28c2c0c67..000000000 --- a/include/mbgl/style/expression/coercion.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Coercion : public Expression { -public: - Coercion(type::Type type_, std::vector> inputs_); - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - - mbgl::Value serialize() const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - std::string getOperator() const override; -private: - EvaluationResult (*coerceSingleValue) (const Value& v); - std::vector> inputs; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl - diff --git a/include/mbgl/style/expression/collator.hpp b/include/mbgl/style/expression/collator.hpp deleted file mode 100644 index 51ba426fa..000000000 --- a/include/mbgl/style/expression/collator.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Collator { -public: - Collator(bool caseSensitive, bool diacriticSensitive, optional locale = {}); - - bool operator==(const Collator& other) const; - - int compare(const std::string& lhs, const std::string& rhs) const; - - std::string resolvedLocale() const; -private: - platform::Collator collator; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/collator_expression.hpp b/include/mbgl/style/expression/collator_expression.hpp deleted file mode 100644 index 2551cd19c..000000000 --- a/include/mbgl/style/expression/collator_expression.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -class CollatorExpression : public Expression { -public: - CollatorExpression(std::unique_ptr caseSensitive, - std::unique_ptr diacriticSensitive, - optional> locale); - - EvaluationResult evaluate(const EvaluationContext&) const override; - static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); - - void eachChild(const std::function&) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override { - // Technically the set of possible outputs is the combinatoric set of Collators produced - // by all possibleOutputs of locale/caseSensitive/diacriticSensitive - // But for the primary use of Collators in comparison operators, we ignore the Collator's - // possibleOutputs anyway, so we can get away with leaving this undefined for now. - return { nullopt }; - } - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "collator"; } -private: - std::unique_ptr caseSensitive; - std::unique_ptr diacriticSensitive; - optional> locale; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/comparison.hpp b/include/mbgl/style/expression/comparison.hpp deleted file mode 100644 index cf64f5cd3..000000000 --- a/include/mbgl/style/expression/comparison.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -ParseResult parseComparison(const mbgl::style::conversion::Convertible&, ParsingContext&); - -class BasicComparison : public Expression { -public: - using CompareFunctionType = bool (*) (Value, Value); - - BasicComparison( - std::string op, - std::unique_ptr lhs, - std::unique_ptr rhs); - - void eachChild(const std::function& visit) const override; - bool operator==(const Expression&) const override; - EvaluationResult evaluate(const EvaluationContext&) const override; - std::vector> possibleOutputs() const override; - std::string getOperator() const override; - -private: - std::string op; - CompareFunctionType compare; - std::unique_ptr lhs; - std::unique_ptr rhs; - bool needsRuntimeTypeCheck; -}; - -class CollatorComparison : public Expression { -public: - using CompareFunctionType = bool (*) (std::string, std::string, Collator); - - CollatorComparison( - std::string op, - std::unique_ptr lhs, - std::unique_ptr rhs, - std::unique_ptr collator); - - void eachChild(const std::function& visit) const override; - bool operator==(const Expression&) const override; - EvaluationResult evaluate(const EvaluationContext&) const override; - std::vector> possibleOutputs() const override; - std::string getOperator() const override; - -private: - std::string op; - CompareFunctionType compare; - std::unique_ptr lhs; - std::unique_ptr rhs; - std::unique_ptr collator; - bool needsRuntimeTypeCheck; -}; - - - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/compound_expression.hpp b/include/mbgl/style/expression/compound_expression.hpp deleted file mode 100644 index 57a96d08a..000000000 --- a/include/mbgl/style/expression/compound_expression.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -namespace detail { -struct SignatureBase; -} // namespace detail - -/* - CompoundExpression provides a mechanism for implementing an expression - simply by providing a list of pure functions of the form - (const T0& arg0, const T1& arg1, ...) -> Result where T0, T1, ..., U are - member types of mbgl::style::expression::Value. - - The majority of expressions specified in the style-spec are implemented in - this fashion (see compound_expression.cpp). -*/ -class CompoundExpression : public Expression { -public: - CompoundExpression(const detail::SignatureBase&, std::vector>); - - std::string getOperator() const override; - EvaluationResult evaluate(const EvaluationContext& evaluationParams) const override; - std::vector> possibleOutputs() const override; - void eachChild(const std::function& visit) const override; - bool operator==(const Expression& e) const override; - - optional getParameterCount() const; - - static bool exists(const std::string& name); - -protected: - const detail::SignatureBase& signature; - std::vector> args; -}; - -ParseResult parseCompoundExpression(const std::string name, - const mbgl::style::conversion::Convertible& value, - ParsingContext& ctx); - -ParseResult createCompoundExpression(const std::string& name, - std::vector> args, - ParsingContext& ctx); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/dsl.hpp b/include/mbgl/style/expression/dsl.hpp deleted file mode 100644 index 4abeac798..000000000 --- a/include/mbgl/style/expression/dsl.hpp +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { -namespace dsl { - -// This convenience API does little to no expression validation or type-checking, and is intended for -// use only by test and other non-production code. - -template -std::vector> vec(Args... args) { - std::vector> result; - util::ignore({ (result.push_back(std::move(args)), 0)... }); - return result; -} - -std::unique_ptr createExpression(const char* expr); -std::unique_ptr createExpression(const mbgl::style::conversion::Convertible& expr); -std::unique_ptr error(std::string); - -std::unique_ptr literal(const char* value); -std::unique_ptr literal(Value value); -std::unique_ptr literal(std::initializer_list value); -std::unique_ptr literal(std::initializer_list value); - -std::unique_ptr -assertion(type::Type, std::unique_ptr, - std::unique_ptr def = nullptr); -std::unique_ptr number(std::unique_ptr, - std::unique_ptr def = nullptr); -std::unique_ptr string(std::unique_ptr, - std::unique_ptr def = nullptr); -std::unique_ptr boolean(std::unique_ptr, - std::unique_ptr def = nullptr); - -std::unique_ptr toColor(std::unique_ptr, - std::unique_ptr def = nullptr); -std::unique_ptr toString(std::unique_ptr, - std::unique_ptr def = nullptr); -std::unique_ptr toFormatted(std::unique_ptr, - std::unique_ptr def = nullptr); - -std::unique_ptr get(const char* value); -std::unique_ptr get(std::unique_ptr); - -std::unique_ptr id(); -std::unique_ptr zoom(); - -std::unique_ptr eq(std::unique_ptr, std::unique_ptr); -std::unique_ptr ne(std::unique_ptr, std::unique_ptr); -std::unique_ptr gt(std::unique_ptr, std::unique_ptr); -std::unique_ptr lt(std::unique_ptr, std::unique_ptr); - -std::unique_ptr step(std::unique_ptr input, - std::unique_ptr output0, - double input1, std::unique_ptr output1); - -Interpolator linear(); -Interpolator exponential(double base); -Interpolator cubicBezier(double x1, double y1, double x2, double y2); - -std::unique_ptr interpolate(Interpolator interpolator, - std::unique_ptr input, - double input1, std::unique_ptr output1); - -std::unique_ptr interpolate(Interpolator interpolator, - std::unique_ptr input, - double input1, std::unique_ptr output1, - double input2, std::unique_ptr output2); - -std::unique_ptr interpolate(Interpolator interpolator, - std::unique_ptr input, - double input1, std::unique_ptr output1, - double input2, std::unique_ptr output2, - double input3, std::unique_ptr output3); - -std::unique_ptr concat(std::vector> inputs); - -std::unique_ptr format(const char* value); -std::unique_ptr format(std::unique_ptr); - -} // namespace dsl -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/error.hpp b/include/mbgl/style/expression/error.hpp deleted file mode 100644 index 9e1da2f0f..000000000 --- a/include/mbgl/style/expression/error.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Error : public Expression { -public: - Error(std::string message_) - : Expression(Kind::Error, type::Error), - message(std::move(message_)) {} - - void eachChild(const std::function&) const override {} - - bool operator==(const Expression& e) const override { - return e.getKind() == Kind::Error; - } - - EvaluationResult evaluate(const EvaluationContext&) const override { - return EvaluationError{message}; - } - - std::vector> possibleOutputs() const override { - return {}; - } - - std::string getOperator() const override { return "error"; } - -private: - std::string message; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp deleted file mode 100644 index 1341a8d04..000000000 --- a/include/mbgl/style/expression/expression.hpp +++ /dev/null @@ -1,237 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { - -class GeometryTileFeature; - -namespace style { -namespace expression { - -class EvaluationError { -public: - std::string message; -}; - -class EvaluationContext { -public: - EvaluationContext() = default; - explicit EvaluationContext(float zoom_) : zoom(zoom_) {} - explicit EvaluationContext(GeometryTileFeature const * feature_) : feature(feature_) {} - EvaluationContext(float zoom_, GeometryTileFeature const * feature_) : - zoom(zoom_), feature(feature_) - {} - EvaluationContext(optional accumulated_, GeometryTileFeature const * feature_) : - accumulated(std::move(accumulated_)), feature(feature_) - {} - EvaluationContext(float zoom_, GeometryTileFeature const* feature_, const FeatureState* state_) - : zoom(zoom_), feature(feature_), featureState(state_) {} - EvaluationContext(optional zoom_, GeometryTileFeature const * feature_, optional colorRampParameter_) : - zoom(std::move(zoom_)), feature(feature_), colorRampParameter(std::move(colorRampParameter_)) - {} - - EvaluationContext& withFormattedSection(const Value* formattedSection_) noexcept { - formattedSection = formattedSection_; - return *this; - }; - - EvaluationContext& withFeatureState(const FeatureState* featureState_) noexcept { - featureState = featureState_; - return *this; - }; - - optional zoom; - optional accumulated; - GeometryTileFeature const * feature = nullptr; - optional colorRampParameter; - // Contains formatted section object, std::unordered_map. - const Value* formattedSection = nullptr; - const FeatureState* featureState = nullptr; -}; - -template -class Result : private variant { -public: - using variant::variant; - using Value = T; - - Result() = default; - - explicit operator bool () const { - return this->template is(); - } - - // optional does some type trait magic for this one, so this might - // be problematic as is. - const T* operator->() const { - assert(this->template is()); - return std::addressof(this->template get()); - } - - T* operator->() { - assert(this->template is()); - return std::addressof(this->template get()); - } - - T& operator*() { - assert(this->template is()); - return this->template get(); - } - - const T& operator*() const { - assert(this->template is()); - return this->template get(); - } - - const EvaluationError& error() const { - assert(this->template is()); - return this->template get(); - } -}; - -class EvaluationResult : public Result { -public: - using Result::Result; // NOLINT - - EvaluationResult() = default; - - EvaluationResult(const std::array& arr) : - Result(toExpressionValue(arr)) - {} - - // used only for the special (private) "error" expression - EvaluationResult(const type::ErrorType&) { - assert(false); - } -}; - -/* - Expression is an abstract class that serves as an interface and base class - for particular expression implementations. - - CompoundExpression implements the majority of expressions in the spec by - inferring the argument and output from a simple function (const T0& arg0, - const T1& arg1, ...) -> Result where T0, T1, ..., U are member types of - mbgl::style::expression::Value. - - The other Expression subclasses (Let, Curve, Match, etc.) exist in order to - implement expressions that need specialized parsing, type checking, or - evaluation logic that can't be handled by CompoundExpression's inference - mechanism. - - Each Expression subclass also provides a static - ParseResult ExpressionClass::parse(const V&, ParsingContext), - which handles parsing a style-spec JSON representation of the expression. -*/ - -enum class Kind : int32_t { - Coalesce, - CompoundExpression, - Literal, - At, - Interpolate, - Assertion, - Length, - Step, - Let, - Var, - CollatorExpression, - Coercion, - Match, - Error, - Case, - Any, - All, - Comparison, - FormatExpression, - FormatSectionOverride, - NumberFormat -}; - -class Expression { -public: - Expression(Kind kind_, type::Type type_) : kind(kind_), type(std::move(type_)) {} - virtual ~Expression() = default; - - virtual EvaluationResult evaluate(const EvaluationContext& params) const = 0; - virtual void eachChild(const std::function&) const = 0; - virtual bool operator==(const Expression&) const = 0; - bool operator!=(const Expression& rhs) const { - return !operator==(rhs); - } - - Kind getKind() const { return kind; }; - type::Type getType() const { return type; }; - - EvaluationResult evaluate(optional zoom, const Feature& feature, optional colorRampParameter) const; - EvaluationResult evaluate(optional accumulated, const Feature& feature) const; - /** - * Statically analyze the expression, attempting to enumerate possible outputs. Returns - * an array of values plus the sentinel null optional value, used to indicate that the - * complete set of outputs is statically undecidable. - */ - virtual std::vector> possibleOutputs() const = 0; - - virtual mbgl::Value serialize() const { - std::vector serialized; - serialized.emplace_back(getOperator()); - eachChild([&](const Expression &child) { - serialized.emplace_back(child.serialize()); - }); - return serialized; - }; - - virtual std::string getOperator() const = 0; - -protected: - template - static bool childrenEqual(const T& lhs, const T& rhs) { - if (lhs.size() != rhs.size()) return false; - for (auto leftChild = lhs.begin(), rightChild = rhs.begin(); - leftChild != lhs.end(); - leftChild++, rightChild++) - { - if (!Expression::childEqual(*leftChild, *rightChild)) return false; - } - return true; - } - - static bool childEqual(const std::unique_ptr& lhs, const std::unique_ptr& rhs) { - return *lhs == *rhs; - } - - template - static bool childEqual(const std::pair>& lhs, - const std::pair>& rhs) { - return lhs.first == rhs.first && *(lhs.second) == *(rhs.second); - } - - template - static bool childEqual(const std::pair>& lhs, - const std::pair>& rhs) { - return lhs.first == rhs.first && *(lhs.second) == *(rhs.second); - } - - static bool childEqual(const std::pair, std::unique_ptr>& lhs, - const std::pair, std::unique_ptr>& rhs) { - return *(lhs.first) == *(rhs.first) && *(lhs.second) == *(rhs.second); - } - -private: - Kind kind; - type::Type type; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/find_zoom_curve.hpp b/include/mbgl/style/expression/find_zoom_curve.hpp deleted file mode 100644 index 6f1419a69..000000000 --- a/include/mbgl/style/expression/find_zoom_curve.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -optional> findZoomCurve(const expression::Expression* e); - -variant findZoomCurveChecked(const expression::Expression* e); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/format_expression.hpp b/include/mbgl/style/expression/format_expression.hpp deleted file mode 100644 index 180df0139..000000000 --- a/include/mbgl/style/expression/format_expression.hpp +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -struct FormatExpressionSection { - FormatExpressionSection(std::unique_ptr text_, - optional> fontScale_, - optional> textFont_, - optional> textColor_); - - std::shared_ptr text; - optional> fontScale; - optional> textFont; - optional> textColor; -}; - -class FormatExpression final : public Expression { -public: - explicit FormatExpression(std::vector sections); - - EvaluationResult evaluate(const EvaluationContext&) const override; - static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); - - void eachChild(const std::function&) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override { - // Technically the combinatoric set of all children - // Usually, this.text will be undefined anyway - return { nullopt }; - } - - const std::vector& getSections() const { return sections; } - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "format"; } -private: - std::vector sections; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/format_section_override.hpp b/include/mbgl/style/expression/format_section_override.hpp deleted file mode 100644 index 63382fda5..000000000 --- a/include/mbgl/style/expression/format_section_override.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -template -class FormatSectionOverride final : public Expression { -public: - FormatSectionOverride(const type::Type& type_, - PossiblyEvaluatedPropertyValue defaultValue_, - std::string propertyName_) : - Expression(Kind::FormatSectionOverride, type_), - defaultValue(std::move(defaultValue_)), - propertyName(std::move(propertyName_)) - {} - - EvaluationResult evaluate(const EvaluationContext& context) const final { - using Object = std::unordered_map; - if (context.formattedSection && - context.formattedSection->is()) { - const auto& section = context.formattedSection->get(); - if (section.find(propertyName) != section.end()) { - return section.at(propertyName); - } - } - - return defaultValue.match( - [&context] (const style::PropertyExpression& e) { return e.getExpression().evaluate(context); }, - [] (const T& t) -> EvaluationResult { return t; } - ); - } - - void eachChild(const std::function& fn) const final { - defaultValue.match([&fn] (const style::PropertyExpression& e) { fn(e.getExpression()); }, - [] (const T&) {}); - } - - bool operator==(const Expression& e) const final { - if (e.getKind() == Kind::FormatSectionOverride) { - const auto* other = static_cast(&e); - - if (getType() != other->getType() || propertyName != other->propertyName) { - return false; - } - - // Check that default values or property expressions are equal. - return defaultValue.match( - [other] (const style::PropertyExpression& thisExpr) { - return other->defaultValue.match([&thisExpr] (const style::PropertyExpression& otherExpr) { - return thisExpr == otherExpr; - }, - [] (const T&) { - return false; - }); - }, - [other] (const T& thisValue) { - return other->defaultValue.match([&thisValue] (const T& otherValue) { - return thisValue == otherValue; - }, - [] (const style::PropertyExpression&) { - return false; - }); - }); - } - - return false; - } - - std::vector> possibleOutputs() const final { - return {nullopt}; - } - - std::string getOperator() const final { return "format-section-override"; } - -private: - PossiblyEvaluatedPropertyValue defaultValue; - std::string propertyName; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/formatted.hpp b/include/mbgl/style/expression/formatted.hpp deleted file mode 100644 index bb3d609c9..000000000 --- a/include/mbgl/style/expression/formatted.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -extern const char* const kFormattedSectionFontScale; -extern const char* const kFormattedSectionTextFont; -extern const char* const kFormattedSectionTextColor; - -struct FormattedSection { - FormattedSection(std::string text_, - optional fontScale_, - optional fontStack_, - optional textColor_) - : text(std::move(text_)) - , fontScale(std::move(fontScale_)) - , fontStack(std::move(fontStack_)) - , textColor(std::move(textColor_)) - {} - - std::string text; - optional fontScale; - optional fontStack; - optional textColor; -}; - -class Formatted { -public: - Formatted() = default; - - Formatted(const char* plainU8String) { - sections.emplace_back(std::string(plainU8String), nullopt, nullopt, nullopt); - } - - Formatted(std::vector sections_) - : sections(std::move(sections_)) - {} - - bool operator==(const Formatted& ) const; - - std::string toString() const; - mbgl::Value toObject() const; - - bool empty() const { - return sections.empty() || sections.at(0).text.empty(); - } - - std::vector sections; -}; - -} // namespace expression - -namespace conversion { - -template <> -struct Converter { -public: - optional operator()(const Convertible& value, Error& error) const; -}; - -template <> -struct ValueFactory { - static Value make(const expression::Formatted& formatted) { return formatted.toObject(); } -}; - -} // namespace conversion - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/get_covering_stops.hpp b/include/mbgl/style/expression/get_covering_stops.hpp deleted file mode 100644 index 157aefe7b..000000000 --- a/include/mbgl/style/expression/get_covering_stops.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -// Return the smallest range of stops that covers the interval [lower, upper] -Range getCoveringStops(const std::map>& stops, - const double lower, const double upper); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/interpolate.hpp b/include/mbgl/style/expression/interpolate.hpp deleted file mode 100644 index 0e7850471..000000000 --- a/include/mbgl/style/expression/interpolate.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -ParseResult parseInterpolate(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - -class Interpolate : public Expression { -public: - Interpolate(const type::Type& type_, - Interpolator interpolator_, - std::unique_ptr input_, - std::map> stops_); - - const std::unique_ptr& getInput() const { return input; } - const Interpolator& getInterpolator() const { return interpolator; } - - void eachChild(const std::function& visit) const override { - visit(*input); - for (const auto& stop : stops) { - visit(*stop.second); - } - } - - void eachStop(const std::function& visit) const { - for (const auto& stop : stops) { - visit(stop.first, *stop.second); - } - } - - // Return the smallest range of stops that covers the interval [lower, upper] - Range getCoveringStops(const double lower, const double upper) const { - return ::mbgl::style::expression::getCoveringStops(stops, lower, upper); - } - - double interpolationFactor(const Range& inputLevels, const double inputValue) const { - return interpolator.match( - [&](const auto& interp) { return interp.interpolationFactor(inputLevels, inputValue); } - ); - } - - bool operator==(const Expression& e) const override { - if (e.getKind() == Kind::Interpolate) { - auto rhs = static_cast(&e); - if (interpolator != rhs->interpolator || - *input != *(rhs->input) || - stops.size() != rhs->stops.size()) - { - return false; - } - - return Expression::childrenEqual(stops, rhs->stops); - } - return false; - } - - std::vector> possibleOutputs() const override; - mbgl::Value serialize() const override; - std::string getOperator() const override { return "interpolate"; } - -protected: - const Interpolator interpolator; - const std::unique_ptr input; - const std::map> stops; -}; - -ParseResult createInterpolate(type::Type type, - Interpolator interpolator, - std::unique_ptr input, - std::map> stops, - ParsingContext& ctx); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/interpolator.hpp b/include/mbgl/style/expression/interpolator.hpp deleted file mode 100644 index 62b48c175..000000000 --- a/include/mbgl/style/expression/interpolator.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class ExponentialInterpolator { -public: - ExponentialInterpolator(double base_) : base(base_) {} - - double base; - - double interpolationFactor(const Range& inputLevels, const double input) const { - return util::interpolationFactor(base, - Range { - static_cast(inputLevels.min), - static_cast(inputLevels.max) - }, - input); - } - - bool operator==(const ExponentialInterpolator& rhs) const { - return base == rhs.base; - } -}; - -class CubicBezierInterpolator { -public: - CubicBezierInterpolator(double x1_, double y1_, double x2_, double y2_) : ub(x1_, y1_, x2_, y2_) {} - - double interpolationFactor(const Range& inputLevels, const double input) const { - return ub.solve(util::interpolationFactor(1.0, - Range { - static_cast(inputLevels.min), - static_cast(inputLevels.max) - }, - input), - 1e-6); - } - - bool operator==(const CubicBezierInterpolator& rhs) const { - return ub == rhs.ub; - } - - util::UnitBezier ub; -}; - -using Interpolator = variant; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/is_constant.hpp b/include/mbgl/style/expression/is_constant.hpp deleted file mode 100644 index 2861407af..000000000 --- a/include/mbgl/style/expression/is_constant.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -template -bool isGlobalPropertyConstant(const Expression& expression, const T& properties) { - if (expression.getKind() == Kind::CompoundExpression) { - auto e = static_cast(&expression); - for (const std::string& property : properties) { - if (e->getOperator() == property) { - return false; - } - } - } - - bool isConstant = true; - expression.eachChild([&](const Expression& e) { - if (isConstant && !isGlobalPropertyConstant(e, properties)) { - isConstant = false; - } - }); - return isConstant; -} - -bool isFeatureConstant(const Expression& expression); -bool isZoomConstant(const Expression& e); - - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/is_expression.hpp b/include/mbgl/style/expression/is_expression.hpp deleted file mode 100644 index 77c489619..000000000 --- a/include/mbgl/style/expression/is_expression.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace style { -namespace expression { - -bool isExpression(const conversion::Convertible& value); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/length.hpp b/include/mbgl/style/expression/length.hpp deleted file mode 100644 index 1d754f193..000000000 --- a/include/mbgl/style/expression/length.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Length : public Expression { -public: - Length(std::unique_ptr input); - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - bool operator==(const Expression& e) const override; - std::vector> possibleOutputs() const override; - std::string getOperator() const override { return "length"; } - -private: - std::unique_ptr input; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/let.hpp b/include/mbgl/style/expression/let.hpp deleted file mode 100644 index d11ba1b97..000000000 --- a/include/mbgl/style/expression/let.hpp +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Let : public Expression { -public: - using Bindings = std::map>; - - Let(Bindings bindings_, std::unique_ptr result_) : - Expression(Kind::Let, result_->getType()), - bindings(std::move(bindings_)), - result(std::move(result_)) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function&) const override; - - bool operator==(const Expression& e) const override { - if (e.getKind() == Kind::Let) { - auto rhs = static_cast(&e); - return *result == *(rhs->result); - } - return false; - } - - std::vector> possibleOutputs() const override; - - Expression* getResult() const { - return result.get(); - } - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "let"; } -private: - Bindings bindings; - std::unique_ptr result; -}; - -class Var : public Expression { -public: - Var(std::string name_, std::shared_ptr value_) : - Expression(Kind::Var, value_->getType()), - name(std::move(name_)), - value(value_) - {} - - static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function&) const override; - - bool operator==(const Expression& e) const override { - if (e.getKind() == Kind::Var) { - auto rhs = static_cast(&e); - return *value == *(rhs->value); - } - return false; - } - - std::vector> possibleOutputs() const override; - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "var"; } - - const std::shared_ptr& getBoundExpression() const { return value; } - -private: - std::string name; - std::shared_ptr value; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/literal.hpp b/include/mbgl/style/expression/literal.hpp deleted file mode 100644 index bcae23b1f..000000000 --- a/include/mbgl/style/expression/literal.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Literal : public Expression { -public: - Literal(Value value_) - : Expression(Kind::Literal, typeOf(value_)) - , value(value_) - {} - - Literal(type::Array type_, std::vector value_) - : Expression(Kind::Literal, type_) - , value(value_) - {} - - EvaluationResult evaluate(const EvaluationContext&) const override { - return value; - } - - static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); - - void eachChild(const std::function&) const override {} - - bool operator==(const Expression& e) const override { - if (e.getKind() == Kind::Literal) { - auto rhs = static_cast(&e); - return value == rhs->value; - } - return false; - } - - std::vector> possibleOutputs() const override { - return {{ value }}; - } - - Value getValue() const { - return value; - } - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "literal"; } - -private: - Value value; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/match.hpp b/include/mbgl/style/expression/match.hpp deleted file mode 100644 index 2ce4b7a53..000000000 --- a/include/mbgl/style/expression/match.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -namespace mbgl { -namespace style { -namespace expression { - -template -class Match : public Expression { -public: - using Branches = std::unordered_map>; - - Match(type::Type type_, - std::unique_ptr input_, - Branches branches_, - std::unique_ptr otherwise_ - ) : Expression(Kind::Match, type_), - input(std::move(input_)), - branches(std::move(branches_)), - otherwise(std::move(otherwise_)) - {} - - EvaluationResult evaluate(const EvaluationContext& params) const override; - - void eachChild(const std::function& visit) const override; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "match"; } -private: - std::unique_ptr input; - Branches branches; - std::unique_ptr otherwise; -}; - -ParseResult parseMatch(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/number_format.hpp b/include/mbgl/style/expression/number_format.hpp deleted file mode 100644 index 9571c7d98..000000000 --- a/include/mbgl/style/expression/number_format.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class NumberFormat final : public Expression { -public: - NumberFormat(std::unique_ptr number_, - std::unique_ptr locale_, - std::unique_ptr currency_, - std::unique_ptr minFractionDigits_, - std::unique_ptr maxFractionDigits_); - - ~NumberFormat(); - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - bool operator==(const Expression& e) const override; - std::vector> possibleOutputs() const override; - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "number-format"; } - -private: - std::unique_ptr number; - std::unique_ptr locale; - std::unique_ptr currency; - std::unique_ptr minFractionDigits; - std::unique_ptr maxFractionDigits; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/parsing_context.hpp b/include/mbgl/style/expression/parsing_context.hpp deleted file mode 100644 index 596b13641..000000000 --- a/include/mbgl/style/expression/parsing_context.hpp +++ /dev/null @@ -1,184 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Expression; - -struct ParsingError { - std::string message; - std::string key; - bool operator==(const ParsingError& rhs) const { return message == rhs.message && key == rhs.key; } -}; - -using ParseResult = optional>; - -namespace detail { - -class Scope { -public: - Scope(const std::map>& bindings_, std::shared_ptr parent_ = nullptr) : - bindings(bindings_), - parent(std::move(parent_)) - {} - - const std::map>& bindings; - std::shared_ptr parent; - - optional> get(const std::string& name) { - auto it = bindings.find(name); - if (it != bindings.end()) { - return {it->second}; - } else if (parent) { - return parent->get(name); - } else { - return optional>(); - } - } -}; - -} // namespace detail - -/* - Controls the annotation behavior of the parser when encountering an expression - whose type is not a subtype of the expected type. The default behavior, used - when optional is a nullopt, is as follows: - - When we expect a number, string, boolean, or array but have a value, wrap it in an assertion. - When we expect a color or formatted string, but have a string or value, wrap it in a coercion. - Otherwise, we do static type-checking. - - These behaviors are overridable for: - * The "coalesce" operator, which needs to omit type annotations. - * String-valued properties (e.g. `text-field`), where coercion is more convenient than assertion. -*/ -enum class TypeAnnotationOption { - coerce, - assert, - omit -}; - -class ParsingContext { -public: - ParsingContext() : errors(std::make_shared>()) {} - ParsingContext(std::string key_) : key(std::move(key_)), errors(std::make_shared>()) {} - explicit ParsingContext(type::Type expected_) - : expected(std::move(expected_)), - errors(std::make_shared>()) - {} - ParsingContext(ParsingContext&&) = default; - - ParsingContext(const ParsingContext&) = delete; - ParsingContext& operator=(const ParsingContext&) = delete; - - std::string getKey() const { return key; } - optional getExpected() const { return expected; } - const std::vector& getErrors() const { return *errors; } - const std::string getCombinedErrors() const; - - /* - Parse the given style-spec JSON value as an expression. - */ - ParseResult parseExpression(const mbgl::style::conversion::Convertible& value, - optional = {}); - - /* - Parse the given style-spec JSON value as an expression intended to be used - in a layout or paint property. This entails checking additional constraints - that exist in that context but not, e.g., for filters. - */ - ParseResult parseLayerPropertyExpression(const mbgl::style::conversion::Convertible& value); - - /* - Parse a child expression. For use by individual Expression::parse() methods. - */ - ParseResult parse(const mbgl::style::conversion::Convertible&, - std::size_t, - optional = {}, - optional = {}); - - /* - Parse a child expression. For use by individual Expression::parse() methods. - */ - ParseResult parse(const mbgl::style::conversion::Convertible&, - std::size_t index, - optional, - const std::map>&); - - /* - Check whether `t` is a subtype of `expected`, collecting an error if not. - */ - optional checkType(const type::Type& t); - - optional> getBinding(const std::string name) { - if (!scope) return optional>(); - return scope->get(name); - } - - void error(std::string message) { - errors->push_back({message, key}); - } - - void error(std::string message, std::size_t child) { - errors->push_back({message, key + "[" + util::toString(child) + "]"}); - } - - void error(std::string message, std::size_t child, std::size_t grandchild) { - errors->push_back({message, key + "[" + util::toString(child) + "][" + util::toString(grandchild) + "]"}); - } - - void appendErrors(ParsingContext&& ctx) { - errors->reserve(errors->size() + ctx.errors->size()); - std::move(ctx.errors->begin(), ctx.errors->end(), std::inserter(*errors, errors->end())); - ctx.errors->clear(); - } - - void clearErrors() { - errors->clear(); - } - -private: - ParsingContext(std::string key_, - std::shared_ptr> errors_, - optional expected_, - std::shared_ptr scope_) - : key(std::move(key_)), - expected(std::move(expected_)), - scope(std::move(scope_)), - errors(std::move(errors_)) - {} - - - /* - Parse the given style-spec JSON value into an Expression object. - Specifically, this function is responsible for determining the expression - type (either Literal, or the one named in value[0]) and dispatching to the - appropriate ParseXxxx::parse(const V&, ParsingContext) method. - */ - ParseResult parse(const mbgl::style::conversion::Convertible& value, - optional = {}); - - std::string key; - optional expected; - std::shared_ptr scope; - std::shared_ptr> errors; -}; - -bool isExpression(const std::string&); - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/step.hpp b/include/mbgl/style/expression/step.hpp deleted file mode 100644 index 24e29b1a4..000000000 --- a/include/mbgl/style/expression/step.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -class Step : public Expression { -public: - Step(const type::Type& type_, - std::unique_ptr input_, - std::map> stops_); - - EvaluationResult evaluate(const EvaluationContext& params) const override; - void eachChild(const std::function& visit) const override; - void eachStop(const std::function& visit) const; - - const std::unique_ptr& getInput() const { return input; } - Range getCoveringStops(const double lower, const double upper) const; - - bool operator==(const Expression& e) const override; - - std::vector> possibleOutputs() const override; - - static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); - - mbgl::Value serialize() const override; - std::string getOperator() const override { return "step"; } - -private: - const std::unique_ptr input; - const std::map> stops; -}; - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/type.hpp b/include/mbgl/style/expression/type.hpp deleted file mode 100644 index a5a1e7616..000000000 --- a/include/mbgl/style/expression/type.hpp +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { -namespace style { -namespace expression { -namespace type { - -template -std::string toString(const T& t); - -struct NullType { - constexpr NullType() {}; - std::string getName() const { return "null"; } - bool operator==(const NullType&) const { return true; } -}; - -struct NumberType { - constexpr NumberType() {}; - std::string getName() const { return "number"; } - bool operator==(const NumberType&) const { return true; } -}; - -struct BooleanType { - constexpr BooleanType() {}; - std::string getName() const { return "boolean"; } - bool operator==(const BooleanType&) const { return true; } -}; - -struct StringType { - constexpr StringType() {}; - std::string getName() const { return "string"; } - bool operator==(const StringType&) const { return true; } -}; - -struct ColorType { - constexpr ColorType() {}; - std::string getName() const { return "color"; } - bool operator==(const ColorType&) const { return true; } -}; - -struct ObjectType { - constexpr ObjectType() {}; - std::string getName() const { return "object"; } - bool operator==(const ObjectType&) const { return true; } -}; - -struct ErrorType { - constexpr ErrorType() {}; - std::string getName() const { return "error"; } - bool operator==(const ErrorType&) const { return true; } -}; - -struct ValueType { - constexpr ValueType() {}; - std::string getName() const { return "value"; } - bool operator==(const ValueType&) const { return true; } -}; - -struct CollatorType { - constexpr CollatorType() {}; // NOLINT - std::string getName() const { return "collator"; } - bool operator==(const CollatorType&) const { return true; } -}; - -struct FormattedType { - constexpr FormattedType() {}; // NOLINT - std::string getName() const { return "formatted"; } - bool operator==(const FormattedType&) const { return true; } -}; - - -constexpr NullType Null; -constexpr NumberType Number; -constexpr StringType String; -constexpr BooleanType Boolean; -constexpr ColorType Color; -constexpr ValueType Value; -constexpr ObjectType Object; -constexpr CollatorType Collator; -constexpr FormattedType Formatted; -constexpr ErrorType Error; - -struct Array; - -using Type = variant< - NullType, - NumberType, - BooleanType, - StringType, - ColorType, - ObjectType, - ValueType, - mapbox::util::recursive_wrapper, - CollatorType, - FormattedType, - ErrorType>; - -struct Array { - explicit Array(Type itemType_) : itemType(std::move(itemType_)) {} - Array(Type itemType_, std::size_t N_) : itemType(std::move(itemType_)), N(N_) {} - Array(Type itemType_, optional N_) : itemType(std::move(itemType_)), N(std::move(N_)) {} - std::string getName() const { - if (N) { - return "array<" + toString(itemType) + ", " + util::toString(*N) + ">"; - } else if (itemType == Value) { - return "array"; - } else { - return "array<" + toString(itemType) + ">"; - } - } - - bool operator==(const Array& rhs) const { return itemType == rhs.itemType && N == rhs.N; } - - Type itemType; - optional N; -}; - -template -std::string toString(const T& type) { return type.match([&] (const auto& t) { return t.getName(); }); } - -} // namespace type -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/expression/value.hpp b/include/mbgl/style/expression/value.hpp deleted file mode 100644 index 91239d083..000000000 --- a/include/mbgl/style/expression/value.hpp +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace mbgl { -namespace style { -namespace expression { - -struct Value; - -using ValueBase = variant< - NullValue, - bool, - double, - std::string, - Color, - Collator, - Formatted, - mapbox::util::recursive_wrapper>, - mapbox::util::recursive_wrapper>>; -struct Value : ValueBase { - using ValueBase::ValueBase; - - // Javascript's Number.MAX_SAFE_INTEGER - static uint64_t maxSafeInteger() { return 9007199254740991ULL; } - - static bool isSafeInteger(uint64_t x) { return x <= maxSafeInteger(); }; - static bool isSafeInteger(int64_t x) { - return static_cast(x > 0 ? x : -x) <= maxSafeInteger(); - } - static bool isSafeInteger(double x) { - return static_cast(x > 0 ? x : -x) <= maxSafeInteger(); - } - -}; - -constexpr NullValue Null = NullValue(); - -type::Type typeOf(const Value& value); - -std::string toString(const Value& value); -std::string stringify(const Value& value); - -/* - Returns a Type object representing the expression type that corresponds to - the value type T. (Specialized for primitives and specific array types in - the .cpp.) -*/ -template -type::Type valueTypeToExpressionType(); - -/* - Conversions between style value types and expression::Value -*/ - -template -struct ValueConverter { - static Value toExpressionValue(const T& value) { - return Value(value); - } - - static optional fromExpressionValue(const Value& value) { - return value.template is() ? value.template get() : optional(); - } -}; - -template <> -struct ValueConverter { - static type::Type expressionType() { return type::Value; } - static Value toExpressionValue(const Value& value) { return value; } - static optional fromExpressionValue(const Value& value) { return value; } -}; - -template <> -struct ValueConverter { - static Value toExpressionValue(const mbgl::Value& value); - static mbgl::Value fromExpressionValue(const Value& value); -}; - -template <> -struct ValueConverter { - static type::Type expressionType() { return type::Number; } - static Value toExpressionValue(const float value); - static optional fromExpressionValue(const Value& value); -}; - -template -struct ValueConverter> { - static type::Type expressionType() { - return type::Array(valueTypeToExpressionType(), N); - } - static Value toExpressionValue(const std::array& value); - static optional> fromExpressionValue(const Value& value); -}; - -template -struct ValueConverter> { - static type::Type expressionType() { - return type::Array(valueTypeToExpressionType()); - } - static Value toExpressionValue(const std::vector& value); - static optional> fromExpressionValue(const Value& value); -}; - -template <> -struct ValueConverter { - static type::Type expressionType() { return type::Array(type::Number, 3); } - static Value toExpressionValue(const mbgl::style::Position& value); - static optional fromExpressionValue(const Value& v); -}; - -template -struct ValueConverter::value >> { - static type::Type expressionType() { return type::String; } - static Value toExpressionValue(const T& value); - static optional fromExpressionValue(const Value& value); -}; - -template -Value toExpressionValue(const T& value) { - return ValueConverter::toExpressionValue(value); -} - -template -optional fromExpressionValue(const Value& value) { - return ValueConverter::fromExpressionValue(value); -} - -template -std::vector> fromExpressionValues(const std::vector>& values) { - std::vector> result; - for (const auto& value : values) { - result.push_back(value ? fromExpressionValue(*value) : nullopt); - } - return result; -} - -} // namespace expression -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/filter.hpp b/include/mbgl/style/filter.hpp deleted file mode 100644 index c9dc9fb1e..000000000 --- a/include/mbgl/style/filter.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { -namespace style { - -class Filter { -public: - optional> expression; -private: - optional legacyFilter; -public: - Filter() : expression() {} - - Filter(expression::ParseResult _expression, optional _filter = {}) - : expression(std::move(*_expression)), - legacyFilter(std::move(_filter)){ - assert(!expression || *expression != nullptr); - } - - bool operator()(const expression::EvaluationContext& context) const; - - friend bool operator==(const Filter& lhs, const Filter& rhs) { - if (!lhs.expression || !rhs.expression) { - return lhs.expression == rhs.expression; - } else { - return *(lhs.expression) == *(rhs.expression); - } - } - - friend bool operator!=(const Filter& lhs, const Filter& rhs) { - return !(lhs == rhs); - } - - mbgl::Value serialize() const { - if (legacyFilter) { - return *legacyFilter; - } - else if (expression) { - return (**expression).serialize(); - } - return NullValue(); - } -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/image.hpp b/include/mbgl/style/image.hpp deleted file mode 100644 index ff3bfedf4..000000000 --- a/include/mbgl/style/image.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { -namespace style { - -class Image { -public: - Image(std::string id, PremultipliedImage&&, float pixelRatio, bool sdf = false); - Image(const Image&); - - std::string getID() const; - - const PremultipliedImage& getImage() const; - - // Pixel ratio of the sprite image. - float getPixelRatio() const; - - // Whether this image should be interpreted as a signed distance field icon. - bool isSdf() const; - - class Impl; - Immutable baseImpl; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp deleted file mode 100644 index b50ca7506..000000000 --- a/include/mbgl/style/layer.hpp +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class LayerObserver; -class Filter; - -/** - * @brief Holds static data for a certain layer type. - */ -struct LayerTypeInfo { - /** - * @brief contains the layer type as defined in the style specification; - */ - const char* type; - - /** - * @brief contains \c Source::Required if the corresponding layer type - * requires source. Contains \c Source::NotRequired otherwise. - */ - const enum class Source { Required, NotRequired } source; - - /** - * @brief contains \c Pass3D::Required if the corresponding layer type - * requires 3D rendering pass. Contains \c Pass3D::NotRequired otherwise. - */ - const enum class Pass3D { Required, NotRequired } pass3d; - - /** - * @brief contains \c Layout::Required if the corresponding layer type - * requires layouting. * contains \c Layout::NotRequired otherwise. - */ - const enum class Layout { Required, NotRequired } layout; - - /** - * @brief contains \c FadingTiles::Required if the corresponding layer type - * requires rendering on fading tiles. Contains \c FadingTiles::NotRequired otherwise. - */ - const enum class FadingTiles { Required, NotRequired } fadingTiles; - - /** - * @brief contains \c CrossTileIndex::Required if the corresponding layer type - * requires cross-tile indexing and placement. Contains \c CrossTileIndex::NotRequired otherwise. - */ - const enum class CrossTileIndex { Required, NotRequired } crossTileIndex; - - /** - * @brief contains the Id of the supported tile type. Used for internal checks. - * The contained values correspond to \c Tile::Kind enum. - */ - const enum class TileKind : uint8_t { Geometry, Raster, RasterDEM, NotRequired } tileKind; -}; - -/** - * The runtime representation of a [layer](https://www.mapbox.com/mapbox-gl-style-spec/#layers) from the Mapbox Style - * Specification. - * - * `Layer` is an abstract base class; concrete derived classes are provided for each layer type. `Layer` contains - * functionality that is common to all layer types: - * - * * Runtime type information: type predicates and casting - * * Accessors for properties common to all layer types: ID, visibility, etc. - * * Cloning and copying - * - * All other functionality lives in the derived classes. To instantiate a layer, create an instance of the desired - * type, calling `LayerManager`: - * - * auto circleLayer = LayerManager::get()->createLayer("circle", ...); - */ -class Layer { -public: - Layer(const Layer& ) = delete; - Layer& operator=(const Layer&) = delete; - - virtual ~Layer(); - - std::string getID() const; - // Source - std::string getSourceID() const; - std::string getSourceLayer() const; - void setSourceLayer(const std::string& sourceLayer); - - // Filter - const Filter& getFilter() const; - void setFilter(const Filter&); - - // Visibility - VisibilityType getVisibility() const; - void setVisibility(VisibilityType); - - // Zoom range - float getMinZoom() const; - float getMaxZoom() const; - void setMinZoom(float); - void setMaxZoom(float); - - // Dynamic properties - virtual optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) = 0; - virtual optional setPaintProperty(const std::string& name, - const conversion::Convertible& value) = 0; - optional setVisibility(const conversion::Convertible& value); - - virtual StyleProperty getProperty(const std::string&) const = 0; - - // Private implementation - // TODO : We should not have public mutable data members. - class Impl; - Immutable baseImpl; - - // Create a layer, copying all properties except id and paint properties from this layer. - virtual std::unique_ptr cloneRef(const std::string& id) const = 0; - - - void setObserver(LayerObserver*); - - // For use in SDK bindings, which store a reference to a platform-native peer - // object here, so that separately-obtained references to this object share - // identical platform-native peers. - mapbox::base::TypeWrapper peer; - Layer(Immutable); - - const LayerTypeInfo* getTypeInfo() const noexcept; - - mapbox::base::WeakPtr makeWeakPtr() { - return weakFactory.makeWeakPtr(); - } - -protected: - virtual Mutable mutableBaseImpl() const = 0; - - LayerObserver* observer; - mapbox::base::WeakPtrFactory weakFactory {this}; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/layer_properties.hpp b/include/mbgl/style/layer_properties.hpp deleted file mode 100644 index 024301f55..000000000 --- a/include/mbgl/style/layer_properties.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once -#include - -namespace mbgl { - -namespace style { - -/** - * @brief An interface, wrapping evaluated layer properties. - * - * It is an abstract base class; concrete derived classes that hold the actual data are provided for each layer type. - */ -class LayerProperties { -public: - virtual ~LayerProperties() = default; - // Returns constants mask for the data-driven properties. - virtual unsigned long constantsMask() const { return 0u; } - Immutable baseImpl; - // Contains render passes used by the renderer, see `mbgl::RenderPass`. - uint8_t renderPasses = 0u; - -protected: - LayerProperties(Immutable impl) : baseImpl(std::move(impl)) {} -}; - -template -inline const auto& getEvaluated(const Immutable& properties) { - return static_cast(*properties).evaluated; -} - -template -inline const auto& getCrossfade(const Immutable& properties) { - return static_cast(*properties).crossfade; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp deleted file mode 100644 index ebdce35d0..000000000 --- a/include/mbgl/style/layers/background_layer.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class BackgroundLayer : public Layer { -public: - BackgroundLayer(const std::string& layerID); - ~BackgroundLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultBackgroundColor(); - const PropertyValue& getBackgroundColor() const; - void setBackgroundColor(const PropertyValue&); - void setBackgroundColorTransition(const TransitionOptions&); - TransitionOptions getBackgroundColorTransition() const; - - static PropertyValue getDefaultBackgroundOpacity(); - const PropertyValue& getBackgroundOpacity() const; - void setBackgroundOpacity(const PropertyValue&); - void setBackgroundOpacityTransition(const TransitionOptions&); - TransitionOptions getBackgroundOpacityTransition() const; - - static PropertyValue getDefaultBackgroundPattern(); - const PropertyValue& getBackgroundPattern() const; - void setBackgroundPattern(const PropertyValue&); - void setBackgroundPatternTransition(const TransitionOptions&); - TransitionOptions getBackgroundPatternTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - BackgroundLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp deleted file mode 100644 index 842094f94..000000000 --- a/include/mbgl/style/layers/circle_layer.hpp +++ /dev/null @@ -1,113 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class CircleLayer : public Layer { -public: - CircleLayer(const std::string& layerID, const std::string& sourceID); - ~CircleLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultCircleBlur(); - const PropertyValue& getCircleBlur() const; - void setCircleBlur(const PropertyValue&); - void setCircleBlurTransition(const TransitionOptions&); - TransitionOptions getCircleBlurTransition() const; - - static PropertyValue getDefaultCircleColor(); - const PropertyValue& getCircleColor() const; - void setCircleColor(const PropertyValue&); - void setCircleColorTransition(const TransitionOptions&); - TransitionOptions getCircleColorTransition() const; - - static PropertyValue getDefaultCircleOpacity(); - const PropertyValue& getCircleOpacity() const; - void setCircleOpacity(const PropertyValue&); - void setCircleOpacityTransition(const TransitionOptions&); - TransitionOptions getCircleOpacityTransition() const; - - static PropertyValue getDefaultCirclePitchAlignment(); - const PropertyValue& getCirclePitchAlignment() const; - void setCirclePitchAlignment(const PropertyValue&); - void setCirclePitchAlignmentTransition(const TransitionOptions&); - TransitionOptions getCirclePitchAlignmentTransition() const; - - static PropertyValue getDefaultCirclePitchScale(); - const PropertyValue& getCirclePitchScale() const; - void setCirclePitchScale(const PropertyValue&); - void setCirclePitchScaleTransition(const TransitionOptions&); - TransitionOptions getCirclePitchScaleTransition() const; - - static PropertyValue getDefaultCircleRadius(); - const PropertyValue& getCircleRadius() const; - void setCircleRadius(const PropertyValue&); - void setCircleRadiusTransition(const TransitionOptions&); - TransitionOptions getCircleRadiusTransition() const; - - static PropertyValue getDefaultCircleStrokeColor(); - const PropertyValue& getCircleStrokeColor() const; - void setCircleStrokeColor(const PropertyValue&); - void setCircleStrokeColorTransition(const TransitionOptions&); - TransitionOptions getCircleStrokeColorTransition() const; - - static PropertyValue getDefaultCircleStrokeOpacity(); - const PropertyValue& getCircleStrokeOpacity() const; - void setCircleStrokeOpacity(const PropertyValue&); - void setCircleStrokeOpacityTransition(const TransitionOptions&); - TransitionOptions getCircleStrokeOpacityTransition() const; - - static PropertyValue getDefaultCircleStrokeWidth(); - const PropertyValue& getCircleStrokeWidth() const; - void setCircleStrokeWidth(const PropertyValue&); - void setCircleStrokeWidthTransition(const TransitionOptions&); - TransitionOptions getCircleStrokeWidthTransition() const; - - static PropertyValue> getDefaultCircleTranslate(); - const PropertyValue>& getCircleTranslate() const; - void setCircleTranslate(const PropertyValue>&); - void setCircleTranslateTransition(const TransitionOptions&); - TransitionOptions getCircleTranslateTransition() const; - - static PropertyValue getDefaultCircleTranslateAnchor(); - const PropertyValue& getCircleTranslateAnchor() const; - void setCircleTranslateAnchor(const PropertyValue&); - void setCircleTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getCircleTranslateAnchorTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - CircleLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp deleted file mode 100644 index c193cfb8d..000000000 --- a/include/mbgl/style/layers/custom_layer.hpp +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { -namespace style { - -/** - * Parameters that define the current camera position for a `CustomLayerHost::render()` function. - */ -struct CustomLayerRenderParameters { - double width; - double height; - double latitude; - double longitude; - double zoom; - double bearing; - double pitch; - double fieldOfView; - std::array projectionMatrix; -}; - -class CustomLayerHost { -public: - virtual ~CustomLayerHost() = default; - /** - * Initialize any GL state needed by the custom layer. This method is called once, from the - * main thread, at a point when the GL context is active but before rendering for the first - * time. - * - * Resources that are acquired in this method must be released in the `deinitialize` function. - */ - virtual void initialize() = 0; - - /** - * Render the layer. This method is called once per frame. The implementation should not make - * any assumptions about the GL state (other than that the correct context is active). It may - * make changes to the state, and is not required to reset values such as the depth mask, stencil - * mask, and corresponding test flags to their original values. - * Make sure that you are drawing your fragments with a z value of 1 to take advantage of the - * opaque fragment culling in case there are opaque layers above your custom layer. - */ - virtual void render(const CustomLayerRenderParameters&) = 0; - - /** - * Called when the system has destroyed the underlying GL context. The - * `deinitialize` function will not be called in this case, however - * `initialize` will be called instead to prepare for a new render. - * - */ - virtual void contextLost() = 0; - - /** - * Destroy any GL state needed by the custom layer, and deallocate context, if necessary. This - * method is called once, from the main thread, at a point when the GL context is active. - * - * Note that it may be called even when the `initialize` function has not been called. - */ - virtual void deinitialize() = 0; -}; - -class CustomLayer : public Layer { -public: - CustomLayer(const std::string& id, - std::unique_ptr host); - - ~CustomLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - StyleProperty getProperty(const std::string&) const final; - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - std::unique_ptr cloneRef(const std::string& id) const final; - - CustomLayer(const CustomLayer&) = delete; - - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp deleted file mode 100644 index 76c235961..000000000 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class FillExtrusionLayer : public Layer { -public: - FillExtrusionLayer(const std::string& layerID, const std::string& sourceID); - ~FillExtrusionLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultFillExtrusionBase(); - const PropertyValue& getFillExtrusionBase() const; - void setFillExtrusionBase(const PropertyValue&); - void setFillExtrusionBaseTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionBaseTransition() const; - - static PropertyValue getDefaultFillExtrusionColor(); - const PropertyValue& getFillExtrusionColor() const; - void setFillExtrusionColor(const PropertyValue&); - void setFillExtrusionColorTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionColorTransition() const; - - static PropertyValue getDefaultFillExtrusionHeight(); - const PropertyValue& getFillExtrusionHeight() const; - void setFillExtrusionHeight(const PropertyValue&); - void setFillExtrusionHeightTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionHeightTransition() const; - - static PropertyValue getDefaultFillExtrusionOpacity(); - const PropertyValue& getFillExtrusionOpacity() const; - void setFillExtrusionOpacity(const PropertyValue&); - void setFillExtrusionOpacityTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionOpacityTransition() const; - - static PropertyValue getDefaultFillExtrusionPattern(); - const PropertyValue& getFillExtrusionPattern() const; - void setFillExtrusionPattern(const PropertyValue&); - void setFillExtrusionPatternTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionPatternTransition() const; - - static PropertyValue> getDefaultFillExtrusionTranslate(); - const PropertyValue>& getFillExtrusionTranslate() const; - void setFillExtrusionTranslate(const PropertyValue>&); - void setFillExtrusionTranslateTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionTranslateTransition() const; - - static PropertyValue getDefaultFillExtrusionTranslateAnchor(); - const PropertyValue& getFillExtrusionTranslateAnchor() const; - void setFillExtrusionTranslateAnchor(const PropertyValue&); - void setFillExtrusionTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionTranslateAnchorTransition() const; - - static PropertyValue getDefaultFillExtrusionVerticalGradient(); - const PropertyValue& getFillExtrusionVerticalGradient() const; - void setFillExtrusionVerticalGradient(const PropertyValue&); - void setFillExtrusionVerticalGradientTransition(const TransitionOptions&); - TransitionOptions getFillExtrusionVerticalGradientTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - FillExtrusionLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp deleted file mode 100644 index 9ec33d7e9..000000000 --- a/include/mbgl/style/layers/fill_layer.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class FillLayer : public Layer { -public: - FillLayer(const std::string& layerID, const std::string& sourceID); - ~FillLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultFillAntialias(); - const PropertyValue& getFillAntialias() const; - void setFillAntialias(const PropertyValue&); - void setFillAntialiasTransition(const TransitionOptions&); - TransitionOptions getFillAntialiasTransition() const; - - static PropertyValue getDefaultFillColor(); - const PropertyValue& getFillColor() const; - void setFillColor(const PropertyValue&); - void setFillColorTransition(const TransitionOptions&); - TransitionOptions getFillColorTransition() const; - - static PropertyValue getDefaultFillOpacity(); - const PropertyValue& getFillOpacity() const; - void setFillOpacity(const PropertyValue&); - void setFillOpacityTransition(const TransitionOptions&); - TransitionOptions getFillOpacityTransition() const; - - static PropertyValue getDefaultFillOutlineColor(); - const PropertyValue& getFillOutlineColor() const; - void setFillOutlineColor(const PropertyValue&); - void setFillOutlineColorTransition(const TransitionOptions&); - TransitionOptions getFillOutlineColorTransition() const; - - static PropertyValue getDefaultFillPattern(); - const PropertyValue& getFillPattern() const; - void setFillPattern(const PropertyValue&); - void setFillPatternTransition(const TransitionOptions&); - TransitionOptions getFillPatternTransition() const; - - static PropertyValue> getDefaultFillTranslate(); - const PropertyValue>& getFillTranslate() const; - void setFillTranslate(const PropertyValue>&); - void setFillTranslateTransition(const TransitionOptions&); - TransitionOptions getFillTranslateTransition() const; - - static PropertyValue getDefaultFillTranslateAnchor(); - const PropertyValue& getFillTranslateAnchor() const; - void setFillTranslateAnchor(const PropertyValue&); - void setFillTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getFillTranslateAnchorTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - FillLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp deleted file mode 100644 index 2dec03b92..000000000 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class HeatmapLayer : public Layer { -public: - HeatmapLayer(const std::string& layerID, const std::string& sourceID); - ~HeatmapLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static ColorRampPropertyValue getDefaultHeatmapColor(); - const ColorRampPropertyValue& getHeatmapColor() const; - void setHeatmapColor(const ColorRampPropertyValue&); - void setHeatmapColorTransition(const TransitionOptions&); - TransitionOptions getHeatmapColorTransition() const; - - static PropertyValue getDefaultHeatmapIntensity(); - const PropertyValue& getHeatmapIntensity() const; - void setHeatmapIntensity(const PropertyValue&); - void setHeatmapIntensityTransition(const TransitionOptions&); - TransitionOptions getHeatmapIntensityTransition() const; - - static PropertyValue getDefaultHeatmapOpacity(); - const PropertyValue& getHeatmapOpacity() const; - void setHeatmapOpacity(const PropertyValue&); - void setHeatmapOpacityTransition(const TransitionOptions&); - TransitionOptions getHeatmapOpacityTransition() const; - - static PropertyValue getDefaultHeatmapRadius(); - const PropertyValue& getHeatmapRadius() const; - void setHeatmapRadius(const PropertyValue&); - void setHeatmapRadiusTransition(const TransitionOptions&); - TransitionOptions getHeatmapRadiusTransition() const; - - static PropertyValue getDefaultHeatmapWeight(); - const PropertyValue& getHeatmapWeight() const; - void setHeatmapWeight(const PropertyValue&); - void setHeatmapWeightTransition(const TransitionOptions&); - TransitionOptions getHeatmapWeightTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - HeatmapLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp deleted file mode 100644 index 824606c29..000000000 --- a/include/mbgl/style/layers/hillshade_layer.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class HillshadeLayer : public Layer { -public: - HillshadeLayer(const std::string& layerID, const std::string& sourceID); - ~HillshadeLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultHillshadeAccentColor(); - const PropertyValue& getHillshadeAccentColor() const; - void setHillshadeAccentColor(const PropertyValue&); - void setHillshadeAccentColorTransition(const TransitionOptions&); - TransitionOptions getHillshadeAccentColorTransition() const; - - static PropertyValue getDefaultHillshadeExaggeration(); - const PropertyValue& getHillshadeExaggeration() const; - void setHillshadeExaggeration(const PropertyValue&); - void setHillshadeExaggerationTransition(const TransitionOptions&); - TransitionOptions getHillshadeExaggerationTransition() const; - - static PropertyValue getDefaultHillshadeHighlightColor(); - const PropertyValue& getHillshadeHighlightColor() const; - void setHillshadeHighlightColor(const PropertyValue&); - void setHillshadeHighlightColorTransition(const TransitionOptions&); - TransitionOptions getHillshadeHighlightColorTransition() const; - - static PropertyValue getDefaultHillshadeIlluminationAnchor(); - const PropertyValue& getHillshadeIlluminationAnchor() const; - void setHillshadeIlluminationAnchor(const PropertyValue&); - void setHillshadeIlluminationAnchorTransition(const TransitionOptions&); - TransitionOptions getHillshadeIlluminationAnchorTransition() const; - - static PropertyValue getDefaultHillshadeIlluminationDirection(); - const PropertyValue& getHillshadeIlluminationDirection() const; - void setHillshadeIlluminationDirection(const PropertyValue&); - void setHillshadeIlluminationDirectionTransition(const TransitionOptions&); - TransitionOptions getHillshadeIlluminationDirectionTransition() const; - - static PropertyValue getDefaultHillshadeShadowColor(); - const PropertyValue& getHillshadeShadowColor() const; - void setHillshadeShadowColor(const PropertyValue&); - void setHillshadeShadowColorTransition(const TransitionOptions&); - TransitionOptions getHillshadeShadowColorTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - HillshadeLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs deleted file mode 100644 index 7b60fcf6e..000000000 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ /dev/null @@ -1,81 +0,0 @@ -<% - const type = locals.type; - const layoutProperties = locals.layoutProperties; - const paintProperties = locals.paintProperties; --%> -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -<% if (type === 'heatmap' || type === 'line') { -%> -#include -<% } -%> -#include -#include -#include -#include -#include - -<% if (type === 'line' || type === 'symbol') { -%> -#include - -<% } -%> -namespace mbgl { -namespace style { - -class TransitionOptions; - -class <%- camelize(type) %>Layer : public Layer { -public: -<% if (type === 'background') { -%> - <%- camelize(type) %>Layer(const std::string& layerID); -<% } else { -%> - <%- camelize(type) %>Layer(const std::string& layerID, const std::string& sourceID); -<% } -%> - ~<%- camelize(type) %>Layer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - -<% if (layoutProperties.length) { -%> - // Layout properties - -<% for (const property of layoutProperties) { -%> - static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>(); - const <%- propertyValueType(property) %>& get<%- camelize(property.name) %>() const; - void set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>&); - -<% } -%> -<% } -%> - // Paint properties - -<% for (const property of paintProperties) { -%> - static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>(); - const <%- propertyValueType(property) %>& get<%- camelize(property.name) %>() const; - void set<%- camelize(property.name) %>(const <%- propertyValueType(property) %>&); - void set<%- camelize(property.name) %>Transition(const TransitionOptions&); - TransitionOptions get<%- camelize(property.name) %>Transition() const; - -<% } -%> - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - <%- camelize(type) %>Layer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp deleted file mode 100644 index 4f2cf5370..000000000 --- a/include/mbgl/style/layers/line_layer.hpp +++ /dev/null @@ -1,134 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class LineLayer : public Layer { -public: - LineLayer(const std::string& layerID, const std::string& sourceID); - ~LineLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Layout properties - - static PropertyValue getDefaultLineCap(); - const PropertyValue& getLineCap() const; - void setLineCap(const PropertyValue&); - - static PropertyValue getDefaultLineJoin(); - const PropertyValue& getLineJoin() const; - void setLineJoin(const PropertyValue&); - - static PropertyValue getDefaultLineMiterLimit(); - const PropertyValue& getLineMiterLimit() const; - void setLineMiterLimit(const PropertyValue&); - - static PropertyValue getDefaultLineRoundLimit(); - const PropertyValue& getLineRoundLimit() const; - void setLineRoundLimit(const PropertyValue&); - - // Paint properties - - static PropertyValue getDefaultLineBlur(); - const PropertyValue& getLineBlur() const; - void setLineBlur(const PropertyValue&); - void setLineBlurTransition(const TransitionOptions&); - TransitionOptions getLineBlurTransition() const; - - static PropertyValue getDefaultLineColor(); - const PropertyValue& getLineColor() const; - void setLineColor(const PropertyValue&); - void setLineColorTransition(const TransitionOptions&); - TransitionOptions getLineColorTransition() const; - - static PropertyValue> getDefaultLineDasharray(); - const PropertyValue>& getLineDasharray() const; - void setLineDasharray(const PropertyValue>&); - void setLineDasharrayTransition(const TransitionOptions&); - TransitionOptions getLineDasharrayTransition() const; - - static PropertyValue getDefaultLineGapWidth(); - const PropertyValue& getLineGapWidth() const; - void setLineGapWidth(const PropertyValue&); - void setLineGapWidthTransition(const TransitionOptions&); - TransitionOptions getLineGapWidthTransition() const; - - static ColorRampPropertyValue getDefaultLineGradient(); - const ColorRampPropertyValue& getLineGradient() const; - void setLineGradient(const ColorRampPropertyValue&); - void setLineGradientTransition(const TransitionOptions&); - TransitionOptions getLineGradientTransition() const; - - static PropertyValue getDefaultLineOffset(); - const PropertyValue& getLineOffset() const; - void setLineOffset(const PropertyValue&); - void setLineOffsetTransition(const TransitionOptions&); - TransitionOptions getLineOffsetTransition() const; - - static PropertyValue getDefaultLineOpacity(); - const PropertyValue& getLineOpacity() const; - void setLineOpacity(const PropertyValue&); - void setLineOpacityTransition(const TransitionOptions&); - TransitionOptions getLineOpacityTransition() const; - - static PropertyValue getDefaultLinePattern(); - const PropertyValue& getLinePattern() const; - void setLinePattern(const PropertyValue&); - void setLinePatternTransition(const TransitionOptions&); - TransitionOptions getLinePatternTransition() const; - - static PropertyValue> getDefaultLineTranslate(); - const PropertyValue>& getLineTranslate() const; - void setLineTranslate(const PropertyValue>&); - void setLineTranslateTransition(const TransitionOptions&); - TransitionOptions getLineTranslateTransition() const; - - static PropertyValue getDefaultLineTranslateAnchor(); - const PropertyValue& getLineTranslateAnchor() const; - void setLineTranslateAnchor(const PropertyValue&); - void setLineTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getLineTranslateAnchorTransition() const; - - static PropertyValue getDefaultLineWidth(); - const PropertyValue& getLineWidth() const; - void setLineWidth(const PropertyValue&); - void setLineWidthTransition(const TransitionOptions&); - TransitionOptions getLineWidthTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - LineLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp deleted file mode 100644 index bff38d42a..000000000 --- a/include/mbgl/style/layers/raster_layer.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class RasterLayer : public Layer { -public: - RasterLayer(const std::string& layerID, const std::string& sourceID); - ~RasterLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Paint properties - - static PropertyValue getDefaultRasterBrightnessMax(); - const PropertyValue& getRasterBrightnessMax() const; - void setRasterBrightnessMax(const PropertyValue&); - void setRasterBrightnessMaxTransition(const TransitionOptions&); - TransitionOptions getRasterBrightnessMaxTransition() const; - - static PropertyValue getDefaultRasterBrightnessMin(); - const PropertyValue& getRasterBrightnessMin() const; - void setRasterBrightnessMin(const PropertyValue&); - void setRasterBrightnessMinTransition(const TransitionOptions&); - TransitionOptions getRasterBrightnessMinTransition() const; - - static PropertyValue getDefaultRasterContrast(); - const PropertyValue& getRasterContrast() const; - void setRasterContrast(const PropertyValue&); - void setRasterContrastTransition(const TransitionOptions&); - TransitionOptions getRasterContrastTransition() const; - - static PropertyValue getDefaultRasterFadeDuration(); - const PropertyValue& getRasterFadeDuration() const; - void setRasterFadeDuration(const PropertyValue&); - void setRasterFadeDurationTransition(const TransitionOptions&); - TransitionOptions getRasterFadeDurationTransition() const; - - static PropertyValue getDefaultRasterHueRotate(); - const PropertyValue& getRasterHueRotate() const; - void setRasterHueRotate(const PropertyValue&); - void setRasterHueRotateTransition(const TransitionOptions&); - TransitionOptions getRasterHueRotateTransition() const; - - static PropertyValue getDefaultRasterOpacity(); - const PropertyValue& getRasterOpacity() const; - void setRasterOpacity(const PropertyValue&); - void setRasterOpacityTransition(const TransitionOptions&); - TransitionOptions getRasterOpacityTransition() const; - - static PropertyValue getDefaultRasterResampling(); - const PropertyValue& getRasterResampling() const; - void setRasterResampling(const PropertyValue&); - void setRasterResamplingTransition(const TransitionOptions&); - TransitionOptions getRasterResamplingTransition() const; - - static PropertyValue getDefaultRasterSaturation(); - const PropertyValue& getRasterSaturation() const; - void setRasterSaturation(const PropertyValue&); - void setRasterSaturationTransition(const TransitionOptions&); - TransitionOptions getRasterSaturationTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - RasterLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp deleted file mode 100644 index 92e214919..000000000 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ /dev/null @@ -1,299 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include - -#include - -namespace mbgl { -namespace style { - -class TransitionOptions; - -class SymbolLayer : public Layer { -public: - SymbolLayer(const std::string& layerID, const std::string& sourceID); - ~SymbolLayer() final; - - // Dynamic properties - optional setLayoutProperty(const std::string& name, const conversion::Convertible& value) final; - optional setPaintProperty(const std::string& name, const conversion::Convertible& value) final; - - StyleProperty getProperty(const std::string& name) const final; - - // Layout properties - - static PropertyValue getDefaultIconAllowOverlap(); - const PropertyValue& getIconAllowOverlap() const; - void setIconAllowOverlap(const PropertyValue&); - - static PropertyValue getDefaultIconAnchor(); - const PropertyValue& getIconAnchor() const; - void setIconAnchor(const PropertyValue&); - - static PropertyValue getDefaultIconIgnorePlacement(); - const PropertyValue& getIconIgnorePlacement() const; - void setIconIgnorePlacement(const PropertyValue&); - - static PropertyValue getDefaultIconImage(); - const PropertyValue& getIconImage() const; - void setIconImage(const PropertyValue&); - - static PropertyValue getDefaultIconKeepUpright(); - const PropertyValue& getIconKeepUpright() const; - void setIconKeepUpright(const PropertyValue&); - - static PropertyValue> getDefaultIconOffset(); - const PropertyValue>& getIconOffset() const; - void setIconOffset(const PropertyValue>&); - - static PropertyValue getDefaultIconOptional(); - const PropertyValue& getIconOptional() const; - void setIconOptional(const PropertyValue&); - - static PropertyValue getDefaultIconPadding(); - const PropertyValue& getIconPadding() const; - void setIconPadding(const PropertyValue&); - - static PropertyValue getDefaultIconPitchAlignment(); - const PropertyValue& getIconPitchAlignment() const; - void setIconPitchAlignment(const PropertyValue&); - - static PropertyValue getDefaultIconRotate(); - const PropertyValue& getIconRotate() const; - void setIconRotate(const PropertyValue&); - - static PropertyValue getDefaultIconRotationAlignment(); - const PropertyValue& getIconRotationAlignment() const; - void setIconRotationAlignment(const PropertyValue&); - - static PropertyValue getDefaultIconSize(); - const PropertyValue& getIconSize() const; - void setIconSize(const PropertyValue&); - - static PropertyValue getDefaultIconTextFit(); - const PropertyValue& getIconTextFit() const; - void setIconTextFit(const PropertyValue&); - - static PropertyValue> getDefaultIconTextFitPadding(); - const PropertyValue>& getIconTextFitPadding() const; - void setIconTextFitPadding(const PropertyValue>&); - - static PropertyValue getDefaultSymbolAvoidEdges(); - const PropertyValue& getSymbolAvoidEdges() const; - void setSymbolAvoidEdges(const PropertyValue&); - - static PropertyValue getDefaultSymbolPlacement(); - const PropertyValue& getSymbolPlacement() const; - void setSymbolPlacement(const PropertyValue&); - - static PropertyValue getDefaultSymbolSortKey(); - const PropertyValue& getSymbolSortKey() const; - void setSymbolSortKey(const PropertyValue&); - - static PropertyValue getDefaultSymbolSpacing(); - const PropertyValue& getSymbolSpacing() const; - void setSymbolSpacing(const PropertyValue&); - - static PropertyValue getDefaultSymbolZOrder(); - const PropertyValue& getSymbolZOrder() const; - void setSymbolZOrder(const PropertyValue&); - - static PropertyValue getDefaultTextAllowOverlap(); - const PropertyValue& getTextAllowOverlap() const; - void setTextAllowOverlap(const PropertyValue&); - - static PropertyValue getDefaultTextAnchor(); - const PropertyValue& getTextAnchor() const; - void setTextAnchor(const PropertyValue&); - - static PropertyValue getDefaultTextField(); - const PropertyValue& getTextField() const; - void setTextField(const PropertyValue&); - - static PropertyValue> getDefaultTextFont(); - const PropertyValue>& getTextFont() const; - void setTextFont(const PropertyValue>&); - - static PropertyValue getDefaultTextIgnorePlacement(); - const PropertyValue& getTextIgnorePlacement() const; - void setTextIgnorePlacement(const PropertyValue&); - - static PropertyValue getDefaultTextJustify(); - const PropertyValue& getTextJustify() const; - void setTextJustify(const PropertyValue&); - - static PropertyValue getDefaultTextKeepUpright(); - const PropertyValue& getTextKeepUpright() const; - void setTextKeepUpright(const PropertyValue&); - - static PropertyValue getDefaultTextLetterSpacing(); - const PropertyValue& getTextLetterSpacing() const; - void setTextLetterSpacing(const PropertyValue&); - - static PropertyValue getDefaultTextLineHeight(); - const PropertyValue& getTextLineHeight() const; - void setTextLineHeight(const PropertyValue&); - - static PropertyValue getDefaultTextMaxAngle(); - const PropertyValue& getTextMaxAngle() const; - void setTextMaxAngle(const PropertyValue&); - - static PropertyValue getDefaultTextMaxWidth(); - const PropertyValue& getTextMaxWidth() const; - void setTextMaxWidth(const PropertyValue&); - - static PropertyValue> getDefaultTextOffset(); - const PropertyValue>& getTextOffset() const; - void setTextOffset(const PropertyValue>&); - - static PropertyValue getDefaultTextOptional(); - const PropertyValue& getTextOptional() const; - void setTextOptional(const PropertyValue&); - - static PropertyValue getDefaultTextPadding(); - const PropertyValue& getTextPadding() const; - void setTextPadding(const PropertyValue&); - - static PropertyValue getDefaultTextPitchAlignment(); - const PropertyValue& getTextPitchAlignment() const; - void setTextPitchAlignment(const PropertyValue&); - - static PropertyValue getDefaultTextRadialOffset(); - const PropertyValue& getTextRadialOffset() const; - void setTextRadialOffset(const PropertyValue&); - - static PropertyValue getDefaultTextRotate(); - const PropertyValue& getTextRotate() const; - void setTextRotate(const PropertyValue&); - - static PropertyValue getDefaultTextRotationAlignment(); - const PropertyValue& getTextRotationAlignment() const; - void setTextRotationAlignment(const PropertyValue&); - - static PropertyValue getDefaultTextSize(); - const PropertyValue& getTextSize() const; - void setTextSize(const PropertyValue&); - - static PropertyValue getDefaultTextTransform(); - const PropertyValue& getTextTransform() const; - void setTextTransform(const PropertyValue&); - - static PropertyValue> getDefaultTextVariableAnchor(); - const PropertyValue>& getTextVariableAnchor() const; - void setTextVariableAnchor(const PropertyValue>&); - - static PropertyValue> getDefaultTextWritingMode(); - const PropertyValue>& getTextWritingMode() const; - void setTextWritingMode(const PropertyValue>&); - - // Paint properties - - static PropertyValue getDefaultIconColor(); - const PropertyValue& getIconColor() const; - void setIconColor(const PropertyValue&); - void setIconColorTransition(const TransitionOptions&); - TransitionOptions getIconColorTransition() const; - - static PropertyValue getDefaultIconHaloBlur(); - const PropertyValue& getIconHaloBlur() const; - void setIconHaloBlur(const PropertyValue&); - void setIconHaloBlurTransition(const TransitionOptions&); - TransitionOptions getIconHaloBlurTransition() const; - - static PropertyValue getDefaultIconHaloColor(); - const PropertyValue& getIconHaloColor() const; - void setIconHaloColor(const PropertyValue&); - void setIconHaloColorTransition(const TransitionOptions&); - TransitionOptions getIconHaloColorTransition() const; - - static PropertyValue getDefaultIconHaloWidth(); - const PropertyValue& getIconHaloWidth() const; - void setIconHaloWidth(const PropertyValue&); - void setIconHaloWidthTransition(const TransitionOptions&); - TransitionOptions getIconHaloWidthTransition() const; - - static PropertyValue getDefaultIconOpacity(); - const PropertyValue& getIconOpacity() const; - void setIconOpacity(const PropertyValue&); - void setIconOpacityTransition(const TransitionOptions&); - TransitionOptions getIconOpacityTransition() const; - - static PropertyValue> getDefaultIconTranslate(); - const PropertyValue>& getIconTranslate() const; - void setIconTranslate(const PropertyValue>&); - void setIconTranslateTransition(const TransitionOptions&); - TransitionOptions getIconTranslateTransition() const; - - static PropertyValue getDefaultIconTranslateAnchor(); - const PropertyValue& getIconTranslateAnchor() const; - void setIconTranslateAnchor(const PropertyValue&); - void setIconTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getIconTranslateAnchorTransition() const; - - static PropertyValue getDefaultTextColor(); - const PropertyValue& getTextColor() const; - void setTextColor(const PropertyValue&); - void setTextColorTransition(const TransitionOptions&); - TransitionOptions getTextColorTransition() const; - - static PropertyValue getDefaultTextHaloBlur(); - const PropertyValue& getTextHaloBlur() const; - void setTextHaloBlur(const PropertyValue&); - void setTextHaloBlurTransition(const TransitionOptions&); - TransitionOptions getTextHaloBlurTransition() const; - - static PropertyValue getDefaultTextHaloColor(); - const PropertyValue& getTextHaloColor() const; - void setTextHaloColor(const PropertyValue&); - void setTextHaloColorTransition(const TransitionOptions&); - TransitionOptions getTextHaloColorTransition() const; - - static PropertyValue getDefaultTextHaloWidth(); - const PropertyValue& getTextHaloWidth() const; - void setTextHaloWidth(const PropertyValue&); - void setTextHaloWidthTransition(const TransitionOptions&); - TransitionOptions getTextHaloWidthTransition() const; - - static PropertyValue getDefaultTextOpacity(); - const PropertyValue& getTextOpacity() const; - void setTextOpacity(const PropertyValue&); - void setTextOpacityTransition(const TransitionOptions&); - TransitionOptions getTextOpacityTransition() const; - - static PropertyValue> getDefaultTextTranslate(); - const PropertyValue>& getTextTranslate() const; - void setTextTranslate(const PropertyValue>&); - void setTextTranslateTransition(const TransitionOptions&); - TransitionOptions getTextTranslateTransition() const; - - static PropertyValue getDefaultTextTranslateAnchor(); - const PropertyValue& getTextTranslateAnchor() const; - void setTextTranslateAnchor(const PropertyValue&); - void setTextTranslateAnchorTransition(const TransitionOptions&); - TransitionOptions getTextTranslateAnchorTransition() const; - - // Private implementation - - class Impl; - const Impl& impl() const; - - Mutable mutableImpl() const; - SymbolLayer(Immutable); - std::unique_ptr cloneRef(const std::string& id) const final; - -protected: - Mutable mutableBaseImpl() const final; -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/light.hpp b/include/mbgl/style/light.hpp deleted file mode 100644 index 7434fb288..000000000 --- a/include/mbgl/style/light.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class LightObserver; - -class Light { -public: - Light(); - ~Light(); - - // Dynamic properties - optional setProperty(const std::string& name, const conversion::Convertible& value); - StyleProperty getProperty(const std::string&) const; - - static LightAnchorType getDefaultAnchor(); - PropertyValue getAnchor() const; - void setAnchor(PropertyValue); - void setAnchorTransition(const TransitionOptions&); - TransitionOptions getAnchorTransition() const; - - static Color getDefaultColor(); - PropertyValue getColor() const; - void setColor(PropertyValue); - void setColorTransition(const TransitionOptions&); - TransitionOptions getColorTransition() const; - - static float getDefaultIntensity(); - PropertyValue getIntensity() const; - void setIntensity(PropertyValue); - void setIntensityTransition(const TransitionOptions&); - TransitionOptions getIntensityTransition() const; - - static Position getDefaultPosition(); - PropertyValue getPosition() const; - void setPosition(PropertyValue); - void setPositionTransition(const TransitionOptions&); - TransitionOptions getPositionTransition() const; - - class Impl; - Immutable impl; - Mutable mutableImpl() const; - - LightObserver* observer = nullptr; - void setObserver(LightObserver*); -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/light.hpp.ejs b/include/mbgl/style/light.hpp.ejs deleted file mode 100644 index e4661dc59..000000000 --- a/include/mbgl/style/light.hpp.ejs +++ /dev/null @@ -1,50 +0,0 @@ -<% - const properties = locals.properties; --%> -// clang-format off - -// This file is generated. Do not edit. - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class LightObserver; - -class Light { -public: - Light(); - ~Light(); - - // Dynamic properties - optional setProperty(const std::string& name, const conversion::Convertible& value); - StyleProperty getProperty(const std::string&) const; - -<% for (const property of properties) { -%> - static <%- evaluatedType(property) %> getDefault<%- camelize(property.name) %>(); - <%- propertyValueType(property) %> get<%- camelize(property.name) %>() const; - void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>); - void set<%- camelize(property.name) %>Transition(const TransitionOptions&); - TransitionOptions get<%- camelize(property.name) %>Transition() const; - -<% } -%> - class Impl; - Immutable impl; - Mutable mutableImpl() const; - - LightObserver* observer = nullptr; - void setObserver(LightObserver*); -}; - -} // namespace style -} // namespace mbgl - -// clang-format on diff --git a/include/mbgl/style/position.hpp b/include/mbgl/style/position.hpp deleted file mode 100644 index 3be8d1c55..000000000 --- a/include/mbgl/style/position.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include - -#include - -namespace mbgl { -namespace style { -class Position { -public: - Position() = default; - Position(std::array& position_) - : radial(position_[0]), azimuthal(position_[1]), polar(position_[2]) { - calculateCartesian(); - }; - - friend bool operator==(const Position& lhs, const Position& rhs) { - return lhs.radial == rhs.radial && lhs.azimuthal == rhs.azimuthal && lhs.polar == rhs.polar; - // TODO this doesn't address wrapping, which would be better addressed by comparing cartesian coordinates but being calculated floats are ont to be trusted. - } - - friend bool operator!=(const Position& lhs, const Position& rhs) { - return !(lhs == rhs); - } - - const std::array getCartesian() const { - return { { x, y, z } }; - }; - - const std::array getSpherical() const { - return { { radial, azimuthal, polar } }; - }; - - void set(std::array& position_) { - radial = position_[0]; - azimuthal = position_[1]; - polar = position_[2]; - calculateCartesian(); - }; - - // Utility function to be used only during interpolation; this leaves spherical coordinates undefined. - void setCartesian(std::array& position_) { - x = position_[0]; - y = position_[1]; - z = position_[2]; - } - -private: - float radial; - float azimuthal; - float polar; - float x; - float y; - float z; - - void calculateCartesian() { - // We abstract "north"/"up" (compass-wise) to be 0° when really this is 90° (π/2): we - // correct for that here - const float _a = (azimuthal + 90) * util::DEG2RAD; - const float _p = polar * util::DEG2RAD; - - x = radial * std::cos(_a) * std::sin(_p); - y = radial * std::sin(_a) * std::sin(_p); - z = radial * std::cos(_p); - }; -}; -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/property_expression.hpp b/include/mbgl/style/property_expression.hpp deleted file mode 100644 index f68285fb1..000000000 --- a/include/mbgl/style/property_expression.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace style { - -class PropertyExpressionBase { -public: - explicit PropertyExpressionBase(std::unique_ptr); - - bool isZoomConstant() const noexcept; - bool isFeatureConstant() const noexcept; - bool canEvaluateWith(const expression::EvaluationContext&) const noexcept; - float interpolationFactor(const Range&, const float) const noexcept; - Range getCoveringStops(const float, const float) const noexcept; - const expression::Expression& getExpression() const noexcept; - - bool useIntegerZoom = false; - -protected: - std::shared_ptr expression; - variant zoomCurve; - bool isZoomConstant_; - bool isFeatureConstant_; -}; - -template -class PropertyExpression final : public PropertyExpressionBase { -public: - // Second parameter to be used only for conversions from legacy functions. - PropertyExpression(std::unique_ptr expression_, optional defaultValue_ = nullopt) - : PropertyExpressionBase(std::move(expression_)), - defaultValue(std::move(defaultValue_)) { - } - - T evaluate(const expression::EvaluationContext& context, T finalDefaultValue = T()) const { - assert(canEvaluateWith(context)); - const expression::EvaluationResult result = expression->evaluate(context); - if (result) { - const optional typed = expression::fromExpressionValue(*result); - return typed ? *typed : defaultValue ? *defaultValue : finalDefaultValue; - } - return defaultValue ? *defaultValue : finalDefaultValue; - } - - T evaluate(float zoom) const { - return evaluate(expression::EvaluationContext(zoom)); - } - - T evaluate(const GeometryTileFeature& feature, T finalDefaultValue) const { - return evaluate(expression::EvaluationContext(&feature), finalDefaultValue); - } - - T evaluate(float zoom, const GeometryTileFeature& feature, T finalDefaultValue) const { - return evaluate(expression::EvaluationContext(zoom, &feature), finalDefaultValue); - } - - T evaluate(float zoom, const GeometryTileFeature& feature, const FeatureState& state, T finalDefaultValue) const { - return evaluate(expression::EvaluationContext(zoom, &feature, &state), finalDefaultValue); - } - - std::vector> possibleOutputs() const { - return expression::fromExpressionValues(expression->possibleOutputs()); - } - - friend bool operator==(const PropertyExpression& lhs, - const PropertyExpression& rhs) { - return *lhs.expression == *rhs.expression; - } - -private: - optional defaultValue; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp deleted file mode 100644 index 86812e230..000000000 --- a/include/mbgl/style/property_value.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace style { - -template -class PropertyValue { -private: - using Value = variant< - Undefined, - T, - PropertyExpression>; - - Value value; - - friend bool operator==(const PropertyValue& lhs, - const PropertyValue& rhs) { - return lhs.value == rhs.value; - } - - friend bool operator!=(const PropertyValue& lhs, - const PropertyValue& rhs) { - return !(lhs == rhs); - } - -public: - PropertyValue() = default; - - PropertyValue(T constant) - : value(std::move(constant)) {} - - PropertyValue(PropertyExpression expression) - : value(std::move(expression)) {} - - bool isUndefined() const { - return value.template is(); - } - - bool isConstant() const { - return value.template is(); - } - - bool isExpression() const { - return value.template is>(); - } - - bool isDataDriven() const { - return value.match( - [] (const Undefined&) { return false; }, - [] (const T&) { return false; }, - [] (const PropertyExpression& fn) { return !fn.isFeatureConstant(); } - ); - } - - bool isZoomConstant() const { - return value.match( - [] (const Undefined&) { return true; }, - [] (const T&) { return true; }, - [] (const PropertyExpression& fn) { return fn.isZoomConstant(); } - ); - } - - const T& asConstant() const { - return value.template get(); - } - - const PropertyExpression& asExpression() const { - return value.template get>(); - } - - template - auto match(Ts&&... ts) const { - return value.match(std::forward(ts)...); - } - - template - auto evaluate(const Evaluator& evaluator, TimePoint = {}) const { - return Value::visit(value, evaluator); - } - - bool hasDataDrivenPropertyDifference(const PropertyValue& other) const { - return *this != other && (isDataDriven() || other.isDataDriven()); - } -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp deleted file mode 100644 index c3c0609a9..000000000 --- a/include/mbgl/style/source.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include - -#include -#include - -namespace mbgl { - -class FileSource; - -namespace style { - -class VectorSource; -class RasterSource; -class RasterDEMSource; -class GeoJSONSource; -class SourceObserver; -struct LayerTypeInfo; - -/** - * The runtime representation of a [source](https://www.mapbox.com/mapbox-gl-style-spec/#sources) from the Mapbox Style - * Specification. - * - * `Source` is an abstract base class; concrete derived classes are provided for each source type. `Source` contains - * functionality that is common to all layer types: - * - * * Runtime type information: type predicates and casting - * * Accessors for properties common to all source types: ID, etc. - * * Cloning and copying - * - * All other functionality lives in the derived classes. To instantiate a source, create an instance of the desired - * type, passing the ID: - * - * auto vectorSource = std::make_unique("my-vector-source"); - */ -class Source : public mbgl::util::noncopyable { -public: - virtual ~Source(); - - // Check whether this source is of the given subtype. - template - bool is() const; - - // Dynamically cast this source to the given subtype. - template - T* as() { - return is() ? reinterpret_cast(this) : nullptr; - } - - template - const T* as() const { - return is() ? reinterpret_cast(this) : nullptr; - } - - SourceType getType() const; - std::string getID() const; - optional getAttribution() const; - - // Private implementation - class Impl; - Immutable baseImpl; - - Source(Immutable); - - void setObserver(SourceObserver*); - SourceObserver* observer = nullptr; - - virtual void loadDescription(FileSource&) = 0; - void dumpDebugLogs() const; - - virtual bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const = 0; - - bool loaded = false; - - // For use in SDK bindings, which store a reference to a platform-native peer - // object here, so that separately-obtained references to this object share - // identical platform-native peers. - mapbox::base::TypeWrapper peer; - - virtual mapbox::base::WeakPtr makeWeakPtr() = 0; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp deleted file mode 100644 index ff0450569..000000000 --- a/include/mbgl/style/sources/custom_geometry_source.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace mbgl { - -class OverscaledTileID; -class CanonicalTileID; -template -class Actor; -class ThreadPool; - -namespace style { - -using TileFunction = std::function; - -class CustomTileLoader; - -class CustomGeometrySource final : public Source { -public: - struct TileOptions { - double tolerance = 0.375; - uint16_t tileSize = util::tileSize; - uint16_t buffer = 128; - bool clip = false; - bool wrap = false; - }; - - struct Options { - TileFunction fetchTileFunction; - TileFunction cancelTileFunction; - Range zoomRange = { 0, 18}; - TileOptions tileOptions; - }; -public: - CustomGeometrySource(std::string id, CustomGeometrySource::Options options); - ~CustomGeometrySource() final; - void loadDescription(FileSource&) final; - void setTileData(const CanonicalTileID&, const GeoJSON&); - void invalidateTile(const CanonicalTileID&); - void invalidateRegion(const LatLngBounds&); - // Private implementation - class Impl; - const Impl& impl() const; - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; - mapbox::base::WeakPtr makeWeakPtr() override { - return weakFactory.makeWeakPtr(); - } -private: - std::shared_ptr threadPool; - std::unique_ptr> loader; - mapbox::base::WeakPtrFactory weakFactory {this}; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::CustomVector; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp deleted file mode 100644 index a256ad6f1..000000000 --- a/include/mbgl/style/sources/geojson_source.hpp +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace mbgl { - -class AsyncRequest; - -namespace style { - -struct GeoJSONOptions { - // GeoJSON-VT options - uint8_t minzoom = 0; - uint8_t maxzoom = 18; - uint16_t tileSize = util::tileSize; - uint16_t buffer = 128; - double tolerance = 0.375; - bool lineMetrics = false; - - // Supercluster options - bool cluster = false; - uint16_t clusterRadius = 50; - uint8_t clusterMaxZoom = 17; - using ClusterExpression = std::pair, - std::shared_ptr>; - using ClusterProperties = std::unordered_map; - ClusterProperties clusterProperties; -}; - -class GeoJSONSource final : public Source { -public: - GeoJSONSource(const std::string& id, optional = nullopt); - ~GeoJSONSource() final; - - void setURL(const std::string& url); - void setGeoJSON(const GeoJSON&); - - optional getURL() const; - - class Impl; - const Impl& impl() const; - - void loadDescription(FileSource&) final; - - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; - - mapbox::base::WeakPtr makeWeakPtr() override { - return weakFactory.makeWeakPtr(); - } - -private: - optional url; - std::unique_ptr req; - mapbox::base::WeakPtrFactory weakFactory {this}; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::GeoJSON; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/image_source.hpp b/include/mbgl/style/sources/image_source.hpp deleted file mode 100644 index 699a3c649..000000000 --- a/include/mbgl/style/sources/image_source.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -class LatLng; -class AsyncRequest; - -namespace style { - -class ImageSource final : public Source { -public: - ImageSource(std::string id, const std::array); - ~ImageSource() override; - - optional getURL() const; - void setURL(const std::string& url); - - void setImage(PremultipliedImage&&); - - void setCoordinates(const std::array&); - std::array getCoordinates() const; - - class Impl; - const Impl& impl() const; - - void loadDescription(FileSource&) final; - - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; - - mapbox::base::WeakPtr makeWeakPtr() override { - return weakFactory.makeWeakPtr(); - } -private: - optional url; - std::unique_ptr req; - mapbox::base::WeakPtrFactory weakFactory {this}; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::Image; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/raster_dem_source.hpp b/include/mbgl/style/sources/raster_dem_source.hpp deleted file mode 100644 index 42e27cd07..000000000 --- a/include/mbgl/style/sources/raster_dem_source.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { - -class AsyncRequest; - -namespace style { - -class RasterDEMSource : public RasterSource { -public: - RasterDEMSource(std::string id, variant urlOrTileset, uint16_t tileSize); - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::RasterDEM; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/raster_source.hpp b/include/mbgl/style/sources/raster_source.hpp deleted file mode 100644 index 00a3b788c..000000000 --- a/include/mbgl/style/sources/raster_source.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { - -class AsyncRequest; - -namespace style { - -class RasterSource : public Source { -public: - RasterSource(std::string id, variant urlOrTileset, uint16_t tileSize, SourceType sourceType = SourceType::Raster); - ~RasterSource() override; - - const variant& getURLOrTileset() const; - optional getURL() const; - - uint16_t getTileSize() const; - - class Impl; - const Impl& impl() const; - - void loadDescription(FileSource&) final; - - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; - - mapbox::base::WeakPtr makeWeakPtr() final { - return weakFactory.makeWeakPtr(); - } - -private: - const variant urlOrTileset; - std::unique_ptr req; - mapbox::base::WeakPtrFactory weakFactory {this}; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::Raster; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/sources/vector_source.hpp b/include/mbgl/style/sources/vector_source.hpp deleted file mode 100644 index 4165af0a6..000000000 --- a/include/mbgl/style/sources/vector_source.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { - -class AsyncRequest; - -namespace style { - -class VectorSource final : public Source { -public: - VectorSource(std::string id, variant urlOrTileset, optional maxZoom = nullopt, - optional minZoom = nullopt); - ~VectorSource() final; - - const variant& getURLOrTileset() const; - optional getURL() const; - - class Impl; - const Impl& impl() const; - - void loadDescription(FileSource&) final; - - bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; - - mapbox::base::WeakPtr makeWeakPtr() override { - return weakFactory.makeWeakPtr(); - } - -private: - const variant urlOrTileset; - std::unique_ptr req; - mapbox::base::WeakPtrFactory weakFactory {this}; - optional maxZoom; - optional minZoom; -}; - -template <> -inline bool Source::is() const { - return getType() == SourceType::Vector; -} - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/style.hpp b/include/mbgl/style/style.hpp deleted file mode 100644 index 4a6a542b8..000000000 --- a/include/mbgl/style/style.hpp +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include -#include - -namespace mbgl { - -class FileSource; - -namespace style { - -class Light; -class Image; -class Source; -class Layer; - -class Style { -public: - Style(FileSource&, float pixelRatio); - ~Style(); - - void loadJSON(const std::string&); - void loadURL(const std::string&); - - std::string getJSON() const; - std::string getURL() const; - - // Defaults - std::string getName() const; - CameraOptions getDefaultCamera() const; - - // TransitionOptions - TransitionOptions getTransitionOptions() const; - void setTransitionOptions(const TransitionOptions&); - - // Light - Light* getLight(); - const Light* getLight() const; - - void setLight(std::unique_ptr); - - // Images - const Image* getImage(const std::string&) const; - void addImage(std::unique_ptr); - void removeImage(const std::string&); - - // Sources - std::vector< Source*> getSources(); - std::vector getSources() const; - - Source* getSource(const std::string&); - const Source* getSource(const std::string&) const; - - void addSource(std::unique_ptr); - std::unique_ptr removeSource(const std::string& sourceID); - - // Layers - std::vector< Layer*> getLayers(); - std::vector getLayers() const; - - Layer* getLayer(const std::string&); - const Layer* getLayer(const std::string&) const; - - void addLayer(std::unique_ptr, const optional& beforeLayerID = {}); - std::unique_ptr removeLayer(const std::string& layerID); - - // Private implementation - class Impl; - const std::unique_ptr impl; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/style_property.hpp b/include/mbgl/style/style_property.hpp deleted file mode 100644 index fc34078de..000000000 --- a/include/mbgl/style/style_property.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace style { - -/** - * @brief Generic representation of a style property. - */ -class StyleProperty { -public: - enum class Kind : uint8_t { Undefined, Constant, Expression, Transition }; - StyleProperty(Value value_, Kind kind_) : value(std::move(value_)), kind(kind_) {} - StyleProperty() = default; - const Value& getValue() const { return value; } - Value& getValue() { return value; } - Kind getKind() const { return kind; } - -private: - Value value; - Kind kind = Kind::Undefined; -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/transition_options.hpp b/include/mbgl/style/transition_options.hpp deleted file mode 100644 index 9cb5c1f57..000000000 --- a/include/mbgl/style/transition_options.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { -namespace style { - -class TransitionOptions { -public: - optional duration; - optional delay; - bool enablePlacementTransitions; - - TransitionOptions(optional duration_ = {}, - optional delay_ = {}, - bool enablePlacementTransitions_ = true) - : duration(std::move(duration_)), - delay(std::move(delay_)), - enablePlacementTransitions(enablePlacementTransitions_) {} - - TransitionOptions reverseMerge(const TransitionOptions& defaults) const { - return { - duration ? duration : defaults.duration, - delay ? delay : defaults.delay, - enablePlacementTransitions - }; - } - - bool isDefined() const { - return duration || delay; - } -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp deleted file mode 100644 index 5d88dafb3..000000000 --- a/include/mbgl/style/types.hpp +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -namespace style { - -// TODO: should be in public source.hpp header -enum class SourceType : uint8_t { - Vector, - Raster, - RasterDEM, - GeoJSON, - Video, - Annotations, - Image, - CustomVector -}; - -enum class VisibilityType : bool { - Visible, - None, -}; - -enum class LineCapType : uint8_t { - Round, - Butt, - Square, -}; - -enum class LineJoinType : uint8_t { - Miter, - Bevel, - Round, - // the following two types are for internal use only - FakeRound, - FlipBevel -}; - -enum class RasterResamplingType : bool { - Linear, - Nearest -}; - -enum class HillshadeIlluminationAnchorType : bool { - Map, - Viewport -}; - -enum class TranslateAnchorType : bool { - Map, - Viewport -}; - -enum class RotateAnchorType : bool { - Map, - Viewport, -}; - -enum class CirclePitchScaleType : bool { - Map, - Viewport, -}; - -enum class SymbolPlacementType : uint8_t { - Point, - Line, - LineCenter -}; - -enum class SymbolZOrderType : uint8_t { - Auto, - ViewportY, - Source -}; - -enum class AlignmentType : uint8_t { - Map, - Viewport, - Auto, -}; - -enum class TextJustifyType : uint8_t { - Auto, - Center, - Left, - Right -}; - -enum class SymbolAnchorType : uint8_t { - Center, - Left, - Right, - Top, - Bottom, - TopLeft, - TopRight, - BottomLeft, - BottomRight -}; - -using TextVariableAnchorType = SymbolAnchorType; - -enum class TextTransformType : uint8_t { - None, - Uppercase, - Lowercase, -}; - -enum class IconTextFitType : uint8_t { - None, - Both, - Width, - Height -}; - -enum class TextWritingModeType : uint8_t { - Horizontal, - Vertical -}; - -enum class LightAnchorType: bool { - Map, - Viewport -}; - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/style/undefined.hpp b/include/mbgl/style/undefined.hpp deleted file mode 100644 index e43f132a8..000000000 --- a/include/mbgl/style/undefined.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -namespace mbgl { -namespace style { - -class Undefined {}; - -inline bool operator==(const Undefined&, const Undefined&) { return true; } -inline bool operator!=(const Undefined&, const Undefined&) { return false; } - -} // namespace style -} // namespace mbgl diff --git a/include/mbgl/tile/tile_id.hpp b/include/mbgl/tile/tile_id.hpp deleted file mode 100644 index c3bdbea5c..000000000 --- a/include/mbgl/tile/tile_id.hpp +++ /dev/null @@ -1,273 +0,0 @@ -#pragma once - -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace mbgl { - -class OverscaledTileID; -class CanonicalTileID; -class UnwrappedTileID; - -// Has integer z/x/y coordinates -// All tiles must be derived from 0/0/0 (=no tiles outside of the main tile pyramid) -// Used for requesting data; represents data tiles that exist out there. -// z is never larger than the source's maxzoom -class CanonicalTileID { -public: - CanonicalTileID(uint8_t z, uint32_t x, uint32_t y); - bool operator==(const CanonicalTileID&) const; - bool operator!=(const CanonicalTileID&) const; - bool operator<(const CanonicalTileID&) const; - bool isChildOf(const CanonicalTileID&) const; - CanonicalTileID scaledTo(uint8_t z) const; - std::array children() const; - - uint8_t z; - uint32_t x; - uint32_t y; -}; - -::std::ostream& operator<<(::std::ostream& os, const CanonicalTileID& rhs); -namespace util { -std::string toString(const CanonicalTileID&); -} // namespace util - -// Has integer z/x/y coordinates -// overscaledZ describes the zoom level this tile is intented to represent, e.g. when parsing data -// z is never larger than the source's maxzoom -// z/x/y describe the -class OverscaledTileID { -public: - OverscaledTileID(uint8_t overscaledZ, int16_t wrap, CanonicalTileID); - OverscaledTileID(uint8_t overscaledZ, int16_t wrap, uint8_t z, uint32_t x, uint32_t y); - OverscaledTileID(uint8_t z, uint32_t x, uint32_t y); - explicit OverscaledTileID(const CanonicalTileID&); - explicit OverscaledTileID(CanonicalTileID&&); - bool operator==(const OverscaledTileID&) const; - bool operator!=(const OverscaledTileID&) const; - bool operator<(const OverscaledTileID&) const; - bool isChildOf(const OverscaledTileID&) const; - uint32_t overscaleFactor() const; - OverscaledTileID scaledTo(uint8_t z) const; - UnwrappedTileID toUnwrapped() const; - OverscaledTileID unwrapTo(int16_t wrap) const; - - uint8_t overscaledZ; - int16_t wrap; - CanonicalTileID canonical; -}; - -::std::ostream& operator<<(::std::ostream& os, const OverscaledTileID& rhs); -namespace util { -std::string toString(const OverscaledTileID&); -} // namespace util - -// Has integer z/x/y coordinates -// wrap describes tiles that are left/right of the main tile pyramid, e.g. when wrapping the world -// Used for describing what position tiles are getting rendered at (= calc the matrix) -// z is never larger than the source's maxzoom -class UnwrappedTileID { -public: - UnwrappedTileID(uint8_t z, int64_t x, int64_t y); - UnwrappedTileID(int16_t wrap, CanonicalTileID); - bool operator==(const UnwrappedTileID&) const; - bool operator!=(const UnwrappedTileID&) const; - bool operator<(const UnwrappedTileID&) const; - bool isChildOf(const UnwrappedTileID&) const; - std::array children() const; - OverscaledTileID overscaleTo(uint8_t z) const; - float pixelsToTileUnits(float pixelValue, float zoom) const; - UnwrappedTileID unwrapTo(int16_t wrap) const; - - int16_t wrap; - CanonicalTileID canonical; -}; - -::std::ostream& operator<<(::std::ostream& os, const UnwrappedTileID& rhs); -namespace util { -std::string toString(const UnwrappedTileID&); -} // namespace util - -inline CanonicalTileID::CanonicalTileID(uint8_t z_, uint32_t x_, uint32_t y_) : z(z_), x(x_), y(y_) { - assert(z <= 32); - assert(x < (1ull << z)); - assert(y < (1ull << z)); -} - -inline bool CanonicalTileID::operator==(const CanonicalTileID& rhs) const { - return z == rhs.z && x == rhs.x && y == rhs.y; -} - -inline bool CanonicalTileID::operator!=(const CanonicalTileID& rhs) const { - return z != rhs.z || x != rhs.x || y != rhs.y; -} - -inline bool CanonicalTileID::operator<(const CanonicalTileID& rhs) const { - return std::tie(z, x, y) < std::tie(rhs.z, rhs.x, rhs.y); -} - -inline bool CanonicalTileID::isChildOf(const CanonicalTileID& parent) const { - // We're first testing for z == 0, to avoid a 32 bit shift, which is undefined. - return parent.z == 0 || - (parent.z < z && parent.x == (x >> (z - parent.z)) && parent.y == (y >> (z - parent.z))); -} - -inline CanonicalTileID CanonicalTileID::scaledTo(uint8_t targetZ) const { - if (targetZ <= z) { - return { targetZ, x >> (z - targetZ), y >> (z - targetZ) }; // parent or same - } else { - return { targetZ, x << (targetZ - z), y << (targetZ - z) }; // child - } -} - -inline std::array CanonicalTileID::children() const { - const uint8_t childZ = z + 1; - const uint32_t childX = x * 2; - const uint32_t childY = y * 2; - return { { - { childZ, childX, childY }, - { childZ, childX, childY + 1 }, - { childZ, childX + 1, childY }, - { childZ, childX + 1, childY + 1 }, - } }; -} - -inline OverscaledTileID::OverscaledTileID(uint8_t overscaledZ_, int16_t wrap_, CanonicalTileID canonical_) - : overscaledZ(overscaledZ_), wrap(wrap_), canonical(canonical_) { - assert(overscaledZ >= canonical.z); -} - -inline OverscaledTileID::OverscaledTileID(uint8_t overscaledZ_, int16_t wrap_, uint8_t z, uint32_t x, uint32_t y) - : overscaledZ(overscaledZ_), wrap(wrap_), canonical(z, x, y) { - assert(overscaledZ >= canonical.z); -} - -inline OverscaledTileID::OverscaledTileID(uint8_t z, uint32_t x, uint32_t y) - : overscaledZ(z), wrap(0), canonical(z, x, y) { -} - -inline OverscaledTileID::OverscaledTileID(const CanonicalTileID& canonical_) - : overscaledZ(canonical_.z), wrap(0), canonical(canonical_) { - assert(overscaledZ >= canonical.z); -} - -inline OverscaledTileID::OverscaledTileID(CanonicalTileID&& canonical_) - : overscaledZ(canonical_.z), wrap(0), canonical(std::forward(canonical_)) { - assert(overscaledZ >= canonical.z); -} - -inline bool OverscaledTileID::operator==(const OverscaledTileID& rhs) const { - return overscaledZ == rhs.overscaledZ && wrap == rhs.wrap &&canonical == rhs.canonical; -} - -inline bool OverscaledTileID::operator!=(const OverscaledTileID& rhs) const { - return overscaledZ != rhs.overscaledZ || wrap != rhs.wrap || canonical != rhs.canonical; -} - -inline bool OverscaledTileID::operator<(const OverscaledTileID& rhs) const { - return std::tie(overscaledZ, wrap, canonical) < std::tie(rhs.overscaledZ, rhs.wrap, rhs.canonical); -} - -inline uint32_t OverscaledTileID::overscaleFactor() const { - return 1u << (overscaledZ - canonical.z); -} - -inline bool OverscaledTileID::isChildOf(const OverscaledTileID& rhs) const { - return wrap == rhs.wrap && - overscaledZ > rhs.overscaledZ && - (canonical == rhs.canonical || canonical.isChildOf(rhs.canonical)); -} - -inline OverscaledTileID OverscaledTileID::scaledTo(uint8_t z) const { - return { z, wrap, z >= canonical.z ? canonical : canonical.scaledTo(z) }; -} - -inline UnwrappedTileID OverscaledTileID::toUnwrapped() const { - return { wrap, canonical }; -} - -inline OverscaledTileID OverscaledTileID::unwrapTo(int16_t newWrap) const { - return { overscaledZ, newWrap, canonical }; -} - -inline UnwrappedTileID::UnwrappedTileID(uint8_t z_, int64_t x_, int64_t y_) - : wrap((x_ < 0 ? x_ - (1ll << z_) + 1 : x_) / (1ll << z_)), - canonical( - z_, - static_cast(x_ - wrap * (1ll << z_)), - y_ < 0 ? 0 : std::min(static_cast(y_), static_cast(1ull << z_) - 1)) { -} - -inline UnwrappedTileID::UnwrappedTileID(int16_t wrap_, CanonicalTileID canonical_) - : wrap(wrap_), canonical(canonical_) {} - -inline bool UnwrappedTileID::operator==(const UnwrappedTileID& rhs) const { - return wrap == rhs.wrap && canonical == rhs.canonical; -} - -inline bool UnwrappedTileID::operator!=(const UnwrappedTileID& rhs) const { - return wrap != rhs.wrap || canonical != rhs.canonical; -} - -inline bool UnwrappedTileID::operator<(const UnwrappedTileID& rhs) const { - return std::tie(wrap, canonical) < std::tie(rhs.wrap, rhs.canonical); -} - -inline UnwrappedTileID UnwrappedTileID::unwrapTo(int16_t newWrap) const { - return { newWrap, canonical }; -} - -inline bool UnwrappedTileID::isChildOf(const UnwrappedTileID& parent) const { - return wrap == parent.wrap && canonical.isChildOf(parent.canonical); -} - -inline std::array UnwrappedTileID::children() const { - const uint8_t childZ = canonical.z + 1; - const uint32_t childX = canonical.x * 2; - const uint32_t childY = canonical.y * 2; - return { { - { wrap, { childZ, childX, childY } }, - { wrap, { childZ, childX, childY + 1 } }, - { wrap, { childZ, childX + 1, childY } }, - { wrap, { childZ, childX + 1, childY + 1 } }, - } }; -} - -inline OverscaledTileID UnwrappedTileID::overscaleTo(const uint8_t overscaledZ) const { - assert(overscaledZ >= canonical.z); - return { overscaledZ, wrap, canonical }; -} - -inline float UnwrappedTileID::pixelsToTileUnits(const float pixelValue, const float zoom) const { - return pixelValue * (util::EXTENT / (util::tileSize * std::pow(2, zoom - canonical.z))); -} - -} // namespace mbgl - -namespace std { - -template <> -struct hash { - size_t operator()(const mbgl::CanonicalTileID& id) const; -}; - -template <> -struct hash { - size_t operator()(const mbgl::UnwrappedTileID& id) const; -}; - -template <> -struct hash { - size_t operator()(const mbgl::OverscaledTileID& id) const; -}; - -} // namespace std - diff --git a/include/mbgl/tile/tile_necessity.hpp b/include/mbgl/tile/tile_necessity.hpp deleted file mode 100644 index e51bf51d1..000000000 --- a/include/mbgl/tile/tile_necessity.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -namespace mbgl { - -// Tiles can have two states: optional or required. -// - optional means that only low-cost actions should be taken to obtain the data -// (e.g. load from cache, but accept stale data) -// - required means that every effort should be taken to obtain the data (e.g. load -// from internet and keep the data fresh if it expires) -enum class TileNecessity : bool { - Optional = false, - Required = true, -}; - -} // namespace mbgl diff --git a/include/mbgl/util/async_request.hpp b/include/mbgl/util/async_request.hpp deleted file mode 100644 index 9e8509496..000000000 --- a/include/mbgl/util/async_request.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -class AsyncRequest : private util::noncopyable { -public: - virtual ~AsyncRequest() = default; -}; - -} // namespace mbgl diff --git a/include/mbgl/util/async_task.hpp b/include/mbgl/util/async_task.hpp deleted file mode 100644 index 69746c3eb..000000000 --- a/include/mbgl/util/async_task.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { -namespace util { - -class AsyncTask : private util::noncopyable { -public: - AsyncTask(std::function&&); - ~AsyncTask(); - - void send(); - -private: - class Impl; - std::unique_ptr impl; -}; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/bitmask_operations.hpp b/include/mbgl/util/bitmask_operations.hpp deleted file mode 100644 index 014fabdea..000000000 --- a/include/mbgl/util/bitmask_operations.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -template -MBGL_CONSTEXPR Enum operator|(Enum a, Enum b) { - static_assert(std::is_enum::value, "Enum must be an enum type"); - return Enum(mbgl::underlying_type(a) | mbgl::underlying_type(b)); -} - -template -MBGL_CONSTEXPR Enum& operator|=(Enum& a, Enum b) { - static_assert(std::is_enum::value, "Enum must be an enum type"); - return (a = a | b); -} - -template -MBGL_CONSTEXPR bool operator&(Enum a, Enum b) { - static_assert(std::is_enum::value, "Enum must be an enum type"); - return bool(mbgl::underlying_type(a) & mbgl::underlying_type(b)); -} - -template -MBGL_CONSTEXPR Enum operator~(Enum value) { - static_assert(std::is_enum::value, "Enum must be an enum type"); - return Enum(~mbgl::underlying_type(value)); -} - - -} // namespace mbgl \ No newline at end of file diff --git a/include/mbgl/util/char_array_buffer.hpp b/include/mbgl/util/char_array_buffer.hpp deleted file mode 100644 index 177f00547..000000000 --- a/include/mbgl/util/char_array_buffer.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -// ref https://artofcode.wordpress.com/2010/12/12/deriving-from-stdstreambuf/ - -class CharArrayBuffer : public std::streambuf -{ -public: - CharArrayBuffer(char const* data, std::size_t size) - : begin_(data), end_(data + size), current_(data) {} - -private: - int_type underflow() final { - if (current_ == end_) { - return traits_type::eof(); - } - return traits_type::to_int_type(*current_); - } - - int_type uflow() final { - if (current_ == end_) { - return traits_type::eof(); - } - return traits_type::to_int_type(*current_++); - } - - int_type pbackfail(int_type ch) final { - if (current_ == begin_ || (ch != traits_type::eof() && ch != current_[-1])) { - return traits_type::eof(); - } - return traits_type::to_int_type(*--current_); - } - - std::streamsize showmanyc() final { - return end_ - current_; - } - - pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode) final { - if (dir == std::ios_base::beg) current_ = std::min(begin_ + off, end_); - else if (dir == std::ios_base::cur) current_ = std::min(current_ + off, end_); - else current_ = std::max(end_ - off, begin_); // dir == std::ios_base::end - return pos_type(off_type(current_ - begin_)); - } - - char const * const begin_; - char const * const end_; - char const * current_; -}; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp deleted file mode 100644 index 723cd131e..000000000 --- a/include/mbgl/util/chrono.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -using Clock = std::chrono::steady_clock; - -using Seconds = std::chrono::seconds; -using Milliseconds = std::chrono::milliseconds; - -using TimePoint = Clock::time_point; -using Duration = Clock::duration; - -// Used to measure second-precision times, such as times gathered from HTTP responses. -using Timestamp = std::chrono::time_point; - -namespace util { - -inline Timestamp now() { - return std::chrono::time_point_cast(std::chrono::system_clock::now()); -} - -// Returns the RFC1123 formatted date. E.g. "Tue, 04 Nov 2014 02:13:24 GMT" -std::string rfc1123(Timestamp); - -// YYYY-mm-dd HH:MM:SS e.g. "2015-11-26 16:11:23" -std::string iso8601(Timestamp); - -Timestamp parseTimestamp(const char *); - -Timestamp parseTimestamp(const int32_t timestamp); - -// C++17 polyfill -template ::min() < std::chrono::duration::zero()>> -constexpr std::chrono::duration abs(std::chrono::duration d) -{ - return d >= d.zero() ? d : -d; -} - -} // namespace util - -} // namespace mbgl diff --git a/include/mbgl/util/color.hpp b/include/mbgl/util/color.hpp deleted file mode 100644 index 1ff44ce08..000000000 --- a/include/mbgl/util/color.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - -namespace mbgl { - -// Stores a premultiplied color, with all four channels ranging from 0..1 -class Color { -public: - Color() = default; - Color(float r_, float g_, float b_, float a_) - : r(r_), g(g_), b(b_), a(a_) { - assert(r_ >= 0.0f); - assert(r_ <= 1.0f); - assert(g_ >= 0.0f); - assert(g_ <= 1.0f); - assert(b_ >= 0.0f); - assert(b_ <= 1.0f); - assert(a_ >= 0.0f); - assert(a_ <= 1.0f); - } - - float r = 0.0f; - float g = 0.0f; - float b = 0.0f; - float a = 0.0f; - - static Color black() { return { 0.0f, 0.0f, 0.0f, 1.0f }; }; - static Color white() { return { 1.0f, 1.0f, 1.0f, 1.0f }; }; - - static Color red() { return { 1.0f, 0.0f, 0.0f, 1.0f }; }; - static Color green() { return { 0.0f, 1.0f, 0.0f, 1.0f }; }; - static Color blue() { return { 0.0f, 0.0f, 1.0f, 1.0f }; }; - - static optional parse(const std::string&); - std::string stringify() const; - std::array toArray() const; - mbgl::Value toObject() const; -}; - -inline bool operator==(const Color& colorA, const Color& colorB) { - return colorA.r == colorB.r && colorA.g == colorB.g && colorA.b == colorB.b && colorA.a == colorB.a; -} - -inline bool operator!=(const Color& colorA, const Color& colorB) { - return !(colorA == colorB); -} - -inline Color operator*(const Color& color, float alpha) { - assert(alpha >= 0.0f); - assert(alpha <= 1.0f); - return { - color.r * alpha, - color.g * alpha, - color.b * alpha, - color.a * alpha - }; -} - -} // namespace mbgl diff --git a/include/mbgl/util/compression.hpp b/include/mbgl/util/compression.hpp deleted file mode 100644 index 93a3ddb8b..000000000 --- a/include/mbgl/util/compression.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -std::string compress(const std::string& raw); -std::string decompress(const std::string& raw); - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp deleted file mode 100644 index ffdc4b2b3..000000000 --- a/include/mbgl/util/constants.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - -namespace mbgl { - -namespace util { - -constexpr double tileSize = 512; - -/* - * The maximum extent of a feature that can be safely stored in the buffer. - * In practice, all features are converted to this extent before being added. - * - * Positions are stored as signed 16bit integers. - * One bit is lost for signedness to support features extending past the left edge of the tile. - * One bit is lost because the line vertex buffer used to pack 1 bit of other data into the int. - * This is no longer the case but we're reserving this bit anyway. - * One bit is lost to support features extending past the extent on the right edge of the tile. - * This leaves us with 2^13 = 8192 - */ -constexpr int32_t EXTENT = 8192; - -constexpr double DEG2RAD = M_PI / 180.0; -constexpr double RAD2DEG = 180.0 / M_PI; -constexpr double M2PI = M_PI * 2; -constexpr double EARTH_RADIUS_M = 6378137; -constexpr double LATITUDE_MAX = 85.051128779806604; -constexpr double LONGITUDE_MAX = 180; -constexpr double DEGREES_MAX = 360; -constexpr double PITCH_MIN = 0.0; -constexpr double PITCH_MAX = M_PI / 3; -constexpr double MIN_ZOOM = 0.0; -constexpr double MAX_ZOOM = 25.5; -constexpr float MIN_ZOOM_F = MIN_ZOOM; -constexpr float MAX_ZOOM_F = MAX_ZOOM; -constexpr uint8_t DEFAULT_MAX_ZOOM = 22; - -// ONE_EM constant used to go between "em" units used in style spec and "points" used internally for layout. -constexpr float ONE_EM = 24.0f; - -constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4; - -constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024; - -// Default ImageManager's cache size for images added via onStyleImageMissing API. -// Average sprite size with 1.0 pixel ratio is ~2kB, 8kB for pixel ratio of 2.0. -constexpr std::size_t DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE = 100 * 8192; - -constexpr Duration DEFAULT_TRANSITION_DURATION = Milliseconds(300); -constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 }; - -constexpr UnitBezier DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 }; - -constexpr int DEFAULT_RATE_LIMIT_TIMEOUT = 5; - -constexpr const char* API_BASE_URL = "https://api.mapbox.com"; - -constexpr uint8_t TERRAIN_RGB_MAXZOOM = 15; - -} // namespace util - -namespace debug { - -extern const bool tileParseWarnings; -extern const bool styleParseWarnings; -extern const bool spriteWarnings; -extern const bool renderWarnings; -extern const bool labelTextMissingWarning; -extern const bool missingFontStackWarning; -extern const bool missingFontFaceWarning; -extern const bool glyphWarning; -extern const bool shapingWarning; - -} // namespace debug - -} // namespace mbgl diff --git a/include/mbgl/util/convert.hpp b/include/mbgl/util/convert.hpp deleted file mode 100644 index 02ec7feef..000000000 --- a/include/mbgl/util/convert.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include -#include -#include - -namespace mbgl { -namespace util { - -template::value>> -MBGL_CONSTEXPR std::array convert(const std::array&from) { - std::array to {{}}; - std::copy(std::begin(from), std::end(from), std::begin(to)); - return to; -} - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/default_styles.hpp b/include/mbgl/util/default_styles.hpp deleted file mode 100644 index e1c53178b..000000000 --- a/include/mbgl/util/default_styles.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { -namespace util { -namespace default_styles { - -struct DefaultStyle { - const char* url; - const char* name; - const unsigned currentVersion; -}; - -// clang-format off -constexpr const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v11", "Streets", 11 }; -constexpr const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v11", "Outdoors", 11 }; -constexpr const DefaultStyle light = { "mapbox://styles/mapbox/light-v10", "Light", 10 }; -constexpr const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v10", "Dark", 10 }; -constexpr const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 }; -constexpr const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v11", "Satellite Streets", 11 }; -// clang-format on - -constexpr std::array orderedStyles = { - {streets, outdoors, light, dark, satellite, satelliteStreets}}; - -constexpr size_t numOrderedStyles = orderedStyles.size(); - -} // end namespace default_styles -} // end namespace util -} // end namespace mbgl diff --git a/include/mbgl/util/enum.hpp b/include/mbgl/util/enum.hpp deleted file mode 100644 index 608befd3c..000000000 --- a/include/mbgl/util/enum.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include - -#include -#include -#include - -namespace mbgl { - -template -class Enum { -public: - using Type = T; - static const char * toString(T); - static optional toEnum(const std::string&); -}; - -#define MBGL_DEFINE_ENUM(T, values...) \ - \ -static const constexpr std::pair T##_names[] = values; \ - \ -template <> \ -const char * Enum::toString(T t) { \ - auto it = std::find_if(std::begin(T##_names), std::end(T##_names), \ - [&] (const auto& v) { return t == v.first; }); \ - assert(it != std::end(T##_names)); return it->second; \ -} \ - \ -template <> \ -optional Enum::toEnum(const std::string& s) { \ - auto it = std::find_if(std::begin(T##_names), std::end(T##_names), \ - [&] (const auto& v) { return s == v.second; }); \ - return it == std::end(T##_names) ? optional() : it->first; \ -} - -} // namespace mbgl diff --git a/include/mbgl/util/event.hpp b/include/mbgl/util/event.hpp deleted file mode 100644 index 15583e956..000000000 --- a/include/mbgl/util/event.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -enum class EventSeverity : uint8_t { - Debug, - Info, - Warning, - Error, -}; - -enum class Event : uint8_t { - General, - Setup, - Shader, - ParseStyle, - ParseTile, - Render, - Style, - Database, - HttpRequest, - Sprite, - Image, - OpenGL, - JNI, - Android, - Crash, - Glyph, - Timing -}; - -struct EventPermutation { - const EventSeverity severity; - const Event event; - - constexpr bool operator==(const EventPermutation &rhs) const { - return severity == rhs.severity && event == rhs.event; - } -}; - -constexpr EventSeverity disabledEventSeverities[] = { -#ifndef NDEBUG - EventSeverity(-1) // Avoid zero size array -#else - EventSeverity::Debug -#endif -}; - -constexpr Event disabledEvents[] = { - Event(-1) // Avoid zero size array -}; - -constexpr EventPermutation disabledEventPermutations[] = { - { EventSeverity::Debug, Event::Shader } -}; - -} // namespace mbgl diff --git a/include/mbgl/util/exception.hpp b/include/mbgl/util/exception.hpp deleted file mode 100644 index a9804e96c..000000000 --- a/include/mbgl/util/exception.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -struct Exception : std::runtime_error { - Exception(const char *msg) : std::runtime_error(msg) {} - Exception(const std::string &msg) : std::runtime_error(msg) {} -}; - -struct SpriteImageException : Exception { - SpriteImageException(const char *msg) : Exception(msg) {} - SpriteImageException(const std::string &msg) : Exception(msg) {} -}; - -struct MisuseException : Exception { - MisuseException(const char *msg) : Exception(msg) {} - MisuseException(const std::string &msg) : Exception(msg) {} -}; - -struct StyleParseException : Exception { - StyleParseException(const char *msg) : Exception(msg) {} - StyleParseException(const std::string &msg) : Exception(msg) {} -}; - -struct StyleLoadException : Exception { - StyleLoadException(const char *msg) : Exception(msg) {} - StyleLoadException(const std::string &msg) : Exception(msg) {} -}; - -struct NotFoundException : Exception { - NotFoundException(const char *msg) : Exception(msg) {} - NotFoundException(const std::string &msg) : Exception(msg) {} -}; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/expected.hpp b/include/mbgl/util/expected.hpp deleted file mode 100644 index 135de3cf9..000000000 --- a/include/mbgl/util/expected.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -template -using expected = nonstd::expected; - -template -using unexpected = nonstd::unexpected_type; - -} // namespace mbgl diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp deleted file mode 100644 index 608097694..000000000 --- a/include/mbgl/util/feature.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace mbgl { - -using Value = mapbox::base::Value; -using NullValue = mapbox::base::NullValue; -using PropertyMap = mapbox::base::ValueObject; -using FeatureIdentifier = mapbox::feature::identifier; -using Feature = mapbox::feature::feature; -using FeatureState = mapbox::base::ValueObject; -using FeatureStates = std::unordered_map; // -using LayerFeatureStates = std::unordered_map; // - -template -optional numericValue(const Value& value) { - return value.match( - [] (uint64_t t) { - return optional(t); - }, - [] (int64_t t) { - return optional(t); - }, - [] (double t) { - return optional(t); - }, - [] (auto) { - return optional(); - }); -} - -inline optional featureIDtoString(const FeatureIdentifier& id) { - if (id.is()) { - return nullopt; - } - - return id.match( - [](const std::string& value_) { return value_; }, [](uint64_t value_) { return util::toString(value_); }, - [](int64_t value_) { return util::toString(value_); }, [](double value_) { return util::toString(value_); }, - [](const auto&) -> optional { return nullopt; }); -} - -} // namespace mbgl diff --git a/include/mbgl/util/font_stack.hpp b/include/mbgl/util/font_stack.hpp deleted file mode 100644 index ccc1a0606..000000000 --- a/include/mbgl/util/font_stack.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - -namespace mbgl { - -// An array of font names -using FontStack = std::vector; -using FontStackHash = std::size_t; - -std::string fontStackToString(const FontStack&); - -struct FontStackHasher { - FontStackHash operator()(const FontStack&) const; -}; - -// Statically evaluate layer properties to determine what font stacks are used. -std::set fontStacks(const std::vector>&); - -} // namespace mbgl diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp deleted file mode 100644 index 170eca4f0..000000000 --- a/include/mbgl/util/geo.hpp +++ /dev/null @@ -1,256 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -namespace mbgl { - -class CanonicalTileID; -class UnwrappedTileID; - -using ScreenCoordinate = mapbox::geometry::point; -using ScreenLineString = mapbox::geometry::line_string; -using ScreenBox = mapbox::geometry::box; - -class LatLng { -private: - double lat; - double lon; - -public: - enum WrapMode : bool { Unwrapped, Wrapped }; - - LatLng(double lat_ = 0, double lon_ = 0, WrapMode mode = Unwrapped) - : lat(lat_), lon(lon_) { - if (std::isnan(lat)) { - throw std::domain_error("latitude must not be NaN"); - } - if (std::isnan(lon)) { - throw std::domain_error("longitude must not be NaN"); - } - if (std::abs(lat) > 90.0) { - throw std::domain_error("latitude must be between -90 and 90"); - } - if (!std::isfinite(lon)) { - throw std::domain_error("longitude must not be infinite"); - } - if (mode == Wrapped) { - wrap(); - } - } - - double latitude() const { return lat; } - double longitude() const { return lon; } - - LatLng wrapped() const { return { lat, lon, Wrapped }; } - - void wrap() { - lon = util::wrap(lon, -util::LONGITUDE_MAX, util::LONGITUDE_MAX); - } - - // If the distance from start to end longitudes is between half and full - // world, unwrap the start longitude to ensure the shortest path is taken. - void unwrapForShortestPath(const LatLng& end) { - const double delta = std::abs(end.lon - lon); - if (delta <= util::LONGITUDE_MAX || delta >= util::DEGREES_MAX) return; - if (lon > 0 && end.lon < 0) lon -= util::DEGREES_MAX; - else if (lon < 0 && end.lon > 0) lon += util::DEGREES_MAX; - } - - // Constructs a LatLng object with the top left position of the specified tile. - LatLng(const CanonicalTileID& id); - LatLng(const UnwrappedTileID& id); - - friend bool operator==(const LatLng& a, const LatLng& b) { - return a.lat == b.lat && a.lon == b.lon; - } - - friend bool operator!=(const LatLng& a, const LatLng& b) { - return !(a == b); - } -}; - -class LatLngBounds { -public: - // Return a bounds covering the entire (unwrapped) world. - static LatLngBounds world() { - return LatLngBounds({-90, -180}, {90, 180}); - } - - // Return the bounds consisting of the single point. - static LatLngBounds singleton(const LatLng& a) { - return LatLngBounds(a, a); - } - - // Return the convex hull of two points; the smallest bounds that contains both. - static LatLngBounds hull(const LatLng& a, const LatLng& b) { - LatLngBounds bounds(a, a); - bounds.extend(b); - return bounds; - } - - // Return a bounds that may serve as the identity element for the extend operation. - static LatLngBounds empty() { - LatLngBounds bounds = world(); - std::swap(bounds.sw, bounds.ne); - return bounds; - } - - /// Returns an infinite bound, a bound for which the constrain method returns its - /// input unmodified. - /// - /// Note: this is different than LatLngBounds::world() since arbitrary unwrapped - /// coordinates are also inside the bounds. - static LatLngBounds unbounded() { - return {}; - } - - // Constructs a LatLngBounds object with the tile's exact boundaries. - LatLngBounds(const CanonicalTileID&); - - bool valid() const { - return (sw.latitude() <= ne.latitude()) && (sw.longitude() <= ne.longitude()); - } - - double south() const { return sw.latitude(); } - double west() const { return sw.longitude(); } - double north() const { return ne.latitude(); } - double east() const { return ne.longitude(); } - - LatLng southwest() const { return sw; } - LatLng northeast() const { return ne; } - LatLng southeast() const { return LatLng(south(), east()); } - LatLng northwest() const { return LatLng(north(), west()); } - - LatLng center() const { - return LatLng((sw.latitude() + ne.latitude()) / 2, - (sw.longitude() + ne.longitude()) / 2); - } - - LatLng constrain(const LatLng& p) const; - - void extend(const LatLng& point) { - sw = LatLng(std::min(point.latitude(), sw.latitude()), - std::min(point.longitude(), sw.longitude())); - ne = LatLng(std::max(point.latitude(), ne.latitude()), - std::max(point.longitude(), ne.longitude())); - } - - void extend(const LatLngBounds& bounds) { - extend(bounds.sw); - extend(bounds.ne); - } - - bool isEmpty() const { - return sw.latitude() > ne.latitude() || - sw.longitude() > ne.longitude(); - } - - bool crossesAntimeridian() const { - return (sw.wrapped().longitude() > ne.wrapped().longitude()); - } - - bool contains(const CanonicalTileID& tileID) const; - bool contains(const LatLng& point, LatLng::WrapMode wrap = LatLng::Unwrapped) const; - bool contains(const LatLngBounds& area, LatLng::WrapMode wrap = LatLng::Unwrapped) const; - - bool intersects(const LatLngBounds area, LatLng::WrapMode wrap = LatLng::Unwrapped) const; - -private: - LatLng sw; - LatLng ne; - bool bounded = true; - - LatLngBounds(LatLng sw_, LatLng ne_) : sw(sw_), ne(ne_) {} - - LatLngBounds() - : sw({-90, -180}), ne({90, 180}), bounded(false) {} - - bool containsLatitude(double latitude) const; - bool containsLongitude(double longitude, LatLng::WrapMode wrap) const; - - friend bool operator==(const LatLngBounds& a, const LatLngBounds& b) { - return (!a.bounded && !b.bounded) || (a.bounded && b.bounded && a.sw == b.sw && a.ne == b.ne); - } - - friend bool operator!=(const LatLngBounds& a, const LatLngBounds& b) { - return !(a == b); - } -}; - -// Determines the orientation of the map. -enum class NorthOrientation : uint8_t { - Upwards, // Default - Rightwards, - Downwards, - Leftwards, -}; - -/// The distance on each side between a rectangle and a rectangle within. -class EdgeInsets { -private: - double _top; // Number of pixels inset from the top edge. - double _left; // Number of pixels inset from the left edge. - double _bottom; // Number of pixels inset from the bottom edge. - double _right; // Number of pixels inset from the right edge. - -public: - EdgeInsets(double t_ = 0, double l_ = 0, double b_ = 0, double r_ = 0) - : _top(t_), _left(l_), _bottom(b_), _right(r_) { - if (std::isnan(_top)) { - throw std::domain_error("top must not be NaN"); - } - if (std::isnan(_left)) { - throw std::domain_error("left must not be NaN"); - } - if (std::isnan(_bottom)) { - throw std::domain_error("bottom must not be NaN"); - } - if (std::isnan(_right)) { - throw std::domain_error("right must not be NaN"); - } - } - - double top() const { return _top; } - double left() const { return _left; } - double bottom() const { return _bottom; } - double right() const { return _right; } - - bool isFlush() const { - return _top == 0 && _left == 0 && _bottom == 0 && _right == 0; - } - - void operator+=(const EdgeInsets& o) { - _top += o._top; - _left += o._left; - _bottom += o._bottom; - _right += o._right; - } - - EdgeInsets operator+(const EdgeInsets& o) const { - return { - _top + o._top, _left + o._left, _bottom + o._bottom, _right + o._right, - }; - } - - ScreenCoordinate getCenter(uint16_t width, uint16_t height) const; - - friend bool operator==(const EdgeInsets& a, const EdgeInsets& b) { - return a._top == b._top && a._left == b._left && a._bottom == b._bottom && a._right == b._right; - } - - friend bool operator!=(const EdgeInsets& a, const EdgeInsets& b) { - return !(a == b); - } -}; - -} // namespace mbgl diff --git a/include/mbgl/util/geojson.hpp b/include/mbgl/util/geojson.hpp deleted file mode 100644 index 2a6569be4..000000000 --- a/include/mbgl/util/geojson.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -using GeoJSON = mapbox::geojson::geojson; -using FeatureCollection = mapbox::geojson::feature_collection; -using FeatureExtensionValue = mapbox::util::variant; - -} // namespace mbgl diff --git a/include/mbgl/util/geometry.hpp b/include/mbgl/util/geometry.hpp deleted file mode 100644 index 17384f222..000000000 --- a/include/mbgl/util/geometry.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace mbgl { - -enum class FeatureType : uint8_t { - Unknown = 0, - Point = 1, - LineString = 2, - Polygon = 3 -}; - -using EmptyGeometry = mapbox::geometry::empty; - -template -using Point = mapbox::geometry::point; - -template -using LineString = mapbox::geometry::line_string; - -template -using Polygon = mapbox::geometry::polygon; - -template -using MultiPoint = mapbox::geometry::multi_point; - -template -using MultiLineString = mapbox::geometry::multi_line_string; - -template -using MultiPolygon = mapbox::geometry::multi_polygon; - -template -using LinearRing = mapbox::geometry::linear_ring; - -template -using Geometry = mapbox::geometry::geometry; - -template -Point convertPoint(const Point& p) { - return Point(p.x, p.y); -} - -struct ToFeatureType { - FeatureType operator()(const EmptyGeometry&) const { return FeatureType::Unknown; } - template - FeatureType operator()(const Point &) const { return FeatureType::Point; } - template - FeatureType operator()(const MultiPoint &) const { return FeatureType::Point; } - template - FeatureType operator()(const LineString &) const { return FeatureType::LineString; } - template - FeatureType operator()(const MultiLineString &) const { return FeatureType::LineString; } - template - FeatureType operator()(const Polygon &) const { return FeatureType::Polygon; } - template - FeatureType operator()(const MultiPolygon &) const { return FeatureType::Polygon; } - template - FeatureType operator()(const mapbox::geometry::geometry_collection &) const { return FeatureType::Unknown; } -}; - -template -auto forEachPoint(const Geometry& g, F f) { - mapbox::geometry::for_each_point(g, f); -} - -} // namespace mbgl diff --git a/include/mbgl/util/ignore.hpp b/include/mbgl/util/ignore.hpp deleted file mode 100644 index 577bcf4d9..000000000 --- a/include/mbgl/util/ignore.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -// Accept any number of parameters of any types, and do nothing with them. -// Useful for providing a context for parameter pack expansion where a legal -// expansion context is not otherwise available. -// -// See https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md -// for more details. -// -template void ignore(Ts&&...) {} - -// std::initializer_list overload, for situations where you need sequenced -// modifications. -// -template void ignore(const std::initializer_list&) {} - -// Handle the zero-argument case. -inline void ignore(const std::initializer_list&) {} - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp deleted file mode 100644 index e997c0222..000000000 --- a/include/mbgl/util/image.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -namespace mbgl { - -enum class ImageAlphaMode { - Unassociated, - Premultiplied, - Exclusive, // Alpha-channel only -}; - -template -class Image : private util::noncopyable { -public: - Image() = default; - - Image(Size size_) : size(size_), data(std::make_unique(bytes())) {} - - Image(Size size_, const uint8_t* srcData, std::size_t srcLength) : size(size_) { - if (srcLength != bytes()) { - throw std::invalid_argument("mismatched image size"); - } - data = std::make_unique(bytes()); - std::copy(srcData, srcData + srcLength, data.get()); - } - - Image(Size size_, std::unique_ptr data_) : size(size_), data(std::move(data_)) {} - - Image(Image&& o) - : size(o.size), - data(std::move(o.data)) { - o.size.width = o.size.height = 0; - } - - Image& operator=(Image&& o) { - size = o.size; - data = std::move(o.data); - o.size.width = o.size.height = 0; - return *this; - } - - friend bool operator==(const Image& lhs, const Image& rhs) { - return std::equal(lhs.data.get(), lhs.data.get() + lhs.bytes(), - rhs.data.get(), rhs.data.get() + rhs.bytes()); - } - - friend bool operator!=(const Image& lhs, const Image& rhs) { - return !(lhs == rhs); - } - - bool valid() const { - return !size.isEmpty() && data.get() != nullptr; - } - - template - T clone() const { - T copy_(size); - std::copy(data.get(), data.get() + bytes(), copy_.data.get()); - return copy_; - } - - size_t stride() const { return channels * size.width; } - size_t bytes() const { return stride() * size.height; } - - void fill(uint8_t value) { - std::fill(data.get(), data.get() + bytes(), value); - } - - void resize(Size size_) { - if (size == size_) { - return; - } - Image newImage(size_); - newImage.fill(0); - copy(*this, newImage, {0, 0}, {0, 0}, { - std::min(size.width, size_.width), - std::min(size.height, size_.height) - }); - operator=(std::move(newImage)); - } - - // Clears the rect area specified by `pt` and `size` from `dstImage`. - static void clear(Image& dstImg, const Point& pt, const Size& size) { - if (size.isEmpty()) { - return; - } - - if (!dstImg.valid()) { - throw std::invalid_argument("invalid destination for image clear"); - } - - if (size.width > dstImg.size.width || - size.height > dstImg.size.height || - pt.x > dstImg.size.width - size.width || - pt.y > dstImg.size.height - size.height) { - throw std::out_of_range("out of range destination coordinates for image clear"); - } - - uint8_t* dstData = dstImg.data.get(); - - for (uint32_t y = 0; y < size.height; y++) { - const std::size_t dstOffset = (pt.y + y) * dstImg.stride() + pt.x * channels; - std::memset(dstData + dstOffset, 0, size.width * channels); - } - } - - // Copy image data within `rect` from `src` to the rectangle of the same size at `pt` - // in `dst`. If the specified bounds exceed the bounds of the source or destination, - // throw `std::out_of_range`. Must not be used to move data within a single Image. - static void copy(const Image& srcImg, Image& dstImg, const Point& srcPt, const Point& dstPt, const Size& size) { - if (size.isEmpty()) { - return; - } - - if (!srcImg.valid()) { - throw std::invalid_argument("invalid source for image copy"); - } - - if (!dstImg.valid()) { - throw std::invalid_argument("invalid destination for image copy"); - } - - if (size.width > srcImg.size.width || - size.height > srcImg.size.height || - srcPt.x > srcImg.size.width - size.width || - srcPt.y > srcImg.size.height - size.height) { - throw std::out_of_range("out of range source coordinates for image copy"); - } - - if (size.width > dstImg.size.width || - size.height > dstImg.size.height || - dstPt.x > dstImg.size.width - size.width || - dstPt.y > dstImg.size.height - size.height) { - throw std::out_of_range("out of range destination coordinates for image copy"); - } - - const uint8_t* srcData = srcImg.data.get(); - uint8_t* dstData = dstImg.data.get(); - - assert(srcData != dstData); - - for (uint32_t y = 0; y < size.height; y++) { - const std::size_t srcOffset = (srcPt.y + y) * srcImg.stride() + srcPt.x * channels; - const std::size_t dstOffset = (dstPt.y + y) * dstImg.stride() + dstPt.x * channels; - std::copy(srcData + srcOffset, - srcData + srcOffset + size.width * channels, - dstData + dstOffset); - } - } - - Size size; - static constexpr size_t channels = Mode == ImageAlphaMode::Exclusive ? 1 : 4; - std::unique_ptr data; -}; - -using UnassociatedImage = Image; -using PremultipliedImage = Image; -using AlphaImage = Image; - -// TODO: don't use std::string for binary data. -PremultipliedImage decodeImage(const std::string&); -std::string encodePNG(const PremultipliedImage&); - -} // namespace mbgl diff --git a/include/mbgl/util/immutable.hpp b/include/mbgl/util/immutable.hpp deleted file mode 100644 index 4d251df8d..000000000 --- a/include/mbgl/util/immutable.hpp +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -/** - * `Mutable` is a non-nullable uniquely owning reference to a `T`. It can be efficiently converted - * to `Immutable`. - * - * The lifecycle of `Mutable` and `Immutable` is as follows: - * - * 1. Create a `Mutable` using `makeMutable(...)` - * 2. Mutate it freely - * 3. When you're ready to freeze its state and enable safe cross-thread sharing, move assign or - * move construct it to `Immutable` - * - * The reason that `Mutable` exists, rather than simply using a `std::unique_ptr`, is to take advantage - * of the underlying single-allocation optimization provided by `std::make_shared`. - */ -template -class Mutable { -public: - Mutable(Mutable&&) = default; - Mutable& operator=(Mutable&&) = default; - - Mutable(const Mutable&) = delete; - Mutable& operator=(const Mutable&) = delete; - - T* get() { return ptr.get(); } - T* operator->() { return ptr.get(); } - T& operator*() { return *ptr; } - -private: - Mutable(std::shared_ptr&& s) - : ptr(std::move(s)) {} - - std::shared_ptr ptr; - - template friend class Immutable; - template friend Mutable makeMutable(Args&&...); - template friend Mutable staticMutableCast(const Mutable&); -}; - -template -Mutable makeMutable(Args&&... args) { - return Mutable(std::make_shared(std::forward(args)...)); -} - -template -Mutable staticMutableCast(const Mutable& u) { - return Mutable(std::static_pointer_cast(u.ptr)); -} - -/** - * `Immutable` is a non-nullable shared reference to a `const T`. Construction requires - * a transfer of unique ownership from a `Mutable`; once constructed it has the same behavior - * as `std::shared_ptr` but with better indication of intent. - * - * Normally one should not share state between threads because it's difficult to verify the - * absence of read/write data races. `Immutable` provides a guarantee that no writes are - * possible, and instances therefore can be freely transferred and shared between threads. - */ -template -class Immutable { -public: - template - Immutable(Mutable&& s) - : ptr(std::const_pointer_cast(std::move(s.ptr))) {} - - template - Immutable(Immutable s) - : ptr(std::move(s.ptr)) {} - - Immutable(Immutable&&) = default; - Immutable(const Immutable&) = default; - - template - Immutable& operator=(Mutable&& s) { - ptr = std::const_pointer_cast(std::move(s.ptr)); - return *this; - } - - Immutable& operator=(Immutable&&) = default; - Immutable& operator=(const Immutable&) = default; - - const T* get() const { return ptr.get(); } - const T* operator->() const { return ptr.get(); } - const T& operator*() const { return *ptr; } - - friend bool operator==(const Immutable& lhs, const Immutable& rhs) { - return lhs.ptr == rhs.ptr; - } - - friend bool operator!=(const Immutable& lhs, const Immutable& rhs) { - return lhs.ptr != rhs.ptr; - } - -private: - Immutable(std::shared_ptr&& s) - : ptr(std::move(s)) {} - - std::shared_ptr ptr; - - template friend class Immutable; - template friend Immutable staticImmutableCast(const Immutable&); -}; - -template -Immutable staticImmutableCast(const Immutable& u) { - return Immutable(std::static_pointer_cast(u.ptr)); -} - -/** - * Constrained mutation of an immutable reference. Makes a temporarily-mutable copy of the - * input Immutable using the inner type's copy constructor, runs the given callable on the - * mutable copy, and then freezes the copy and reassigns it to the input reference. - * - * Note that other Immutables referring to the same inner instance are not affected; they - * continue to referencing the original immutable instance. - */ -template -void mutate(Immutable& immutable, Fn&& fn) { - Mutable mut = makeMutable(*immutable); - std::forward(fn)(*mut); - immutable = std::move(mut); -} - -} // namespace mbgl diff --git a/include/mbgl/util/indexed_tuple.hpp b/include/mbgl/util/indexed_tuple.hpp deleted file mode 100644 index 99d73d1e1..000000000 --- a/include/mbgl/util/indexed_tuple.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include - -#include -#include - -namespace mbgl { - -template -struct TypeIndex; - -template -struct TypeIndex : std::integral_constant {}; - -template -struct TypeIndex : std::integral_constant::value> {}; - -template class IndexedTuple; - -// A tuple of Ts, where individual members can be accessed via `t.get()` for I ∈ Is. -// -// See https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md -// for motivation. -// -template -class IndexedTuple, TypeList> : public std::tuple { -public: - static_assert(sizeof...(Is) == sizeof...(Ts), "IndexedTuple size mismatch"); - - template - auto& get() { - return std::get::value, Ts...>(*this); - } - - template - const auto& get() const { - return std::get::value, Ts...>(*this); - } - - template - IndexedTuple(Us&&... other) : std::tuple(std::forward(other)...) {}; - - template - IndexedTuple, TypeList> - concat(const IndexedTuple, TypeList>& other) const { - return IndexedTuple, TypeList> { - get()..., - other.template get()... - }; - } - - // Help out MSVC++ - bool operator==(const IndexedTuple, TypeList>& other) const { - return static_cast&>(*this) == static_cast&>(other); - } - - bool operator!=(const IndexedTuple, TypeList>& other) const { - return !(*this == other); - } -}; - -template -using ExpandToType = T; - -} // namespace mbgl diff --git a/include/mbgl/util/interpolate.hpp b/include/mbgl/util/interpolate.hpp deleted file mode 100644 index aff730a0a..000000000 --- a/include/mbgl/util/interpolate.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace util { - -float interpolationFactor(float base, Range range, float z); - -template -struct Interpolator; - -template -T interpolate(const T& a, const T& b, const double t) { - return Interpolator()(a, b, t); -} - - -template -struct Interpolator { - T operator()(const T& a, const T& b, const double t) const { - return a * (1.0 - t) + b * t; - } -}; - -template -struct Interpolator> { -private: - using Array = std::array; - - template - Array operator()(const Array& a, const Array& b, const double t, std::index_sequence) { - return {{ interpolate(a[I], b[I], t)... }}; - } - -public: - Array operator()(const Array& a, const Array& b, const double t) { - return operator()(a, b, t, std::make_index_sequence()); - } -}; - - -// In order to accept Array as an output value for Curve -// expressions, we need to have an interpolatable std::vector type. -// However, style properties like line-dasharray are represented using -// std::vector, and should NOT be considered interpolatable. -// So, we use std::vector to represent expression array values, -// asserting that (a) the vectors are the same size, and (b) they contain -// only numeric values. (These invariants should be relatively safe, -// being enforced by the expression type system.) -template<> -struct Interpolator> { - std::vector operator()(const std::vector& a, - const std::vector& b, - const double t) const { - assert(a.size() == b.size()); - if (a.size() == 0) return {}; - std::vector result; - for (std::size_t i = 0; i < a.size(); i++) { - assert(a[i].template is()); - assert(b[i].template is()); - style::expression::Value item = interpolate( - a[i].template get(), - b[i].template get(), - t); - result.push_back(item); - } - return result; - } -}; - -template <> -struct Interpolator { -public: - style::Position operator()(const style::Position& a, const style::Position& b, const double t) { - auto pos = style::Position(); - auto interpolated = interpolate(a.getCartesian(), b.getCartesian(), t); - pos.setCartesian(interpolated); - return { pos }; - } -}; - -template <> -struct Interpolator { -public: - Color operator()(const Color& a, const Color& b, const double t) { - return { - interpolate(a.r, b.r, t), - interpolate(a.g, b.g, t), - interpolate(a.b, b.b, t), - interpolate(a.a, b.a, t) - }; - } -}; - -struct Uninterpolated { - template - T operator()(const T& a, const T&, const double) const { - return a; - } -}; - -template <> -struct Interpolator - : Uninterpolated {}; - -template -struct Interpolator::value>> - : Uninterpolated {}; - -template <> -struct Interpolator - : Uninterpolated {}; - -template -struct Interpolator> - : Uninterpolated {}; - -template -struct Interpolatable - : std::conditional_t< - !std::is_base_of>::value, - std::true_type, - std::false_type> {}; - - - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/logging.hpp b/include/mbgl/util/logging.hpp deleted file mode 100644 index 03db2d746..000000000 --- a/include/mbgl/util/logging.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include - -#include - -#include -#include - -namespace mbgl { - -class Log { -public: - class Observer : private util::noncopyable { - public: - virtual ~Observer() = default; - - // When an observer is set, this function will be called for every log - // message. Returning true will consume the message. - virtual bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string &msg) = 0; - }; - - class NullObserver : public Observer { - bool onRecord(EventSeverity, Event, int64_t, const std::string&) override { - return true; - } - }; - - static void setObserver(std::unique_ptr Observer); - static std::unique_ptr removeObserver(); - -private: - template - constexpr static bool includes(const T e, const T (&l)[N], const size_t i = 0) { - return i < N && (l[i] == e || includes(e, l, i + 1)); - } - -public: - template - static void Debug(Event event, Args&& ...args) { - Record(EventSeverity::Debug, event, ::std::forward(args)...); - } - - template - static void Info(Event event, Args&& ...args) { - Record(EventSeverity::Info, event, ::std::forward(args)...); - } - - template - static void Warning(Event event, Args&& ...args) { - Record(EventSeverity::Warning, event, ::std::forward(args)...); - } - - template - static void Error(Event event, Args&& ...args) { - Record(EventSeverity::Error, event, ::std::forward(args)...); - } - - template - static void Record(EventSeverity severity, Event event, Args&& ...args) { - if (!includes(severity, disabledEventSeverities) && - !includes(event, disabledEvents) && - !includes({ severity, event }, disabledEventPermutations)) { - record(severity, event, ::std::forward(args)...); - } - } - -private: - static void record(EventSeverity severity, Event event, const std::string &msg); - static void record(EventSeverity severity, Event event, const char* format = "", ...); - static void record(EventSeverity severity, Event event, int64_t code, const char* format = "", ...); - static void record(EventSeverity severity, Event event, int64_t code, const std::string &msg); - - // This method is the data sink that must be implemented by each platform we - // support. It should ideally output the error message in a human readable - // format to the developer. - static void platformRecord(EventSeverity severity, const std::string &msg); -}; - -} // namespace mbgl diff --git a/include/mbgl/util/noncopyable.hpp b/include/mbgl/util/noncopyable.hpp deleted file mode 100644 index 8cb7e198d..000000000 --- a/include/mbgl/util/noncopyable.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -namespace mbgl { namespace util { - -namespace non_copyable_ -{ - -class noncopyable -{ -public: - noncopyable( noncopyable const& ) = delete; - noncopyable& operator=(noncopyable const& ) = delete; - -protected: - constexpr noncopyable() = default; - ~noncopyable() = default; -}; -} // namespace non_copyable_ - -using noncopyable = non_copyable_::noncopyable; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/optional.hpp b/include/mbgl/util/optional.hpp deleted file mode 100644 index e0a3786a7..000000000 --- a/include/mbgl/util/optional.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace mbgl { - -template -using optional = std::experimental::optional; - -using nullopt_t = std::experimental::nullopt_t; -constexpr nullopt_t nullopt = std::experimental::nullopt; - -} // namespace mbgl diff --git a/include/mbgl/util/platform.hpp b/include/mbgl/util/platform.hpp deleted file mode 100644 index 354465974..000000000 --- a/include/mbgl/util/platform.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace platform { - -class Request; - -// Uppercase a string, potentially using platform-specific routines. -std::string uppercase(const std::string &string); - -// Lowercase a string, potentially using platform-specific routines. -std::string lowercase(const std::string &string); - -// Gets the name of the current thread. -std::string getCurrentThreadName(); - -// Set the name of the current thread, truncated at 15. -void setCurrentThreadName(const std::string& name); - -// Makes the current thread low priority. -void makeThreadLowPriority(); - -} // namespace platform -} // namespace mbgl diff --git a/include/mbgl/util/premultiply.hpp b/include/mbgl/util/premultiply.hpp deleted file mode 100644 index 532c7cb11..000000000 --- a/include/mbgl/util/premultiply.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include - -namespace mbgl { -namespace util { - -PremultipliedImage premultiply(UnassociatedImage&&); -UnassociatedImage unpremultiply(PremultipliedImage&&); - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp deleted file mode 100644 index f0b9115eb..000000000 --- a/include/mbgl/util/projection.hpp +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { - -class ProjectedMeters { -private: - double _northing; // Distance measured northwards. - double _easting; // Distance measured eastwards. - -public: - ProjectedMeters(double n_ = 0, double e_ = 0) - : _northing(n_), _easting(e_) { - if (std::isnan(_northing)) { - throw std::domain_error("northing must not be NaN"); - } - if (std::isnan(_easting)) { - throw std::domain_error("easting must not be NaN"); - } - } - - double northing() const { return _northing; } - double easting() const { return _easting; } - - friend bool operator==(const ProjectedMeters& a, const ProjectedMeters& b) { - return a._northing == b._northing && a._easting == b._easting; - } - - friend bool operator!=(const ProjectedMeters& a, const ProjectedMeters& b) { - return !(a == b); - } -}; - -// Spherical Mercator projection -// http://docs.openlayers.org/library/spherical_mercator.html -class Projection { -public: - // Map pixel width at given scale. - static double worldSize(double scale) { - return scale * util::tileSize; - } - - static double getMetersPerPixelAtLatitude(double lat, double zoom) { - const double constrainedZoom = util::clamp(zoom, util::MIN_ZOOM, util::MAX_ZOOM); - const double constrainedScale = std::pow(2.0, constrainedZoom); - const double constrainedLatitude = util::clamp(lat, -util::LATITUDE_MAX, util::LATITUDE_MAX); - return std::cos(constrainedLatitude * util::DEG2RAD) * util::M2PI * util::EARTH_RADIUS_M / worldSize(constrainedScale); - } - - static ProjectedMeters projectedMetersForLatLng(const LatLng& latLng) { - const double constrainedLatitude = util::clamp(latLng.latitude(), -util::LATITUDE_MAX, util::LATITUDE_MAX); - const double constrainedLongitude = util::clamp(latLng.longitude(), -util::LONGITUDE_MAX, util::LONGITUDE_MAX); - - const double m = 1 - 1e-15; - const double f = util::clamp(std::sin(util::DEG2RAD * constrainedLatitude), -m, m); - - const double easting = util::EARTH_RADIUS_M * constrainedLongitude * util::DEG2RAD; - const double northing = 0.5 * util::EARTH_RADIUS_M * std::log((1 + f) / (1 - f)); - - return ProjectedMeters(northing, easting); - } - - static LatLng latLngForProjectedMeters(const ProjectedMeters& projectedMeters) { - double latitude = (2 * std::atan(std::exp(projectedMeters.northing() / util::EARTH_RADIUS_M)) - (M_PI / 2.0)) * util::RAD2DEG; - double longitude = projectedMeters.easting() * util::RAD2DEG / util::EARTH_RADIUS_M; - - latitude = util::clamp(latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX); - longitude = util::clamp(longitude, -util::LONGITUDE_MAX, util::LONGITUDE_MAX); - - return LatLng(latitude, longitude); - } - - static Point project(const LatLng& latLng, double scale) { - return project_(latLng, worldSize(scale)); - } - - //Returns point on tile - static Point project(const LatLng& latLng, int32_t zoom) { - return project_(latLng, 1 << zoom); - } - - static LatLng unproject(const Point& p, double scale, LatLng::WrapMode wrapMode = LatLng::Unwrapped) { - auto p2 = p * util::DEGREES_MAX / worldSize(scale); - return LatLng { - util::DEGREES_MAX / M_PI * std::atan(std::exp((util::LONGITUDE_MAX - p2.y) * util::DEG2RAD)) - 90.0, - p2.x - util::LONGITUDE_MAX, - wrapMode - }; - } - -private: - static Point project_(const LatLng& latLng, double worldSize) { - const double latitude = util::clamp(latLng.latitude(), -util::LATITUDE_MAX, util::LATITUDE_MAX); - return Point { - util::LONGITUDE_MAX + latLng.longitude(), - util::LONGITUDE_MAX - util::RAD2DEG * std::log(std::tan(M_PI / 4 + latitude * M_PI / util::DEGREES_MAX)) - } * (worldSize / util::DEGREES_MAX); - } -}; - -} // namespace mbgl diff --git a/include/mbgl/util/range.hpp b/include/mbgl/util/range.hpp deleted file mode 100644 index 5591a22a1..000000000 --- a/include/mbgl/util/range.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#pragma once - -namespace mbgl { - -template -class Range { -public: - constexpr Range(T min_, T max_) - : min(std::move(min_)), max(std::move(max_)) {} - - T min; - T max; -}; - -template -bool operator==(const Range& a, const Range& b) { - return a.min == b.min && a.max == b.max; -} - -template -bool operator!=(const Range& a, const Range& b) { - return !(a == b); -} - -} // namespace mbgl diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp deleted file mode 100644 index 5cde95a53..000000000 --- a/include/mbgl/util/run_loop.hpp +++ /dev/null @@ -1,131 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace mbgl { -namespace util { - -using LOOP_HANDLE = void *; - -class RunLoop : public Scheduler, - private util::noncopyable { -public: - enum class Type : uint8_t { - Default, - New, - }; - - enum class Priority : bool { - Default = false, - High = true, - }; - - enum class Event : uint8_t { - None = 0, - Read = 1, - Write = 2, - ReadWrite = Read | Write, - }; - - RunLoop(Type type = Type::Default); - ~RunLoop() override; - - static RunLoop* Get(); - static LOOP_HANDLE getLoopHandle(); - - void run(); - void runOnce(); - void stop(); - - // So far only needed by the libcurl backend. - void addWatch(int fd, Event, std::function&& callback); - void removeWatch(int fd); - - // Invoke fn(args...) on this RunLoop. - template - void invoke(Priority priority, Fn&& fn, Args&&... args) { - push(priority, WorkTask::make(std::forward(fn), std::forward(args)...)); - } - - // Invoke fn(args...) on this RunLoop. - template - void invoke(Fn&& fn, Args&&... args) { - invoke(Priority::Default, std::forward(fn), std::forward(args)...); - } - - // Post the cancellable work fn(args...) to this RunLoop. - template - std::unique_ptr - invokeCancellable(Fn&& fn, Args&&... args) { - std::shared_ptr task = WorkTask::make(std::forward(fn), std::forward(args)...); - push(Priority::Default, task); - return std::make_unique(task); - } - - void schedule(std::function fn) override { invoke(std::move(fn)); } - ::mapbox::base::WeakPtr makeWeakPtr() override { return weakFactory.makeWeakPtr(); } - - class Impl; - -private: - MBGL_STORE_THREAD(tid) - - using Queue = std::queue>; - - // Wakes up the RunLoop so that it starts processing items in the queue. - void wake(); - - // Adds a WorkTask to the queue, and wakes it up. - void push(Priority priority, std::shared_ptr task) { - std::lock_guard lock(mutex); - if (priority == Priority::High) { - highPriorityQueue.emplace(std::move(task)); - } else { - defaultQueue.emplace(std::move(task)); - } - wake(); - } - - void process() { - std::shared_ptr task; - std::unique_lock lock(mutex); - while (true) { - if (!highPriorityQueue.empty()) { - task = std::move(highPriorityQueue.front()); - highPriorityQueue.pop(); - } else if (!defaultQueue.empty()) { - task = std::move(defaultQueue.front()); - defaultQueue.pop(); - } else { - break; - } - lock.unlock(); - (*task)(); - task.reset(); - lock.lock(); - } - } - - Queue defaultQueue; - Queue highPriorityQueue; - std::mutex mutex; - - std::unique_ptr impl; - ::mapbox::base::WeakPtrFactory weakFactory{this}; -}; - -} // namespace util -} // namespace mbgl - -#include diff --git a/include/mbgl/util/size.hpp b/include/mbgl/util/size.hpp deleted file mode 100644 index 12c0ad056..000000000 --- a/include/mbgl/util/size.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -class Size { -public: - constexpr Size() = default; - - constexpr Size(const uint32_t width_, const uint32_t height_) : width(width_), height(height_) { - } - - constexpr uint32_t area() const { - return width * height; - } - - constexpr float aspectRatio() const { - return static_cast(width) / static_cast(height); - } - - constexpr bool isEmpty() const { - return width == 0 || height == 0; - } - - uint32_t width = 0; - uint32_t height = 0; -}; - -constexpr inline bool operator==(const Size& a, const Size& b) { - return a.width == b.width && a.height == b.height; -} - -constexpr inline bool operator!=(const Size& a, const Size& b) { - return !(a == b); -} - -} // namespace mbgl diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp deleted file mode 100644 index 1e0f512ba..000000000 --- a/include/mbgl/util/string.hpp +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include -#include - -// Polyfill needed by Qt when building for Android with GCC -#if defined(__ANDROID__) && defined(__GLIBCXX__) - -namespace std { - -inline int stoi(const std::string &str) -{ - return atoi(str.c_str()); -} - -inline float stof(const std::string &str) { - return static_cast(atof(str.c_str())); -} - -} // namespace std - -#endif - -namespace mbgl { -namespace util { - -std::string toString(int64_t); -std::string toString(uint64_t); -std::string toString(int32_t); -std::string toString(uint32_t); -std::string toString(double, bool decimal = false); - -inline std::string toString(int16_t t) { - return toString(static_cast(t)); -} - -inline std::string toString(uint16_t t) { - return toString(static_cast(t)); -} - -inline std::string toString(int8_t t) { - return toString(static_cast(t)); -} - -inline std::string toString(uint8_t t) { - return toString(static_cast(t)); -} - -template ::value>> -inline std::string toString(unsigned long t) { - return toString(static_cast(t)); -} - -template ::value>> -inline std::string toString(unsigned long long t) { - return toString(static_cast(t)); -} - -inline std::string toString(float t, bool decimal = false) { - return toString(static_cast(t), decimal); -} - -inline std::string toString(long double t, bool decimal = false) { - return toString(static_cast(t), decimal); -} - -std::string toString(std::exception_ptr); - -template -std::string toString(T) = delete; - -std::string toHex(uint32_t); -std::string toHex(uint64_t); - -inline float stof(const std::string& str) { - return std::stof(str); -} - -} // namespace util -} // namespace mbgl - -// Android's libstdc++ doesn't have std::to_string() -#if defined(__ANDROID__) && defined(__GLIBCXX__) - -namespace std { - -template -inline std::string to_string(T value) { - return mbgl::util::toString(value); -} - -} // namespace std - -#endif diff --git a/include/mbgl/util/thread.hpp b/include/mbgl/util/thread.hpp deleted file mode 100644 index ab0403e44..000000000 --- a/include/mbgl/util/thread.hpp +++ /dev/null @@ -1,162 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mbgl { -namespace util { - -// Manages a thread with `Object`. - -// Upon creation of this object, it launches a thread and creates an object of type `Object` -// in that thread. When the `Thread<>` object is destructed, the destructor waits -// for thread termination. The `Thread<>` constructor blocks until the thread and -// the `Object` are fully created, so after the object creation, it's safe to obtain the -// `Object` stored in this thread. The thread created will always have low priority on -// the platforms that support setting thread priority. -// -// The following properties make this class different from `ThreadPool`: -// -// - Only one thread is created. -// - `Object` will live in a single thread, providing thread affinity. -// - It is safe to use `ThreadLocal` in an `Object` managed by `Thread<>` -// - A `RunLoop` is created for the `Object` thread. -// - `Object` can use `Timer` and do asynchronous I/O, like wait for sockets events. -// -template -class Thread { -public: - template - Thread(const std::string& name, Args&&... args) { - - std::promise running_; - running = running_.get_future(); - - auto capturedArgs = std::make_tuple(std::forward(args)...); - - thread = std::thread([ - this, - name, - capturedArgs = std::move(capturedArgs), - runningPromise = std::move(running_) - ] () mutable { - platform::setCurrentThreadName(name); - platform::makeThreadLowPriority(); - platform::attachThread(); - - // narrowing the scope to release the Object before we detach the thread - { - util::RunLoop loop_(util::RunLoop::Type::New); - loop = &loop_; - EstablishedActor establishedActor(loop_, object, std::move(capturedArgs)); - - runningPromise.set_value(); - - loop->run(); - - (void) establishedActor; - - loop = nullptr; - } - - platform::detachThread(); - }); - } - - ~Thread() { - if (paused) { - resume(); - } - - std::promise stoppable; - - running.wait(); - - // Invoke a noop task on the run loop to ensure that we're executing - // run() before we call stop() - loop->invoke([&] { - stoppable.set_value(); - }); - - stoppable.get_future().get(); - - loop->stop(); - thread.join(); - } - - // Returns a non-owning reference to `Object` that - // can be used to send messages to `Object`. It is safe - // to the non-owning reference to outlive this object - // and be used after the `Thread<>` gets destroyed. - ActorRef> actor() { - return object.self(); - } - - // Pauses the `Object` thread. It will prevent the object to wake - // up from events such as timers and file descriptor I/O. Messages - // sent to a paused `Object` will be queued and only processed after - // `resume()` is called. - void pause() { - MBGL_VERIFY_THREAD(tid); - - assert(!paused); - - paused = std::make_unique>(); - resumed = std::make_unique>(); - - auto pausing = paused->get_future(); - - running.wait(); - - loop->invoke(RunLoop::Priority::High, [this] { - auto resuming = resumed->get_future(); - paused->set_value(); - resuming.get(); - }); - - pausing.get(); - } - - // Resumes the `Object` thread previously paused by `pause()`. - void resume() { - MBGL_VERIFY_THREAD(tid); - - assert(paused); - - resumed->set_value(); - - resumed.reset(); - paused.reset(); - } - -private: - MBGL_STORE_THREAD(tid); - - AspiringActor object; - - std::thread thread; - - std::future running; - - std::unique_ptr> paused; - std::unique_ptr> resumed; - - util::RunLoop* loop = nullptr; -}; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/tileset.hpp b/include/mbgl/util/tileset.hpp deleted file mode 100644 index c0885e0eb..000000000 --- a/include/mbgl/util/tileset.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mbgl { - -class Tileset { -public: - enum class Scheme : bool { XYZ, TMS }; - enum class DEMEncoding : bool { Mapbox, Terrarium }; - - std::vector tiles; - Range zoomRange; - std::string attribution; - Scheme scheme; - // DEMEncoding is not supported by the TileJSON spec - DEMEncoding encoding; - optional bounds; - - Tileset(std::vector tiles_ = std::vector(), - Range zoomRange_ = {0, util::DEFAULT_MAX_ZOOM}, - std::string attribution_ = {}, - Scheme scheme_ = Scheme::XYZ, - DEMEncoding encoding_ = DEMEncoding::Mapbox) - : tiles(std::move(tiles_)), - zoomRange(zoomRange_), - attribution(std::move(attribution_)), - scheme(scheme_), - encoding(encoding_), - bounds(){}; - - // TileJSON also includes center and zoom but they are not used by mbgl. - - friend bool operator==(const Tileset& lhs, const Tileset& rhs) { - return std::tie(lhs.tiles, lhs.zoomRange, lhs.attribution, lhs.scheme, lhs.bounds) - == std::tie(rhs.tiles, rhs.zoomRange, rhs.attribution, rhs.scheme, rhs.bounds); - } - - friend bool operator!=(const Tileset& lhs, const Tileset& rhs) { - return !(lhs == rhs); - } -}; - -} // namespace mbgl diff --git a/include/mbgl/util/timer.hpp b/include/mbgl/util/timer.hpp deleted file mode 100644 index 7d76e3b79..000000000 --- a/include/mbgl/util/timer.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -namespace mbgl { -namespace util { - -class Timer : private util::noncopyable { -public: - Timer(); - ~Timer(); - - void start(Duration timeout, Duration repeat, std::function&&); - void stop(); - -private: - class Impl; - std::unique_ptr impl; -}; - -} // namespace util -} // namespace mbgl diff --git a/include/mbgl/util/traits.hpp b/include/mbgl/util/traits.hpp deleted file mode 100644 index e37144e60..000000000 --- a/include/mbgl/util/traits.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace mbgl { - -template -constexpr auto underlying_type(T t) -> typename std::underlying_type_t { - return typename std::underlying_type_t(t); -} - -template struct is_utf16char_like: std::false_type {}; -template struct is_utf16char_like: is_utf16char_like {}; -template <> struct is_utf16char_like: std::true_type {}; -template <> struct is_utf16char_like: std::true_type {}; -template <> struct is_utf16char_like: std::true_type {}; - -template using is_utf16char_like_pointer = std::integral_constant::value - && is_utf16char_like::type>::value>; - -template -typename std::enable_if::value && is_utf16char_like_pointer::value, OutPointer>::type utf16char_cast(InChar *in) -{ - return reinterpret_cast(in); -} - -template -struct is_linear_container : std::false_type {}; - -template -struct is_linear_container> : std::true_type {}; -template -struct is_linear_container> : std::true_type {}; - -} // namespace mbgl diff --git a/include/mbgl/util/type_list.hpp b/include/mbgl/util/type_list.hpp deleted file mode 100644 index 1b594bf7f..000000000 --- a/include/mbgl/util/type_list.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include -#include - -namespace mbgl { - -template -struct TypeList { - template