mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-27 15:03:20 +03:00
Add a timer around the slow auto-filter-everything tool, and actually
use the heuristic dropdown on the browse screen
This commit is contained in:
parent
e7bcb12b84
commit
d09bfb7a70
@ -236,12 +236,7 @@ impl<'a> Timer<'a> {
|
||||
return;
|
||||
}
|
||||
let name = raw_name.into();
|
||||
if let Some(StackEntry::Progress(p)) = self.stack.last() {
|
||||
panic!(
|
||||
"Can't start_iter({}) while Progress({}) is top of the stack",
|
||||
name, p.label
|
||||
);
|
||||
}
|
||||
// Note we may have two StackEntry::Progress entries nested
|
||||
|
||||
self.stack
|
||||
.push(StackEntry::Progress(Progress::new(name, total_items)));
|
||||
@ -283,6 +278,7 @@ impl<'a> Timer<'a> {
|
||||
s.nested_results.push(format!("{}- {}", padding, line));
|
||||
s.nested_time += elapsed;
|
||||
}
|
||||
Some(StackEntry::Progress(_)) => {}
|
||||
Some(_) => unreachable!(),
|
||||
None => {
|
||||
self.results.push(format!("{}- {}", padding, line));
|
||||
|
@ -144,6 +144,10 @@ impl State<App> for BrowseNeighborhoods {
|
||||
}
|
||||
"Automatically place filters" => {
|
||||
ctx.loading_screen("automatically filter all neighborhoods", |ctx, timer| {
|
||||
timer.start_iter(
|
||||
"filter neighborhood",
|
||||
app.session.partitioning.all_neighborhoods().len(),
|
||||
);
|
||||
for id in app
|
||||
.session
|
||||
.partitioning
|
||||
@ -152,6 +156,7 @@ impl State<App> for BrowseNeighborhoods {
|
||||
.cloned()
|
||||
.collect::<Vec<_>>()
|
||||
{
|
||||
timer.next();
|
||||
let neighborhood = Neighborhood::new(ctx, app, id);
|
||||
app.session.heuristic.apply(ctx, app, &neighborhood, timer);
|
||||
}
|
||||
@ -168,15 +173,19 @@ impl State<App> for BrowseNeighborhoods {
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
Outcome::Changed(_) => {
|
||||
app.session.highlight_boundary_roads =
|
||||
self.left_panel.is_checked("highlight boundary roads");
|
||||
app.session.draw_neighborhood_style = self.left_panel.dropdown_value("style");
|
||||
Outcome::Changed(x) => {
|
||||
if x == "heuristic" {
|
||||
app.session.heuristic = self.left_panel.dropdown_value("heuristic");
|
||||
} else {
|
||||
app.session.highlight_boundary_roads =
|
||||
self.left_panel.is_checked("highlight boundary roads");
|
||||
app.session.draw_neighborhood_style = self.left_panel.dropdown_value("style");
|
||||
|
||||
ctx.loading_screen("change style", |ctx, timer| {
|
||||
self.world = make_world(ctx, app, timer);
|
||||
self.draw_over_roads = draw_over_roads(ctx, app, timer);
|
||||
});
|
||||
ctx.loading_screen("change style", |ctx, timer| {
|
||||
self.world = make_world(ctx, app, timer);
|
||||
self.draw_over_roads = draw_over_roads(ctx, app, timer);
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user