use std::collections::HashMap; // Store railway ways for deferred insertion (after relation processing for colors) pub struct RailwayWay { pub id: i64, pub tags: HashMap, pub points: Vec, // Serialized line blob pub first_lat: f64, pub first_lon: f64, } pub struct RailwayStore { ways: HashMap, // way_id -> railway data way_colors: HashMap, // way_id -> colour from route relation } impl RailwayStore { pub fn new() -> Self { Self { ways: HashMap::new(), way_colors: HashMap::new(), } } pub fn insert_way(&mut self, id: i64, tags: HashMap, points: Vec, first_lat: f64, first_lon: f64) { self.ways.insert(id, RailwayWay { id, tags, points, first_lat, first_lon }); } pub fn set_color(&mut self, way_id: i64, color: String) { // Only set if not already set (first route relation wins) self.way_colors.entry(way_id).or_insert(color); } pub fn get_color(&self, way_id: i64) -> Option<&String> { self.way_colors.get(&way_id) } pub fn into_data(self) -> (HashMap, HashMap) { (self.ways, self.way_colors) } }