summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/layers/render_heatmap_layer.hpp
blob: d18d03f5de87b0162ee361c22dd94afda4c692fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
#include <mbgl/style/layers/heatmap_layer_properties.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/offscreen_texture.hpp>
#include <mbgl/layout/circle_layout.hpp>

namespace mbgl {

class RenderHeatmapLayer: public RenderLayer {
public:
    RenderHeatmapLayer(Immutable<style::HeatmapLayer::Impl>);
    ~RenderHeatmapLayer() final = default;

    using StyleLayerImpl = style::HeatmapLayer::Impl;

    void transition(const TransitionParameters&) override;
    void evaluate(const PropertyEvaluationParameters&) override;
    bool hasTransition() const override;
    bool hasCrossfade() const override;
    void render(PaintParameters&, RenderSource*) override;
    void update() final;

    style::HeatmapPaintProperties::PossiblyEvaluated paintProperties() const;

    bool queryIntersectsFeature(
            const GeometryCoordinates&,
            const GeometryTileFeature&,
            const float,
            const TransformState&,
            const float,
            const mat4&) const override;


    std::unique_ptr<Layout> createLayout(const BucketParameters&, const std::vector<const RenderLayer*>&,
                                         std::unique_ptr<GeometryTileLayer>, GlyphDependencies&,
                                         ImageDependencies&) const override;
    // Paint properties
    style::HeatmapPaintProperties::Unevaluated unevaluated;
    style::HeatmapPaintProperties::PossiblyEvaluated evaluated;

    const style::HeatmapLayer::Impl& impl() const;

    PremultipliedImage colorRamp;
    optional<OffscreenTexture> renderTexture;
    optional<gl::Texture> colorRampTexture;

private:
    void updateColorRamp();
};

inline const RenderHeatmapLayer* toRenderHeatmapLayer(const RenderLayer* layer) {
    return static_cast<const RenderHeatmapLayer*>(layer);
}

} // namespace mbgl