summaryrefslogtreecommitdiff
path: root/src/mbgl/style/paint_property.hpp
blob: 195eb645a965e2120c455d049517ca3108e6807d (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
#pragma once

#include <mbgl/style/properties.hpp>
#include <mbgl/style/property_value.hpp>
#include <mbgl/style/heatmap_color_property_value.hpp>
#include <mbgl/style/data_driven_property_value.hpp>
#include <mbgl/renderer/property_evaluator.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/renderer/data_driven_property_evaluator.hpp>

#include <utility>

namespace mbgl {
namespace style {

template <class T>
class PaintProperty {
public:
    using TransitionableType = Transitionable<PropertyValue<T>>;
    using UnevaluatedType = Transitioning<PropertyValue<T>>;
    using EvaluatorType = PropertyEvaluator<T>;
    using PossiblyEvaluatedType = T;
    using Type = T;
    static constexpr bool IsDataDriven = false;
};

template <class T, class A, class U>
class DataDrivenPaintProperty {
public:
    using TransitionableType = Transitionable<DataDrivenPropertyValue<T>>;
    using UnevaluatedType = Transitioning<DataDrivenPropertyValue<T>>;
    using EvaluatorType = DataDrivenPropertyEvaluator<T>;
    using PossiblyEvaluatedType = PossiblyEvaluatedPropertyValue<T>;
    using Type = T;
    static constexpr bool IsDataDriven = true;

    using Attribute = A;
    using Uniform = U;
};

template <class T>
class CrossFadedPaintProperty {
public:
    using TransitionableType = Transitionable<PropertyValue<T>>;
    using UnevaluatedType = Transitioning<PropertyValue<T>>;
    using EvaluatorType = CrossFadedPropertyEvaluator<T>;
    using PossiblyEvaluatedType = Faded<T>;
    using Type = T;
    static constexpr bool IsDataDriven = false;
};

/*
 * Special-case paint property traits for heatmap-color, needed because
 * heatmap-color values do not fit into the
 * Undefined | Value | {Camera,Source,Composite}Function taxonomy that applies
 * to all other paint properties.
 *
 * These traits are provided here--despite the fact that heatmap-color
 * is not used like other paint properties--to allow the parameter-pack-based
 * batch evaluation of paint properties to compile properly.
 */
class HeatmapColor {
public:
    using TransitionableType = Transitionable<HeatmapColorPropertyValue>;
    using UnevaluatedType = Transitioning<HeatmapColorPropertyValue>;
    using EvaluatorType = PropertyEvaluator<Color>;
    using PossiblyEvaluatedType = Color;
    using Type = Color;
    static constexpr bool IsDataDriven = false;
    
    static Color defaultValue() { return {}; }
};

} // namespace style
} // namespace mbgl