summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/style_diff.hpp
blob: 285d1e12ed66a6b357382206737db95c94c55cb0 (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
#pragma once

#include <mbgl/style/image_impl.hpp>
#include <mbgl/style/source_impl.hpp>
#include <mbgl/style/layer_impl.hpp>
#include <mbgl/util/immutable.hpp>
#include <mbgl/util/variant.hpp>

#include <unordered_map>

namespace mbgl {

template <class T>
class StyleDifference {
public:
    std::unordered_map<std::string, T> added;
    std::unordered_map<std::string, T> removed;
    std::unordered_map<std::string, std::array<T, 2>> changed;
};

using ImmutableImage = Immutable<style::Image::Impl>;
using ImageDifference = StyleDifference<ImmutableImage>;

ImageDifference diffImages(const std::vector<ImmutableImage>&,
                           const std::vector<ImmutableImage>&);

using ImmutableSource = Immutable<style::Source::Impl>;
using SourceDifference = StyleDifference<ImmutableSource>;

SourceDifference diffSources(const std::vector<ImmutableSource>&,
                             const std::vector<ImmutableSource>&);

using ImmutableLayer = Immutable<style::Layer::Impl>;
using LayerDifference = StyleDifference<ImmutableLayer>;

LayerDifference diffLayers(const std::vector<ImmutableLayer>&,
                           const std::vector<ImmutableLayer>&);

bool hasLayoutDifference(const LayerDifference&, const std::string& layerID);

} // namespace mbgl