summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/custom_geometry_source.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-11-27 17:24:25 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-11-27 17:48:36 +0200
commitb44302af2aac3aa8ad7ee13be7c44fd1334cc81c (patch)
treed505da9d3af241a64f1cc9e201889406e58b2807 /src/mbgl/style/sources/custom_geometry_source.cpp
parent572822c8ca15be190b43afbf7f91d132e988bf21 (diff)
downloadqtlocation-mapboxgl-b44302af2aac3aa8ad7ee13be7c44fd1334cc81c.tar.gz
Bump Mapbox GL Nativeqt-v1.2.0
mapbox-gl-native @ cf3357ea4517e74ba3a63434c330a1506064b130
Diffstat (limited to 'src/mbgl/style/sources/custom_geometry_source.cpp')
-rw-r--r--src/mbgl/style/sources/custom_geometry_source.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp
new file mode 100644
index 0000000000..ab46843d38
--- /dev/null
+++ b/src/mbgl/style/sources/custom_geometry_source.cpp
@@ -0,0 +1,45 @@
+#include <mbgl/style/sources/custom_geometry_source.hpp>
+#include <mbgl/style/custom_tile_loader.hpp>
+#include <mbgl/style/sources/custom_geometry_source_impl.hpp>
+#include <mbgl/actor/actor.hpp>
+#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/tile/tile_id.hpp>
+#include <mbgl/util/shared_thread_pool.hpp>
+#include <tuple>
+#include <map>
+
+namespace mbgl {
+namespace style {
+
+CustomGeometrySource::CustomGeometrySource(std::string id,
+ const CustomGeometrySource::Options options)
+ : Source(makeMutable<CustomGeometrySource::Impl>(std::move(id), options)),
+ loader(std::make_unique<Actor<CustomTileLoader>>(*sharedThreadPool(), options.fetchTileFunction, options.cancelTileFunction)) {
+}
+
+CustomGeometrySource::~CustomGeometrySource() = default;
+
+const CustomGeometrySource::Impl& CustomGeometrySource::impl() const {
+ return static_cast<const CustomGeometrySource::Impl&>(*baseImpl);
+}
+
+void CustomGeometrySource::loadDescription(FileSource&) {
+ baseImpl = makeMutable<CustomGeometrySource::Impl>(impl(), loader->self());
+ loaded = true;
+}
+
+void CustomGeometrySource::setTileData(const CanonicalTileID& tileID,
+ const GeoJSON& data) {
+ loader->invoke(&CustomTileLoader::setTileData, tileID, data);
+}
+
+void CustomGeometrySource::invalidateTile(const CanonicalTileID& tileID) {
+ loader->invoke(&CustomTileLoader::invalidateTile, tileID);
+}
+
+void CustomGeometrySource::invalidateRegion(const LatLngBounds& bounds) {
+ loader->invoke(&CustomTileLoader::invalidateRegion, bounds, impl().getZoomRange());
+}
+
+} // namespace style
+} // namespace mbgl