sim/
render.rs

1//! Intermediate structures so that sim and game crates don't have a cyclic dependency.
2
3use geom::{Angle, Distance, PolyLine, Pt2D};
4use map_model::{BuildingID, ParkingLotID, Traversable, TurnID};
5
6use crate::{AgentID, CarID, PedestrianID, PersonID};
7
8#[derive(Clone)]
9pub struct DrawPedestrianInput {
10    pub id: PedestrianID,
11    pub pos: Pt2D,
12    pub facing: Angle,
13    pub waiting_for_turn: Option<TurnID>,
14    pub intent: Option<Intent>,
15    pub preparing_bike: bool,
16    pub waiting_for_bus: bool,
17    pub on: Traversable,
18    pub person: PersonID,
19}
20
21pub struct DrawPedCrowdInput {
22    pub low: Distance,
23    pub high: Distance,
24    pub members: Vec<PedestrianID>,
25    pub location: PedCrowdLocation,
26}
27
28#[derive(Clone)]
29pub enum PedCrowdLocation {
30    /// bool is contraflow
31    Sidewalk(Traversable, bool),
32    BldgDriveway(BuildingID),
33    LotDriveway(ParkingLotID),
34}
35
36#[derive(Clone)]
37pub struct DrawCarInput {
38    pub id: CarID,
39    pub waiting_for_turn: Option<TurnID>,
40    pub status: CarStatus,
41    pub intent: Option<Intent>,
42    /// Front of the car
43    pub on: Traversable,
44    /// Possibly the rest
45    pub partly_on: Vec<Traversable>,
46    pub label: Option<String>,
47    /// None means a bus or parked car. Note parked cars do NOT express their owner here!
48    pub person: Option<PersonID>,
49
50    // Starts at the BACK of the car.
51    pub body: PolyLine,
52}
53
54#[derive(Clone, Copy, PartialEq, Eq)]
55pub enum CarStatus {
56    Moving,
57    Parked,
58}
59
60/// Shows an agent's current inner intention or thoughts.
61#[derive(Clone, PartialEq)]
62pub enum Intent {
63    Parking,
64    SteepUphill,
65}
66
67pub struct UnzoomedAgent {
68    pub id: AgentID,
69    pub pos: Pt2D,
70    /// None means a bus.
71    pub person: Option<PersonID>,
72    /// True only for cars currently looking for parking. I don't want this struct to grow, but
73    /// this is important enough to call out here.
74    pub parking: bool,
75}