diff --git a/editor/src/render/map.rs b/editor/src/render/map.rs index b3b7d43c74..78db3abeaa 100644 --- a/editor/src/render/map.rs +++ b/editor/src/render/map.rs @@ -377,7 +377,7 @@ impl AgentCache { let mut batch = GeomBatch::new(); let radius = Distance::meters(10.0) / g.canvas.cam_zoom; - for agent in primary.sim.get_unzoomed_agents_with_details(&primary.map) { + for agent in primary.sim.get_unzoomed_agents(&primary.map) { batch.push( acs.color_for(&agent, cs), Circle::new(agent.pos, radius).to_polygon(), diff --git a/sim/src/mechanics/driving.rs b/sim/src/mechanics/driving.rs index a7c4940708..eca2c74f70 100644 --- a/sim/src/mechanics/driving.rs +++ b/sim/src/mechanics/driving.rs @@ -3,10 +3,10 @@ use crate::mechanics::queue::Queue; use crate::{ ActionAtEnd, AgentID, CarID, Command, CreateCar, DistanceInterval, DrawCarInput, IntersectionSimState, ParkedCar, ParkingSimState, Scheduler, TimeInterval, TransitSimState, - TripManager, TripPositions, UnzoomedAgent, VehicleType, WalkingSimState, FOLLOWING_DISTANCE, + TripManager, TripPositions, UnzoomedAgent, WalkingSimState, FOLLOWING_DISTANCE, }; use abstutil::{deserialize_btreemap, serialize_btreemap}; -use geom::{Distance, Duration, PolyLine, Pt2D}; +use geom::{Distance, Duration, PolyLine}; use map_model::{BuildingID, IntersectionID, LaneID, Map, Path, Traversable}; use petgraph::graph::{Graph, NodeIndex}; use serde_derive::{Deserialize, Serialize}; @@ -653,41 +653,7 @@ impl DrivingSimState { } } - // cars, bikes, buses - pub fn get_unzoomed_agents( - &self, - now: Duration, - map: &Map, - ) -> (Vec, Vec, Vec) { - let mut cars = Vec::new(); - let mut bikes = Vec::new(); - let mut buses = Vec::new(); - - for queue in self.queues.values() { - if queue.cars.is_empty() { - continue; - } - - for (car, dist) in queue.get_car_positions(now, &self.cars, &self.queues) { - let result = queue.id.dist_along(dist, map).0; - match car.1 { - VehicleType::Car => { - cars.push(result); - } - VehicleType::Bike => { - bikes.push(result); - } - VehicleType::Bus => { - buses.push(result); - } - } - } - } - - (cars, bikes, buses) - } - - pub fn get_unzoomed_agents_with_details(&self, now: Duration, map: &Map) -> Vec { + pub fn get_unzoomed_agents(&self, now: Duration, map: &Map) -> Vec { let mut result = Vec::new(); for queue in self.queues.values() { diff --git a/sim/src/mechanics/walking.rs b/sim/src/mechanics/walking.rs index 36a79d7abd..4814a00a49 100644 --- a/sim/src/mechanics/walking.rs +++ b/sim/src/mechanics/walking.rs @@ -4,7 +4,7 @@ use crate::{ TimeInterval, TransitSimState, TripID, TripManager, TripPositions, UnzoomedAgent, }; use abstutil::{deserialize_multimap, serialize_multimap, MultiMap}; -use geom::{Distance, Duration, Line, PolyLine, Pt2D, Speed}; +use geom::{Distance, Duration, Line, PolyLine, Speed}; use map_model::{BuildingID, Map, Path, PathStep, Traversable, LANE_THICKNESS}; use serde_derive::{Deserialize, Serialize}; use std::collections::BTreeMap; @@ -262,17 +262,7 @@ impl WalkingSimState { Some(&p.path) } - pub fn get_unzoomed_agents(&self, now: Duration, map: &Map) -> Vec { - let mut peds = Vec::new(); - - for ped in self.peds.values() { - peds.push(ped.get_draw_ped(now, map).pos); - } - - peds - } - - pub fn get_unzoomed_agents_with_details(&self, now: Duration, map: &Map) -> Vec { + pub fn get_unzoomed_agents(&self, now: Duration, map: &Map) -> Vec { let mut peds = Vec::new(); for ped in self.peds.values() { diff --git a/sim/src/sim.rs b/sim/src/sim.rs index 7ef9da0715..dfe9ba8ef0 100644 --- a/sim/src/sim.rs +++ b/sim/src/sim.rs @@ -310,22 +310,9 @@ impl GetDrawAgents for Sim { // Drawing impl Sim { - // The results represent (cars, bikes, buses, pedestrians) - pub fn get_unzoomed_agents(&self, map: &Map) -> (Vec, Vec, Vec, Vec) { - let (cars, bikes, buses) = self.driving.get_unzoomed_agents(self.time, map); - let peds = self.walking.get_unzoomed_agents(self.time, map); - (cars, bikes, buses, peds) - } - - // TODO Ideally we'd always return UnzoomedAgent, but it's slow! - pub fn get_unzoomed_agents_with_details(&self, map: &Map) -> Vec { - let mut result = self - .driving - .get_unzoomed_agents_with_details(self.time, map); - result.extend( - self.walking - .get_unzoomed_agents_with_details(self.time, map), - ); + pub fn get_unzoomed_agents(&self, map: &Map) -> Vec { + let mut result = self.driving.get_unzoomed_agents(self.time, map); + result.extend(self.walking.get_unzoomed_agents(self.time, map)); result } }