Skip to main content

mln_style/layers/
symbol_layer_properties.rs

1// This file is generated by //tools/style-codegen from the style spec
2// (tools/style-codegen/v8.json). Do not edit.
3
4use crate::layer::LayerStyle;
5use crate::layers::Symbol;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9    /// The layout properties of a symbol layer.
10    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11    pub mod SymbolLayoutProperties: layout {
12        icon_allow_overlap: constant bool = false,
13        icon_anchor: data_driven SymbolAnchorType = SymbolAnchorType::Center,
14        icon_ignore_placement: constant bool = false,
15        icon_image: data_driven Image = Image::default(),
16        icon_keep_upright: constant bool = false,
17        icon_offset: data_driven [f32; 2] = [0.0_f32, 0.0_f32],
18        icon_optional: constant bool = false,
19        icon_overlap: constant IconOverlapType = IconOverlapType::Undefined,
20        icon_padding: data_driven Padding = Padding::uniform(2.0_f32),
21        icon_pitch_alignment: constant AlignmentType = AlignmentType::Auto,
22        icon_rotate: data_driven f32 = 0.0_f32,
23        icon_rotation_alignment: data_driven AlignmentType = AlignmentType::Auto,
24        icon_size: data_driven f32 = 1.0_f32,
25        icon_text_fit: constant IconTextFitType = IconTextFitType::None,
26        icon_text_fit_padding: constant [f32; 4] = [0.0_f32, 0.0_f32, 0.0_f32, 0.0_f32],
27        symbol_avoid_edges: constant bool = false,
28        symbol_height_anchor: constant SymbolHeightAnchorType = SymbolHeightAnchorType::Ground,
29        symbol_height_offset: data_driven f32 = 0.0_f32,
30        symbol_placement: constant SymbolPlacementType = SymbolPlacementType::Point,
31        symbol_screen_space: constant bool = false,
32        symbol_sort_key: data_driven f32 = 0.0_f32,
33        symbol_spacing: constant f32 = 250.0_f32,
34        symbol_z_order: constant SymbolZOrderType = SymbolZOrderType::Auto,
35        text_allow_overlap: constant bool = false,
36        text_anchor: data_driven SymbolAnchorType = SymbolAnchorType::Center,
37        text_field: data_driven Formatted = Formatted::default(),
38        text_font: data_driven Vec<String> = vec!["Open Sans Regular".to_owned(), "Arial Unicode MS Regular".to_owned()],
39        text_ignore_placement: constant bool = false,
40        text_justify: data_driven TextJustifyType = TextJustifyType::Center,
41        text_keep_upright: constant bool = true,
42        text_letter_spacing: data_driven f32 = 0.0_f32,
43        text_line_height: constant f32 = 1.2_f32,
44        text_max_angle: constant f32 = 45.0_f32,
45        text_max_width: data_driven f32 = 10.0_f32,
46        text_offset: data_driven [f32; 2] = [0.0_f32, 0.0_f32],
47        text_optional: constant bool = false,
48        text_overlap: constant TextOverlapType = TextOverlapType::Undefined,
49        text_padding: constant f32 = 2.0_f32,
50        text_pitch_alignment: constant AlignmentType = AlignmentType::Auto,
51        text_radial_offset: data_driven f32 = 0.0_f32,
52        text_rotate: data_driven f32 = 0.0_f32,
53        text_rotation_alignment: constant TextRotationAlignmentType = TextRotationAlignmentType::Auto,
54        text_size: data_driven f32 = 16.0_f32,
55        text_transform: data_driven TextTransformType = TextTransformType::None,
56        text_variable_anchor: constant Vec<TextVariableAnchorType> = Vec::new(),
57        text_variable_anchor_offset: data_driven VariableAnchorOffsetCollection = VariableAnchorOffsetCollection::default(),
58        text_writing_mode: constant Vec<TextWritingModeType> = Vec::new(),
59    }
60    use crate::expression::Formatted, crate::expression::Image, crate::padding::Padding, crate::types::AlignmentType, crate::types::IconOverlapType, crate::types::IconTextFitType, crate::types::SymbolAnchorType, crate::types::SymbolHeightAnchorType, crate::types::SymbolPlacementType, crate::types::SymbolZOrderType, crate::types::TextJustifyType, crate::types::TextOverlapType, crate::types::TextRotationAlignmentType, crate::types::TextTransformType, crate::types::TextVariableAnchorType, crate::types::TextWritingModeType, crate::types::VariableAnchorOffsetCollection;
61);
62
63crate::properties!(
64    /// The paint properties of a symbol layer.
65    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
66    pub mod SymbolPaintProperties: paint {
67        icon_color: data_driven Color = Color::black(),
68        icon_halo_blur: data_driven f32 = 0.0_f32,
69        icon_halo_color: data_driven Color = Color::default(),
70        icon_halo_width: data_driven f32 = 0.0_f32,
71        icon_opacity: data_driven f32 = 1.0_f32,
72        icon_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
73        icon_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
74        text_color: data_driven Color = Color::black(),
75        text_halo_blur: data_driven f32 = 0.0_f32,
76        text_halo_color: data_driven Color = Color::default(),
77        text_halo_width: data_driven f32 = 0.0_f32,
78        text_opacity: data_driven f32 = 1.0_f32,
79        text_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
80        text_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
81    }
82    use crate::color::Color, crate::types::TranslateAnchorType;
83);
84
85/// The properties, by slot.
86pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
87    &[
88        PropertyInfo::paint("icon-color").data_driven().interpolated(),
89        PropertyInfo::paint("icon-halo-blur").data_driven().interpolated(),
90        PropertyInfo::paint("icon-halo-color").data_driven().interpolated(),
91        PropertyInfo::paint("icon-halo-width").data_driven().interpolated(),
92        PropertyInfo::paint("icon-opacity").data_driven().interpolated(),
93        PropertyInfo::paint("icon-translate").interpolated(),
94        PropertyInfo::paint("icon-translate-anchor"),
95        PropertyInfo::paint("text-color").data_driven().overridable().interpolated(),
96        PropertyInfo::paint("text-halo-blur").data_driven().interpolated(),
97        PropertyInfo::paint("text-halo-color").data_driven().interpolated(),
98        PropertyInfo::paint("text-halo-width").data_driven().interpolated(),
99        PropertyInfo::paint("text-opacity").data_driven().interpolated(),
100        PropertyInfo::paint("text-translate").interpolated(),
101        PropertyInfo::paint("text-translate-anchor"),
102        PropertyInfo::layout("icon-allow-overlap"),
103        PropertyInfo::layout("icon-anchor").data_driven(),
104        PropertyInfo::layout("icon-ignore-placement"),
105        PropertyInfo::layout("icon-image").data_driven().tokens(),
106        PropertyInfo::layout("icon-keep-upright"),
107        PropertyInfo::layout("icon-offset").data_driven().interpolated(),
108        PropertyInfo::layout("icon-optional"),
109        PropertyInfo::layout("icon-overlap"),
110        PropertyInfo::layout("icon-padding").data_driven().interpolated(),
111        PropertyInfo::layout("icon-pitch-alignment"),
112        PropertyInfo::layout("icon-rotate").data_driven().interpolated(),
113        PropertyInfo::layout("icon-rotation-alignment").data_driven(),
114        PropertyInfo::layout("icon-size").data_driven().interpolated(),
115        PropertyInfo::layout("icon-text-fit"),
116        PropertyInfo::layout("icon-text-fit-padding").interpolated(),
117        PropertyInfo::layout("symbol-avoid-edges"),
118        PropertyInfo::layout("symbol-height-anchor"),
119        PropertyInfo::layout("symbol-height-offset").data_driven().interpolated(),
120        PropertyInfo::layout("symbol-placement"),
121        PropertyInfo::layout("symbol-screen-space"),
122        PropertyInfo::layout("symbol-sort-key").data_driven(),
123        PropertyInfo::layout("symbol-spacing").interpolated(),
124        PropertyInfo::layout("symbol-z-order"),
125        PropertyInfo::layout("text-allow-overlap"),
126        PropertyInfo::layout("text-anchor").data_driven(),
127        PropertyInfo::layout("text-field").data_driven().tokens(),
128        PropertyInfo::layout("text-font").data_driven(),
129        PropertyInfo::layout("text-ignore-placement"),
130        PropertyInfo::layout("text-justify").data_driven(),
131        PropertyInfo::layout("text-keep-upright"),
132        PropertyInfo::layout("text-letter-spacing").data_driven().interpolated(),
133        PropertyInfo::layout("text-line-height").interpolated(),
134        PropertyInfo::layout("text-max-angle").interpolated(),
135        PropertyInfo::layout("text-max-width").data_driven().interpolated(),
136        PropertyInfo::layout("text-offset").data_driven().interpolated(),
137        PropertyInfo::layout("text-optional"),
138        PropertyInfo::layout("text-overlap"),
139        PropertyInfo::layout("text-padding").interpolated(),
140        PropertyInfo::layout("text-pitch-alignment"),
141        PropertyInfo::layout("text-radial-offset").data_driven().interpolated(),
142        PropertyInfo::layout("text-rotate").data_driven().interpolated(),
143        PropertyInfo::layout("text-rotation-alignment"),
144        PropertyInfo::layout("text-size").data_driven().interpolated(),
145        PropertyInfo::layout("text-transform").data_driven(),
146        PropertyInfo::layout("text-variable-anchor"),
147        PropertyInfo::layout("text-variable-anchor-offset").data_driven().interpolated(),
148        PropertyInfo::layout("text-writing-mode"),
149    ],
150    &[
151        14, 15, 0, 1, 2, 3, 16, 17, 18, 19, 4, 20, 21, 22, 23, 24, 25, 26, 27, 28, 5, 6, 29, 30, 31, 32, 33, 34, 35, 36,
152        37, 38, 7, 39, 40, 8, 9, 10, 41, 42, 43, 44, 45, 46, 47, 48, 11, 49, 50, 51, 52, 53, 54, 55, 56, 57, 12, 13, 58,
153        59, 60,
154    ],
155);
156
157/// Calls `visitor` with the field of the property in `slot`.
158pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Symbol>>>(slot: usize, visitor: V) -> Option<V::Output> {
159    Some(match slot {
160        0 => visitor.paint(|s| &s.paint.icon_color, |s| &mut s.paint.icon_color),
161        1 => visitor.paint(|s| &s.paint.icon_halo_blur, |s| &mut s.paint.icon_halo_blur),
162        2 => visitor.paint(|s| &s.paint.icon_halo_color, |s| &mut s.paint.icon_halo_color),
163        3 => visitor.paint(|s| &s.paint.icon_halo_width, |s| &mut s.paint.icon_halo_width),
164        4 => visitor.paint(|s| &s.paint.icon_opacity, |s| &mut s.paint.icon_opacity),
165        5 => visitor.paint(|s| &s.paint.icon_translate, |s| &mut s.paint.icon_translate),
166        6 => visitor.paint(|s| &s.paint.icon_translate_anchor, |s| &mut s.paint.icon_translate_anchor),
167        7 => visitor.paint(|s| &s.paint.text_color, |s| &mut s.paint.text_color),
168        8 => visitor.paint(|s| &s.paint.text_halo_blur, |s| &mut s.paint.text_halo_blur),
169        9 => visitor.paint(|s| &s.paint.text_halo_color, |s| &mut s.paint.text_halo_color),
170        10 => visitor.paint(|s| &s.paint.text_halo_width, |s| &mut s.paint.text_halo_width),
171        11 => visitor.paint(|s| &s.paint.text_opacity, |s| &mut s.paint.text_opacity),
172        12 => visitor.paint(|s| &s.paint.text_translate, |s| &mut s.paint.text_translate),
173        13 => visitor.paint(|s| &s.paint.text_translate_anchor, |s| &mut s.paint.text_translate_anchor),
174        14 => visitor.layout(|s| &s.layout.icon_allow_overlap, |s| &mut s.layout.icon_allow_overlap),
175        15 => visitor.layout(|s| &s.layout.icon_anchor, |s| &mut s.layout.icon_anchor),
176        16 => visitor.layout(|s| &s.layout.icon_ignore_placement, |s| &mut s.layout.icon_ignore_placement),
177        17 => visitor.layout(|s| &s.layout.icon_image, |s| &mut s.layout.icon_image),
178        18 => visitor.layout(|s| &s.layout.icon_keep_upright, |s| &mut s.layout.icon_keep_upright),
179        19 => visitor.layout(|s| &s.layout.icon_offset, |s| &mut s.layout.icon_offset),
180        20 => visitor.layout(|s| &s.layout.icon_optional, |s| &mut s.layout.icon_optional),
181        21 => visitor.layout(|s| &s.layout.icon_overlap, |s| &mut s.layout.icon_overlap),
182        22 => visitor.layout(|s| &s.layout.icon_padding, |s| &mut s.layout.icon_padding),
183        23 => visitor.layout(|s| &s.layout.icon_pitch_alignment, |s| &mut s.layout.icon_pitch_alignment),
184        24 => visitor.layout(|s| &s.layout.icon_rotate, |s| &mut s.layout.icon_rotate),
185        25 => visitor.layout(|s| &s.layout.icon_rotation_alignment, |s| &mut s.layout.icon_rotation_alignment),
186        26 => visitor.layout(|s| &s.layout.icon_size, |s| &mut s.layout.icon_size),
187        27 => visitor.layout(|s| &s.layout.icon_text_fit, |s| &mut s.layout.icon_text_fit),
188        28 => visitor.layout(|s| &s.layout.icon_text_fit_padding, |s| &mut s.layout.icon_text_fit_padding),
189        29 => visitor.layout(|s| &s.layout.symbol_avoid_edges, |s| &mut s.layout.symbol_avoid_edges),
190        30 => visitor.layout(|s| &s.layout.symbol_height_anchor, |s| &mut s.layout.symbol_height_anchor),
191        31 => visitor.layout(|s| &s.layout.symbol_height_offset, |s| &mut s.layout.symbol_height_offset),
192        32 => visitor.layout(|s| &s.layout.symbol_placement, |s| &mut s.layout.symbol_placement),
193        33 => visitor.layout(|s| &s.layout.symbol_screen_space, |s| &mut s.layout.symbol_screen_space),
194        34 => visitor.layout(|s| &s.layout.symbol_sort_key, |s| &mut s.layout.symbol_sort_key),
195        35 => visitor.layout(|s| &s.layout.symbol_spacing, |s| &mut s.layout.symbol_spacing),
196        36 => visitor.layout(|s| &s.layout.symbol_z_order, |s| &mut s.layout.symbol_z_order),
197        37 => visitor.layout(|s| &s.layout.text_allow_overlap, |s| &mut s.layout.text_allow_overlap),
198        38 => visitor.layout(|s| &s.layout.text_anchor, |s| &mut s.layout.text_anchor),
199        39 => visitor.layout(|s| &s.layout.text_field, |s| &mut s.layout.text_field),
200        40 => visitor.layout(|s| &s.layout.text_font, |s| &mut s.layout.text_font),
201        41 => visitor.layout(|s| &s.layout.text_ignore_placement, |s| &mut s.layout.text_ignore_placement),
202        42 => visitor.layout(|s| &s.layout.text_justify, |s| &mut s.layout.text_justify),
203        43 => visitor.layout(|s| &s.layout.text_keep_upright, |s| &mut s.layout.text_keep_upright),
204        44 => visitor.layout(|s| &s.layout.text_letter_spacing, |s| &mut s.layout.text_letter_spacing),
205        45 => visitor.layout(|s| &s.layout.text_line_height, |s| &mut s.layout.text_line_height),
206        46 => visitor.layout(|s| &s.layout.text_max_angle, |s| &mut s.layout.text_max_angle),
207        47 => visitor.layout(|s| &s.layout.text_max_width, |s| &mut s.layout.text_max_width),
208        48 => visitor.layout(|s| &s.layout.text_offset, |s| &mut s.layout.text_offset),
209        49 => visitor.layout(|s| &s.layout.text_optional, |s| &mut s.layout.text_optional),
210        50 => visitor.layout(|s| &s.layout.text_overlap, |s| &mut s.layout.text_overlap),
211        51 => visitor.layout(|s| &s.layout.text_padding, |s| &mut s.layout.text_padding),
212        52 => visitor.layout(|s| &s.layout.text_pitch_alignment, |s| &mut s.layout.text_pitch_alignment),
213        53 => visitor.layout(|s| &s.layout.text_radial_offset, |s| &mut s.layout.text_radial_offset),
214        54 => visitor.layout(|s| &s.layout.text_rotate, |s| &mut s.layout.text_rotate),
215        55 => visitor.layout(|s| &s.layout.text_rotation_alignment, |s| &mut s.layout.text_rotation_alignment),
216        56 => visitor.layout(|s| &s.layout.text_size, |s| &mut s.layout.text_size),
217        57 => visitor.layout(|s| &s.layout.text_transform, |s| &mut s.layout.text_transform),
218        58 => visitor.layout(|s| &s.layout.text_variable_anchor, |s| &mut s.layout.text_variable_anchor),
219        59 => visitor.layout(|s| &s.layout.text_variable_anchor_offset, |s| &mut s.layout.text_variable_anchor_offset),
220        60 => visitor.layout(|s| &s.layout.text_writing_mode, |s| &mut s.layout.text_writing_mode),
221        _ => return None,
222    })
223}