diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2016-10-19 16:05:36 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-10-20 17:02:40 +0300 |
commit | ab85fdb4524788ce7279e8ac362a0c1edbd5d5df (patch) | |
tree | 7a6511e29020f20d07c4662e53671ad06b3d4b1d | |
parent | 04a9a98b98d41312a687518fd43445a64dadadf0 (diff) | |
download | qtlocation-mapboxgl-ab85fdb4524788ce7279e8ac362a0c1edbd5d5df.tar.gz |
[glfw] add map change callback methods to glfw_view
-rw-r--r-- | include/mbgl/platform/default/glfw_view.hpp | 5 | ||||
-rw-r--r-- | platform/default/glfw_view.cpp | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp index b352709830..8662a90bf3 100644 --- a/include/mbgl/platform/default/glfw_view.hpp +++ b/include/mbgl/platform/default/glfw_view.hpp @@ -42,6 +42,9 @@ public: void run(); void report(float duration); + + void setMapChangeCallback(std::function<void(mbgl::MapChange)> callback); + void notifyMapChange(mbgl::MapChange change) override; private: mbgl::Color makeRandomColor() const; @@ -62,6 +65,8 @@ private: mbgl::AnnotationIDs annotationIDs; std::vector<std::string> spriteIDs; + std::function<void(mbgl::MapChange)> mapChangeCallback; + private: bool fullscreen = false; const bool benchmark = false; diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index fa5190c80c..28789e4a67 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -508,6 +508,16 @@ void GLFWView::setWindowTitle(const std::string& title) { glfwSetWindowTitle(window, (std::string { "Mapbox GL: " } + title).c_str()); } +void GLFWView::setMapChangeCallback(std::function<void(mbgl::MapChange)> callback) { + this->mapChangeCallback = callback; +} + +void GLFWView::notifyMapChange(mbgl::MapChange change) { + if (mapChangeCallback) { + mapChangeCallback(change); + } +} + namespace mbgl { namespace platform { |