summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-10-24 11:23:05 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-10-25 16:23:40 +0300
commit55710cbb6799cc3802ef2dbb53d85134739cf83e (patch)
tree41626cbc18051d015d150403c2e0272b382d88b9 /src
parent8e2214129eb30e278c2d8fc39801f6570b6f02e9 (diff)
downloadqtlocation-mapboxgl-55710cbb6799cc3802ef2dbb53d85134739cf83e.tar.gz
[core] Added RendererState::has{Image,Layer,Source}
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/renderer_state.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mbgl/renderer/renderer_state.cpp b/src/mbgl/renderer/renderer_state.cpp
index dc5c4c1292..a024f37dfc 100644
--- a/src/mbgl/renderer/renderer_state.cpp
+++ b/src/mbgl/renderer/renderer_state.cpp
@@ -1,10 +1,42 @@
#include <mbgl/renderer/renderer_state.hpp>
#include <mbgl/renderer/update_parameters.hpp>
+#include <mbgl/style/image_impl.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/source_impl.hpp>
+
namespace mbgl {
CameraOptions RendererState::getCameraOptions(UpdateParameters& updateParameters, const EdgeInsets& padding) {
return updateParameters.transformState.getCameraOptions(padding);
}
+bool RendererState::hasImage(UpdateParameters& updateParameters, const std::string& id) {
+ for (const auto& image : *updateParameters.images) {
+ if (image.get()->id == id) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool RendererState::hasLayer(UpdateParameters& updateParameters, const std::string& id) {
+ for (const auto& layer : *updateParameters.layers) {
+ if (layer.get()->id == id) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool RendererState::hasSource(UpdateParameters& updateParameters, const std::string& id) {
+ for (const auto& source : *updateParameters.sources) {
+ if (source.get()->id == id) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
} // namespace mbgl