summaryrefslogtreecommitdiff
path: root/src/mbgl/annotation
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-05-19 15:34:08 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-06-10 12:42:14 +0200
commite8d8f52d2ea8b788a0dbe859549ec86fc0732df3 (patch)
tree80e8d41f1bbd8de633e851086be523860b8979db /src/mbgl/annotation
parent6998479d05497baf57eb264e92807d327920f7d6 (diff)
downloadqtlocation-mapboxgl-e8d8f52d2ea8b788a0dbe859549ec86fc0732df3.tar.gz
[core] *TileMonitor => *TileSource
Diffstat (limited to 'src/mbgl/annotation')
-rw-r--r--src/mbgl/annotation/annotation_manager.cpp5
-rw-r--r--src/mbgl/annotation/annotation_manager.hpp8
-rw-r--r--src/mbgl/annotation/annotation_tile.cpp19
-rw-r--r--src/mbgl/annotation/annotation_tile.hpp23
-rw-r--r--src/mbgl/annotation/symbol_annotation_impl.cpp1
5 files changed, 9 insertions, 47 deletions
diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp
index e332850357..22cdf313bf 100644
--- a/src/mbgl/annotation/annotation_manager.cpp
+++ b/src/mbgl/annotation/annotation_manager.cpp
@@ -5,6 +5,7 @@
#include <mbgl/annotation/fill_annotation_impl.hpp>
#include <mbgl/annotation/style_sourced_annotation_impl.hpp>
#include <mbgl/style/source.hpp>
+#include <mbgl/tile/annotation_tile_source.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
@@ -139,12 +140,12 @@ void AnnotationManager::updateStyle(Style& style) {
}
}
-void AnnotationManager::addTileMonitor(AnnotationTileMonitor& monitor) {
+void AnnotationManager::addTileSource(AnnotationTileSource& monitor) {
monitors.insert(&monitor);
monitor.update(getTile(monitor.tileID.canonical));
}
-void AnnotationManager::removeTileMonitor(AnnotationTileMonitor& monitor) {
+void AnnotationManager::removeTileSource(AnnotationTileSource& monitor) {
monitors.erase(&monitor);
}
diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp
index 73907e10c8..6f2700ab70 100644
--- a/src/mbgl/annotation/annotation_manager.hpp
+++ b/src/mbgl/annotation/annotation_manager.hpp
@@ -15,7 +15,7 @@
namespace mbgl {
class AnnotationTile;
-class AnnotationTileMonitor;
+class AnnotationTileSource;
class SymbolAnnotationImpl;
class ShapeAnnotationImpl;
@@ -41,8 +41,8 @@ public:
void updateStyle(style::Style&);
- void addTileMonitor(AnnotationTileMonitor&);
- void removeTileMonitor(AnnotationTileMonitor&);
+ void addTileSource(AnnotationTileSource&);
+ void removeTileSource(AnnotationTileSource&);
static const std::string SourceID;
static const std::string PointLayerID;
@@ -65,7 +65,7 @@ private:
SymbolAnnotationMap symbolAnnotations;
ShapeAnnotationMap shapeAnnotations;
std::vector<std::string> obsoleteShapeAnnotationLayers;
- std::set<AnnotationTileMonitor*> monitors;
+ std::set<AnnotationTileSource*> monitors;
SpriteStore spriteStore;
SpriteAtlas spriteAtlas;
diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp
index ba4b69108c..dd2afca127 100644
--- a/src/mbgl/annotation/annotation_tile.cpp
+++ b/src/mbgl/annotation/annotation_tile.cpp
@@ -32,23 +32,4 @@ util::ptr<GeometryTileLayer> AnnotationTile::getLayer(const std::string& name) c
return nullptr;
}
-AnnotationTileMonitor::AnnotationTileMonitor(const OverscaledTileID& tileID_, AnnotationManager& annotationManager_)
- : tileID(tileID_),
- annotationManager(annotationManager_) {
-}
-
-AnnotationTileMonitor::~AnnotationTileMonitor() {
- annotationManager.removeTileMonitor(*this);
-}
-
-std::unique_ptr<AsyncRequest> AnnotationTileMonitor::monitorTile(const GeometryTileMonitor::Callback& callback_) {
- callback = callback_;
- annotationManager.addTileMonitor(*this);
- return nullptr;
-}
-
-void AnnotationTileMonitor::update(std::unique_ptr<GeometryTile> tile) {
- callback(nullptr, std::move(tile), {}, {});
-}
-
} // namespace mbgl
diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp
index d607d563d4..8e8d76286e 100644
--- a/src/mbgl/annotation/annotation_tile.hpp
+++ b/src/mbgl/annotation/annotation_tile.hpp
@@ -1,10 +1,6 @@
#pragma once
#include <mbgl/tile/geometry_tile.hpp>
-#include <mbgl/tile/tile_id.hpp>
-
-#include <map>
-#include <unordered_map>
namespace mbgl {
@@ -40,24 +36,7 @@ class AnnotationTile : public GeometryTile {
public:
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
- std::map<std::string, util::ptr<AnnotationTileLayer>> layers;
-};
-
-class AnnotationManager;
-
-class AnnotationTileMonitor : public GeometryTileMonitor {
-public:
- AnnotationTileMonitor(const OverscaledTileID&, AnnotationManager&);
- ~AnnotationTileMonitor();
-
- void update(std::unique_ptr<GeometryTile>);
- std::unique_ptr<AsyncRequest> monitorTile(const GeometryTileMonitor::Callback&) override;
-
- OverscaledTileID tileID;
-
-private:
- AnnotationManager& annotationManager;
- GeometryTileMonitor::Callback callback;
+ std::unordered_map<std::string, util::ptr<AnnotationTileLayer>> layers;
};
} // namespace mbgl
diff --git a/src/mbgl/annotation/symbol_annotation_impl.cpp b/src/mbgl/annotation/symbol_annotation_impl.cpp
index 44a89576bb..9859f6b032 100644
--- a/src/mbgl/annotation/symbol_annotation_impl.cpp
+++ b/src/mbgl/annotation/symbol_annotation_impl.cpp
@@ -1,5 +1,6 @@
#include <mbgl/annotation/symbol_annotation_impl.hpp>
#include <mbgl/annotation/annotation_tile.hpp>
+#include <mbgl/tile/tile_id.hpp>
#include <mbgl/math/clamp.hpp>
namespace mbgl {