Fix lakeslice again. Some manually fixed traffic signals weren't

imported, because they referenced way IDs from before the service road
import. That happened after a bad Cargo.lock merge undid the effects of
pinning to the latest seattle_traffic_signals.
This commit is contained in:
Dustin Carlino 2020-10-07 15:05:50 -07:00
parent 2ed916e89f
commit 536429f37f
4 changed files with 74 additions and 67 deletions

2
Cargo.lock generated
View File

@ -2260,7 +2260,7 @@ dependencies = [
[[package]]
name = "seattle_traffic_signals"
version = "0.1.0"
source = "git+https://github.com/dabreegster/seattle_traffic_signals#a01733241976911c0a1b02404002938fd30d1f9d"
source = "git+https://github.com/dabreegster/seattle_traffic_signals#0fe8cf9993d871824dda39fa077131f892c9df7a"
dependencies = [
"include_dir 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,5 +1,5 @@
data/input/berlin/EWR201812E_Matrix.csv,7966d3e37c45e7ffa4ee26bb6c8cec28,https://www.dropbox.com/s/38fl51jxp5iwuz3/EWR201812E_Matrix.csv.zip?dl=0
data/input/berlin/berlin_center_separate_cycleways.bin,ee076cfe1566f7a769b7c8437eeb37e0,https://www.dropbox.com/s/nas6r3pzesmrbdj/berlin_center_separate_cycleways.bin.zip?dl=0
data/input/berlin/berlin_center_separate_cycleways.bin,a2baf944416111e712738a95449d51aa,https://www.dropbox.com/s/nas6r3pzesmrbdj/berlin_center_separate_cycleways.bin.zip?dl=0
data/input/berlin/berlin_center_snapped_cycleways.bin,2ff14b60c55ada6154bad1ce71f1ddb5,https://www.dropbox.com/s/n1kdzjv2iq4gewt/berlin_center_snapped_cycleways.bin.zip?dl=0
data/input/berlin/footways.bin,19d6608e9bc85800706e004e4530a81b,https://www.dropbox.com/s/c36724ayytwwpz8/footways.bin.zip?dl=0
data/input/berlin/osm/berlin-latest.osm.pbf,8e7f5ecf37631bb975f062593c5add99,https://www.dropbox.com/s/6lssl37uhbyo7gr/berlin-latest.osm.pbf.zip?dl=0
@ -8,7 +8,7 @@ data/input/berlin/planning_areas.bin,f1a3bd5118a0e4982b64c2307e01d82a,https://ww
data/input/berlin/planning_areas.kml,1bfc2044f1f5f40acdcdded1a644ad22,https://www.dropbox.com/s/9bvbshrtjw14tm7/planning_areas.kml.zip?dl=0
data/input/berlin/service_roads.bin,be06e4b4136771f8e03a2ba7a5f9b8cd,https://www.dropbox.com/s/g4km7xhshigwz8g/service_roads.bin.zip?dl=0
data/input/krakow/footways.bin,017e85fd6da69b67a1a7a790506f52ff,https://www.dropbox.com/s/xxwivqmxev2ecl6/footways.bin.zip?dl=0
data/input/krakow/krakow_center_separate_cycleways.bin,eb71ffd4e20c13438fe833c0b10dad33,https://www.dropbox.com/s/dqrc5w5jxpv9nfc/krakow_center_separate_cycleways.bin.zip?dl=0
data/input/krakow/krakow_center_separate_cycleways.bin,e0a1858a2879fd3b06937213b5199ed5,https://www.dropbox.com/s/dqrc5w5jxpv9nfc/krakow_center_separate_cycleways.bin.zip?dl=0
data/input/krakow/krakow_center_snapped_cycleways.bin,03c50c05dcb636229f827879ae2b983e,https://www.dropbox.com/s/03f9g4gubb9x3y3/krakow_center_snapped_cycleways.bin.zip?dl=0
data/input/krakow/osm/krakow_center.osm,b914bbcd42a7f769a40a90970cea35f2,https://www.dropbox.com/s/pf3avtszpw732jd/krakow_center.osm.zip?dl=0
data/input/krakow/osm/malopolskie-latest.osm.pbf,9505917bbacc478177e36605e89b6d77,https://www.dropbox.com/s/vehjfvwx25v1qnd/malopolskie-latest.osm.pbf.zip?dl=0
@ -17,7 +17,7 @@ data/input/london/footways.bin,95816ac4d77d857c561a61830d1998a0,https://www.drop
data/input/london/osm/greater-london-latest.osm.pbf,ef110d0831b482bb7336c82e36b115ed,https://www.dropbox.com/s/wzwjgcd3wsc4sx1/greater-london-latest.osm.pbf.zip?dl=0
data/input/london/osm/southbank.osm,b86babace41d69a9e5b8be2310a725ae,https://www.dropbox.com/s/qip39avqaijvxy6/southbank.osm.zip?dl=0
data/input/london/service_roads.bin,4f651a450d9d6b73618db015c34a03ad,https://www.dropbox.com/s/c477mruya21q9a0/service_roads.bin.zip?dl=0
data/input/london/southbank_separate_cycleways.bin,027b5b5a840f828e8372b0b975a0cd77,https://www.dropbox.com/s/pahf7kbiuh1j2yr/southbank_separate_cycleways.bin.zip?dl=0
data/input/london/southbank_separate_cycleways.bin,1d76d0d77bbbf015f36dd61226619800,https://www.dropbox.com/s/pahf7kbiuh1j2yr/southbank_separate_cycleways.bin.zip?dl=0
data/input/london/southbank_snapped_cycleways.bin,6cbbe9d6c102a1d35c17ddd1acd7841a,https://www.dropbox.com/s/l4anoe33yuut4vs/southbank_snapped_cycleways.bin.zip?dl=0
data/input/raw_maps/ballard.bin,91c68fd153435f724d8bfca69977087d,https://www.dropbox.com/s/xjutuwth6oyxiqm/ballard.bin.zip?dl=0
data/input/raw_maps/berlin_center.bin,bd6acbb9a316382d1a18187b6ce132f5,https://www.dropbox.com/s/p8irq9yu8jsqr9f/berlin_center.bin.zip?dl=0
@ -39,11 +39,11 @@ data/input/screenshots/montlake.zip,23fdc0f77af7c72141677055facc59aa,https://www
data/input/screenshots/southbank.zip,ef8ab513c72c9e3e418c3a725d94d363,https://www.dropbox.com/s/f1i64ic454ooxtr/southbank.zip.zip?dl=0
data/input/screenshots/udistrict.zip,4c330ebee1a0525ffc03ed74bef93b6b,https://www.dropbox.com/s/efes2r6hwgcv38k/udistrict.zip.zip?dl=0
data/input/seattle/N47W122.hgt,0db4e23e51f7680538b0bbbc72208e07,https://www.dropbox.com/s/mmb4mgutwotijdw/N47W122.hgt.zip?dl=0
data/input/seattle/ballard_separate_cycleways.bin,91a11260c29ef2734d4280d09c757d89,https://www.dropbox.com/s/jixtgr2vej4jojy/ballard_separate_cycleways.bin.zip?dl=0
data/input/seattle/ballard_snapped_cycleways.bin,1f25c6dac0d0c8f01b187031c4bcf58c,https://www.dropbox.com/s/fwfez964qnmgpqi/ballard_snapped_cycleways.bin.zip?dl=0
data/input/seattle/ballard_separate_cycleways.bin,2b39882e62ac92d1e538ff49b44b898c,https://www.dropbox.com/s/jixtgr2vej4jojy/ballard_separate_cycleways.bin.zip?dl=0
data/input/seattle/ballard_snapped_cycleways.bin,67d84e6e231b62e6e3bd0c80a5580775,https://www.dropbox.com/s/fwfez964qnmgpqi/ballard_snapped_cycleways.bin.zip?dl=0
data/input/seattle/blockface.bin,add872bab9040ae911366328a230f8b5,https://www.dropbox.com/s/rxd2care60tbe75/blockface.bin.zip?dl=0
data/input/seattle/blockface.kml,350bd9e59bf2af4e885a7c0741e6ee6b,https://www.dropbox.com/s/ukknmpjdvilncq9/blockface.kml.zip?dl=0
data/input/seattle/downtown_separate_cycleways.bin,3907edd479ea0518a94ed7ca1d9e2102,https://www.dropbox.com/s/ovxtsehm0erw5gb/downtown_separate_cycleways.bin.zip?dl=0
data/input/seattle/downtown_separate_cycleways.bin,de5f9fd3066ed6ce764bf1f6dcf67340,https://www.dropbox.com/s/v32vx554mxmmw7f/downtown_separate_cycleways.bin.zip?dl=0
data/input/seattle/downtown_snapped_cycleways.bin,ece26188973856f10bcebe54b84b14da,https://www.dropbox.com/s/04udsnariucippl/downtown_snapped_cycleways.bin.zip?dl=0
data/input/seattle/footways.bin,09c6aca2ad37d007c6bd40b91886ed95,https://www.dropbox.com/s/u4i3138idj1ih7r/footways.bin.zip?dl=0
data/input/seattle/google_transit/agency.txt,75f564fcc06b1950b7b33acf9d61f696,https://www.dropbox.com/s/z0idqw556c8ouu0/agency.txt.zip?dl=0
@ -58,11 +58,11 @@ data/input/seattle/google_transit/shapes.txt,aebada05d6d05c78551adb634b748e22,ht
data/input/seattle/google_transit/stop_times.txt,1f1d148b266142b72ab24816d76a9cee,https://www.dropbox.com/s/zvg6o7olxagd3rt/stop_times.txt.zip?dl=0
data/input/seattle/google_transit/stops.txt,da1ff7000efdf2166d861479a69d80a4,https://www.dropbox.com/s/w4g0leglckiv4es/stops.txt.zip?dl=0
data/input/seattle/google_transit/trips.txt,e8efe1d2e130e248942188284d88ab09,https://www.dropbox.com/s/lw0hhnqttns2h8z/trips.txt.zip?dl=0
data/input/seattle/huge_seattle_separate_cycleways.bin,66ac7e28cd7e93fe8e8ad70654a03633,https://www.dropbox.com/s/6ig4kkkc3xn3tjv/huge_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/huge_seattle_snapped_cycleways.bin,8ec684df2622622e5b30a4cab5bfed68,https://www.dropbox.com/s/n613496yq3f4kcq/huge_seattle_snapped_cycleways.bin.zip?dl=0
data/input/seattle/lakeslice_separate_cycleways.bin,6aeca77db59f1bf00e2262b1a9e5ffdb,https://www.dropbox.com/s/kd1j1474fjh86pk/lakeslice_separate_cycleways.bin.zip?dl=0
data/input/seattle/huge_seattle_separate_cycleways.bin,2b0d4873b43f139c665aab1d8968f8ca,https://www.dropbox.com/s/fb7xk8vrabpe2gu/huge_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/huge_seattle_snapped_cycleways.bin,620b615c1c1bf434463c14045d3ac56d,https://www.dropbox.com/s/n613496yq3f4kcq/huge_seattle_snapped_cycleways.bin.zip?dl=0
data/input/seattle/lakeslice_separate_cycleways.bin,46c8b28d3e0d8ce6ca4a858b9d41a4e1,https://www.dropbox.com/s/1tpiurm10x5udul/lakeslice_separate_cycleways.bin.zip?dl=0
data/input/seattle/lakeslice_snapped_cycleways.bin,30916279d151f97fd7ff6653eaef8719,https://www.dropbox.com/s/5uf52oy8qubzzcl/lakeslice_snapped_cycleways.bin.zip?dl=0
data/input/seattle/montlake_separate_cycleways.bin,b7334936f0eada525baf690d454148da,https://www.dropbox.com/s/b9zmb50lg1ryvl8/montlake_separate_cycleways.bin.zip?dl=0
data/input/seattle/montlake_separate_cycleways.bin,0027a574d0df2f4726cc90518671164e,https://www.dropbox.com/s/yupazp530q7jbwo/montlake_separate_cycleways.bin.zip?dl=0
data/input/seattle/montlake_snapped_cycleways.bin,bad5e9c0a0ca11b8e73d79e47ab903a2,https://www.dropbox.com/s/yqv2zvt66ceyaij/montlake_snapped_cycleways.bin.zip?dl=0
data/input/seattle/offstreet_parking.bin,a33c05e8962dfe10a7a14b9eb6413803,https://www.dropbox.com/s/7j2gwb18685kd5u/offstreet_parking.bin.zip?dl=0
data/input/seattle/offstreet_parking.kml,e24d1c308ca739df73621846c7b7847c,https://www.dropbox.com/s/dkkkpywob7cdo57/offstreet_parking.kml.zip?dl=0
@ -79,19 +79,19 @@ data/input/seattle/parcels.bin,9cd91b7fa68b13634b21be7abfa0e654,https://www.drop
data/input/seattle/parcels_urbansim.txt,db63d7d606e8702d12f9399e87e6a00f,https://www.dropbox.com/s/6g8rbsf200dssj3/parcels_urbansim.txt.zip?dl=0
data/input/seattle/popdat.bin,592592ec7bd0dadc7b09ee96a4d086a7,https://www.dropbox.com/s/fe8xsfhuan7w7dj/popdat.bin.zip?dl=0
data/input/seattle/service_roads.bin,550f1e72408b63781596ec26b6daa1d0,https://www.dropbox.com/s/0konam8z33ulepy/service_roads.bin.zip?dl=0
data/input/seattle/south_seattle_separate_cycleways.bin,0545a1103e553e4933c9ccae1e8d0663,https://www.dropbox.com/s/13uaknqa34zn6y4/south_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/south_seattle_separate_cycleways.bin,482f09cce508d304ab66d21070b0e0c8,https://www.dropbox.com/s/lld3h29rd2j3aoo/south_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/south_seattle_snapped_cycleways.bin,92bb9e7d7b8d89e63ecb4d9fe54e3b7f,https://www.dropbox.com/s/lcu1u73kubxty9k/south_seattle_snapped_cycleways.bin.zip?dl=0
data/input/seattle/trips_2014.csv,d4a8e733045b28c0385fb81359d6df03,https://www.dropbox.com/s/5ppravwmk6bf20d/trips_2014.csv.zip?dl=0
data/input/seattle/udistrict_separate_cycleways.bin,4f11fbe89eca75e6e32281b92c9bf689,https://www.dropbox.com/s/hxvk17l4n04oesw/udistrict_separate_cycleways.bin.zip?dl=0
data/input/seattle/udistrict_snapped_cycleways.bin,bcea0f2da9f979c814db74d63482f9cf,https://www.dropbox.com/s/zpznqax43fxl7xp/udistrict_snapped_cycleways.bin.zip?dl=0
data/input/seattle/west_seattle_separate_cycleways.bin,c6317fe7fa0fc2dfa95fabd2c6ccaad9,https://www.dropbox.com/s/2hfcu60ybglbb67/west_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/udistrict_separate_cycleways.bin,dc67c4a2471d48372600390cfb5cf293,https://www.dropbox.com/s/lai0us65jl5vmoh/udistrict_separate_cycleways.bin.zip?dl=0
data/input/seattle/udistrict_snapped_cycleways.bin,937654a8be61da06486d3c5c5304132c,https://www.dropbox.com/s/zpznqax43fxl7xp/udistrict_snapped_cycleways.bin.zip?dl=0
data/input/seattle/west_seattle_separate_cycleways.bin,59f569ae705a855a7e8080d84c9bd4e9,https://www.dropbox.com/s/91hl3fum82p6bui/west_seattle_separate_cycleways.bin.zip?dl=0
data/input/seattle/west_seattle_snapped_cycleways.bin,4a8e438b0795360aa7fec1ebacd64233,https://www.dropbox.com/s/f7dz2e4o6k4c2ix/west_seattle_snapped_cycleways.bin.zip?dl=0
data/input/tel_aviv/footways.bin,4fb70e32d0cc3ddeaa8924c240bc9d5b,https://www.dropbox.com/s/ka38f1kwjgm0fpo/footways.bin.zip?dl=0
data/input/tel_aviv/osm/israel-and-palestine-latest.osm.pbf,d5b0d6a26bfdedd32cc5c9c26e6fd426,https://www.dropbox.com/s/ehwhbhp03zuy1qn/israel-and-palestine-latest.osm.pbf.zip?dl=0
data/input/tel_aviv/osm/tel_aviv.osm,eeb7f3813a33f754eceed13766a3c236,https://www.dropbox.com/s/kqvn0iifhmmcjve/tel_aviv.osm.zip?dl=0
data/input/tel_aviv/service_roads.bin,216407d6f112683e81973fbb11af6403,https://www.dropbox.com/s/7rscshpat7dyzxv/service_roads.bin.zip?dl=0
data/input/tel_aviv/tel_aviv_separate_cycleways.bin,a16f296c8f1155aad747f724a70ff4a9,https://www.dropbox.com/s/p62d1gum2e04rp9/tel_aviv_separate_cycleways.bin.zip?dl=0
data/input/tel_aviv/tel_aviv_snapped_cycleways.bin,e846cdffc84dc1c3f09abb0e4b7d8b85,https://www.dropbox.com/s/wq2oco1u22gzwou/tel_aviv_snapped_cycleways.bin.zip?dl=0
data/input/tel_aviv/tel_aviv_separate_cycleways.bin,6feb90004775e67eab160934c9b812e5,https://www.dropbox.com/s/p62d1gum2e04rp9/tel_aviv_separate_cycleways.bin.zip?dl=0
data/input/tel_aviv/tel_aviv_snapped_cycleways.bin,f9101f6ff1662c4c0bd69246599a27c3,https://www.dropbox.com/s/wq2oco1u22gzwou/tel_aviv_snapped_cycleways.bin.zip?dl=0
data/input/xian/footways.bin,425becbab867631415fe49edcf8f9694,https://www.dropbox.com/s/6hf4t4ovk1m1wi3/footways.bin.zip?dl=0
data/input/xian/osm/china-latest.osm.pbf,0108807f1dc321d5de5579622ac3f4cf,https://www.dropbox.com/s/qewwxtioocbv3ld/china-latest.osm.pbf.zip?dl=0
data/input/xian/osm/xian.osm,4084c665ad947bb40173a43cb33fdec8,https://www.dropbox.com/s/j5qwt33bs077sd2/xian.osm.zip?dl=0
@ -110,14 +110,14 @@ data/system/maps/tel_aviv.bin,839283d1d221db99227645a462f6dc68,https://www.dropb
data/system/maps/udistrict.bin,a547d5d8694371c2c6f9664d9de3f4ac,https://www.dropbox.com/s/283elifjihv6289/udistrict.bin.zip?dl=0
data/system/maps/west_seattle.bin,e867cc142ecf22d2dbd888a1cb76fd41,https://www.dropbox.com/s/ftqt1adtkd0vhdy/west_seattle.bin.zip?dl=0
data/system/maps/xian.bin,35b50a1a8d33101c55947e4d5ee8985d,https://www.dropbox.com/s/ydl6tfzt2k60to5/xian.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,55f10b1571afb80314fc9ebe4635fc1b,https://www.dropbox.com/s/80pt5gsz8dryd4h/weekday.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,54969f5ad4f1dc0f76411aced5f6a2c0,https://www.dropbox.com/s/9owc5afo5bunlht/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/car vs bike contention.bin,4be92c76d13cc688eb2c88e583926943,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,b4dd4670a94b9bdcacbb53c0aeba82d9,https://www.dropbox.com/s/qg8wugwjqkwk740/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,ae0d591f1386da1067e9389ebdb58547,https://www.dropbox.com/s/9hk4uabdskqnb7w/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,ab1f9132a4ed12641a27492586f154cb,https://www.dropbox.com/s/8j1qvot90v2dkxd/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,41f209ec99b40bc6808c3504e00b3695,https://www.dropbox.com/s/x6wiii210r1t2sm/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,a8a97b93bcd5850e2c94ef0a9a1bde6e,https://www.dropbox.com/s/ozvhwo689eti9vo/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,ad2d0899e6ac2df1de147837bfbdba3e,https://www.dropbox.com/s/8hxdp11yialuv2l/weekday.bin.zip?dl=0
data/system/scenarios/huge_seattle/weekday.bin,16ebca93a10e77d5012eaa37c796f5db,https://www.dropbox.com/s/5abjeeadgjnvay2/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,c8f246737bdc077e1f16c889bc7a409b,https://www.dropbox.com/s/pbklyxhr24mjaya/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,9679c6c1469dbcdaaca867e7b4303623,https://www.dropbox.com/s/z5zgpnu36ypz38b/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,d9c28ce9d855eddbc3f5082b3f6d4401,https://www.dropbox.com/s/6po5dq4zozzg5op/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,f4d428ef447118f94e8f6b6c7ef6642b,https://www.dropbox.com/s/033oejazgno4czl/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,11e7bfcbd8d56f9e71af5e122cb3d389,https://www.dropbox.com/s/wylju9u77cbemb0/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,7be3fa0f149e312a3a1f9b7054e7a086,https://www.dropbox.com/s/dzgt3aqj0thrlfp/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,fb5b0e7ef377c0321daa23b4ba05f959,https://www.dropbox.com/s/tbsi7ta161hblwu/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,f30d86c989c006a277ec158fb6c478a0,https://www.dropbox.com/s/457o5zfmy0zu9b1/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,8853d91d4d8ef313d0a34d2b338d2a16,https://www.dropbox.com/s/aguxdygjo73k0bx/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,47a0b378bb8e32d7844321fba93d98ac,https://www.dropbox.com/s/iui9l75mphawl3x/weekday.bin.zip?dl=0

View File

@ -26,15 +26,19 @@ pub fn get_possible_policies(
.unwrap()
.remove(&map.get_i(id).orig_id.0)
{
if let Ok(ts) = ControlTrafficSignal::import(raw, id, map) {
results.push(("hand-mapped current real settings".to_string(), ts));
} else {
let i = map.get_i(id);
timer.error(format!(
"seattle_traffic_signals data for {} ({}) out of date, go update it",
i.orig_id,
i.name(None, map)
));
match ControlTrafficSignal::import(raw, id, map) {
Ok(ts) => {
results.push(("hand-mapped current real settings".to_string(), ts));
}
Err(err) => {
let i = map.get_i(id);
timer.error(format!(
"seattle_traffic_signals data for {} ({}) out of date, go update it: {}",
i.orig_id,
i.name(None, map),
err
));
}
}
}

View File

@ -351,23 +351,33 @@ impl ControlTrafficSignal {
) -> Result<ControlTrafficSignal, String> {
let mut stages = Vec::new();
for s in raw.phases {
let num_protected = s.protected_turns.len();
let num_permitted = s.permitted_turns.len();
let protected_movements = s
.protected_turns
.into_iter()
.filter_map(|t| import_movement(t, map))
.collect::<BTreeSet<_>>();
let yield_movements = s
.permitted_turns
.into_iter()
.filter_map(|t| import_movement(t, map))
.collect::<BTreeSet<_>>();
if protected_movements.len() == num_protected && yield_movements.len() == num_permitted
{
let mut errors = Vec::new();
let mut protected_movements = BTreeSet::new();
for t in s.protected_turns {
match import_movement(t, map) {
Ok(mvmnt) => {
protected_movements.insert(mvmnt);
}
Err(err) => {
errors.push(err);
}
}
}
let mut permitted_movements = BTreeSet::new();
for t in s.permitted_turns {
match import_movement(t, map) {
Ok(mvmnt) => {
permitted_movements.insert(mvmnt);
}
Err(err) => {
errors.push(err);
}
}
}
if errors.is_empty() {
stages.push(Stage {
protected_movements,
yield_movements,
yield_movements: permitted_movements,
phase_type: match s.phase_type {
seattle_traffic_signals::PhaseType::Fixed(d) => {
PhaseType::Fixed(Duration::seconds(d as f64))
@ -378,10 +388,7 @@ impl ControlTrafficSignal {
},
});
} else {
return Err(format!(
"Failed to import some of the movements for {}",
raw.intersection_osm_node_id
));
return Err(errors.join("; "));
}
}
let ts = ControlTrafficSignal {
@ -417,25 +424,21 @@ fn export_movement(id: &MovementID, map: &Map) -> seattle_traffic_signals::Turn
}
}
fn import_movement(id: seattle_traffic_signals::Turn, map: &Map) -> Option<MovementID> {
Some(MovementID {
fn import_movement(id: seattle_traffic_signals::Turn, map: &Map) -> Result<MovementID, String> {
Ok(MovementID {
from: find_r(id.from, map)?,
to: find_r(id.to, map)?,
parent: map
.find_i_by_osm_id(osm::NodeID(id.intersection_osm_node_id))
.ok()?,
parent: map.find_i_by_osm_id(osm::NodeID(id.intersection_osm_node_id))?,
crosswalk: id.is_crosswalk,
})
}
fn find_r(id: seattle_traffic_signals::DirectedRoad, map: &Map) -> Option<DirectedRoadID> {
Some(DirectedRoadID {
id: map
.find_r_by_osm_id(OriginalRoad::new(
id.osm_way_id,
(id.osm_node1, id.osm_node2),
))
.ok()?,
fn find_r(id: seattle_traffic_signals::DirectedRoad, map: &Map) -> Result<DirectedRoadID, String> {
Ok(DirectedRoadID {
id: map.find_r_by_osm_id(OriginalRoad::new(
id.osm_way_id,
(id.osm_node1, id.osm_node2),
))?,
dir: if id.is_forwards {
Direction::Fwd
} else {