diff --git a/convert_osm/src/lib.rs b/convert_osm/src/lib.rs index 3cc325d1b4..5411e99502 100644 --- a/convert_osm/src/lib.rs +++ b/convert_osm/src/lib.rs @@ -6,8 +6,8 @@ mod srtm; use abstutil::Timer; use geom::{Distance, FindClosest, PolyLine, Pt2D}; use kml::ExtraShapes; -use map_model::osm; -use map_model::raw::{DrivingSide, OriginalBuilding, OriginalRoad, RawMap}; +use map_model::raw::{OriginalBuilding, OriginalRoad, RawMap}; +use map_model::{osm, MapConfig}; // Just used for matching hints to different sides of a road. const DIRECTED_ROAD_THICKNESS: Distance = Distance::const_meters(2.5); @@ -19,7 +19,7 @@ pub struct Options { // The path to an osmosis boundary polygon. Highly recommended. pub clip: Option, - pub drive_on_right: bool, + pub map_config: MapConfig, pub onstreet_parking: OnstreetParking, pub public_offstreet_parking: PublicOffstreetParking, @@ -73,11 +73,7 @@ pub fn convert(opts: Options, timer: &mut abstutil::Timer) -> RawMap { timer, ); clip::clip_map(&mut map, timer); - map.driving_side = if opts.drive_on_right { - DrivingSide::Right - } else { - DrivingSide::Left - }; + map.config = opts.map_config; // Need to do a first pass of removing cul-de-sacs here, or we wind up with loop PolyLines when // doing the parking hint matching. @@ -137,14 +133,16 @@ fn use_parking_hints(map: &mut RawMap, path: String, timer: &mut Timer) { let center = PolyLine::new(r.center_points.clone()); closest.add( (*id, true), - map.driving_side + map.config + .driving_side .right_shift(center.clone(), DIRECTED_ROAD_THICKNESS) .get(timer) .points(), ); closest.add( (*id, false), - map.driving_side + map.config + .driving_side .left_shift(center, DIRECTED_ROAD_THICKNESS) .get(timer) .points(), diff --git a/data/MANIFEST.txt b/data/MANIFEST.txt index 7490eb6e1f..2f622ea6de 100644 --- a/data/MANIFEST.txt +++ b/data/MANIFEST.txt @@ -3,60 +3,60 @@ data/input/austin/osm/downtown_atx.osm,a30b0f460a481598e494f16a9d07a822,https:// data/input/austin/osm/huge_austin.osm,fb166029fc8006bd20dc959fbbbde3b6,https://www.dropbox.com/s/4x421o9o8px0m6o/huge_austin.osm.zip?dl=0 data/input/krakow/osm/huge_krakow.osm,0b098456c8ae844ff240ca9fe3b617d1,https://www.dropbox.com/s/fe2e8qzd4g5tkoy/huge_krakow.osm.zip?dl=0 data/input/krakow/osm/malopolskie-latest.osm.pbf,d848a278092001aaab3ced09de4d98ff,https://www.dropbox.com/s/ia2uwy3z52r6hpe/malopolskie-latest.osm.pbf.zip?dl=0 -data/input/raw_maps/ballard.bin,eeb376efa9a87e3a7f8cea5a0a1795c2,https://www.dropbox.com/s/49eq6ctt3vko300/ballard.bin.zip?dl=0 -data/input/raw_maps/downtown.bin,4560307f46e64e2b4495494a4406e458,https://www.dropbox.com/s/20zw8valbf35tci/downtown.bin.zip?dl=0 -data/input/raw_maps/downtown_atx.bin,cf2cd0fea92b70e5555ac693b2d4a653,https://www.dropbox.com/s/02moxvh1gn41x5s/downtown_atx.bin.zip?dl=0 -data/input/raw_maps/huge_austin.bin,d37364ac2da4e9d44de886457ba915ed,https://www.dropbox.com/s/updgay4ia9dsbot/huge_austin.bin.zip?dl=0 -data/input/raw_maps/huge_krakow.bin,c5b169ff3ee0bddc52de2e51d1b06018,https://www.dropbox.com/s/e723z3uy5v2yos3/huge_krakow.bin.zip?dl=0 -data/input/raw_maps/huge_seattle.bin,5c06f78dd172f5717895283ac1ea0f65,https://www.dropbox.com/s/mst2n74jqjknyv5/huge_seattle.bin.zip?dl=0 -data/input/raw_maps/lakeslice.bin,f3b6e1820abf31f77d30a8cce3963f0d,https://www.dropbox.com/s/6jz3aisto2rhsjj/lakeslice.bin.zip?dl=0 -data/input/raw_maps/montlake.bin,749507726d6acc94fbde892bf78bd137,https://www.dropbox.com/s/q7w9lwitdrv3ln2/montlake.bin.zip?dl=0 -data/input/raw_maps/south_seattle.bin,0ebdda0feb14d520741e7907e9fa4286,https://www.dropbox.com/s/1lsmaiz97gqh02j/south_seattle.bin.zip?dl=0 -data/input/raw_maps/udistrict.bin,cbbded9a3045cf4e6a0b10768bc99cde,https://www.dropbox.com/s/4deintbkbocl3v9/udistrict.bin.zip?dl=0 -data/input/raw_maps/west_seattle.bin,8472bc3288ea510cad0278b035e5a744,https://www.dropbox.com/s/1p4ui7pbdpq9la0/west_seattle.bin.zip?dl=0 -data/input/screenshots/downtown.zip,c209c8aa0b2af4547cb95aed95267138,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0 +data/input/raw_maps/ballard.bin,fea0486d3925c7ffce54d0e21139ab75,https://www.dropbox.com/s/dfbtfu6qq7shj9t/ballard.bin.zip?dl=0 +data/input/raw_maps/downtown.bin,5da76c12b035bcde09d0735c6673d4ae,https://www.dropbox.com/s/f3jz7qk6xiij5po/downtown.bin.zip?dl=0 +data/input/raw_maps/downtown_atx.bin,2995df6f32feb8135fbb1126b52402ba,https://www.dropbox.com/s/csuzjqhhbtw657x/downtown_atx.bin.zip?dl=0 +data/input/raw_maps/huge_austin.bin,fb671ea39ea254207c334b5662763433,https://www.dropbox.com/s/91i763larrbmx7z/huge_austin.bin.zip?dl=0 +data/input/raw_maps/huge_krakow.bin,978426f967f122675ba530edc94b43e3,https://www.dropbox.com/s/5l9ojm1lfq32otz/huge_krakow.bin.zip?dl=0 +data/input/raw_maps/huge_seattle.bin,e7e49c7421e1343371ab06dc9e3dd64b,https://www.dropbox.com/s/dlajjc94bmxf07p/huge_seattle.bin.zip?dl=0 +data/input/raw_maps/lakeslice.bin,95ed0a848ed098c068ada54db04c9495,https://www.dropbox.com/s/g1y26xudv7rkmko/lakeslice.bin.zip?dl=0 +data/input/raw_maps/montlake.bin,1840e685f91589cf267f146f43878c47,https://www.dropbox.com/s/p5itfq7zioz2b3r/montlake.bin.zip?dl=0 +data/input/raw_maps/south_seattle.bin,bb870ffa8bd159a7ce9dca83216ac0b0,https://www.dropbox.com/s/v405rk7wm7luc0o/south_seattle.bin.zip?dl=0 +data/input/raw_maps/udistrict.bin,ae242a89a2b83b2b9fc115dea0c40256,https://www.dropbox.com/s/vefz3ozb7od9xdf/udistrict.bin.zip?dl=0 +data/input/raw_maps/west_seattle.bin,4784c2eeebd11c6c180d11eda73cf1e1,https://www.dropbox.com/s/6lp4foo4l7g487n/west_seattle.bin.zip?dl=0 +data/input/screenshots/downtown.zip,f1cb474323244ef7a31971e3d5b25a12,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0 data/input/screenshots/huge_krakow.zip,cfc8fe595097fed224d369f2c647443c,https://www.dropbox.com/s/dbzon7k5ukndtza/huge_krakow.zip.zip?dl=0 -data/input/screenshots/lakeslice.zip,3e8e43b48112b0d5027c7565c78a9287,https://www.dropbox.com/s/z0z96lsn7bunqfy/lakeslice.zip.zip?dl=0 -data/input/screenshots/montlake.zip,38ab9848eadaf18759be2d3ad2c64ffa,https://www.dropbox.com/s/r9vkgwesqklfuq2/montlake.zip.zip?dl=0 -data/input/screenshots/udistrict.zip,b75e49f46933f972465f73ba3ab4280d,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0 +data/input/screenshots/lakeslice.zip,37ad352dbe42ce4aea0ba0a67067d451,https://www.dropbox.com/s/z0z96lsn7bunqfy/lakeslice.zip.zip?dl=0 +data/input/screenshots/montlake.zip,c8b016f00792ef23b9fae44956d2d86c,https://www.dropbox.com/s/r9vkgwesqklfuq2/montlake.zip.zip?dl=0 +data/input/screenshots/udistrict.zip,584036034b44708da6ae006b2f40fa3b,https://www.dropbox.com/s/ecnt1tyza48y9o2/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/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/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 -data/input/seattle/osm/ballard.osm,bfa8d63ee45fdf789837c9316c366f77,https://www.dropbox.com/s/8w0lzb6juueewsn/ballard.osm.zip?dl=0 -data/input/seattle/osm/downtown.osm,090a9c70cb96f6f6ef6b7457b87ea424,https://www.dropbox.com/s/r68k8mq1c1t9c3x/downtown.osm.zip?dl=0 -data/input/seattle/osm/huge_seattle.osm,c0f27a520b55b5d7bf3d69672825e163,https://www.dropbox.com/s/yul97r216jpjzja/huge_seattle.osm.zip?dl=0 -data/input/seattle/osm/lakeslice.osm,6f9b495b1833a027fedbd94f21c9a3cd,https://www.dropbox.com/s/nmzifqc54cliljm/lakeslice.osm.zip?dl=0 -data/input/seattle/osm/montlake.osm,4450f67d899df4b73132baee693b5b18,https://www.dropbox.com/s/363w15v82bqe3o3/montlake.osm.zip?dl=0 -data/input/seattle/osm/south_seattle.osm,fbda605b8a4f580e426790fbb6e6dd15,https://www.dropbox.com/s/7sdgvnpoe983gju/south_seattle.osm.zip?dl=0 -data/input/seattle/osm/udistrict.osm,7510484ec8abddbe64a2dc761a94fb67,https://www.dropbox.com/s/wraohtnpydpfe1p/udistrict.osm.zip?dl=0 -data/input/seattle/osm/washington-latest.osm.pbf,e06cc7eec144eac6a495d93db6d85766,https://www.dropbox.com/s/fhgqauc5obh05cd/washington-latest.osm.pbf.zip?dl=0 -data/input/seattle/osm/west_seattle.osm,ce708f4701cd9118c2e9de0573e69457,https://www.dropbox.com/s/1bsbebu9va987qx/west_seattle.osm.zip?dl=0 -data/input/seattle/parcels.bin,fe766ae44b6aa6145a84d57b661139d0,https://www.dropbox.com/s/6cfohnt2ropgg97/parcels.bin.zip?dl=0 +data/input/seattle/osm/ballard.osm,954d91fc1813025ab1c3e3f03c1ded72,https://www.dropbox.com/s/2qqvnoj2snijanb/ballard.osm.zip?dl=0 +data/input/seattle/osm/downtown.osm,19691ce71952b19ec67a24d44683ddeb,https://www.dropbox.com/s/eehsb4q2pb5rrre/downtown.osm.zip?dl=0 +data/input/seattle/osm/huge_seattle.osm,0e2cca07e58fbab45c330f5f434a8ad1,https://www.dropbox.com/s/sfew0wjwi34lffl/huge_seattle.osm.zip?dl=0 +data/input/seattle/osm/lakeslice.osm,ce37321505a335e9dd3f392fe2900a2d,https://www.dropbox.com/s/5xlanqa3xw82wg9/lakeslice.osm.zip?dl=0 +data/input/seattle/osm/montlake.osm,defd4bc1b135449cd351675b81137c2f,https://www.dropbox.com/s/tj28kx0oxqw30qn/montlake.osm.zip?dl=0 +data/input/seattle/osm/south_seattle.osm,2a20b3549004a3d37ef962baf07fbf93,https://www.dropbox.com/s/l2vmsjyagszuwlh/south_seattle.osm.zip?dl=0 +data/input/seattle/osm/udistrict.osm,769388ffc0d73c6a149ed79698e2b8f3,https://www.dropbox.com/s/3v6axtyuofqatit/udistrict.osm.zip?dl=0 +data/input/seattle/osm/washington-latest.osm.pbf,ac31d2a9d3a109f4467e5f64b5922509,https://www.dropbox.com/s/eilk9soyod3war6/washington-latest.osm.pbf.zip?dl=0 +data/input/seattle/osm/west_seattle.osm,b87c760bd512c4302846519ed052ad5a,https://www.dropbox.com/s/qhtkotrtp7ilmy1/west_seattle.osm.zip?dl=0 +data/input/seattle/parcels.bin,1cfdc485a35df9edce7b24e5c17b2977,https://www.dropbox.com/s/s977yzbcds355nv/parcels.bin.zip?dl=0 data/input/seattle/parcels_urbansim.txt,db63d7d606e8702d12f9399e87e6a00f,https://www.dropbox.com/s/6g8rbsf200dssj3/parcels_urbansim.txt.zip?dl=0 -data/input/seattle/popdat.bin,b607f9990528d0ca2fbeec9f02a5755e,https://www.dropbox.com/s/hcf80kvl66a4yai/popdat.bin.zip?dl=0 +data/input/seattle/popdat.bin,ad38e1f20ce71f488112fe81e32798d2,https://www.dropbox.com/s/ajqii1qpfke8063/popdat.bin.zip?dl=0 data/input/seattle/trips_2014.csv,d4a8e733045b28c0385fb81359d6df03,https://www.dropbox.com/s/5ppravwmk6bf20d/trips_2014.csv.zip?dl=0 -data/system/cities/seattle.bin,d8e88217584d6ece7abaf1ec4222c7e6,https://www.dropbox.com/s/s1i208j6oy5pd5o/seattle.bin.zip?dl=0 -data/system/maps/ballard.bin,d1298c3e016097740dc3611570dde305,https://www.dropbox.com/s/6m1plyql7ed4dx3/ballard.bin.zip?dl=0 -data/system/maps/downtown.bin,6899ca0ef8f957aceec97521e372e384,https://www.dropbox.com/s/wxt5o820ozotqye/downtown.bin.zip?dl=0 -data/system/maps/downtown_atx.bin,cb186c034fe153edde0ffd020cc3d103,https://www.dropbox.com/s/ku8n445av31ezeu/downtown_atx.bin.zip?dl=0 -data/system/maps/huge_austin.bin,451147064552a1a4db3701607393c3cb,https://www.dropbox.com/s/9g683ls5fffhvek/huge_austin.bin.zip?dl=0 -data/system/maps/huge_krakow.bin,60572892063bc10cce8f15b73f51abaf,https://www.dropbox.com/s/kxuhrk07m73qnf2/huge_krakow.bin.zip?dl=0 -data/system/maps/huge_seattle.bin,83e3359361cc8e557b9f26e6c653a6e0,https://www.dropbox.com/s/mgs7dfawguacx6c/huge_seattle.bin.zip?dl=0 -data/system/maps/lakeslice.bin,eb22bed45933e1e1a7901f11f87f1fb0,https://www.dropbox.com/s/4inyip1nfn6mmzy/lakeslice.bin.zip?dl=0 -data/system/maps/montlake.bin,030003f0c2e43fe3d7d2ba8d626559aa,https://www.dropbox.com/s/eshynlfyelpmsfu/montlake.bin.zip?dl=0 -data/system/maps/south_seattle.bin,4f49f53740b8e9aa4c23bc074fb66b73,https://www.dropbox.com/s/idun7k39w97904d/south_seattle.bin.zip?dl=0 -data/system/maps/udistrict.bin,a561a18d5e00c0553df094b4630bdcaf,https://www.dropbox.com/s/3auy67vyilrufnm/udistrict.bin.zip?dl=0 -data/system/maps/west_seattle.bin,f4b75da8bcadfa17308648f56735592b,https://www.dropbox.com/s/vzn10bj8gw5750k/west_seattle.bin.zip?dl=0 -data/system/prebaked_results/lakeslice/weekday.bin,a6447d7680b569cd228ce52b0017a6c6,https://www.dropbox.com/s/xwv9i8nsu5xkfng/weekday.bin.zip?dl=0 +data/system/cities/seattle.bin,9ed9ff25b3f3941fecf530b3815a1b05,https://www.dropbox.com/s/nwb29tt4koqk6um/seattle.bin.zip?dl=0 +data/system/maps/ballard.bin,b98c9b698d876ebadd34bbcb541630d3,https://www.dropbox.com/s/ocv4p7dzrxcogyq/ballard.bin.zip?dl=0 +data/system/maps/downtown.bin,f951b7ca011b91f062334a94585b7083,https://www.dropbox.com/s/ww7jzqlbpxur8l6/downtown.bin.zip?dl=0 +data/system/maps/downtown_atx.bin,700a4a78af42e37ef1245e4fc63ce0c4,https://www.dropbox.com/s/ixijn46f07zizzi/downtown_atx.bin.zip?dl=0 +data/system/maps/huge_austin.bin,f7ea14d6b616a6ca9a63ac4460b0a2a0,https://www.dropbox.com/s/5jlbbinjp4132rp/huge_austin.bin.zip?dl=0 +data/system/maps/huge_krakow.bin,f87b77708170bafa72331cccc6df57b6,https://www.dropbox.com/s/friayproln1gtig/huge_krakow.bin.zip?dl=0 +data/system/maps/huge_seattle.bin,4086044e523651a631f0745e73238bb8,https://www.dropbox.com/s/aj0h8igtskfths3/huge_seattle.bin.zip?dl=0 +data/system/maps/lakeslice.bin,ea5e918b7b70db2c8e484f8666c4737b,https://www.dropbox.com/s/p6r64ujz81vx7vd/lakeslice.bin.zip?dl=0 +data/system/maps/montlake.bin,032f96ae28a2db2d6b4aa848469e9aea,https://www.dropbox.com/s/rjei8n91qil1bhw/montlake.bin.zip?dl=0 +data/system/maps/south_seattle.bin,c967a5d372ef7298a711fc213244ccd8,https://www.dropbox.com/s/nynh73cxqggeuj3/south_seattle.bin.zip?dl=0 +data/system/maps/udistrict.bin,a9a320f182af78d235af98a78aa0646c,https://www.dropbox.com/s/92joyhk29cqoipk/udistrict.bin.zip?dl=0 +data/system/maps/west_seattle.bin,ccfb1547ffceaa8a635b12252951ce8f,https://www.dropbox.com/s/x9o4lg7fgvy5kr2/west_seattle.bin.zip?dl=0 +data/system/prebaked_results/lakeslice/weekday.bin,3bcb09e1d6ddeed75e3baf3b6b476e5c,https://www.dropbox.com/s/5odd5kdxn0caodk/weekday.bin.zip?dl=0 data/system/prebaked_results/montlake/car vs bike contention.bin,d3e42a758ba4e10e6143c8f8370a638f,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0 -data/system/prebaked_results/montlake/weekday.bin,6e51ceb3cea0e3fd771fd4adcf6d88d6,https://www.dropbox.com/s/taoxrje2ux1byy0/weekday.bin.zip?dl=0 -data/system/scenarios/ballard/weekday.bin,914c350aa88a64e70c059112faedcc05,https://www.dropbox.com/s/1xqonwmpaw86xdz/weekday.bin.zip?dl=0 -data/system/scenarios/downtown/weekday.bin,f99f22f09ffa7eaa5fa204118b966164,https://www.dropbox.com/s/elyokhsddwvr27b/weekday.bin.zip?dl=0 -data/system/scenarios/huge_seattle/weekday.bin,cb447fb0eefae0960e4892d21e37e73d,https://www.dropbox.com/s/wcs0lbm5euktvfe/weekday.bin.zip?dl=0 -data/system/scenarios/lakeslice/weekday.bin,26b0ea3e01e5e5ea5b4137f553df4910,https://www.dropbox.com/s/ggjj4iur9kd4mrf/weekday.bin.zip?dl=0 -data/system/scenarios/montlake/weekday.bin,3a31731bb20909fa79d3c2b602e4df55,https://www.dropbox.com/s/1oi9wmfqtydo4gh/weekday.bin.zip?dl=0 -data/system/scenarios/south_seattle/weekday.bin,fe4a93c141a1421efcea84215fe5cbbb,https://www.dropbox.com/s/sc3jjle32o5offk/weekday.bin.zip?dl=0 -data/system/scenarios/udistrict/weekday.bin,55b4df31e7f932bb13f3e1dd620086ff,https://www.dropbox.com/s/lbgkxrk5ydvpoqf/weekday.bin.zip?dl=0 -data/system/scenarios/west_seattle/weekday.bin,f13ab117455bcce4f3089af4f782d215,https://www.dropbox.com/s/82wja3sxf1kzjyh/weekday.bin.zip?dl=0 +data/system/prebaked_results/montlake/weekday.bin,979af6c1db9f5bf31a3cf12301c4c6f9,https://www.dropbox.com/s/0duohjtnbj5y7gc/weekday.bin.zip?dl=0 +data/system/scenarios/ballard/weekday.bin,f6d7dac5af0f35a6ae5589d3943be789,https://www.dropbox.com/s/klvs4wkauh00xud/weekday.bin.zip?dl=0 +data/system/scenarios/downtown/weekday.bin,2b4506c9aab41a0a12f8d0ef769db492,https://www.dropbox.com/s/swmss3vyrrjnv6n/weekday.bin.zip?dl=0 +data/system/scenarios/huge_seattle/weekday.bin,30cf8491099a33c758aa76c31267bd13,https://www.dropbox.com/s/a20dujaxnwhe2aj/weekday.bin.zip?dl=0 +data/system/scenarios/lakeslice/weekday.bin,19812c16dc90945f5c3659b47c1c55e8,https://www.dropbox.com/s/00cjax1g3bcmwvf/weekday.bin.zip?dl=0 +data/system/scenarios/montlake/weekday.bin,ee5359d37d1d9446578d34c3b97b9266,https://www.dropbox.com/s/bx6sv6rogt2alyq/weekday.bin.zip?dl=0 +data/system/scenarios/south_seattle/weekday.bin,9b84537fb47831d6b65f81dcb947600d,https://www.dropbox.com/s/i36o01uv6ud8rj3/weekday.bin.zip?dl=0 +data/system/scenarios/udistrict/weekday.bin,6c08853e72f8fc65b25b69639cb59464,https://www.dropbox.com/s/3c0tlq9k8niz0pr/weekday.bin.zip?dl=0 +data/system/scenarios/west_seattle/weekday.bin,48a9b04d69948436c8eb89f943e36b5d,https://www.dropbox.com/s/8jq9rs6dom8t0y9/weekday.bin.zip?dl=0 diff --git a/importer/src/austin.rs b/importer/src/austin.rs index 394da494c5..c4535f19c0 100644 --- a/importer/src/austin.rs +++ b/importer/src/austin.rs @@ -26,7 +26,10 @@ pub fn osm_to_raw(name: &str) { "input/austin/polygons/{}.poly", name ))), - drive_on_right: true, + map_config: map_model::MapConfig { + driving_side: map_model::raw::DrivingSide::Right, + bikes_can_use_bus_lanes: true, + }, onstreet_parking: convert_osm::OnstreetParking::JustOSM, public_offstreet_parking: convert_osm::PublicOffstreetParking::None, diff --git a/importer/src/krakow.rs b/importer/src/krakow.rs index 2824ddbb8e..0a62156c17 100644 --- a/importer/src/krakow.rs +++ b/importer/src/krakow.rs @@ -26,7 +26,10 @@ pub fn osm_to_raw(name: &str) { "input/krakow/polygons/{}.poly", name ))), - drive_on_right: true, + map_config: map_model::MapConfig { + driving_side: map_model::raw::DrivingSide::Right, + bikes_can_use_bus_lanes: false, + }, onstreet_parking: convert_osm::OnstreetParking::SomeResidential { pct: 50 }, public_offstreet_parking: convert_osm::PublicOffstreetParking::None, diff --git a/importer/src/main.rs b/importer/src/main.rs index 47465f58b7..1ae40d0636 100644 --- a/importer/src/main.rs +++ b/importer/src/main.rs @@ -162,7 +162,14 @@ fn oneshot(osm_path: String, clip: Option, drive_on_right: bool) { name: name.clone(), clip, - drive_on_right, + map_config: map_model::MapConfig { + driving_side: if drive_on_right { + map_model::raw::DrivingSide::Right + } else { + map_model::raw::DrivingSide::Left + }, + bikes_can_use_bus_lanes: true, + }, onstreet_parking: convert_osm::OnstreetParking::JustOSM, public_offstreet_parking: convert_osm::PublicOffstreetParking::None, diff --git a/importer/src/seattle.rs b/importer/src/seattle.rs index e5324104bf..456ee71c43 100644 --- a/importer/src/seattle.rs +++ b/importer/src/seattle.rs @@ -45,7 +45,10 @@ pub fn osm_to_raw(name: &str) { "input/seattle/polygons/{}.poly", name ))), - drive_on_right: true, + map_config: map_model::MapConfig { + driving_side: map_model::raw::DrivingSide::Right, + bikes_can_use_bus_lanes: true, + }, onstreet_parking: convert_osm::OnstreetParking::Blockface(abstutil::path( "input/seattle/blockface.bin", diff --git a/map_model/src/edits.rs b/map_model/src/edits.rs index ac304b895a..9e505579b8 100644 --- a/map_model/src/edits.rs +++ b/map_model/src/edits.rs @@ -716,8 +716,13 @@ fn recalculate_turns( return; } - for t in crate::make::turns::make_all_turns(map.driving_side, i, &map.roads, &map.lanes, timer) - { + for t in crate::make::turns::make_all_turns( + map.config.driving_side, + i, + &map.roads, + &map.lanes, + timer, + ) { effects.added_turns.insert(t.id); i.turns.insert(t.id); if let Some(_existing_t) = old_turns.iter().find(|turn| turn.id == t.id) { diff --git a/map_model/src/lib.rs b/map_model/src/lib.rs index aff8c5ee1b..e454d7103a 100644 --- a/map_model/src/lib.rs +++ b/map_model/src/lib.rs @@ -14,6 +14,7 @@ pub use crate::edits::{ EditCmd, EditEffects, EditIntersection, MapEdits, OriginalLane, PermanentMapEdits, }; pub use crate::make::initial::lane_specs::RoadSpec; +pub use crate::map::MapConfig; pub use crate::objects::area::{Area, AreaID, AreaType}; pub use crate::objects::building::{Building, BuildingID, FrontPath, OffstreetParking}; pub use crate::objects::bus_stop::{BusRoute, BusRouteID, BusStop, BusStopID}; @@ -75,7 +76,7 @@ pub struct Map { gps_bounds: GPSBounds, bounds: Bounds, - driving_side: raw::DrivingSide, + config: MapConfig, // TODO Argh, hack, initialization order is hard! pathfinder: Option, diff --git a/map_model/src/make/initial/mod.rs b/map_model/src/make/initial/mod.rs index 1e2adf0765..402a240248 100644 --- a/map_model/src/make/initial/mod.rs +++ b/map_model/src/make/initial/mod.rs @@ -104,14 +104,15 @@ impl InitialMap { m.intersections.get_mut(&id.i1).unwrap().roads.insert(*id); m.intersections.get_mut(&id.i2).unwrap().roads.insert(*id); - m.roads.insert(*id, Road::new(*id, r, raw.driving_side)); + m.roads + .insert(*id, Road::new(*id, r, raw.config.driving_side)); } timer.start_iter("find each intersection polygon", m.intersections.len()); for i in m.intersections.values_mut() { timer.next(); - i.polygon = intersection_polygon(raw.driving_side, i, &mut m.roads, timer).0; + i.polygon = intersection_polygon(raw.config.driving_side, i, &mut m.roads, timer).0; } m diff --git a/map_model/src/make/mod.rs b/map_model/src/make/mod.rs index f6f94882fc..ff42aed7cf 100644 --- a/map_model/src/make/mod.rs +++ b/map_model/src/make/mod.rs @@ -45,7 +45,7 @@ impl Map { traffic_signals: BTreeMap::new(), gps_bounds, bounds, - driving_side: raw.driving_side, + config: raw.config.clone(), pathfinder: None, pathfinder_dirty: false, city_name: raw.city_name.clone(), @@ -242,7 +242,9 @@ impl Map { continue; } - for t in turns::make_all_turns(map.driving_side, i, &map.roads, &map.lanes, timer) { + for t in + turns::make_all_turns(map.config.driving_side, i, &map.roads, &map.lanes, timer) + { assert!(!map.turns.contains_key(&t.id)); i.turns.insert(t.id); if t.geom.length() < geom::EPSILON_DIST { @@ -427,21 +429,27 @@ fn match_points_to_lanes bool>( // For each point, find the closest point to any lane, using the quadtree to prune the // search. - let mut results: HashMap = HashMap::new(); - timer.start_iter("find closest lane point", pts.len()); - for query_pt in pts { - timer.next(); - if let Some((l, pt)) = closest.closest_pt(query_pt.to_pt2d(), max_dist_away) { - if let Some(dist_along) = lanes[l.0].dist_along_of_point(pt) { - results.insert(query_pt, Position::new(l, dist_along)); - } else { - panic!( - "{} isn't on {} according to dist_along_of_point, even though closest_point \ - thinks it is.\n{}", - pt, l, lanes[l.0].lane_center_pts - ); - } - } - } - results + timer + .parallelize( + "find closest lane point", + pts.into_iter().collect(), + |query_pt| { + if let Some((l, pt)) = closest.closest_pt(query_pt.to_pt2d(), max_dist_away) { + if let Some(dist_along) = lanes[l.0].dist_along_of_point(pt) { + Some((query_pt, Position::new(l, dist_along))) + } else { + panic!( + "{} isn't on {} according to dist_along_of_point, even though \ + closest_point thinks it is.\n{}", + pt, l, lanes[l.0].lane_center_pts + ); + } + } else { + None + } + }, + ) + .into_iter() + .flatten() + .collect() } diff --git a/map_model/src/map.rs b/map_model/src/map.rs index fb90c5826e..0c1bb3252c 100644 --- a/map_model/src/map.rs +++ b/map_model/src/map.rs @@ -7,8 +7,17 @@ use crate::{ }; use abstutil::{Timer, Warn}; use geom::{Angle, Bounds, Distance, GPSBounds, Line, PolyLine, Polygon, Pt2D}; +use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque}; +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct MapConfig { + // If true, driving happens on the right side of the road (USA). If false, on the left + // (Australia). + pub driving_side: DrivingSide, + pub bikes_can_use_bus_lanes: bool, +} + impl Map { pub fn new(path: String, timer: &mut Timer) -> Map { if path.starts_with(&abstutil::path_all_maps()) { @@ -126,7 +135,10 @@ impl Map { traffic_signals: BTreeMap::new(), gps_bounds: GPSBounds::new(), bounds: Bounds::new(), - driving_side: DrivingSide::Right, + config: MapConfig { + driving_side: DrivingSide::Right, + bikes_can_use_bus_lanes: true, + }, pathfinder: None, pathfinder_dirty: false, city_name: "blank city".to_string(), @@ -617,23 +629,23 @@ impl Map { } pub fn right_shift(&self, pl: PolyLine, width: Distance) -> Warn { - self.driving_side.right_shift(pl, width) + self.config.driving_side.right_shift(pl, width) } pub fn left_shift(&self, pl: PolyLine, width: Distance) -> Warn { - self.driving_side.left_shift(pl, width) + self.config.driving_side.left_shift(pl, width) } pub fn right_shift_line(&self, line: Line, width: Distance) -> Line { - self.driving_side.right_shift_line(line, width) + self.config.driving_side.right_shift_line(line, width) } pub fn left_shift_line(&self, line: Line, width: Distance) -> Line { - self.driving_side.left_shift_line(line, width) + self.config.driving_side.left_shift_line(line, width) } pub fn driving_side_angle(&self, a: Angle) -> Angle { - self.driving_side.angle_offset(a) + self.config.driving_side.angle_offset(a) } // Last resort pub fn get_driving_side(&self) -> DrivingSide { - self.driving_side + self.config.driving_side } // TODO Sort of a temporary hack diff --git a/map_model/src/pathfind/mod.rs b/map_model/src/pathfind/mod.rs index b013ff42a2..7c5108f0ec 100644 --- a/map_model/src/pathfind/mod.rs +++ b/map_model/src/pathfind/mod.rs @@ -444,8 +444,7 @@ impl PathConstraints { PathConstraints::Bike => { if l.is_biking() { true - } else if l.is_driving() || l.is_bus() { - // Note bikes can use bus lanes -- this is generally true in Seattle. + } else if l.is_driving() || (l.is_bus() && map.config.bikes_can_use_bus_lanes) { let road = map.get_r(l.parent); road.osm_tags.get("bicycle") != Some(&"no".to_string()) && road.osm_tags.get(osm::HIGHWAY) != Some(&"motorway".to_string()) diff --git a/map_model/src/raw.rs b/map_model/src/raw.rs index 8ffc242939..d601fddeb5 100644 --- a/map_model/src/raw.rs +++ b/map_model/src/raw.rs @@ -1,5 +1,5 @@ use crate::make::initial::lane_specs::get_lane_types; -use crate::{osm, AreaType, IntersectionType, RoadSpec}; +use crate::{osm, AreaType, IntersectionType, MapConfig, RoadSpec}; use abstutil::{deserialize_btreemap, serialize_btreemap, Timer, Warn}; use geom::{Angle, Distance, GPSBounds, Line, PolyLine, Polygon, Pt2D}; use serde::{Deserialize, Serialize}; @@ -32,9 +32,7 @@ pub struct RawMap { pub boundary_polygon: Polygon, pub gps_bounds: GPSBounds, - // If true, driving happens on the right side of the road (USA). If false, on the left - // (Australia). - pub driving_side: DrivingSide, + pub config: MapConfig, } // A way to refer to roads across many maps and over time. Also trivial to relate with OSM to find @@ -122,7 +120,10 @@ impl RawMap { // Some nonsense thing boundary_polygon: Polygon::rectangle(1.0, 1.0), gps_bounds: GPSBounds::new(), - driving_side: DrivingSide::Right, + config: MapConfig { + driving_side: DrivingSide::Right, + bikes_can_use_bus_lanes: true, + }, } } @@ -190,12 +191,12 @@ impl RawMap { for r in &i.roads { roads.insert( *r, - initial::Road::new(*r, &self.roads[r], self.driving_side), + initial::Road::new(*r, &self.roads[r], self.config.driving_side), ); } let (i_pts, debug) = - initial::intersection_polygon(self.driving_side, &i, &mut roads, timer); + initial::intersection_polygon(self.config.driving_side, &i, &mut roads, timer); ( Polygon::new(&i_pts), roads