summaryrefslogtreecommitdiff
path: root/bin/render.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-03-21 14:41:08 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-03-28 13:53:19 +0200
commit68e032e505e23811aec1f6079995709b3d2b9700 (patch)
tree80296f3dd19cc2855d4d364659d5ee58921ba11b /bin/render.cpp
parent9b39013ce4c6f98590b80ced425e0a3bcdb3f77f (diff)
downloadqtlocation-mapboxgl-68e032e505e23811aec1f6079995709b3d2b9700.tar.gz
[core] Remove private header includes from CLI utilities
Diffstat (limited to 'bin/render.cpp')
-rw-r--r--bin/render.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/render.cpp b/bin/render.cpp
index d4090cfa9f..0af933475a 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -1,14 +1,12 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/backend_scope.hpp>
#include <mbgl/util/image.hpp>
-#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/gl/headless_backend.hpp>
#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"
@@ -21,6 +19,7 @@ namespace po = boost::program_options;
#include <cstdlib>
#include <iostream>
+#include <fstream>
int main(int argc, char *argv[]) {
std::string style_path;
@@ -91,12 +90,12 @@ int main(int argc, char *argv[]) {
ThreadPool threadPool(4);
Map map(backend, mbgl::Size { width, height }, pixelRatio, fileSource, threadPool, MapMode::Still);
- if (util::isURL(style_path)) {
- map.setStyleURL(style_path);
- } else {
- map.setStyleJSON(mbgl::util::read_file(style_path));
+ if (style_path.find("://") == std::string::npos) {
+ style_path = std::string("file://") + style_path;
}
+ map.setStyleURL(style_path);
+
map.setClasses(classes);
map.setLatLngZoom({ lat, lon }, zoom);
@@ -117,7 +116,9 @@ int main(int argc, char *argv[]) {
exit(1);
}
- util::write_file(output, encodePNG(view.readStillImage()));
+ std::ofstream out(output, std::ios::binary);
+ out << encodePNG(view.readStillImage());
+ out.close();
loop.stop();
});