summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-09-17 18:51:53 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-09-18 16:21:59 +0300
commit224d49cc9083f8ecb418a68ae0fea839bc51def6 (patch)
treef7fe1451c5b3d9631f6d4e1e5672ae628ecd7982 /src/mbgl/annotation
parent8b355c7f8b42d4523c3adfc3f7407a522273824f (diff)
downloadqtlocation-mapboxgl-224d49cc9083f8ecb418a68ae0fea839bc51def6.tar.gz
[core] Check layer compatibility with source
Diffstat (limited to 'src/mbgl/annotation')
-rw-r--r--src/mbgl/annotation/annotation_source.cpp7
-rw-r--r--src/mbgl/annotation/annotation_source.hpp7
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mbgl/annotation/annotation_source.cpp b/src/mbgl/annotation/annotation_source.cpp
index 68f36f2d3a..7a137f1881 100644
--- a/src/mbgl/annotation/annotation_source.cpp
+++ b/src/mbgl/annotation/annotation_source.cpp
@@ -1,5 +1,6 @@
-#include <mbgl/annotation/annotation_source.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
+#include <mbgl/annotation/annotation_source.hpp>
+#include <mbgl/style/layer.hpp>
namespace mbgl {
@@ -21,4 +22,8 @@ optional<std::string> AnnotationSource::Impl::getAttribution() const {
return {};
}
+bool AnnotationSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const {
+ return !std::strcmp(info->type, "line") || !std::strcmp(info->type, "symbol") || !std::strcmp(info->type, "fill");
+}
+
} // namespace mbgl
diff --git a/src/mbgl/annotation/annotation_source.hpp b/src/mbgl/annotation/annotation_source.hpp
index 018e2136ea..0379426b3e 100644
--- a/src/mbgl/annotation/annotation_source.hpp
+++ b/src/mbgl/annotation/annotation_source.hpp
@@ -12,13 +12,12 @@ public:
class Impl;
const Impl& impl() const;
+private:
+ void loadDescription(FileSource&) final;
+ bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override;
mapbox::base::WeakPtr<Source> makeWeakPtr() override {
return weakFactory.makeWeakPtr();
}
-
-private:
- void loadDescription(FileSource&) final;
-
Mutable<Impl> mutableImpl() const;
mapbox::base::WeakPtrFactory<Source> weakFactory {this};
};