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

crate::properties!(
    /// The layout properties of a fill layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod FillLayoutProperties: layout {
        fill_sort_key: data_driven f32 = 0.0_f32,
    }
);

crate::properties!(
    /// The paint properties of a fill layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod FillPaintProperties: paint {
        fill_antialias: constant bool = true,
        fill_color: data_driven Color = Color::black(),
        fill_layer_blend: constant LayerBlendType = LayerBlendType::Normal,
        fill_layer_opacity: constant f32 = 1.0_f32,
        fill_opacity: data_driven f32 = 1.0_f32,
        fill_outline_color: data_driven Color = Color::default(),
        fill_pattern: cross_faded_data_driven Image = Image::default(),
        fill_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
        fill_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
    }
    use crate::color::Color, crate::expression::Image, crate::types::LayerBlendType, crate::types::TranslateAnchorType;
);

/// The properties, by slot.
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
    &[
        PropertyInfo::paint("fill-antialias"),
        PropertyInfo::paint("fill-color").data_driven(),
        PropertyInfo::paint("fill-layer-blend"),
        PropertyInfo::paint("fill-layer-opacity"),
        PropertyInfo::paint("fill-opacity").data_driven(),
        PropertyInfo::paint("fill-outline-color").data_driven(),
        PropertyInfo::paint("fill-pattern").data_driven().cross_faded(),
        PropertyInfo::paint("fill-translate"),
        PropertyInfo::paint("fill-translate-anchor"),
        PropertyInfo::layout("fill-sort-key").data_driven(),
    ],
    &[0, 1, 2, 3, 4, 5, 6, 9, 7, 8],
);

/// Calls `visitor` with the field of the property in `slot`.
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Fill>>>(slot: usize, visitor: V) -> Option<V::Output> {
    Some(match slot {
        0 => visitor.paint(|s| &s.paint.fill_antialias, |s| &mut s.paint.fill_antialias),
        1 => visitor.paint(|s| &s.paint.fill_color, |s| &mut s.paint.fill_color),
        2 => visitor.paint(|s| &s.paint.fill_layer_blend, |s| &mut s.paint.fill_layer_blend),
        3 => visitor.paint(|s| &s.paint.fill_layer_opacity, |s| &mut s.paint.fill_layer_opacity),
        4 => visitor.paint(|s| &s.paint.fill_opacity, |s| &mut s.paint.fill_opacity),
        5 => visitor.paint(|s| &s.paint.fill_outline_color, |s| &mut s.paint.fill_outline_color),
        6 => visitor.paint(|s| &s.paint.fill_pattern, |s| &mut s.paint.fill_pattern),
        7 => visitor.paint(|s| &s.paint.fill_translate, |s| &mut s.paint.fill_translate),
        8 => visitor.paint(|s| &s.paint.fill_translate_anchor, |s| &mut s.paint.fill_translate_anchor),
        9 => visitor.layout(|s| &s.layout.fill_sort_key, |s| &mut s.layout.fill_sort_key),
        _ => return None,
    })
}