summaryrefslogtreecommitdiff
path: root/proto/style.proto
blob: 90e5b65061bb5345758f0b3641a4330f3aa3b3d8 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
enum bucket_type {
    fill = 1;
    line = 2;
    point = 3;

    background = 15;
}

enum cap_type {
    round_cap = 1;
    butt_cap = 2;
    square_cap = 3;
}

enum join_type {
    miter_join = 1;
    bevel_join = 2;
    round_join = 3;
}

enum winding_type {
    evenodd = 1;
    nonzero = 2;
}

enum property_type {
    null = 1;
    constant = 2;
    stops = 3;
    linear = 4;
}

message value {
    // Exactly one of these values may be present in a valid message
    optional string string_value = 1;
    optional float float_value = 2;
    optional double double_value = 3;
    optional int64 int_value = 4;
    optional uint64 uint_value = 5;
    optional sint64 sint_value = 6;
    optional bool bool_value = 7;

    extensions 8 to max;
}

message bucket {
    required string name = 1;
    required bucket_type type = 2;

    // Specify what data to pull into this bucket
    required string source_name = 3;
    required string source_layer = 4;
    optional string source_field = 5;
    repeated value source_value = 6;

    // Specifies how the geometry for this bucket should be created
    optional cap_type cap = 7;
    optional join_type join = 8;
    optional string font = 9;
    optional float font_size = 10;
}

message layer {
    required string name = 1;
    optional string bucket_name = 2;
    repeated layer child_layer = 3;
}

message property {
    required property_type function = 1;
    repeated float value = 2 [ packed = true ];
}

message fill_style {
    required string layer_name = 1;
    optional property hidden = 2;
    optional winding_type winding = 3 [ default = nonzero ];
    optional property antialias = 4;
    optional fixed32 fill_color = 5 [ default = 0x000000FF ]; // rgba (=> rgb << 8 | 0xFF for opaque!)
    optional fixed32 stroke_color = 6; // if none is specified, no stroke will be painted
    optional property opacity = 7; // values from 0..1
    optional string image = 8;
    // TODO: translate x/y
}

message stroke_style {
    required string layer_name = 1;
    optional property hidden = 2;
    optional fixed32 color = 3 [ default = 0x000000FF ]; // rgba (=> rgb << 8 | 0xFF for opaque!)
    optional property width = 4;
    optional property offset = 5;
    optional property opacity = 6; // values from 0..1
    // line join + line cap are already defined in the
    // TODO: dasharray
    // TODO: image/icon
    // TODO: translate x/y
}

message class {
    required string name = 1;
    repeated fill_style fill = 2;
    repeated stroke_style stroke = 3;
}

// root level object
message style {
    repeated bucket bucket = 1;
    repeated layer layer = 2;
    repeated class class = 3;
}