1 #pragma once
2 
3 #include <mbgl/renderer/render_source.hpp>
4 #include <mbgl/renderer/tile_pyramid.hpp>
5 #include <mbgl/style/sources/raster_source_impl.hpp>
6 
7 namespace mbgl {
8 
9 class RenderRasterDEMSource : public RenderSource {
10 public:
11     RenderRasterDEMSource(Immutable<style::RasterSource::Impl>);
12 
13     bool isLoaded() const final;
14 
15     void update(Immutable<style::Source::Impl>,
16                 const std::vector<Immutable<style::Layer::Impl>>&,
17                 bool needsRendering,
18                 bool needsRelayout,
19                 const TileParameters&) final;
20 
21     void startRender(PaintParameters&) final;
22     void finishRender(PaintParameters&) final;
23 
24     std::vector<std::reference_wrapper<RenderTile>> getRenderTiles() final;
25 
26     std::unordered_map<std::string, std::vector<Feature>>
27     queryRenderedFeatures(const ScreenLineString& geometry,
28                           const TransformState& transformState,
29                           const std::vector<const RenderLayer*>& layers,
30                           const RenderedQueryOptions& options,
31                           const mat4& projMatrix) const final;
32 
33     std::vector<Feature>
34     querySourceFeatures(const SourceQueryOptions&) const final;
35 
36     void reduceMemoryUse() final;
37     void dumpDebugLogs() const final;
38 
getMaxZoom() const39     uint8_t getMaxZoom() const {
40         return maxzoom;
41     };
42 
43 private:
44     const style::RasterSource::Impl& impl() const;
45 
46     TilePyramid tilePyramid;
47     optional<Tileset> tileset;
48     uint8_t maxzoom = 15;
49 
50 protected:
51     void onTileChanged(Tile&) final;
52 };
53 
54 template <>
is() const55 inline bool RenderSource::is<RenderRasterDEMSource>() const {
56     return baseImpl->type == style::SourceType::RasterDEM;
57 }
58 
59 } // namespace mbgl
60