Skip to main content

mln_style/layers/
line_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::Line;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9    /// The layout properties of a line layer.
10    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11    pub mod LineLayoutProperties: layout {
12        line_cap: data_driven LineCapType = LineCapType::Butt,
13        line_join: data_driven LineJoinType = LineJoinType::Miter,
14        line_miter_limit: data_driven f32 = 2.0_f32,
15        line_round_limit: data_driven f32 = 1.05_f32,
16        line_sort_key: data_driven f32 = 0.0_f32,
17    }
18    use crate::types::LineCapType, crate::types::LineJoinType;
19);
20
21crate::properties!(
22    /// The paint properties of a line layer.
23    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
24    pub mod LinePaintProperties: paint {
25        line_blur: data_driven f32 = 0.0_f32,
26        line_color: data_driven Color = Color::black(),
27        line_dasharray: cross_faded_or_data_driven Vec<f32> = Vec::new(),
28        line_gap_width: data_driven f32 = 0.0_f32,
29        line_gradient: color_ramp Color = Color::default(),
30        line_layer_blend: constant LayerBlendType = LayerBlendType::Normal,
31        line_layer_opacity: constant f32 = 1.0_f32,
32        line_offset: data_driven f32 = 0.0_f32,
33        line_opacity: data_driven f32 = 1.0_f32,
34        line_pattern: cross_faded_data_driven Image = Image::default(),
35        line_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
36        line_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
37        line_width: data_driven f32 = 1.0_f32,
38    }
39    derived {
40        line_floor_width: integer_zoom f32 = 1.0_f32 => line_width,
41    }
42    use crate::color::Color, crate::expression::Image, crate::types::LayerBlendType, crate::types::TranslateAnchorType;
43);
44
45/// The properties, by slot.
46pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
47    &[
48        PropertyInfo::paint("line-blur").data_driven().interpolated(),
49        PropertyInfo::paint("line-color").data_driven().interpolated(),
50        PropertyInfo::paint("line-dasharray").data_driven().cross_faded(),
51        PropertyInfo::paint("line-gap-width").data_driven().interpolated(),
52        PropertyInfo::paint("line-gradient").interpolated(),
53        PropertyInfo::paint("line-layer-blend"),
54        PropertyInfo::paint("line-layer-opacity").interpolated(),
55        PropertyInfo::paint("line-offset").data_driven().interpolated(),
56        PropertyInfo::paint("line-opacity").data_driven().interpolated(),
57        PropertyInfo::paint("line-pattern").data_driven().cross_faded(),
58        PropertyInfo::paint("line-translate").interpolated(),
59        PropertyInfo::paint("line-translate-anchor"),
60        PropertyInfo::paint("line-width").data_driven().interpolated(),
61        PropertyInfo::layout("line-cap").data_driven(),
62        PropertyInfo::layout("line-join").data_driven(),
63        PropertyInfo::layout("line-miter-limit").data_driven().interpolated(),
64        PropertyInfo::layout("line-round-limit").data_driven().interpolated(),
65        PropertyInfo::layout("line-sort-key").data_driven(),
66    ],
67    &[0, 13, 1, 2, 3, 4, 14, 5, 6, 15, 7, 8, 9, 16, 17, 10, 11, 12],
68);
69
70/// Calls `visitor` with the field of the property in `slot`.
71pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Line>>>(slot: usize, visitor: V) -> Option<V::Output> {
72    Some(match slot {
73        0 => visitor.paint(|s| &s.paint.line_blur, |s| &mut s.paint.line_blur),
74        1 => visitor.paint(|s| &s.paint.line_color, |s| &mut s.paint.line_color),
75        2 => visitor.paint(|s| &s.paint.line_dasharray, |s| &mut s.paint.line_dasharray),
76        3 => visitor.paint(|s| &s.paint.line_gap_width, |s| &mut s.paint.line_gap_width),
77        4 => visitor.paint(|s| &s.paint.line_gradient, |s| &mut s.paint.line_gradient),
78        5 => visitor.paint(|s| &s.paint.line_layer_blend, |s| &mut s.paint.line_layer_blend),
79        6 => visitor.paint(|s| &s.paint.line_layer_opacity, |s| &mut s.paint.line_layer_opacity),
80        7 => visitor.paint(|s| &s.paint.line_offset, |s| &mut s.paint.line_offset),
81        8 => visitor.paint(|s| &s.paint.line_opacity, |s| &mut s.paint.line_opacity),
82        9 => visitor.paint(|s| &s.paint.line_pattern, |s| &mut s.paint.line_pattern),
83        10 => visitor.paint(|s| &s.paint.line_translate, |s| &mut s.paint.line_translate),
84        11 => visitor.paint(|s| &s.paint.line_translate_anchor, |s| &mut s.paint.line_translate_anchor),
85        12 => visitor.paint(|s| &s.paint.line_width, |s| &mut s.paint.line_width),
86        13 => visitor.layout(|s| &s.layout.line_cap, |s| &mut s.layout.line_cap),
87        14 => visitor.layout(|s| &s.layout.line_join, |s| &mut s.layout.line_join),
88        15 => visitor.layout(|s| &s.layout.line_miter_limit, |s| &mut s.layout.line_miter_limit),
89        16 => visitor.layout(|s| &s.layout.line_round_limit, |s| &mut s.layout.line_round_limit),
90        17 => visitor.layout(|s| &s.layout.line_sort_key, |s| &mut s.layout.line_sort_key),
91        _ => return None,
92    })
93}