summaryrefslogtreecommitdiff
path: root/include/mbgl/storage
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2018-03-23 15:44:21 +0200
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2018-08-20 22:49:01 +0300
commitfae099933b23a36176dcc8c4a91c37816fa9b7fe (patch)
treec1a57fb87405cd341c2dc8e5b5bffc9b4b08cc7f /include/mbgl/storage
parentcf0313f21919b0df4840d3085d9db3fe4b6bbbec (diff)
downloadqtlocation-mapboxgl-fae099933b23a36176dcc8c4a91c37816fa9b7fe.tar.gz
[core] offline region definition - add support for arbitrary geometries
Diffstat (limited to 'include/mbgl/storage')
-rw-r--r--include/mbgl/storage/offline.hpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/include/mbgl/storage/offline.hpp b/include/mbgl/storage/offline.hpp
index 62353446fa..b4e40cb5f3 100644
--- a/include/mbgl/storage/offline.hpp
+++ b/include/mbgl/storage/offline.hpp
@@ -1,8 +1,10 @@
#pragma once
#include <mbgl/util/geo.hpp>
+#include <mbgl/util/geometry.hpp>
#include <mbgl/util/range.hpp>
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/variant.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/storage/response.hpp>
@@ -30,22 +32,40 @@ public:
OfflineTilePyramidRegionDefinition(std::string, LatLngBounds, double, double, float);
/* Private */
- std::vector<CanonicalTileID> tileCover(style::SourceType, uint16_t tileSize, const Range<uint8_t>& zoomRange) const;
- uint64_t tileCount(style::SourceType, uint16_t tileSize, const Range<uint8_t>& zoomRange) const;
const std::string styleURL;
const LatLngBounds bounds;
const double minZoom;
const double maxZoom;
const float pixelRatio;
-private:
- Range<uint8_t> coveringZoomRange(style::SourceType, uint16_t tileSize, const Range<uint8_t>& zoomRange) const;
};
/*
- * For the present, a tile pyramid is the only type of offline region. In the future,
- * other definition types will be available and this will be a variant type.
+ * An offline region defined by a style URL, geometry, zoom range, and
+ * device pixel ratio.
+ *
+ * Both minZoom and maxZoom must be ≥ 0, and maxZoom must be ≥ minZoom.
+ *
+ * maxZoom may be ∞, in which case for each tile source, the region will include
+ * tiles from minZoom up to the maximum zoom level provided by that source.
+ *
+ * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0.
+ */
+class OfflineGeometryRegionDefinition {
+public:
+ OfflineGeometryRegionDefinition(std::string styleURL, Geometry<double>, double minZoom, double maxZoom, float pixelRatio);
+
+ /* Private */
+ const std::string styleURL;
+ const Geometry<double> geometry;
+ const double minZoom;
+ const double maxZoom;
+ const float pixelRatio;
+};
+
+/*
+ * The offline region definition types supported
*/
-using OfflineRegionDefinition = OfflineTilePyramidRegionDefinition;
+using OfflineRegionDefinition = variant<OfflineTilePyramidRegionDefinition, OfflineGeometryRegionDefinition>;
/*
* The encoded format is private.