mln_style/layers/
circle_layer_properties.rs1use crate::layer::LayerStyle;
5use crate::layers::Circle;
6use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};
7
8crate::properties!(
9 #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
11 pub mod CircleLayoutProperties: layout {
12 circle_sort_key: data_driven f32 = 0.0_f32,
13 }
14);
15
16crate::properties!(
17 #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
19 pub mod CirclePaintProperties: paint {
20 circle_blur: data_driven f32 = 0.0_f32,
21 circle_color: data_driven Color = Color::black(),
22 circle_opacity: data_driven f32 = 1.0_f32,
23 circle_pitch_alignment: constant AlignmentType = AlignmentType::Viewport,
24 circle_pitch_scale: constant CirclePitchScaleType = CirclePitchScaleType::Map,
25 circle_radius: data_driven f32 = 5.0_f32,
26 circle_stroke_color: data_driven Color = Color::black(),
27 circle_stroke_opacity: data_driven f32 = 1.0_f32,
28 circle_stroke_width: data_driven f32 = 0.0_f32,
29 circle_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
30 circle_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
31 }
32 use crate::color::Color, crate::types::AlignmentType, crate::types::CirclePitchScaleType, crate::types::TranslateAnchorType;
33);
34
35pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
37 &[
38 PropertyInfo::paint("circle-blur").data_driven(),
39 PropertyInfo::paint("circle-color").data_driven(),
40 PropertyInfo::paint("circle-opacity").data_driven(),
41 PropertyInfo::paint("circle-pitch-alignment"),
42 PropertyInfo::paint("circle-pitch-scale"),
43 PropertyInfo::paint("circle-radius").data_driven(),
44 PropertyInfo::paint("circle-stroke-color").data_driven(),
45 PropertyInfo::paint("circle-stroke-opacity").data_driven(),
46 PropertyInfo::paint("circle-stroke-width").data_driven(),
47 PropertyInfo::paint("circle-translate"),
48 PropertyInfo::paint("circle-translate-anchor"),
49 PropertyInfo::layout("circle-sort-key").data_driven(),
50 ],
51 &[0, 1, 2, 3, 4, 5, 11, 6, 7, 8, 9, 10],
52);
53
54pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Circle>>>(slot: usize, visitor: V) -> Option<V::Output> {
56 Some(match slot {
57 0 => visitor.paint(|s| &s.paint.circle_blur, |s| &mut s.paint.circle_blur),
58 1 => visitor.paint(|s| &s.paint.circle_color, |s| &mut s.paint.circle_color),
59 2 => visitor.paint(|s| &s.paint.circle_opacity, |s| &mut s.paint.circle_opacity),
60 3 => visitor.paint(|s| &s.paint.circle_pitch_alignment, |s| &mut s.paint.circle_pitch_alignment),
61 4 => visitor.paint(|s| &s.paint.circle_pitch_scale, |s| &mut s.paint.circle_pitch_scale),
62 5 => visitor.paint(|s| &s.paint.circle_radius, |s| &mut s.paint.circle_radius),
63 6 => visitor.paint(|s| &s.paint.circle_stroke_color, |s| &mut s.paint.circle_stroke_color),
64 7 => visitor.paint(|s| &s.paint.circle_stroke_opacity, |s| &mut s.paint.circle_stroke_opacity),
65 8 => visitor.paint(|s| &s.paint.circle_stroke_width, |s| &mut s.paint.circle_stroke_width),
66 9 => visitor.paint(|s| &s.paint.circle_translate, |s| &mut s.paint.circle_translate),
67 10 => visitor.paint(|s| &s.paint.circle_translate_anchor, |s| &mut s.paint.circle_translate_anchor),
68 11 => visitor.layout(|s| &s.layout.circle_sort_key, |s| &mut s.layout.circle_sort_key),
69 _ => return None,
70 })
71}