[core] Introduce RenderTileSource

RenderTileSource is a base class for the render sources that provide render tiles.

* Removes repeated code
* Simplifies render source code refactoring and improves readability
This commit is contained in:
Mikhail Pozdnyakov
2019-05-29 11:07:46 +03:00
parent 5bb0a49dc9
commit b50aa497cc
13 changed files with 150 additions and 358 deletions

View File

@@ -137,6 +137,7 @@
"src/mbgl/renderer/sources/render_image_source.cpp",
"src/mbgl/renderer/sources/render_raster_dem_source.cpp",
"src/mbgl/renderer/sources/render_raster_source.cpp",
"src/mbgl/renderer/sources/render_tile_source.cpp",
"src/mbgl/renderer/sources/render_vector_source.cpp",
"src/mbgl/renderer/style_diff.cpp",
"src/mbgl/renderer/tile_pyramid.cpp",
@@ -651,6 +652,7 @@
"mbgl/renderer/sources/render_image_source.hpp": "src/mbgl/renderer/sources/render_image_source.hpp",
"mbgl/renderer/sources/render_raster_dem_source.hpp": "src/mbgl/renderer/sources/render_raster_dem_source.hpp",
"mbgl/renderer/sources/render_raster_source.hpp": "src/mbgl/renderer/sources/render_raster_source.hpp",
"mbgl/renderer/sources/render_tile_source.hpp": "src/mbgl/renderer/sources/render_tile_source.hpp",
"mbgl/renderer/sources/render_vector_source.hpp": "src/mbgl/renderer/sources/render_vector_source.hpp",
"mbgl/renderer/style_diff.hpp": "src/mbgl/renderer/style_diff.hpp",
"mbgl/renderer/tile_mask.hpp": "src/mbgl/renderer/tile_mask.hpp",

View File

