Skip to main content

mln_style/layers/
fill_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::Fill;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9    /// The layout properties of a fill layer.
10    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11    pub mod FillLayoutProperties: layout {
12        fill_sort_key: data_driven f32 = 0.0_f32,
13    }
14);
15
16crate::properties!(
17    /// The paint properties of a fill layer.
18    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
19    pub mod FillPaintProperties: paint {
20        fill_antialias: constant bool = true,
21        fill_color: data_driven Color = Color::black(),
22        fill_layer_blend: constant LayerBlendType = LayerBlendType::Normal,
23        fill_layer_opacity: constant f32 = 1.0_f32,
24        fill_opacity: data_driven f32 = 1.0_f32,
25        fill_outline_color: data_driven Color = Color::default(),
26        fill_pattern: cross_faded_data_driven Image = Image::default(),
27        fill_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
28        fill_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
29    }
30    use crate::color::Color, crate::expression::Image, crate::types::LayerBlendType, crate::types::TranslateAnchorType;
31);
32
33/// The properties, by slot.
34pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
35    &[
36        PropertyInfo::paint("fill-antialias"),
37        PropertyInfo::paint("fill-color").data_driven(),
38        PropertyInfo::paint("fill-layer-blend"),
39        PropertyInfo::paint("fill-layer-opacity"),
40        PropertyInfo::paint("fill-opacity").data_driven(),
41        PropertyInfo::paint("fill-outline-color").data_driven(),
42        PropertyInfo::paint("fill-pattern").data_driven().cross_faded(),
43        PropertyInfo::paint("fill-translate"),
44        PropertyInfo::paint("fill-translate-anchor"),
45        PropertyInfo::layout("fill-sort-key").data_driven(),
46    ],
47    &[0, 1, 2, 3, 4, 5, 6, 9, 7, 8],
48);
49
50/// Calls `visitor` with the field of the property in `slot`.
51pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Fill>>>(slot: usize, visitor: V) -> Option<V::Output> {
52    Some(match slot {
53        0 => visitor.paint(|s| &s.paint.fill_antialias, |s| &mut s.paint.fill_antialias),
54        1 => visitor.paint(|s| &s.paint.fill_color, |s| &mut s.paint.fill_color),
55        2 => visitor.paint(|s| &s.paint.fill_layer_blend, |s| &mut s.paint.fill_layer_blend),
56        3 => visitor.paint(|s| &s.paint.fill_layer_opacity, |s| &mut s.paint.fill_layer_opacity),
57        4 => visitor.paint(|s| &s.paint.fill_opacity, |s| &mut s.paint.fill_opacity),
58        5 => visitor.paint(|s| &s.paint.fill_outline_color, |s| &mut s.paint.fill_outline_color),
59        6 => visitor.paint(|s| &s.paint.fill_pattern, |s| &mut s.paint.fill_pattern),
60        7 => visitor.paint(|s| &s.paint.fill_translate, |s| &mut s.paint.fill_translate),
61        8 => visitor.paint(|s| &s.paint.fill_translate_anchor, |s| &mut s.paint.fill_translate_anchor),
62        9 => visitor.layout(|s| &s.layout.fill_sort_key, |s| &mut s.layout.fill_sort_key),
63        _ => return None,
64    })
65}