mln_style/layers/
hillshade_layer_properties.rs1use crate::layer::LayerStyle;
5use crate::layers::Hillshade;
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 HillshadePaintProperties: paint {
12 hillshade_accent_color: constant Color = Color::black(),
13 hillshade_exaggeration: constant f32 = 0.5_f32,
14 hillshade_highlight_color: constant Vec<Color> = vec![Color::white()],
15 hillshade_illumination_altitude: constant Vec<f32> = vec![45.0_f32],
16 hillshade_illumination_anchor: constant HillshadeIlluminationAnchorType = HillshadeIlluminationAnchorType::Viewport,
17 hillshade_illumination_direction: constant Vec<f32> = vec![335.0_f32],
18 hillshade_method: constant HillshadeMethodType = HillshadeMethodType::Standard,
19 hillshade_shadow_color: constant Vec<Color> = vec![Color::black()],
20 resampling: constant ResamplingType = ResamplingType::Linear,
21 }
22 use crate::color::Color, crate::types::HillshadeIlluminationAnchorType, crate::types::HillshadeMethodType, crate::types::ResamplingType;
23);
24
25pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
27 &[
28 PropertyInfo::paint("hillshade-accent-color"),
29 PropertyInfo::paint("hillshade-exaggeration"),
30 PropertyInfo::paint("hillshade-highlight-color"),
31 PropertyInfo::paint("hillshade-illumination-altitude"),
32 PropertyInfo::paint("hillshade-illumination-anchor"),
33 PropertyInfo::paint("hillshade-illumination-direction"),
34 PropertyInfo::paint("hillshade-method"),
35 PropertyInfo::paint("hillshade-shadow-color"),
36 PropertyInfo::paint("resampling"),
37 ],
38 &[0, 1, 2, 3, 4, 5, 6, 7, 8],
39);
40
41pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Hillshade>>>(slot: usize, visitor: V) -> Option<V::Output> {
43 Some(match slot {
44 0 => visitor.paint(|s| &s.paint.hillshade_accent_color, |s| &mut s.paint.hillshade_accent_color),
45 1 => visitor.paint(|s| &s.paint.hillshade_exaggeration, |s| &mut s.paint.hillshade_exaggeration),
46 2 => visitor.paint(|s| &s.paint.hillshade_highlight_color, |s| &mut s.paint.hillshade_highlight_color),
47 3 => visitor.paint(|s| &s.paint.hillshade_illumination_altitude, |s| &mut s.paint.hillshade_illumination_altitude),
48 4 => visitor.paint(|s| &s.paint.hillshade_illumination_anchor, |s| &mut s.paint.hillshade_illumination_anchor),
49 5 => visitor.paint(|s| &s.paint.hillshade_illumination_direction, |s| &mut s.paint.hillshade_illumination_direction),
50 6 => visitor.paint(|s| &s.paint.hillshade_method, |s| &mut s.paint.hillshade_method),
51 7 => visitor.paint(|s| &s.paint.hillshade_shadow_color, |s| &mut s.paint.hillshade_shadow_color),
52 8 => visitor.paint(|s| &s.paint.resampling, |s| &mut s.paint.resampling),
53 _ => return None,
54 })
55}