summaryrefslogtreecommitdiff
path: root/include/mbgl/style/layer_properties.hpp
blob: c238faf02f67e6e1858744e1daceddf2604e6a92 (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
#pragma once
#include <mbgl/style/layer_impl.hpp>

namespace mbgl {

namespace style {

/**
 * @brief An interface, wrapping evaluated layer properties.
 * 
 *  It is an abstract base class; concrete derived classes that hold the actual data are provided for each layer type. 
 */
class LayerProperties {
public:
    virtual ~LayerProperties() = default;
    // Returns constants mask for the data-driven properties.
    virtual unsigned long constantsMask() const { return 0u; }
    Immutable<Layer::Impl> baseImpl;

protected:
    LayerProperties(Immutable<Layer::Impl> impl) : baseImpl(std::move(impl)) {}
};

template <class Derived>
inline const auto& getEvaluated(const Immutable<LayerProperties>& properties) {
    return static_cast<const Derived&>(*properties).evaluated;
}

template <class Derived>
inline const auto& getCrossfade(const Immutable<LayerProperties>& properties) {
    return static_cast<const Derived&>(*properties).crossfade;
}

} // namespace style
} // namespace mbgl