1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
mod area;
mod bike;
mod building;
mod bus_stop;
mod car;
mod intersection;
mod lane;
mod map;
mod parking_lot;
mod pedestrian;
mod road;
mod traffic_signal;
mod turn;
use crate::app::App;
use crate::colors::ColorScheme;
use crate::helpers::ID;
pub use crate::render::area::DrawArea;
use crate::render::bike::DrawBike;
use crate::render::car::DrawCar;
pub use crate::render::intersection::{calculate_corners, DrawIntersection};
pub use crate::render::map::{AgentCache, DrawMap, UnzoomedAgents};
pub use crate::render::pedestrian::{DrawPedCrowd, DrawPedestrian};
pub use crate::render::traffic_signal::draw_signal_phase;
pub use crate::render::turn::{DrawTurnGroup, DrawUberTurnGroup};
use ezgui::{GfxCtx, Prerender};
use geom::{Distance, Polygon, Pt2D};
use map_model::{IntersectionID, Map};
use sim::{DrawCarInput, VehicleType};
pub const BIG_ARROW_THICKNESS: Distance = Distance::const_meters(0.5);
pub const CROSSWALK_LINE_THICKNESS: Distance = Distance::const_meters(0.15);
pub const OUTLINE_THICKNESS: Distance = Distance::const_meters(0.5);
pub trait Renderable {
fn get_id(&self) -> ID;
fn draw(&self, g: &mut GfxCtx, app: &App, opts: &DrawOptions);
fn get_zorder(&self) -> isize {
-5
}
fn get_outline(&self, map: &Map) -> Polygon;
fn contains_pt(&self, pt: Pt2D, map: &Map) -> bool {
self.get_outline(map).contains_pt(pt)
}
}
fn draw_vehicle(
input: DrawCarInput,
map: &Map,
prerender: &Prerender,
cs: &ColorScheme,
) -> Box<dyn Renderable> {
if input.id.1 == VehicleType::Bike {
Box::new(DrawBike::new(input, map, prerender, cs))
} else {
Box::new(DrawCar::new(input, map, prerender, cs))
}
}
#[derive(Clone)]
pub struct DrawOptions {
pub suppress_traffic_signal_details: Vec<IntersectionID>,
pub label_buildings: bool,
}
impl DrawOptions {
pub fn new() -> DrawOptions {
DrawOptions {
suppress_traffic_signal_details: Vec::new(),
label_buildings: false,
}
}
}