summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-20 17:32:06 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-03-20 18:25:04 +0200
commit24198ebca86cbe1329a1854f080e3f4638973142 (patch)
tree43447ee32faff421349706b8251d10d90fc9bc2b /src
parentf846205eb68e9508a0d80259008cf9adb8069a1b (diff)
downloadqtlocation-mapboxgl-24198ebca86cbe1329a1854f080e3f4638973142.tar.gz
[core] Expose Source::getZoomRange
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/annotation/annotation_source.cpp2
-rw-r--r--src/mbgl/annotation/annotation_source.hpp2
-rw-r--r--src/mbgl/style/source.cpp6
-rw-r--r--src/mbgl/style/source_impl.hpp2
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp2
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.hpp3
-rw-r--r--src/mbgl/style/tile_source_impl.cpp2
-rw-r--r--src/mbgl/style/tile_source_impl.hpp4
8 files changed, 14 insertions, 9 deletions
diff --git a/src/mbgl/annotation/annotation_source.cpp b/src/mbgl/annotation/annotation_source.cpp
index a9db9ad8ae..7434029c4b 100644
--- a/src/mbgl/annotation/annotation_source.cpp
+++ b/src/mbgl/annotation/annotation_source.cpp
@@ -14,7 +14,7 @@ AnnotationSource::Impl::Impl(Source& base_)
: Source::Impl(SourceType::Annotations, AnnotationManager::SourceID, base_) {
}
-Range<uint8_t> AnnotationSource::Impl::getZoomRange() {
+Range<uint8_t> AnnotationSource::Impl::getZoomRange() const {
return { 0, 22 };
}
diff --git a/src/mbgl/annotation/annotation_source.hpp b/src/mbgl/annotation/annotation_source.hpp
index d995222f33..62d1aa3488 100644
--- a/src/mbgl/annotation/annotation_source.hpp
+++ b/src/mbgl/annotation/annotation_source.hpp
@@ -20,7 +20,7 @@ public:
private:
uint16_t getTileSize() const final { return util::tileSize; }
- Range<uint8_t> getZoomRange() final;
+ Range<uint8_t> getZoomRange() const final;
std::unique_ptr<Tile> createTile(const OverscaledTileID&, const style::UpdateParameters&) final;
};
diff --git a/src/mbgl/style/source.cpp b/src/mbgl/style/source.cpp
index 25c06024d6..9ef245ac34 100644
--- a/src/mbgl/style/source.cpp
+++ b/src/mbgl/style/source.cpp
@@ -17,7 +17,11 @@ const std::string& Source::getID() const {
optional<std::string> Source::getAttribution() const {
return baseImpl->getAttribution();
}
-
+
+Range<uint8_t> Source::getZoomRange() const {
+ return baseImpl->getZoomRange();
+}
+
std::vector<Feature> Source::querySourceFeatures(const SourceQueryOptions& options) {
return baseImpl->querySourceFeatures(options);
}
diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp
index b9707edaa7..fbec2b0eba 100644
--- a/src/mbgl/style/source_impl.hpp
+++ b/src/mbgl/style/source_impl.hpp
@@ -83,6 +83,7 @@ public:
const std::string id;
virtual optional<std::string> getAttribution() const { return {}; };
+ virtual Range<uint8_t> getZoomRange() const = 0;
bool loaded = false;
@@ -109,7 +110,6 @@ private:
void onTileError(Tile&, std::exception_ptr) override;
virtual uint16_t getTileSize() const = 0;
- virtual Range<uint8_t> getZoomRange() = 0;
virtual std::unique_ptr<Tile> createTile(const OverscaledTileID&, const UpdateParameters&) = 0;
std::map<UnwrappedTileID, RenderTile> renderTiles;
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index c7c3753076..5ceb4f71e0 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -153,7 +153,7 @@ void GeoJSONSource::Impl::loadDescription(FileSource& fileSource) {
});
}
-Range<uint8_t> GeoJSONSource::Impl::getZoomRange() {
+Range<uint8_t> GeoJSONSource::Impl::getZoomRange() const {
assert(loaded);
return { 0, options.maxzoom };
}
diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp
index eec7cf0605..05302d6bc0 100644
--- a/src/mbgl/style/sources/geojson_source_impl.hpp
+++ b/src/mbgl/style/sources/geojson_source_impl.hpp
@@ -28,10 +28,11 @@ public:
return util::tileSize;
}
+ Range<uint8_t> getZoomRange() const final;
+
private:
void _setGeoJSON(const GeoJSON&);
- Range<uint8_t> getZoomRange() final;
std::unique_ptr<Tile> createTile(const OverscaledTileID&, const UpdateParameters&) final;
GeoJSONOptions options;
diff --git a/src/mbgl/style/tile_source_impl.cpp b/src/mbgl/style/tile_source_impl.cpp
index bda602bb5f..44a25a8bfb 100644
--- a/src/mbgl/style/tile_source_impl.cpp
+++ b/src/mbgl/style/tile_source_impl.cpp
@@ -113,7 +113,7 @@ void TileSourceImpl::loadDescription(FileSource& fileSource) {
});
}
-Range<uint8_t> TileSourceImpl::getZoomRange() {
+Range<uint8_t> TileSourceImpl::getZoomRange() const {
assert(loaded);
return tileset.zoomRange;
}
diff --git a/src/mbgl/style/tile_source_impl.hpp b/src/mbgl/style/tile_source_impl.hpp
index 2b17872d2b..1fda3b3769 100644
--- a/src/mbgl/style/tile_source_impl.hpp
+++ b/src/mbgl/style/tile_source_impl.hpp
@@ -36,9 +36,9 @@ public:
optional<std::string> getAttribution() const override;
-protected:
- Range<uint8_t> getZoomRange() final;
+ Range<uint8_t> getZoomRange() const final;
+protected:
const variant<std::string, Tileset> urlOrTileset;
const uint16_t tileSize;