summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/programs.cpp
blob: f82e46c9a21f823e8c37cbb38dd061cd810c6d52 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <mbgl/programs/programs.hpp>

#include <mbgl/programs/background_program.hpp>
#include <mbgl/programs/circle_program.hpp>
#include <mbgl/programs/heatmap_program.hpp>
#include <mbgl/programs/hillshade_program.hpp>
#include <mbgl/programs/fill_extrusion_program.hpp>
#include <mbgl/programs/fill_program.hpp>
#include <mbgl/programs/line_program.hpp>
#include <mbgl/programs/raster_program.hpp>
#include <mbgl/programs/symbol_program.hpp>

namespace mbgl {

Programs::Programs(gfx::Context& context_, const ProgramParameters& programParameters_)
    : debug(context_, programParameters_),
      clippingMask(context_, programParameters_),
      context(context_),
      programParameters(std::move(programParameters_)) {
}

Programs::~Programs() = default;

BackgroundLayerPrograms& Programs::getBackgroundLayerPrograms() noexcept {
    if (!backgroundPrograms) {
        backgroundPrograms = std::make_unique<BackgroundLayerPrograms>(context, programParameters);
    }
    return static_cast<BackgroundLayerPrograms&>(*backgroundPrograms);   
}

RasterLayerPrograms& Programs::getRasterLayerPrograms() noexcept {
    if (!rasterPrograms) {
        rasterPrograms = std::make_unique<RasterLayerPrograms>(context, programParameters);
    }
    return static_cast<RasterLayerPrograms&>(*rasterPrograms);   
}

HeatmapLayerPrograms& Programs::getHeatmapLayerPrograms() noexcept {
    if (!heatmapPrograms) {
        heatmapPrograms = std::make_unique<HeatmapLayerPrograms>(context, programParameters);
    }
    return static_cast<HeatmapLayerPrograms&>(*heatmapPrograms);   
}

HillshadeLayerPrograms& Programs::getHillshadeLayerPrograms() noexcept {
    if (!hillshadePrograms) {
        hillshadePrograms = std::make_unique<HillshadeLayerPrograms>(context, programParameters);
    }
    return static_cast<HillshadeLayerPrograms&>(*hillshadePrograms);   
}

FillLayerPrograms& Programs::getFillLayerPrograms() noexcept {
    if (!fillPrograms) {
        fillPrograms = std::make_unique<FillLayerPrograms>(context, programParameters);
    }
    return static_cast<FillLayerPrograms&>(*fillPrograms);   
}

FillExtrusionLayerPrograms& Programs::getFillExtrusionLayerPrograms() noexcept {
    if (!fillExtrusionPrograms) {
        fillExtrusionPrograms = std::make_unique<FillExtrusionLayerPrograms>(context, programParameters);
    }
    return static_cast<FillExtrusionLayerPrograms&>(*fillExtrusionPrograms);   
}

CircleLayerPrograms& Programs::getCircleLayerPrograms() noexcept {
    if (!circlePrograms) {
        circlePrograms = std::make_unique<CircleLayerPrograms>(context, programParameters);
    }
    return static_cast<CircleLayerPrograms&>(*circlePrograms);   
}

LineLayerPrograms& Programs::getLineLayerPrograms() noexcept {
    if (!linePrograms) {
        linePrograms = std::make_unique<LineLayerPrograms>(context, programParameters);
    }
    return static_cast<LineLayerPrograms&>(*linePrograms);   
}

SymbolLayerPrograms& Programs::getSymbolLayerPrograms() noexcept {
    if (!symbolPrograms) {
        symbolPrograms = std::make_unique<SymbolLayerPrograms>(context, programParameters);
    }
    return static_cast<SymbolLayerPrograms&>(*symbolPrograms);   
}

} // namespace mbgl