mln-rs-style 0.0.21

Part of mln-rs, a MapLibre map renderer written in Rust. Depend on mln-rs instead.
Documentation
// This file is generated by //tools/style-codegen from the style spec
// (tools/style-codegen/v8.json). Do not edit.

use crate::layer::LayerStyle;
use crate::layers::Hillshade;
use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};

crate::properties!(
    /// The paint properties of a hillshade layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod HillshadePaintProperties: paint {
        hillshade_accent_color: constant Color = Color::black(),
        hillshade_exaggeration: constant f32 = 0.5_f32,
        hillshade_highlight_color: constant Vec<Color> = vec![Color::white()],
        hillshade_illumination_altitude: constant Vec<f32> = vec![45.0_f32],
        hillshade_illumination_anchor: constant HillshadeIlluminationAnchorType = HillshadeIlluminationAnchorType::Viewport,
        hillshade_illumination_direction: constant Vec<f32> = vec![335.0_f32],
        hillshade_method: constant HillshadeMethodType = HillshadeMethodType::Standard,
        hillshade_shadow_color: constant Vec<Color> = vec![Color::black()],
        resampling: constant ResamplingType = ResamplingType::Linear,
    }
    use crate::color::Color, crate::types::HillshadeIlluminationAnchorType, crate::types::HillshadeMethodType, crate::types::ResamplingType;
);

/// The properties, by slot.
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
    &[
        PropertyInfo::paint("hillshade-accent-color"),
        PropertyInfo::paint("hillshade-exaggeration"),
        PropertyInfo::paint("hillshade-highlight-color"),
        PropertyInfo::paint("hillshade-illumination-altitude"),
        PropertyInfo::paint("hillshade-illumination-anchor"),
        PropertyInfo::paint("hillshade-illumination-direction"),
        PropertyInfo::paint("hillshade-method"),
        PropertyInfo::paint("hillshade-shadow-color"),
        PropertyInfo::paint("resampling"),
    ],
    &[0, 1, 2, 3, 4, 5, 6, 7, 8],
);

/// Calls `visitor` with the field of the property in `slot`.
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Hillshade>>>(slot: usize, visitor: V) -> Option<V::Output> {
    Some(match slot {
        0 => visitor.paint(|s| &s.paint.hillshade_accent_color, |s| &mut s.paint.hillshade_accent_color),
        1 => visitor.paint(|s| &s.paint.hillshade_exaggeration, |s| &mut s.paint.hillshade_exaggeration),
        2 => visitor.paint(|s| &s.paint.hillshade_highlight_color, |s| &mut s.paint.hillshade_highlight_color),
        3 => visitor.paint(|s| &s.paint.hillshade_illumination_altitude, |s| &mut s.paint.hillshade_illumination_altitude),
        4 => visitor.paint(|s| &s.paint.hillshade_illumination_anchor, |s| &mut s.paint.hillshade_illumination_anchor),
        5 => visitor.paint(|s| &s.paint.hillshade_illumination_direction, |s| &mut s.paint.hillshade_illumination_direction),
        6 => visitor.paint(|s| &s.paint.hillshade_method, |s| &mut s.paint.hillshade_method),
        7 => visitor.paint(|s| &s.paint.hillshade_shadow_color, |s| &mut s.paint.hillshade_shadow_color),
        8 => visitor.paint(|s| &s.paint.resampling, |s| &mut s.paint.resampling),
        _ => return None,
    })
}