match agents spawning somewhere on a lane as a border intersection, so trip counting works. much simpler than the full refactor attempted in another branch.

This commit is contained in:
Dustin Carlino 2019-11-08 12:23:55 -08:00
parent fff1068689
commit 8fa813f5c2
4 changed files with 12 additions and 22 deletions

View File

@ -38,14 +38,6 @@ impl TripExplorer {
ID::Intersection(i),
Text::from(Line(format!("enter map via {}", i))),
),
TripStart::Appearing(pos) => (
pos.pt(map),
ID::Lane(pos.lane()),
Text::from(Line(format!(
"start by appearing at {}",
map.get_parent(pos.lane()).get_name()
))),
),
},
(
ui.primary

View File

@ -201,14 +201,7 @@ impl TripSpawner {
SidewalkSpot::building(b, map),
));
}
let trip_start = {
let src_i = map.get_i(map.get_l(start_pos.lane()).src_i);
if src_i.is_border() {
TripStart::Border(src_i.id)
} else {
TripStart::Appearing(start_pos)
}
};
let trip_start = TripStart::Border(map.get_l(start_pos.lane()).src_i);
let trip = trips.new_trip(start_time, trip_start, legs);
let router = goal.make_router(path, map, vehicle.vehicle_type);
scheduler.quick_push(
@ -295,7 +288,9 @@ impl TripSpawner {
start_time,
match start.connection {
SidewalkPOI::Building(b) => TripStart::Bldg(b),
SidewalkPOI::SuddenlyAppear => TripStart::Appearing(start.sidewalk_pos),
SidewalkPOI::SuddenlyAppear => {
TripStart::Border(map.get_l(start.sidewalk_pos.lane()).src_i)
}
SidewalkPOI::Border(i) => TripStart::Border(i),
_ => unreachable!(),
},
@ -340,7 +335,9 @@ impl TripSpawner {
start_time,
match start.connection {
SidewalkPOI::Building(b) => TripStart::Bldg(b),
SidewalkPOI::SuddenlyAppear => TripStart::Appearing(start.sidewalk_pos),
SidewalkPOI::SuddenlyAppear => {
TripStart::Border(map.get_l(start.sidewalk_pos.lane()).src_i)
}
SidewalkPOI::Border(i) => TripStart::Border(i),
_ => unreachable!(),
},
@ -372,7 +369,9 @@ impl TripSpawner {
start_time,
match start.connection {
SidewalkPOI::Building(b) => TripStart::Bldg(b),
SidewalkPOI::SuddenlyAppear => TripStart::Appearing(start.sidewalk_pos),
SidewalkPOI::SuddenlyAppear => {
TripStart::Border(map.get_l(start.sidewalk_pos.lane()).src_i)
}
SidewalkPOI::Border(i) => TripStart::Border(i),
_ => unreachable!(),
},

View File

@ -11,7 +11,7 @@ use derivative::Derivative;
use geom::{Distance, Duration, DurationHistogram, PolyLine, Pt2D};
use map_model::{
BuildingID, BusRoute, BusRouteID, IntersectionID, LaneID, Map, Path, PathRequest, PathStep,
Position, Traversable,
Traversable,
};
use serde_derive::{Deserialize, Serialize};
use std::collections::HashSet;
@ -231,7 +231,7 @@ impl Sim {
// Same for this TripStart, though it doesn't matter too much.
let trip = self.trips.new_trip(
self.time,
TripStart::Appearing(Position::new(path.current_step().as_lane(), Distance::ZERO)),
TripStart::Border(map.get_l(path.current_step().as_lane()).src_i),
vec![TripLeg::ServeBusRoute(id, route.id)],
);

View File

@ -742,7 +742,6 @@ impl std::fmt::Display for TripMode {
pub enum TripStart {
Bldg(BuildingID),
Border(IntersectionID),
Appearing(Position),
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]