diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-02-04 20:08:12 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-03-06 12:41:00 +0100 |
commit | 8e42582c52d39153a1e1a0b14599b63c38c68531 (patch) | |
tree | 465df28f52acec21c116b256f85f631b474879f1 | |
parent | 5821be029c46d375d32bff91bdacec2f8ed701dd (diff) | |
download | qtlocation-mapboxgl-8e42582c52d39153a1e1a0b14599b63c38c68531.tar.gz |
update static image rendering executable
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | bin/render.cpp | 14 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/map/map.cpp | 4 |
4 files changed, 23 insertions, 10 deletions
@@ -184,6 +184,16 @@ android-deploy: $(ANDROID_ABIS) cd android/java/MapboxGLAndroidSDK && chmod ugo+x deploy.sh && ./deploy.sh +##### Render builds ############################################################ + +.PRECIOUS: Makefile/render +Makefile/render: bin/render.gyp config/$(HOST).gypi + deps/run_gyp bin/render.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make + +render: Makefile/render + $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) mbgl-render + + ##### Maintenace operations #################################################### .PHONY: clear_xcode_cache diff --git a/bin/render.cpp b/bin/render.cpp index c791152d1d..fad6600cf7 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -3,10 +3,6 @@ #include <mbgl/util/std.hpp> #include <mbgl/util/io.hpp> -#include <rapidjson/document.h> -#include <rapidjson/writer.h> -#include <rapidjson/stringbuffer.h> - #include <mbgl/platform/default/headless_view.hpp> #include <mbgl/platform/default/headless_display.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -32,8 +28,8 @@ int main(int argc, char *argv[]) { double zoom = 0; double bearing = 0; - int width = 256; - int height = 256; + int width = 512; + int height = 512; double pixelRatio = 1.0; std::string output = "out.png"; std::string cache_file = "cache.sqlite"; @@ -100,16 +96,14 @@ int main(int argc, char *argv[]) { view.resize(width, height, pixelRatio); map.resize(width, height, pixelRatio); - map.setLatLonZoom(LatLng(lat, lon), zoom); + map.setLatLngZoom({ lat, lon }, zoom); map.setBearing(bearing); - std::unique_ptr<uint32_t[]> pixels; - // Run the loop. It will terminate when we don't have any further listeners. map.run(); // Get the data from the GPU. - pixels = view.readPixels(); + auto pixels = view.readPixels(); const unsigned int w = width * pixelRatio; const unsigned int h = height * pixelRatio; diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 844970bb8f..fed68cb08a 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -37,6 +37,11 @@ class GlyphAtlas; class SpriteAtlas; class LineAtlas; +struct exception : std::runtime_error { + inline exception(const char *msg) : std::runtime_error(msg) { + } +}; + class Map : private util::noncopyable { public: explicit Map(View&, FileSource&); diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index ed20ec24a6..73e188848f 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -241,6 +241,10 @@ void Map::run() { checkForPause(); } + if (mode == Mode::Static && !style && styleURL.empty()) { + throw exception("Style is not set"); + } + view.activate(); workers = util::make_unique<uv::worker>(**loop, 4, "Tile Worker"); |