[core] Source::update => Source::{load,parse}Tiles, Source::load => Source::loadDescription
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -236,7 +236,7 @@ void Map::Impl::update() {
|
||||
*annotationManager,
|
||||
*style);
|
||||
|
||||
style->update(parameters);
|
||||
style->updateTiles(parameters);
|
||||
|
||||
if (mode == MapMode::Continuous) {
|
||||
view.invalidate();
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user