diff --git a/game/src/common/colors.rs b/game/src/common/colors.rs index ca65d77919..14d2e7c5de 100644 --- a/game/src/common/colors.rs +++ b/game/src/common/colors.rs @@ -5,7 +5,7 @@ use ezgui::{ ManagedWidget, Outcome, Text, VerticalAlignment, }; use geom::{Circle, Distance, Pt2D}; -use map_model::{BuildingID, IntersectionID, LaneID, Map, RoadID}; +use map_model::{BuildingID, BusStopID, IntersectionID, LaneID, Map, RoadID}; use std::collections::HashMap; pub struct ColorerBuilder { @@ -15,6 +15,7 @@ pub struct ColorerBuilder { roads: HashMap, intersections: HashMap, buildings: HashMap, + bus_stops: HashMap, } pub struct Colorer { @@ -55,6 +56,7 @@ impl ColorerBuilder { roads: HashMap::new(), intersections: HashMap::new(), buildings: HashMap::new(), + bus_stops: HashMap::new(), } } @@ -93,9 +95,14 @@ impl ColorerBuilder { self.buildings.insert(b, color); } + pub fn add_bs(&mut self, bs: BusStopID, color: Color) { + self.bus_stops.insert(bs, color); + } + pub fn build(self, ctx: &mut EventCtx, ui: &UI) -> Colorer { let mut zoomed = GeomBatch::new(); let mut unzoomed = GeomBatch::new(); + let map = &ui.primary.map; for (l, color) in self.lanes { zoomed.push( @@ -104,16 +111,25 @@ impl ColorerBuilder { ); } for (r, color) in self.roads { - unzoomed.push(color, ui.primary.map.get_r(r).get_thick_polygon().unwrap()); + unzoomed.push(color, map.get_r(r).get_thick_polygon().unwrap()); } for (i, color) in self.intersections { - zoomed.push(color.alpha(0.4), ui.primary.map.get_i(i).polygon.clone()); - unzoomed.push(color, ui.primary.map.get_i(i).polygon.clone()); + zoomed.push(color.alpha(0.4), map.get_i(i).polygon.clone()); + unzoomed.push(color, map.get_i(i).polygon.clone()); } for (b, color) in self.buildings { - zoomed.push(color.alpha(0.4), ui.primary.map.get_b(b).polygon.clone()); - unzoomed.push(color, ui.primary.map.get_b(b).polygon.clone()); + zoomed.push(color.alpha(0.4), map.get_b(b).polygon.clone()); + unzoomed.push(color, map.get_b(b).polygon.clone()); + } + + for (bs, color) in self.bus_stops { + let pt = map.get_bs(bs).sidewalk_pos.pt(map); + zoomed.push( + color.alpha(0.4), + Circle::new(pt, Distance::meters(5.0)).to_polygon(), + ); + unzoomed.push(color, Circle::new(pt, Distance::meters(15.0)).to_polygon()); } Colorer { diff --git a/game/src/sandbox/overlays.rs b/game/src/sandbox/overlays.rs index bd17ec6696..e33c7b1602 100644 --- a/game/src/sandbox/overlays.rs +++ b/game/src/sandbox/overlays.rs @@ -308,14 +308,21 @@ impl Overlays { } fn bus_network(ctx: &mut EventCtx, ui: &UI) -> Overlays { - let color = Color::hex("#4CA7E9"); - let mut colorer = - ColorerBuilder::new(Text::from(Line("bus networks")), vec![("bus lanes", color)]); + let lane = Color::hex("#4CA7E9"); + let stop = Color::hex("#4CA7E9"); + let mut colorer = ColorerBuilder::new( + Text::from(Line("bus networks")), + vec![("bus lanes", lane), ("bus stops", stop)], + ); for l in ui.primary.map.all_lanes() { if l.is_bus() { - colorer.add_l(l.id, color, &ui.primary.map); + colorer.add_l(l.id, lane, &ui.primary.map); } } + for bs in ui.primary.map.all_bus_stops().keys() { + colorer.add_bs(*bs, stop); + } + Overlays::BusNetwork(colorer.build(ctx, ui)) }