fix bike layer when there's no traffic yet

This commit is contained in:
Dustin Carlino 2020-05-30 13:12:57 -07:00
parent 204b2962b1
commit 1161591b6b
4 changed files with 19 additions and 2 deletions

View File

@ -441,3 +441,11 @@ changes here.
- rendering improvements: unzoomed agent size, visualizing routes on trip table, transparent roads beneath bridges, draw harbor island
- overhauled street/address finder
- parking mapper: shortcut to open bing
0.1.43
- new map picker!
- UI polish: traffic signal editor, layers, bus stops, delay plots
- generate more interesting biographies for people
- tuned all the map boundaries
- fleshing out lots of docs in preparation for the alpha release...

View File

@ -82,6 +82,7 @@ impl LaneEditor {
change_speed_limit(ctx, parent.speed_limit).margin_below(5),
Widget::row(vec![
Btn::text_fg("Finish").build_def(ctx, hotkey(Key::Escape)),
// TODO Handle reverting speed limit too...
if app.primary.map.get_edits().original_lts.contains_key(&l)
|| app.primary.map.get_edits().reversed_lanes.contains(&l)
{

View File

@ -555,7 +555,7 @@ pub fn change_speed_limit(ctx: &mut EventCtx, default: Speed) -> Widget {
"Change speed limit:"
.draw_text(ctx)
.centered_vert()
.margin_right(5),
.margin_right(15),
Widget::dropdown(
ctx,
"speed limit",

View File

@ -56,9 +56,16 @@ impl Layer for BikeNetwork {
impl BikeNetwork {
pub fn new(ctx: &mut EventCtx, app: &App) -> BikeNetwork {
// Show throughput, broken down by bike lanes or not
let mut on_bike_lanes = Counter::new();
let mut off_bike_lanes = Counter::new();
// Make sure all bikes lanes show up no matter what
for l in app.primary.map.all_lanes() {
if l.is_biking() {
on_bike_lanes.add(l.parent, 0);
}
}
// Show throughput, broken down by bike lanes or not
for ((r, mode, _), count) in &app.primary.sim.get_analytics().road_thruput.counts {
if *mode == TripMode::Bike {
let (fwd, back) = app.primary.map.get_r(*r).get_lane_types();
@ -86,6 +93,7 @@ impl BikeNetwork {
(on_bike_lanes, &app.cs.good_to_bad_monochrome_green),
(off_bike_lanes, &app.cs.good_to_bad_monochrome_red),
] {
// TODO This is nonsense, bin based on percentiles of values. Dupe values now.
let roads = counter.sorted_asc();
let p50_idx = ((roads.len() as f64) * 0.5) as usize;
let p90_idx = ((roads.len() as f64) * 0.9) as usize;