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::Raster;
use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};

crate::properties!(
    /// The paint properties of a raster layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod RasterPaintProperties: paint {
        raster_brightness_max: constant f32 = 1.0_f32,
        raster_brightness_min: constant f32 = 0.0_f32,
        raster_contrast: constant f32 = 0.0_f32,
        raster_fade_duration: constant f32 = 300.0_f32,
        raster_hue_rotate: constant f32 = 0.0_f32,
        raster_layer_blend: constant LayerBlendType = LayerBlendType::Normal,
        raster_opacity: constant f32 = 1.0_f32,
        raster_resampling: constant RasterResamplingType = RasterResamplingType::Linear,
        raster_saturation: constant f32 = 0.0_f32,
        resampling: constant ResamplingType = ResamplingType::Linear,
    }
    use crate::types::LayerBlendType, crate::types::RasterResamplingType, crate::types::ResamplingType;
);

/// The properties, by slot.
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
    &[
        PropertyInfo::paint("raster-brightness-max"),
        PropertyInfo::paint("raster-brightness-min"),
        PropertyInfo::paint("raster-contrast"),
        PropertyInfo::paint("raster-fade-duration"),
        PropertyInfo::paint("raster-hue-rotate"),
        PropertyInfo::paint("raster-layer-blend"),
        PropertyInfo::paint("raster-opacity"),
        PropertyInfo::paint("raster-resampling"),
        PropertyInfo::paint("raster-saturation"),
        PropertyInfo::paint("resampling"),
    ],
    &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
);

/// Calls `visitor` with the field of the property in `slot`.
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Raster>>>(slot: usize, visitor: V) -> Option<V::Output> {
    Some(match slot {
        0 => visitor.paint(|s| &s.paint.raster_brightness_max, |s| &mut s.paint.raster_brightness_max),
        1 => visitor.paint(|s| &s.paint.raster_brightness_min, |s| &mut s.paint.raster_brightness_min),
        2 => visitor.paint(|s| &s.paint.raster_contrast, |s| &mut s.paint.raster_contrast),
        3 => visitor.paint(|s| &s.paint.raster_fade_duration, |s| &mut s.paint.raster_fade_duration),
        4 => visitor.paint(|s| &s.paint.raster_hue_rotate, |s| &mut s.paint.raster_hue_rotate),
        5 => visitor.paint(|s| &s.paint.raster_layer_blend, |s| &mut s.paint.raster_layer_blend),
        6 => visitor.paint(|s| &s.paint.raster_opacity, |s| &mut s.paint.raster_opacity),
        7 => visitor.paint(|s| &s.paint.raster_resampling, |s| &mut s.paint.raster_resampling),
        8 => visitor.paint(|s| &s.paint.raster_saturation, |s| &mut s.paint.raster_saturation),
        9 => visitor.paint(|s| &s.paint.resampling, |s| &mut s.paint.resampling),
        _ => return None,
    })
}