process_map

Function process_map 

Source
pub fn process_map(
    path: &Path,
    highlights: &[MapHighlight],
) -> Result<String, ProcessorError>
Expand description

Process a school map SVG file and apply department highlights.

Loads an SVG map file, finds elements matching the provided highlight IDs, and injects fill attributes with the specified colors.

§Arguments

  • path - Path to the school map SVG file
  • highlights - Vector of department highlights to apply

§Returns

The modified SVG content as a string with highlights applied.

§Errors

Returns ProcessorError if:

  • The map file cannot be read
  • The SVG XML is malformed
  • Regex patterns are invalid

§Example

use timetable_core::processor::{process_map, MapHighlight};
use std::path::Path;

let highlights = vec![
    MapHighlight {
        id: "Maths_Rooms".to_string(),
        color: "#fcdcd8".to_string(),
    },
    MapHighlight {
        id: "Science_Rooms".to_string(),
        color: "#fad7e6".to_string(),
    },
];

let map_svg = process_map(Path::new("resources/map.svg"), &highlights)?;
println!("Processed map: {} bytes", map_svg.len());