Skip to content

Commit

Permalink
Speed up LTN tool filter placement, by skipping an expensive building…
Browse files Browse the repository at this point in the history
… snapping step when lane config doesn't change. #1079
  • Loading branch information
dabreegster committed May 2, 2023
1 parent 6059587 commit 26ef670
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions map_model/src/edits/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,22 @@ impl EditCmd {
fn apply(&self, effects: &mut EditEffects, map: &mut Map) {
match self {
EditCmd::ChangeRoad { r, ref new, .. } => {
if map.get_r_edit(*r) == new.clone() {
let old_state = map.get_r_edit(*r);
if old_state == new.clone() {
return;
}

modify_lanes(map, *r, new.lanes_ltr.clone(), effects);
if old_state.lanes_ltr != new.lanes_ltr {
modify_lanes(map, *r, new.lanes_ltr.clone(), effects);
}
let road = &mut map.roads[r.0];
road.speed_limit = new.speed_limit;
road.access_restrictions = new.access_restrictions.clone();
road.modal_filter = new.modal_filter.clone();
road.crossings = new.crossings.clone();

effects.changed_roads.insert(road.id);
// TODO If lanes_ltr didn't change, can we skip some of this?
for i in [road.src_i, road.dst_i] {
effects.changed_intersections.insert(i);
let i = &mut map.intersections[i.0];
Expand Down

0 comments on commit 26ef670

Please sign in to comment.