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_rounded_corner_distance: constant f32 = 0.0_f32,
28        fill_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
29        fill_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
30    }
31    use crate::color::Color, crate::expression::Image, crate::types::LayerBlendType, crate::types::TranslateAnchorType;
32);
33
34/// The properties, by slot.
35pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
36    &[
37        PropertyInfo::paint("fill-antialias"),
38        PropertyInfo::paint("fill-color").data_driven().interpolated(),
39        PropertyInfo::paint("fill-layer-blend"),
40        PropertyInfo::paint("fill-layer-opacity").interpolated(),
41        PropertyInfo::paint("fill-opacity").data_driven().interpolated(),
42        PropertyInfo::paint("fill-outline-color").data_driven().interpolated(),
43        PropertyInfo::paint("fill-pattern").data_driven().cross_faded(),
44        PropertyInfo::paint("fill-rounded-corner-distance").interpolated(),
45        PropertyInfo::paint("fill-translate").interpolated(),
46        PropertyInfo::paint("fill-translate-anchor"),
47        PropertyInfo::layout("fill-sort-key").data_driven(),
48    ],
49    &[0, 1, 2, 3, 4, 5, 6, 7, 10, 8, 9],
50);
51
52/// Calls `visitor` with the field of the property in `slot`.
53pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Fill>>>(slot: usize, visitor: V) -> Option<V::Output> {
54    Some(match slot {
55        0 => visitor.paint(|s| &s.paint.fill_antialias, |s| &mut s.paint.fill_antialias),
56        1 => visitor.paint(|s| &s.paint.fill_color, |s| &mut s.paint.fill_color),
57        2 => visitor.paint(|s| &s.paint.fill_layer_blend, |s| &mut s.paint.fill_layer_blend),
58        3 => visitor.paint(|s| &s.paint.fill_layer_opacity, |s| &mut s.paint.fill_layer_opacity),
59        4 => visitor.paint(|s| &s.paint.fill_opacity, |s| &mut s.paint.fill_opacity),
60        5 => visitor.paint(|s| &s.paint.fill_outline_color, |s| &mut s.paint.fill_outline_color),
61        6 => visitor.paint(|s| &s.paint.fill_pattern, |s| &mut s.paint.fill_pattern),
62        7 => visitor.paint(|s| &s.paint.fill_rounded_corner_distance, |s| &mut s.paint.fill_rounded_corner_distance),
63        8 => visitor.paint(|s| &s.paint.fill_translate, |s| &mut s.paint.fill_translate),
64        9 => visitor.paint(|s| &s.paint.fill_translate_anchor, |s| &mut s.paint.fill_translate_anchor),
65        10 => visitor.layout(|s| &s.layout.fill_sort_key, |s| &mut s.layout.fill_sort_key),
66        _ => return None,
67    })
68}