[core] Remove MapData dependency from AnnotationTile and StyleUpdateParameters
This commit is contained in:
@@ -28,18 +28,18 @@ util::ptr<GeometryTileLayer> AnnotationTile::getLayer(const std::string& name) c
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AnnotationTileMonitor::AnnotationTileMonitor(const TileID& tileID_, MapData& data_)
|
||||
AnnotationTileMonitor::AnnotationTileMonitor(const TileID& tileID_, AnnotationManager& annotationManager_)
|
||||
: tileID(tileID_),
|
||||
data(data_) {
|
||||
annotationManager(annotationManager_) {
|
||||
}
|
||||
|
||||
AnnotationTileMonitor::~AnnotationTileMonitor() {
|
||||
data.getAnnotationManager()->removeTileMonitor(*this);
|
||||
annotationManager.removeTileMonitor(*this);
|
||||
}
|
||||
|
||||
std::unique_ptr<AsyncRequest> AnnotationTileMonitor::monitorTile(const GeometryTileMonitor::Callback& callback_) {
|
||||
callback = callback_;
|
||||
data.getAnnotationManager()->addTileMonitor(*this);
|
||||
annotationManager.addTileMonitor(*this);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,11 @@ public:
|
||||
std::map<std::string, util::ptr<AnnotationTileLayer>> layers;
|
||||
};
|
||||
|
||||
class MapData;
|
||||
class AnnotationManager;
|
||||
|
||||
class AnnotationTileMonitor : public GeometryTileMonitor {
|
||||
public:
|
||||
// TODO: should just take AnnotationManager&, but we need to eliminate util::exclusive<AnnotationManager> from MapData first.
|
||||
AnnotationTileMonitor(const TileID&, MapData&);
|
||||
AnnotationTileMonitor(const TileID&, AnnotationManager&);
|
||||
~AnnotationTileMonitor();
|
||||
|
||||
void update(std::unique_ptr<GeometryTile>);
|
||||
@@ -52,7 +51,7 @@ public:
|
||||
TileID tileID;
|
||||
|
||||
private:
|
||||
MapData& data;
|
||||
AnnotationManager& annotationManager;
|
||||
GeometryTileMonitor::Callback callback;
|
||||
};
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ TileData::State Source::addTile(const TileID& tileID, const StyleUpdateParameter
|
||||
if (type == SourceType::Vector) {
|
||||
monitor = std::make_unique<VectorTileMonitor>(normalizedID, parameters.pixelRatio, info->tiles.at(0), parameters.fileSource);
|
||||
} else if (type == SourceType::Annotations) {
|
||||
monitor = std::make_unique<AnnotationTileMonitor>(normalizedID, parameters.data);
|
||||
monitor = std::make_unique<AnnotationTileMonitor>(normalizedID, parameters.annotationManager);
|
||||
} else if (type == SourceType::GeoJSON) {
|
||||
monitor = std::make_unique<GeoJSONTileMonitor>(geojsonvt.get(), normalizedID);
|
||||
} else {
|
||||
|
||||
@@ -159,7 +159,7 @@ void Style::update(const TransformState& transform, const TimePoint& timePoint,
|
||||
texturePool,
|
||||
shouldReparsePartialTiles,
|
||||
data.mode,
|
||||
data,
|
||||
*data.getAnnotationManager(),
|
||||
*this);
|
||||
|
||||
for (const auto& source : sources) {
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace mbgl {
|
||||
class TransformState;
|
||||
class Worker;
|
||||
class FileSource;
|
||||
class MapData;
|
||||
class Style;
|
||||
namespace gl { class TexturePool; }
|
||||
class AnnotationManager;
|
||||
|
||||
class StyleUpdateParameters {
|
||||
public:
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
gl::TexturePool& texturePool_,
|
||||
bool shouldReparsePartialTiles_,
|
||||
const MapMode mode_,
|
||||
MapData& data_,
|
||||
AnnotationManager& annotationManager_,
|
||||
Style& style_)
|
||||
: pixelRatio(pixelRatio_),
|
||||
debugOptions(debugOptions_),
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
texturePool(texturePool_),
|
||||
shouldReparsePartialTiles(shouldReparsePartialTiles_),
|
||||
mode(mode_),
|
||||
data(data_),
|
||||
annotationManager(annotationManager_),
|
||||
style(style_) {}
|
||||
|
||||
float pixelRatio;
|
||||
@@ -46,9 +46,9 @@ public:
|
||||
gl::TexturePool& texturePool;
|
||||
bool shouldReparsePartialTiles;
|
||||
const MapMode mode;
|
||||
AnnotationManager& annotationManager;
|
||||
|
||||
// TODO: remove
|
||||
MapData& data;
|
||||
Style& style;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user