mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
fix crosswalk coupling in intersection editors, not sure when this broke
This commit is contained in:
parent
1d5e5a2795
commit
b6cdd0f99c
@ -24,7 +24,8 @@ https://gis-kingcounty.opendata.arcgis.com/datasets/acs-means-of-transportation-
|
||||
https://gis-kingcounty.opendata.arcgis.com/datasets/acs-travel-time-to-work-acs-b08303-traveltime
|
||||
https://gis-kingcounty.opendata.arcgis.com/datasets/consolidated-demographics-index-for-king-county-census-tracts-demographic-index-area
|
||||
https://gis-kingcounty.opendata.arcgis.com/datasets/acs-household-size-by-vehicles-available-acs-b08201-householdvehicles
|
||||
|
||||
https://lehd.ces.census.gov/
|
||||
https://movement.uber.com/explore/seattle/
|
||||
|
||||
- indications of population
|
||||
https://gis-kingcounty.opendata.arcgis.com/datasets/acs-total-population-acs-b01003-totalpop
|
||||
|
@ -26,6 +26,8 @@
|
||||
- https://commuteseattle.com/
|
||||
- https://www.theurbanist.org/
|
||||
- https://humantransit.org/2019/03/notes-on-simcity-at-30.html
|
||||
- https://mynorthwest.com/category/chokepoints/
|
||||
- https://blogs.uw.edu/ceadvice/2019/05/08/infrastructure-week-2019-welcome-uw-cee-students-and-faculty/
|
||||
|
||||
## Similar projects
|
||||
|
||||
|
@ -142,7 +142,7 @@ impl TrafficSignalEditor {
|
||||
Key::Space,
|
||||
&format!("toggle from {:?} to {:?}", cycle.get_priority(id), pri),
|
||||
) {
|
||||
cycle.edit_turn(id, pri);
|
||||
cycle.edit_turn(ui.primary.map.get_t(id), pri);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@ -201,11 +201,8 @@ impl TrafficSignalEditor {
|
||||
} else if has_sidewalks && self.menu.action("add a new pedestrian scramble cycle") {
|
||||
let mut cycle = Cycle::new(self.i, signal.cycles.len());
|
||||
for t in ui.primary.map.get_turns_in_intersection(self.i) {
|
||||
// edit_turn adds the other_crosswalk_id and asserts no duplicates.
|
||||
if t.turn_type == TurnType::SharedSidewalkCorner
|
||||
|| (t.turn_type == TurnType::Crosswalk && t.id.src < t.id.dst)
|
||||
{
|
||||
cycle.edit_turn(t.id, TurnPriority::Priority);
|
||||
if t.between_sidewalks() {
|
||||
cycle.edit_turn(t, TurnPriority::Priority);
|
||||
}
|
||||
}
|
||||
signal.cycles.insert(self.current_cycle, cycle);
|
||||
|
@ -154,7 +154,11 @@ impl ControlStopSign {
|
||||
}
|
||||
|
||||
pub fn change(&mut self, t: TurnID, pri: TurnPriority, map: &Map) {
|
||||
let turn = map.get_t(t);
|
||||
self.turns.insert(t, pri);
|
||||
if turn.turn_type == TurnType::Crosswalk {
|
||||
self.turns.insert(turn.other_crosswalk_id(), pri);
|
||||
}
|
||||
self.recalculate_stop_signs(map);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{IntersectionID, Map, RoadID, TurnID, TurnPriority, TurnType};
|
||||
use crate::{IntersectionID, Map, RoadID, Turn, TurnID, TurnPriority, TurnType};
|
||||
use abstutil::{Error, Timer, Warn};
|
||||
use geom::Duration;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@ -314,13 +314,19 @@ impl Cycle {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn edit_turn(&mut self, t: TurnID, pri: TurnPriority) {
|
||||
self.priority_turns.remove(&t);
|
||||
self.yield_turns.remove(&t);
|
||||
pub fn edit_turn(&mut self, t: &Turn, pri: TurnPriority) {
|
||||
let mut ids = vec![t.id];
|
||||
if t.turn_type == TurnType::Crosswalk {
|
||||
ids.push(t.other_crosswalk_id());
|
||||
}
|
||||
for id in ids {
|
||||
self.priority_turns.remove(&id);
|
||||
self.yield_turns.remove(&id);
|
||||
if pri == TurnPriority::Priority {
|
||||
self.priority_turns.insert(t);
|
||||
self.priority_turns.insert(id);
|
||||
} else if pri == TurnPriority::Yield {
|
||||
self.yield_turns.insert(t);
|
||||
self.yield_turns.insert(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ impl Turn {
|
||||
pub fn between_sidewalks(&self) -> bool {
|
||||
self.turn_type == TurnType::SharedSidewalkCorner || self.turn_type == TurnType::Crosswalk
|
||||
}
|
||||
pub fn other_crosswalk_id(&self) -> TurnID {
|
||||
pub(crate) fn other_crosswalk_id(&self) -> TurnID {
|
||||
assert_eq!(self.turn_type, TurnType::Crosswalk);
|
||||
TurnID {
|
||||
parent: self.id.parent,
|
||||
|
Loading…
Reference in New Issue
Block a user