summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-05 19:03:27 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-09-05 19:03:27 +0200
commit46b73b8a2cf5748596ab6023e2cb1f2ce45d2b0d (patch)
treedb1f2b4075c076bcd1e964ddb7414b81b6808464
parent51b2033fce5ca4d016b67b94abc50c1822c139fe (diff)
downloadqtlocation-mapboxgl-46b73b8a2cf5748596ab6023e2cb1f2ce45d2b0d.tar.gz
[core] Source::update => Source::{load,parse}Tiles, Source::load => Source::loadDescription
-rw-r--r--src/mbgl/annotation/annotation_source.cpp2
-rw-r--r--src/mbgl/annotation/annotation_source.hpp2
-rw-r--r--src/mbgl/map/map.cpp2
-rw-r--r--src/mbgl/style/source_impl.cpp11
-rw-r--r--src/mbgl/style/source_impl.hpp5
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp2
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.hpp2
-rw-r--r--src/mbgl/style/style.cpp7
-rw-r--r--src/mbgl/style/style.hpp2
-rw-r--r--src/mbgl/style/tile_source_impl.cpp2
-rw-r--r--src/mbgl/style/tile_source_impl.hpp2
-rw-r--r--test/style/source.cpp36
12 files changed, 39 insertions, 36 deletions
diff --git a/src/mbgl/annotation/annotation_source.cpp b/src/mbgl/annotation/annotation_source.cpp
index 61fc4ca2e4..a9db9ad8ae 100644
--- a/src/mbgl/annotation/annotation_source.cpp
+++ b/src/mbgl/annotation/annotation_source.cpp
@@ -18,7 +18,7 @@ Range<uint8_t> AnnotationSource::Impl::getZoomRange() {
return { 0, 22 };
}
-void AnnotationSource::Impl::load(FileSource&) {
+void AnnotationSource::Impl::loadDescription(FileSource&) {
loaded = true;
}
diff --git a/src/mbgl/annotation/annotation_source.hpp b/src/mbgl/annotation/annotation_source.hpp
index db9221788f..d995222f33 100644
--- a/src/mbgl/annotation/annotation_source.hpp
+++ b/src/mbgl/annotation/annotation_source.hpp
@@ -16,7 +16,7 @@ class AnnotationSource::Impl : public style::Source::Impl {
public:
Impl(Source&);
- void load(FileSource&) final;
+ void loadDescription(FileSource&) final;
private:
uint16_t getTileSize() const final { return util::tileSize; }
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 3a307735ab..cb3a1fefcb 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -236,7 +236,7 @@ void Map::Impl::update() {
*annotationManager,
*style);
- style->update(parameters);
+ style->updateTiles(parameters);
if (mode == MapMode::Continuous) {
view.invalidate();
diff --git a/src/mbgl/style/source_impl.cpp b/src/mbgl/style/source_impl.cpp
index 6f4772bfac..595eaf97e5 100644
--- a/src/mbgl/style/source_impl.cpp
+++ b/src/mbgl/style/source_impl.cpp
@@ -77,11 +77,9 @@ const std::map<UnwrappedTileID, RenderTile>& Source::Impl::getRenderTiles() cons
return renderTiles;
}
-bool Source::Impl::update(const UpdateParameters& parameters) {
- bool allTilesUpdated = true;
-
- if (!loaded || parameters.animationTime <= updated) {
- return allTilesUpdated;
+void Source::Impl::loadTiles(const UpdateParameters& parameters) {
+ if (!loaded) {
+ return;
}
const uint16_t tileSize = getTileSize();
@@ -163,7 +161,10 @@ bool Source::Impl::update(const UpdateParameters& parameters) {
++retainIt;
}
}
+}
+bool Source::Impl::parseTiles(const UpdateParameters& parameters) {
+ bool allTilesUpdated = true;
const PlacementConfig newConfig{ parameters.transformState.getAngle(),
parameters.transformState.getPitch(),
parameters.debugOptions & MapDebugOptions::Collision };
diff --git a/src/mbgl/style/source_impl.hpp b/src/mbgl/style/source_impl.hpp
index 2602c02eb9..7a29e3db54 100644
--- a/src/mbgl/style/source_impl.hpp
+++ b/src/mbgl/style/source_impl.hpp
@@ -40,14 +40,15 @@ public:
Impl(SourceType, std::string id, Source&);
~Impl() override;
- virtual void load(FileSource&) = 0;
+ virtual void loadDescription(FileSource&) = 0;
bool isLoaded() const;
// Request or parse all the tiles relevant for the "TransformState". This method
// will return true if all the tiles were scheduled for updating of false if
// they were not. shouldReparsePartialTiles must be set to "true" if there is
// new data available that a tile in the "partial" state might be interested at.
- bool update(const UpdateParameters&);
+ void loadTiles(const UpdateParameters&);
+ bool parseTiles(const UpdateParameters&);
void startRender(algorithm::ClipIDGenerator&,
const mat4& projMatrix,
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index 1e02270819..032576b47e 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -67,7 +67,7 @@ void GeoJSONSource::Impl::setGeoJSON(const GeoJSON& geoJSON) {
}
}
-void GeoJSONSource::Impl::load(FileSource& fileSource) {
+void GeoJSONSource::Impl::loadDescription(FileSource& fileSource) {
if (!url) {
loaded = true;
return;
diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp
index 684b79b3fa..cf079e472c 100644
--- a/src/mbgl/style/sources/geojson_source_impl.hpp
+++ b/src/mbgl/style/sources/geojson_source_impl.hpp
@@ -20,7 +20,7 @@ public:
void setGeoJSON(const GeoJSON&);
- void load(FileSource&) final;
+ void loadDescription(FileSource&) final;
uint16_t getTileSize() const final {
return util::tileSize;
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index ae6bc14b8b..20202cbcf4 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -197,11 +197,12 @@ double Style::getDefaultPitch() const {
return defaultPitch;
}
-void Style::update(const UpdateParameters& parameters) {
+void Style::updateTiles(const UpdateParameters& parameters) {
bool allTilesUpdated = true;
for (const auto& source : sources) {
- if (!source->baseImpl->update(parameters)) {
+ source->baseImpl->loadTiles(parameters);
+ if (!source->baseImpl->parseTiles(parameters)) {
allTilesUpdated = false;
}
}
@@ -260,7 +261,7 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) {
if (source && layer->baseImpl->needsRendering(z)) {
source->baseImpl->enabled = true;
if (!source->baseImpl->loaded) {
- source->baseImpl->load(fileSource);
+ source->baseImpl->loadDescription(fileSource);
}
}
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 06a25385b6..671e25bdc1 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -48,7 +48,7 @@ public:
// Fetch the tiles needed by the current viewport and emit a signal when
// a tile is ready so observers can render the tile.
- void update(const UpdateParameters&);
+ void updateTiles(const UpdateParameters&);
void cascade(const TimePoint&, MapMode);
void recalculate(float z, const TimePoint&, MapMode);
diff --git a/src/mbgl/style/tile_source_impl.cpp b/src/mbgl/style/tile_source_impl.cpp
index 3999a88a07..b201045d03 100644
--- a/src/mbgl/style/tile_source_impl.cpp
+++ b/src/mbgl/style/tile_source_impl.cpp
@@ -49,7 +49,7 @@ TileSourceImpl::TileSourceImpl(SourceType type_, std::string id_, Source& base_,
TileSourceImpl::~TileSourceImpl() = default;
-void TileSourceImpl::load(FileSource& fileSource) {
+void TileSourceImpl::loadDescription(FileSource& fileSource) {
if (urlOrTileset.is<Tileset>()) {
tileset = urlOrTileset.get<Tileset>();
loaded = true;
diff --git a/src/mbgl/style/tile_source_impl.hpp b/src/mbgl/style/tile_source_impl.hpp
index 8f420a15d5..d0b4b3d8ee 100644
--- a/src/mbgl/style/tile_source_impl.hpp
+++ b/src/mbgl/style/tile_source_impl.hpp
@@ -24,7 +24,7 @@ public:
uint16_t tileSize);
~TileSourceImpl() override;
- void load(FileSource&) final;
+ void loadDescription(FileSource&) final;
uint16_t getTileSize() const final {
return tileSize;
diff --git a/test/style/source.cpp b/test/style/source.cpp
index 59b2524e17..cc23698b2b 100644
--- a/test/style/source.cpp
+++ b/test/style/source.cpp
@@ -87,7 +87,7 @@ TEST(Source, LoadingFail) {
VectorSource source("source", "url");
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
+ source.baseImpl->loadDescription(test.fileSource);
test.run();
}
@@ -110,7 +110,7 @@ TEST(Source, LoadingCorrupt) {
VectorSource source("source", "url");
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
+ source.baseImpl->loadDescription(test.fileSource);
test.run();
}
@@ -138,8 +138,8 @@ TEST(Source, RasterTileEmpty) {
RasterSource source("source", tileset, 512);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -167,8 +167,8 @@ TEST(Source, VectorTileEmpty) {
VectorSource source("source", tileset);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -196,8 +196,8 @@ TEST(Source, RasterTileFail) {
RasterSource source("source", tileset, 512);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -225,8 +225,8 @@ TEST(Source, VectorTileFail) {
VectorSource source("source", tileset);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -253,8 +253,8 @@ TEST(Source, RasterTileCorrupt) {
RasterSource source("source", tileset, 512);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -285,8 +285,8 @@ TEST(Source, VectorTileCorrupt) {
VectorSource source("source", tileset);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -312,8 +312,8 @@ TEST(Source, RasterTileCancel) {
RasterSource source("source", tileset, 512);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}
@@ -339,8 +339,8 @@ TEST(Source, VectorTileCancel) {
VectorSource source("source", tileset);
source.baseImpl->setObserver(&test.observer);
- source.baseImpl->load(test.fileSource);
- source.baseImpl->update(test.updateParameters);
+ source.baseImpl->loadDescription(test.fileSource);
+ source.baseImpl->loadTiles(test.updateParameters);
test.run();
}