diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-12-06 14:45:34 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-12-07 10:46:43 +0100 |
commit | 6be56ff9c25a8b5c6710f2be51f9cf96f2a38974 (patch) | |
tree | f5f362269ddd8daeebb0f23b0cbf339acee9608c /bin/render.cpp | |
parent | dc1bda435fa1345737604767ee71859377d41530 (diff) | |
download | qtlocation-mapboxgl-6be56ff9c25a8b5c6710f2be51f9cf96f2a38974.tar.gz |
[render] allow passing URLs to mbgl-render
Diffstat (limited to 'bin/render.cpp')
-rw-r--r-- | bin/render.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/render.cpp b/bin/render.cpp index 12ad1626ce..d275b445d2 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -7,6 +7,7 @@ #include <mbgl/gl/offscreen_view.hpp> #include <mbgl/util/default_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> +#include <mbgl/util/url.hpp> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" @@ -65,8 +66,6 @@ int main(int argc, char *argv[]) { exit(1); } - std::string style = mbgl::util::read_file(style_path); - using namespace mbgl; util::RunLoop loop; @@ -90,7 +89,12 @@ int main(int argc, char *argv[]) { ThreadPool threadPool(4); Map map(backend, mbgl::Size { width, height }, pixelRatio, fileSource, threadPool, MapMode::Still); - map.setStyleJSON(style); + if (util::isURL(style_path)) { + map.setStyleURL(style_path); + } else { + map.setStyleJSON(mbgl::util::read_file(style_path)); + } + map.setClasses(classes); map.setLatLngZoom({ lat, lon }, zoom); |