summaryrefslogtreecommitdiff
path: root/include/mbgl/style/sources/custom_geometry_source.hpp
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 /include/mbgl/style/sources/custom_geometry_source.hpp
parent572822c8ca15be190b43afbf7f91d132e988bf21 (diff)
downloadqtlocation-mapboxgl-b44302af2aac3aa8ad7ee13be7c44fd1334cc81c.tar.gz
Bump Mapbox GL Nativeqt-v1.2.0
mapbox-gl-native @ cf3357ea4517e74ba3a63434c330a1506064b130
Diffstat (limited to 'include/mbgl/style/sources/custom_geometry_source.hpp')
-rw-r--r--include/mbgl/style/sources/custom_geometry_source.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp
new file mode 100644
index 0000000000..a0b990b44b
--- /dev/null
+++ b/include/mbgl/style/sources/custom_geometry_source.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <mbgl/style/source.hpp>
+#include <mbgl/util/geo.hpp>
+#include <mbgl/util/geojson.hpp>
+#include <mbgl/util/range.hpp>
+#include <mbgl/util/constants.hpp>
+
+namespace mbgl {
+
+class OverscaledTileID;
+class CanonicalTileID;
+template <class T>
+class Actor;
+
+namespace style {
+
+using TileFunction = std::function<void(const CanonicalTileID&)>;
+
+class CustomTileLoader;
+
+class CustomGeometrySource : public Source {
+public:
+ struct TileOptions {
+ double tolerance = 0.375;
+ uint16_t tileSize = util::tileSize;
+ uint16_t buffer = 128;
+ };
+
+ struct Options {
+ TileFunction fetchTileFunction;
+ TileFunction cancelTileFunction;
+ Range<uint8_t> zoomRange = { 0, 18};
+ TileOptions tileOptions;
+ };
+public:
+ CustomGeometrySource(std::string id, CustomGeometrySource::Options options);
+ ~CustomGeometrySource() final;
+ void loadDescription(FileSource&) final;
+ void setTileData(const CanonicalTileID&, const GeoJSON&);
+ void invalidateTile(const CanonicalTileID&);
+ void invalidateRegion(const LatLngBounds&);
+ // Private implementation
+ class Impl;
+ const Impl& impl() const;
+private:
+ std::unique_ptr<Actor<CustomTileLoader>> loader;
+};
+
+template <>
+inline bool Source::is<CustomGeometrySource>() const {
+ return getType() == SourceType::CustomVector;
+}
+
+} // namespace style
+} // namespace mbgl