@@ -8,7 +8,7 @@ namespace mbgl {
using namespace style;
RenderCustomGeometrySource::RenderCustomGeometrySource(Immutable<style::CustomGeometrySource::Impl> impl_)
: RenderSource(impl_) {
: RenderTileSource(std::move(impl_)) {
tilePyramid.setObserver(this);
}
@@ -16,10 +16,6 @@ const style::CustomGeometrySource::Impl& RenderCustomGeometrySource::impl() cons
return static_cast<const style::CustomGeometrySource::Impl&>(*baseImpl);
}
bool RenderCustomGeometrySource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderCustomGeometrySource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<style::LayerProperties>>& layers,
const bool needsRendering,
@@ -47,49 +43,4 @@ void RenderCustomGeometrySource::update(Immutable<style::Source::Impl> baseImpl_
});
}
void RenderCustomGeometrySource::upload(gfx::UploadPass& uploadPass) {
tilePyramid.upload(uploadPass);
}
void RenderCustomGeometrySource::prepare(const SourcePrepareParameters& parameters) {
tilePyramid.prepare(parameters);
}
void RenderCustomGeometrySource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderCustomGeometrySource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderCustomGeometrySource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderCustomGeometrySource::getRenderTiles() {
return tilePyramid.getRenderTiles();
}
std::unordered_map<std::string, std::vector<Feature>>
RenderCustomGeometrySource::queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const {
return tilePyramid.queryRenderedFeatures(geometry, transformState, layers, options, projMatrix);
}
std::vector<Feature> RenderCustomGeometrySource::querySourceFeatures(const SourceQueryOptions& options) const {
return tilePyramid.querySourceFeatures(options);
}
void RenderCustomGeometrySource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderCustomGeometrySource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -1,48 +1,22 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/style/sources/custom_geometry_source_impl.hpp>
namespace mbgl {
class RenderCustomGeometrySource : public RenderSource {
class RenderCustomGeometrySource final : public RenderTileSource {
public:
RenderCustomGeometrySource(Immutable<style::CustomGeometrySource::Impl>);
bool isLoaded() const final;
explicit RenderCustomGeometrySource(Immutable<style::CustomGeometrySource::Impl>);
void update(Immutable<style::Source::Impl>,
const std::vector<Immutable<style::LayerProperties>>&,
bool needsRendering,
bool needsRelayout,
const TileParameters&) final;
void upload(gfx::UploadPass&) final;
void prepare(const SourcePrepareParameters&) final;
void finishRender(PaintParameters&) final;
void updateFadingTiles() final;
bool hasFadingTiles() const final;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const final;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
const TileParameters&) override;
private:
const style::CustomGeometrySource::Impl& impl() const;
TilePyramid tilePyramid;
};
template <>

View File

@@ -66,8 +66,7 @@ MAPBOX_ETERNAL_CONSTEXPR const auto extensionGetters = mapbox::eternal::hash_map
} // namespace
RenderGeoJSONSource::RenderGeoJSONSource(Immutable<style::GeoJSONSource::Impl> impl_)
: RenderSource(impl_) {
tilePyramid.setObserver(this);
: RenderTileSource(std::move(impl_)) {
}
RenderGeoJSONSource::~RenderGeoJSONSource() = default;
@@ -76,10 +75,6 @@ const style::GeoJSONSource::Impl& RenderGeoJSONSource::impl() const {
return static_cast<const style::GeoJSONSource::Impl&>(*baseImpl);
}
bool RenderGeoJSONSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderGeoJSONSource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<LayerProperties>>& layers,
const bool needsRendering,
@@ -123,43 +118,6 @@ void RenderGeoJSONSource::update(Immutable<style::Source::Impl> baseImpl_,
});
}
void RenderGeoJSONSource::upload(gfx::UploadPass& parameters) {
tilePyramid.upload(parameters);
}
void RenderGeoJSONSource::prepare(const SourcePrepareParameters& parameters) {
tilePyramid.prepare(parameters);
}
void RenderGeoJSONSource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderGeoJSONSource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderGeoJSONSource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderGeoJSONSource::getRenderTiles() {
return tilePyramid.getRenderTiles();
}
std::unordered_map<std::string, std::vector<Feature>>
RenderGeoJSONSource::queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const {
return tilePyramid.queryRenderedFeatures(geometry, transformState, layers, options, projMatrix);
}
std::vector<Feature> RenderGeoJSONSource::querySourceFeatures(const SourceQueryOptions& options) const {
return tilePyramid.querySourceFeatures(options);
}
mapbox::util::variant<Value, FeatureCollection>
RenderGeoJSONSource::queryFeatureExtensions(const Feature& feature,
const std::string& extension,
@@ -187,12 +145,4 @@ RenderGeoJSONSource::queryFeatureExtensions(const Feature& feature,
return extensionIt->second(std::move(jsonData), static_cast<std::uint32_t>(*clusterID), args);
}
void RenderGeoJSONSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderGeoJSONSource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/style/sources/geojson_source_impl.hpp>
namespace mbgl {
@@ -10,50 +9,26 @@ namespace style {
class GeoJSONData;
} // namespace style
class RenderGeoJSONSource : public RenderSource {
class RenderGeoJSONSource final : public RenderTileSource {
public:
RenderGeoJSONSource(Immutable<style::GeoJSONSource::Impl>);
~RenderGeoJSONSource() final;
bool isLoaded() const final;
explicit RenderGeoJSONSource(Immutable<style::GeoJSONSource::Impl>);
~RenderGeoJSONSource() override;
void update(Immutable<style::Source::Impl>,
const std::vector<Immutable<style::LayerProperties>>&,
bool needsRendering,
bool needsRelayout,
const TileParameters&) final;
void upload(gfx::UploadPass&) final;
void prepare(const SourcePrepareParameters&) final;
void finishRender(PaintParameters&) final;
void updateFadingTiles() final;
bool hasFadingTiles() const final;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const final;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
const TileParameters&) override;
FeatureExtensionValue
queryFeatureExtensions(const Feature& feature,
const std::string& extension,
const std::string& extensionField,
const optional<std::map<std::string, Value>>& args) const final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
const optional<std::map<std::string, Value>>& args) const override;
private:
const style::GeoJSONSource::Impl& impl() const;
TilePyramid tilePyramid;
std::weak_ptr<style::GeoJSONData> data;
};

View File

@@ -10,18 +10,13 @@ namespace mbgl {
using namespace style;
RenderRasterDEMSource::RenderRasterDEMSource(Immutable<style::RasterSource::Impl> impl_)
: RenderSource(impl_) {
tilePyramid.setObserver(this);
: RenderTileSource(std::move(impl_)) {
}
const style::RasterSource::Impl& RenderRasterDEMSource::impl() const {
return static_cast<const style::RasterSource::Impl&>(*baseImpl);
}
bool RenderRasterDEMSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderRasterDEMSource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<LayerProperties>>& layers,
const bool needsRendering,
@@ -123,32 +118,12 @@ void RenderRasterDEMSource::onTileChanged(Tile& tile){
}
}
}
RenderSource::onTileChanged(tile);
}
void RenderRasterDEMSource::upload(gfx::UploadPass& parameters) {
tilePyramid.upload(parameters);
RenderTileSource::onTileChanged(tile);
}
void RenderRasterDEMSource::prepare(const SourcePrepareParameters& parameters) {
algorithm::updateTileMasks(tilePyramid.getRenderTiles());
tilePyramid.prepare(parameters);
}
void RenderRasterDEMSource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderRasterDEMSource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderRasterDEMSource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderRasterDEMSource::getRenderTiles() {
return tilePyramid.getRenderTiles();
RenderTileSource::prepare(parameters);
}
std::unordered_map<std::string, std::vector<Feature>>
@@ -157,19 +132,12 @@ RenderRasterDEMSource::queryRenderedFeatures(const ScreenLineString&,
const std::vector<const RenderLayer*>&,
const RenderedQueryOptions&,
const mat4&) const {
return std::unordered_map<std::string, std::vector<Feature>> {};
return std::unordered_map<std::string, std::vector<Feature>>{};
}
std::vector<Feature> RenderRasterDEMSource::querySourceFeatures(const SourceQueryOptions&) const {
return {};
}
void RenderRasterDEMSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderRasterDEMSource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -1,16 +1,14 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/style/sources/raster_source_impl.hpp>
#include <mbgl/util/constants.hpp>
namespace mbgl {
class RenderRasterDEMSource : public RenderSource {
class RenderRasterDEMSource final : public RenderTileSource {
public:
RenderRasterDEMSource(Immutable<style::RasterSource::Impl>);
bool isLoaded() const final;
explicit RenderRasterDEMSource(Immutable<style::RasterSource::Impl>);
void update(Immutable<style::Source::Impl>,
const std::vector<Immutable<style::LayerProperties>>&,
@@ -18,40 +16,27 @@ public:
bool needsRelayout,
const TileParameters&) final;
void upload(gfx::UploadPass&) final;
void prepare(const SourcePrepareParameters&) final;
void finishRender(PaintParameters&) final;
void updateFadingTiles() final;
bool hasFadingTiles() const final;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
void prepare(const SourcePrepareParameters&) override;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const final;
const mat4& projMatrix) const override;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
querySourceFeatures(const SourceQueryOptions&) const override;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
uint8_t getMaxZoom() const {
return maxzoom;
};
uint8_t getMaxZoom() const { return maxzoom; }
private:
const style::RasterSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<Tileset> tileset;
uint8_t maxzoom = 15;
uint8_t maxzoom = util::TERRAIN_RGB_MAXZOOM;
protected:
void onTileChanged(Tile&) final;
void onTileChanged(Tile&) override;
};
template <>

View File

@@ -8,18 +8,13 @@ namespace mbgl {
using namespace style;
RenderRasterSource::RenderRasterSource(Immutable<style::RasterSource::Impl> impl_)
: RenderSource(impl_) {
tilePyramid.setObserver(this);
: RenderTileSource(std::move(impl_)) {
}
const style::RasterSource::Impl& RenderRasterSource::impl() const {
return static_cast<const style::RasterSource::Impl&>(*baseImpl);
}
bool RenderRasterSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<LayerProperties>>& layers,
const bool needsRendering,
@@ -57,29 +52,9 @@ void RenderRasterSource::update(Immutable<style::Source::Impl> baseImpl_,
});
}
void RenderRasterSource::upload(gfx::UploadPass& parameters) {
tilePyramid.upload(parameters);
}
void RenderRasterSource::prepare(const SourcePrepareParameters& parameters) {
algorithm::updateTileMasks(tilePyramid.getRenderTiles());
tilePyramid.prepare(parameters);
}
void RenderRasterSource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderRasterSource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderRasterSource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderRasterSource::getRenderTiles() {
return tilePyramid.getRenderTiles();
RenderTileSource::prepare(parameters);
}
std::unordered_map<std::string, std::vector<Feature>>
@@ -88,19 +63,12 @@ RenderRasterSource::queryRenderedFeatures(const ScreenLineString&,
const std::vector<const RenderLayer*>&,
const RenderedQueryOptions&,
const mat4&) const {
return std::unordered_map<std::string, std::vector<Feature>> {};
return std::unordered_map<std::string, std::vector<Feature>>{};
}
std::vector<Feature> RenderRasterSource::querySourceFeatures(const SourceQueryOptions&) const {
return {};
}
void RenderRasterSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderRasterSource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -1,48 +1,33 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/style/sources/raster_source_impl.hpp>
namespace mbgl {
class RenderRasterSource : public RenderSource {
class RenderRasterSource final : public RenderTileSource {
public:
RenderRasterSource(Immutable<style::RasterSource::Impl>);
bool isLoaded() const final;
explicit RenderRasterSource(Immutable<style::RasterSource::Impl>);
void update(Immutable<style::Source::Impl>,
const std::vector<Immutable<style::LayerProperties>>&,
bool needsRendering,
bool needsRelayout,
const TileParameters&) final;
void upload(gfx::UploadPass&) final;
void prepare(const SourcePrepareParameters&) final;
void finishRender(PaintParameters&) final;
void updateFadingTiles() final;
bool hasFadingTiles() const final;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const final;
const mat4& projMatrix) const override;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
querySourceFeatures(const SourceQueryOptions&) const override;
private:
const style::RasterSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<Tileset> tileset;
};

View File

@@ -0,0 +1,66 @@
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/tile/vector_tile.hpp>
namespace mbgl {
using namespace style;
RenderTileSource::RenderTileSource(Immutable<style::Source::Impl> impl_)
: RenderSource(std::move(impl_)) {
tilePyramid.setObserver(this);
}
RenderTileSource::~RenderTileSource() = default;
bool RenderTileSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderTileSource::upload(gfx::UploadPass& parameters) {
tilePyramid.upload(parameters);
}
void RenderTileSource::prepare(const SourcePrepareParameters& parameters) {
tilePyramid.prepare(parameters);
}
void RenderTileSource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderTileSource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderTileSource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderTileSource::getRenderTiles() {
return tilePyramid.getRenderTiles();
}
std::unordered_map<std::string, std::vector<Feature>>
RenderTileSource::queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const {
return tilePyramid.queryRenderedFeatures(geometry, transformState, layers, options, projMatrix);
}
std::vector<Feature> RenderTileSource::querySourceFeatures(const SourceQueryOptions& options) const {
return tilePyramid.querySourceFeatures(options);
}
void RenderTileSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderTileSource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -0,0 +1,44 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/style/sources/vector_source_impl.hpp>
namespace mbgl {
/**
* @brief Base class for render sources that provide render tiles.
*/
class RenderTileSource : public RenderSource {
public:
RenderTileSource(Immutable<style::Source::Impl>);
~RenderTileSource() override;
bool isLoaded() const override;
void upload(gfx::UploadPass&) override;
void prepare(const SourcePrepareParameters&) override;
void finishRender(PaintParameters&) override;
void updateFadingTiles() override;
bool hasFadingTiles() const override;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() override;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const override;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const override;
void reduceMemoryUse() override;
void dumpDebugLogs() const override;
protected:
TilePyramid tilePyramid;
};
} // namespace mbgl

View File

@@ -8,18 +8,13 @@ namespace mbgl {
using namespace style;
RenderVectorSource::RenderVectorSource(Immutable<style::VectorSource::Impl> impl_)
: RenderSource(impl_) {
tilePyramid.setObserver(this);
: RenderTileSource(impl_) {
}
const style::VectorSource::Impl& RenderVectorSource::impl() const {
return static_cast<const style::VectorSource::Impl&>(*baseImpl);
}
bool RenderVectorSource::isLoaded() const {
return tilePyramid.isLoaded();
}
void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
const std::vector<Immutable<style::LayerProperties>>& layers,
const bool needsRendering,
@@ -57,49 +52,4 @@ void RenderVectorSource::update(Immutable<style::Source::Impl> baseImpl_,
});
}
void RenderVectorSource::upload(gfx::UploadPass& parameters) {
tilePyramid.upload(parameters);
}
void RenderVectorSource::prepare(const SourcePrepareParameters& parameters) {
tilePyramid.prepare(parameters);
}
void RenderVectorSource::finishRender(PaintParameters& parameters) {
tilePyramid.finishRender(parameters);
}
void RenderVectorSource::updateFadingTiles() {
tilePyramid.updateFadingTiles();
}
bool RenderVectorSource::hasFadingTiles() const {
return tilePyramid.hasFadingTiles();
}
std::vector<std::reference_wrapper<RenderTile>> RenderVectorSource::getRenderTiles() {
return tilePyramid.getRenderTiles();
}
std::unordered_map<std::string, std::vector<Feature>>
RenderVectorSource::queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const {
return tilePyramid.queryRenderedFeatures(geometry, transformState, layers, options, projMatrix);
}
std::vector<Feature> RenderVectorSource::querySourceFeatures(const SourceQueryOptions& options) const {
return tilePyramid.querySourceFeatures(options);
}
void RenderVectorSource::reduceMemoryUse() {
tilePyramid.reduceMemoryUse();
}
void RenderVectorSource::dumpDebugLogs() const {
tilePyramid.dumpDebugLogs();
}
} // namespace mbgl

View File

@@ -1,48 +1,22 @@
#pragma once
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/sources/render_tile_source.hpp>
#include <mbgl/renderer/tile_pyramid.hpp>
#include <mbgl/style/sources/vector_source_impl.hpp>
namespace mbgl {
class RenderVectorSource : public RenderSource {
class RenderVectorSource final : public RenderTileSource {
public:
RenderVectorSource(Immutable<style::VectorSource::Impl>);
bool isLoaded() const final;
explicit RenderVectorSource(Immutable<style::VectorSource::Impl>);
void update(Immutable<style::Source::Impl>,
const std::vector<Immutable<style::LayerProperties>>&,
bool needsRendering,
bool needsRelayout,
const TileParameters&) final;
void upload(gfx::UploadPass&) final;
void prepare(const SourcePrepareParameters&) final;
void finishRender(PaintParameters&) final;
void updateFadingTiles() final;
bool hasFadingTiles() const final;
std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
std::unordered_map<std::string, std::vector<Feature>>
queryRenderedFeatures(const ScreenLineString& geometry,
const TransformState& transformState,
const std::vector<const RenderLayer*>& layers,
const RenderedQueryOptions& options,
const mat4& projMatrix) const final;
std::vector<Feature>
querySourceFeatures(const SourceQueryOptions&) const final;
void reduceMemoryUse() final;
void dumpDebugLogs() const final;
private:
const style::VectorSource::Impl& impl() const;
TilePyramid tilePyramid;
optional<Tileset> tileset;
};