[core] Merge LiveTileData into VectorTileData

To encapsulate the differences, this introduces an abstract
GeometryTileMonitor class, with concrete VectorTileMonitor and
AnnotationTileMonitor implementations, and makes pbf parsing for
VectorTile data happen lazily in getLayer, since we want that to
happen on the worker thread, rather than when VectorTile is created.

Fixes #2792
This commit is contained in:
John Firebaugh
2015-10-28 14:51:16 -07:00
parent 978da4224e
commit e2dc956eb6
12 changed files with 233 additions and 352 deletions

View File

@@ -46,12 +46,28 @@ private:
class VectorTile : public GeometryTile {
public:
VectorTile(pbf);
VectorTile(std::shared_ptr<const std::string> data);
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
private:
std::map<std::string, util::ptr<GeometryTileLayer>> layers;
std::shared_ptr<const std::string> data;
mutable bool parsed = false;
mutable std::map<std::string, util::ptr<GeometryTileLayer>> layers;
};
class SourceInfo;
class TileID;
class VectorTileMonitor : public GeometryTileMonitor {
public:
VectorTileMonitor(const SourceInfo&, const TileID&, float pixelRatio);
Request* monitorTile(std::function<void (std::exception_ptr, std::unique_ptr<GeometryTile>)>) override;
private:
std::string url;
std::shared_ptr<const std::string> data;
};
}