summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-10-11 15:16:48 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-10-11 16:51:27 -0700
commitfa81ebc2bff3db41c1d12d0be16ea835a666c030 (patch)
tree87ee50fdb9d642486b06930b7671df58cca8a87e /src/mbgl
parentf381388b1c6bd10deffbc8b83bb9b37c21dda90c (diff)
downloadqtlocation-mapboxgl-fa81ebc2bff3db41c1d12d0be16ea835a666c030.tar.gz
[core] Tests for CustomVectorSource and CustomTile
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/style/custom_tile_loader.cpp17
-rw-r--r--src/mbgl/style/custom_tile_loader.hpp3
-rw-r--r--src/mbgl/tile/custom_tile.cpp1
3 files changed, 18 insertions, 3 deletions
diff --git a/src/mbgl/style/custom_tile_loader.cpp b/src/mbgl/style/custom_tile_loader.cpp
index da4ade6734..942216d26e 100644
--- a/src/mbgl/style/custom_tile_loader.cpp
+++ b/src/mbgl/style/custom_tile_loader.cpp
@@ -11,7 +11,7 @@ CustomTileLoader::CustomTileLoader(const TileFunction& fetchTileFn, const TileFu
void CustomTileLoader::fetchTile(const OverscaledTileID& tileID, ActorRef<SetTileDataFunction> callbackRef) {
auto cachedTileData = dataCache.find(tileID.canonical);
if (cachedTileData == dataCache.end()) {
- fetchTileFunction(tileID.canonical);
+ invokeTileFetch(tileID.canonical);
} else {
callbackRef.invoke(&SetTileDataFunction::operator(), *(cachedTileData->second));
}
@@ -33,7 +33,7 @@ void CustomTileLoader::fetchTile(const OverscaledTileID& tileID, ActorRef<SetTil
void CustomTileLoader::cancelTile(const OverscaledTileID& tileID) {
if(tileCallbackMap.find(tileID.canonical) != tileCallbackMap.end()) {
- cancelTileFunction(tileID.canonical);
+ invokeTileCancel(tileID.canonical);
}
}
@@ -50,7 +50,6 @@ void CustomTileLoader::removeTile(const OverscaledTileID& tileID) {
tileCallbackMap.erase(tileCallbacks);
dataCache.erase(tileID.canonical);
}
-
}
void CustomTileLoader::setTileData(const CanonicalTileID& tileID, const GeoJSON& data) {
@@ -63,5 +62,17 @@ void CustomTileLoader::setTileData(const CanonicalTileID& tileID, const GeoJSON&
}
}
+void CustomTileLoader::invokeTileFetch(const CanonicalTileID& tileID) {
+ if (fetchTileFunction != nullptr) {
+ fetchTileFunction(tileID);
+ }
+}
+
+void CustomTileLoader::invokeTileCancel(const CanonicalTileID& tileID) {
+ if (cancelTileFunction != nullptr) {
+ cancelTileFunction(tileID);
+ }
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/custom_tile_loader.hpp b/src/mbgl/style/custom_tile_loader.hpp
index 12b2dd525b..e993294f94 100644
--- a/src/mbgl/style/custom_tile_loader.hpp
+++ b/src/mbgl/style/custom_tile_loader.hpp
@@ -26,6 +26,9 @@ public:
void setTileData(const CanonicalTileID& tileID, const GeoJSON& data);
private:
+ void invokeTileFetch(const CanonicalTileID& tileID);
+ void invokeTileCancel(const CanonicalTileID& tileID);
+
TileFunction fetchTileFunction;
TileFunction cancelTileFunction;
std::unordered_map<CanonicalTileID, std::vector<OverscaledIDFunctionTuple>> tileCallbackMap;
diff --git a/src/mbgl/tile/custom_tile.cpp b/src/mbgl/tile/custom_tile.cpp
index 710c6f6691..7662085499 100644
--- a/src/mbgl/tile/custom_tile.cpp
+++ b/src/mbgl/tile/custom_tile.cpp
@@ -3,6 +3,7 @@
#include <mbgl/renderer/query.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/style/filter_evaluator.hpp>
#include <mapbox/geojsonvt.hpp>