summaryrefslogtreecommitdiff
path: root/include/llmr/style/style.hpp
blob: ee99ff224369ed06db25f3ea8dd39fa3a1557f73 (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
#ifndef LLMR_STYLE_STYLE
#define LLMR_STYLE_STYLE

#include <map>
#include <vector>
#include <set>
#include "../util/pbf.hpp"

#include "value.hpp"
#include "properties.hpp"
#include "bucket_description.hpp"
#include "layer_description.hpp"
#include "class_description.hpp"

namespace llmr {

class Style {
public:
    Style();

    void reset();
    void load(const uint8_t *const data, uint32_t bytes);

    void cascade();

private:
    static std::pair<std::string, BucketDescription> loadBucket(pbf data);
    static LayerDescription loadLayer(pbf data);
    static std::pair<std::string, ClassDescription> loadClass(pbf data);
    static std::pair<std::string, LayerStyleDescription> loadLayerStyle(pbf data);
    static WidthDescription loadWidth(pbf data);

public:
    // This is static information parsed from the stylesheet.
    std::map<std::string, BucketDescription> buckets;
    std::vector<LayerDescription> layers;
    std::map<std::string, ClassDescription> classes;


    // This are applied settings.
    std::set<std::string> appliedClasses;
    struct {
        std::map<std::string, FillProperties> fills;
        std::map<std::string, StrokeProperties> strokes;
    } computed;
};

}



#endif