diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-20 17:11:50 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-02 08:45:09 -0700 |
commit | 3f0c89d633a5056006557ad5f4b9e446807d00ee (patch) | |
tree | 5405c50dd26a5a393a982e8e0f76b764dbbccf48 /src/mbgl/annotation/render_annotation_source.cpp | |
parent | 197751bace6181f2c2dbe4c890f277a0dc7e58b1 (diff) | |
download | qtlocation-mapboxgl-3f0c89d633a5056006557ad5f4b9e446807d00ee.tar.gz |
[core] Refactor Source::*Impls into RenderSources and TilePyramid
Diffstat (limited to 'src/mbgl/annotation/render_annotation_source.cpp')
-rw-r--r-- | src/mbgl/annotation/render_annotation_source.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/mbgl/annotation/render_annotation_source.cpp b/src/mbgl/annotation/render_annotation_source.cpp new file mode 100644 index 0000000000..f926b6ce9a --- /dev/null +++ b/src/mbgl/annotation/render_annotation_source.cpp @@ -0,0 +1,79 @@ +#include <mbgl/annotation/render_annotation_source.hpp> +#include <mbgl/annotation/annotation_tile.hpp> +#include <mbgl/renderer/render_tile.hpp> + +#include <mbgl/algorithm/generate_clip_ids.hpp> +#include <mbgl/algorithm/generate_clip_ids_impl.hpp> + +namespace mbgl { + +using namespace style; + +RenderAnnotationSource::RenderAnnotationSource(const AnnotationSource::Impl& impl_) + : RenderSource(impl_) { + tilePyramid.setObserver(this); +} + +bool RenderAnnotationSource::isLoaded() const { + return tilePyramid.isLoaded(); +} + +void RenderAnnotationSource::invalidateTiles() { + tilePyramid.invalidateTiles(); +} + +void RenderAnnotationSource::startRender(algorithm::ClipIDGenerator& generator, const mat4& projMatrix, const mat4& clipMatrix, const TransformState& transform) { + generator.update(tilePyramid.getRenderTiles()); + tilePyramid.startRender(projMatrix, clipMatrix, transform); +} + +void RenderAnnotationSource::finishRender(Painter& painter) { + tilePyramid.finishRender(painter); +} + +std::map<UnwrappedTileID, RenderTile>& RenderAnnotationSource::getRenderTiles() { + return tilePyramid.getRenderTiles(); +} + +void RenderAnnotationSource::updateTiles(const UpdateParameters& parameters) { + tilePyramid.updateTiles(parameters, + SourceType::Annotations, + util::tileSize, + { 0, 22 }, + [&] (const OverscaledTileID& tileID) { + return std::make_unique<AnnotationTile>(tileID, parameters); + }); +} + +void RenderAnnotationSource::removeTiles() { + tilePyramid.removeTiles(); +} + +void RenderAnnotationSource::reloadTiles() { + tilePyramid.reloadTiles(); +} + +std::unordered_map<std::string, std::vector<Feature>> +RenderAnnotationSource::queryRenderedFeatures(const ScreenLineString& geometry, + const TransformState& transformState, + const RenderedQueryOptions& options) const { + return tilePyramid.queryRenderedFeatures(geometry, transformState, options); +} + +std::vector<Feature> RenderAnnotationSource::querySourceFeatures(const SourceQueryOptions&) const { + return {}; +} + +void RenderAnnotationSource::setCacheSize(size_t size) { + tilePyramid.setCacheSize(size); +} + +void RenderAnnotationSource::onLowMemory() { + tilePyramid.onLowMemory(); +} + +void RenderAnnotationSource::dumpDebugLogs() const { + tilePyramid.dumpDebugLogs(); +} + +} // namespace mbgl |