abstreet/sim/src/render.rs

65 lines
1.5 KiB
Rust
Raw Normal View History

//! Intermediate structures so that sim and game crates don't have a cyclic dependency.
2020-10-07 04:25:39 +03:00
use geom::{Angle, Distance, PolyLine, Pt2D};
use map_model::{BuildingID, ParkingLotID, Traversable, TurnID};
2018-11-13 22:34:17 +03:00
use crate::{AgentID, CarID, PedestrianID, PersonID};
#[derive(Clone)]
2018-11-13 22:34:17 +03:00
pub struct DrawPedestrianInput {
pub id: PedestrianID,
pub pos: Pt2D,
2019-05-06 22:12:31 +03:00
pub facing: Angle,
2018-11-13 22:34:17 +03:00
pub waiting_for_turn: Option<TurnID>,
2018-11-17 01:23:33 +03:00
pub preparing_bike: bool,
pub waiting_for_bus: bool,
pub on: Traversable,
2018-11-13 22:34:17 +03:00
}
pub struct DrawPedCrowdInput {
pub low: Distance,
pub high: Distance,
pub members: Vec<PedestrianID>,
pub location: PedCrowdLocation,
}
#[derive(Clone)]
pub enum PedCrowdLocation {
/// bool is contraflow
Sidewalk(Traversable, bool),
BldgDriveway(BuildingID),
LotDriveway(ParkingLotID),
}
#[derive(Clone)]
2018-11-13 22:34:17 +03:00
pub struct DrawCarInput {
pub id: CarID,
pub waiting_for_turn: Option<TurnID>,
2019-02-27 03:39:17 +03:00
pub status: CarStatus,
2020-10-08 00:16:58 +03:00
pub show_parking_intent: bool,
/// Front of the car
pub on: Traversable,
/// Possibly the rest
pub partly_on: Vec<Traversable>,
2019-08-13 22:20:28 +03:00
pub label: Option<String>,
2019-01-11 02:11:16 +03:00
// Starts at the BACK of the car.
2019-01-11 02:11:16 +03:00
pub body: PolyLine,
2018-11-13 22:34:17 +03:00
}
#[derive(Clone, Copy, PartialEq, Eq)]
2019-02-27 03:39:17 +03:00
pub enum CarStatus {
2018-11-13 22:34:17 +03:00
Moving,
Parked,
2018-11-13 22:34:17 +03:00
}
pub struct UnzoomedAgent {
pub id: AgentID,
pub pos: Pt2D,
/// None means a bus.
pub person: Option<PersonID>,
/// True only for cars currently looking for parking. I don't want this struct to grow, but
/// this is important enough to call out here.
pub parking: bool,
}