note in trip panel when a path isnt possible anymore

This commit is contained in:
Dustin Carlino 2020-05-06 09:54:58 -07:00
parent e1c827ed24
commit 6696049b09
3 changed files with 12 additions and 1 deletions

View File

@ -91,6 +91,8 @@ You can rerun specific stages of the importer:
- By default, Seattle is assumed as the city. You have to specify otherwise:
`./import.sh --city=los_angeles --map downtown_la`.
You can also make the importer [import a new city](new_city.md).
## Understanding stuff
The docs listed at

View File

@ -368,6 +368,7 @@ fn make_timeline(
let mut timeline = Vec::new();
let num_phases = phases.len();
let mut elevation = Vec::new();
let mut path_impossible = false;
for (idx, p) in phases.into_iter().enumerate() {
let color = match p.phase_type {
TripPhaseType::Driving => app.cs.unzoomed_car,
@ -495,6 +496,8 @@ fn make_timeline(
),
);
}
} else if p.has_path_req {
path_impossible = true;
}
}
@ -552,6 +555,9 @@ fn make_timeline(
])
.margin_above(5),
];
if path_impossible {
col.push("Map edits have disconnected the path taken before".draw_text(ctx));
}
// TODO This just needs too much more work
if false {
col.extend(elevation);

View File

@ -441,6 +441,7 @@ impl Analytics {
map.pathfind(req.clone())
.map(|path| (req.start.dist_along(), path))
}),
has_path_req: maybe_req.is_some(),
phase_type: *phase_type,
})
}
@ -449,7 +450,7 @@ impl Analytics {
pub fn get_all_trip_phases(&self) -> BTreeMap<TripID, Vec<TripPhase>> {
let mut trips = BTreeMap::new();
for (t, id, _, phase_type) in &self.trip_log {
for (t, id, maybe_req, phase_type) in &self.trip_log {
let phases: &mut Vec<TripPhase> = trips.entry(*id).or_insert_with(Vec::new);
if let Some(ref mut last) = phases.last_mut() {
last.end_time = Some(*t);
@ -467,6 +468,7 @@ impl Analytics {
end_time: None,
// Don't compute any paths
path: None,
has_path_req: maybe_req.is_some(),
phase_type: *phase_type,
})
}
@ -611,6 +613,7 @@ pub struct TripPhase {
pub end_time: Option<Time>,
// Plumb along start distance
pub path: Option<(Distance, Path)>,
pub has_path_req: bool,
pub phase_type: TripPhaseType,
}