Eliminate Map::getStyle()
This commit is contained in:
@@ -126,7 +126,6 @@ public:
|
||||
|
||||
public:
|
||||
inline const TransformState &getState() const { return state; }
|
||||
inline util::ptr<Style> getStyle() const { return style; }
|
||||
inline timestamp getAnimationTime() const { return animationTime; }
|
||||
inline timestamp getTime() const { return animationTime; }
|
||||
void updateTiles();
|
||||
|
||||
@@ -24,6 +24,7 @@ class SpriteAtlas;
|
||||
class Sprite;
|
||||
class FileSource;
|
||||
class Texturepool;
|
||||
class Style;
|
||||
class Painter;
|
||||
class StyleLayer;
|
||||
class TransformState;
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
|
||||
void load(Map&, FileSource&);
|
||||
bool update(Map&, uv::worker&,
|
||||
util::ptr<Style>,
|
||||
GlyphAtlas&, GlyphStore&,
|
||||
SpriteAtlas&, util::ptr<Sprite>,
|
||||
Texturepool&, FileSource&);
|
||||
@@ -57,11 +59,13 @@ private:
|
||||
std::forward_list<Tile::ID> coveringTiles(const TransformState&) const;
|
||||
|
||||
bool updateTiles(Map&, uv::worker&,
|
||||
util::ptr<Style>,
|
||||
GlyphAtlas&, GlyphStore&,
|
||||
SpriteAtlas&, util::ptr<Sprite>,
|
||||
Texturepool&, FileSource&);
|
||||
|
||||
TileData::State addTile(Map&, uv::worker&,
|
||||
util::ptr<Style>,
|
||||
GlyphAtlas&, GlyphStore&,
|
||||
SpriteAtlas&, util::ptr<Sprite>,
|
||||
FileSource&, Texturepool&,
|
||||
|
||||
@@ -26,12 +26,14 @@ class GlyphStore;
|
||||
class SpriteAtlas;
|
||||
class Sprite;
|
||||
class Texturepool;
|
||||
class Style;
|
||||
|
||||
class VectorTileData : public TileData {
|
||||
friend class TileParser;
|
||||
|
||||
public:
|
||||
VectorTileData(Tile::ID const&, Map&,
|
||||
util::ptr<Style>,
|
||||
GlyphAtlas&, GlyphStore&,
|
||||
SpriteAtlas&, util::ptr<Sprite>,
|
||||
Texturepool&,
|
||||
@@ -62,6 +64,7 @@ protected:
|
||||
SpriteAtlas& spriteAtlas;
|
||||
util::ptr<Sprite> sprite;
|
||||
Texturepool& texturepool;
|
||||
util::ptr<Style> style;
|
||||
|
||||
public:
|
||||
const float depth;
|
||||
|
||||
@@ -643,7 +643,7 @@ void Map::updateSources(const util::ptr<StyleLayerGroup> &group) {
|
||||
void Map::updateTiles() {
|
||||
for (const util::ptr<StyleSource> &source : getActiveSources()) {
|
||||
source->source->update(*this, getWorker(),
|
||||
glyphAtlas, *glyphStore,
|
||||
style, glyphAtlas, *glyphStore,
|
||||
spriteAtlas, getSprite(),
|
||||
*texturepool, *fileSource);
|
||||
}
|
||||
|
||||
@@ -62,11 +62,15 @@ void Source::load(Map& map, FileSource& fileSource) {
|
||||
}
|
||||
|
||||
bool Source::update(Map& map, uv::worker& worker,
|
||||
util::ptr<Style> style,
|
||||
GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
|
||||
SpriteAtlas& spriteAtlas, util::ptr<Sprite> sprite,
|
||||
Texturepool& texturepool, FileSource& fileSource) {
|
||||
if (loaded && map.getTime() > updated) {
|
||||
return updateTiles(map, worker, glyphAtlas, glyphStore, spriteAtlas, sprite, texturepool, fileSource);
|
||||
return updateTiles(map, worker, style,
|
||||
glyphAtlas, glyphStore,
|
||||
spriteAtlas, sprite,
|
||||
texturepool, fileSource);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -163,6 +167,7 @@ TileData::State Source::hasTile(const Tile::ID& id) {
|
||||
}
|
||||
|
||||
TileData::State Source::addTile(Map& map, uv::worker& worker,
|
||||
util::ptr<Style> style,
|
||||
GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
|
||||
SpriteAtlas& spriteAtlas, util::ptr<Sprite> sprite,
|
||||
FileSource& fileSource, Texturepool& texturepool,
|
||||
@@ -194,7 +199,10 @@ TileData::State Source::addTile(Map& map, uv::worker& worker,
|
||||
if (!new_tile.data) {
|
||||
// If we don't find working tile data, we're just going to load it.
|
||||
if (info->type == SourceType::Vector) {
|
||||
new_tile.data = std::make_shared<VectorTileData>(normalized_id, map, glyphAtlas, glyphStore, spriteAtlas, sprite, texturepool, info);
|
||||
new_tile.data = std::make_shared<VectorTileData>(normalized_id, map, style,
|
||||
glyphAtlas, glyphStore,
|
||||
spriteAtlas, sprite,
|
||||
texturepool, info);
|
||||
} else if (info->type == SourceType::Raster) {
|
||||
new_tile.data = std::make_shared<RasterTileData>(normalized_id, map, texturepool, info);
|
||||
} else {
|
||||
@@ -288,7 +296,7 @@ bool Source::findLoadedParent(const Tile::ID& id, int32_t minCoveringZoom, std::
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Source::updateTiles(Map& map, uv::worker& worker,
|
||||
bool Source::updateTiles(Map& map, uv::worker& worker, util::ptr<Style> style,
|
||||
GlyphAtlas& glyphAtlas, GlyphStore& glyphStore,
|
||||
SpriteAtlas& spriteAtlas, util::ptr<Sprite> sprite,
|
||||
Texturepool& texturepool, FileSource& fileSource) {
|
||||
@@ -308,7 +316,7 @@ bool Source::updateTiles(Map& map, uv::worker& worker,
|
||||
|
||||
// Add existing child/parent tiles if the actual tile is not yet loaded
|
||||
for (const Tile::ID& id : required) {
|
||||
const TileData::State state = addTile(map, worker,
|
||||
const TileData::State state = addTile(map, worker, style,
|
||||
glyphAtlas, glyphStore,
|
||||
spriteAtlas, sprite,
|
||||
fileSource, texturepool,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
using namespace mbgl;
|
||||
|
||||
VectorTileData::VectorTileData(Tile::ID const& id_, Map &map_,
|
||||
util::ptr<Style> style_,
|
||||
GlyphAtlas& glyphAtlas_, GlyphStore& glyphStore_,
|
||||
SpriteAtlas& spriteAtlas_, util::ptr<Sprite> sprite_,
|
||||
Texturepool& texturepool_,
|
||||
@@ -19,6 +20,7 @@ VectorTileData::VectorTileData(Tile::ID const& id_, Map &map_,
|
||||
spriteAtlas(spriteAtlas_),
|
||||
sprite(sprite_),
|
||||
texturepool(texturepool_),
|
||||
style(style_),
|
||||
depth(id.z >= source->max_zoom ? map.getMaxZoom() - id.z : 1) {
|
||||
}
|
||||
|
||||
@@ -36,7 +38,7 @@ void VectorTileData::parse() {
|
||||
// Parsing creates state that is encapsulated in TileParser. While parsing,
|
||||
// the TileParser object writes results into this objects. All other state
|
||||
// is going to be discarded afterwards.
|
||||
TileParser parser(data, *this, map.getStyle(),
|
||||
TileParser parser(data, *this, style,
|
||||
glyphAtlas, glyphStore,
|
||||
spriteAtlas, sprite,
|
||||
texturepool);
|
||||
|
||||
Reference in New Issue
Block a user