Don't use assemble_ltr outside of raw_map; it's one small complication to switching to osm2lanes for https://github.com/a-b-street/osm2lanes/issues/71

This commit is contained in:
Dustin Carlino 2022-04-14 09:41:18 +01:00
parent 3657d89702
commit 9ffab3c976
4 changed files with 12 additions and 29 deletions

1
Cargo.lock generated
View File

@ -2106,6 +2106,7 @@ dependencies = [
"map_gui",
"map_model",
"maplit",
"raw_map",
"serde",
"serde_json",
"structopt",

View File

@ -27,6 +27,7 @@ log = "0.4"
maplit = "1.0.2"
map_gui = { path = "../../map_gui" }
map_model = { path = "../../map_model" }
raw_map = { path = "../../raw_map" }
serde = "1.0.123"
serde_json = "1.0.61"
synthpop = { path = "../../synthpop" }

View File

@ -1,7 +1,7 @@
use abstutil::{Tags, Timer};
use geom::Distance;
use map_gui::render::DrawMap;
use map_model::{osm, Direction, LaneSpec, LaneType, Map, Road};
use map_model::{osm, Map, Road};
use widgetry::EventCtx;
use crate::App;
@ -14,33 +14,14 @@ pub fn transform_existing_filters(ctx: &EventCtx, app: &mut App, timer: &mut Tim
let mut filtered_roads = Vec::new();
for r in detect_filters(&app.map) {
edits.commands.push(app.map.edit_road_cmd(r.id, |new| {
// Use a fixed [sidewalk, driving, driving, sidewalk] configuration
let tags = Tags::empty();
let fwd = vec![
LaneSpec {
lt: LaneType::Driving,
dir: Direction::Fwd,
width: LaneSpec::typical_lane_widths(LaneType::Driving, &tags)[0].0,
},
LaneSpec {
lt: LaneType::Sidewalk,
dir: Direction::Fwd,
width: LaneSpec::typical_lane_widths(LaneType::Sidewalk, &tags)[0].0,
},
];
let back = vec![
LaneSpec {
lt: LaneType::Driving,
dir: Direction::Back,
width: LaneSpec::typical_lane_widths(LaneType::Driving, &tags)[0].0,
},
LaneSpec {
lt: LaneType::Sidewalk,
dir: Direction::Back,
width: LaneSpec::typical_lane_widths(LaneType::Sidewalk, &tags)[0].0,
},
];
new.lanes_ltr = LaneSpec::assemble_ltr(fwd, back, app.map.get_config().driving_side);
// Produce a fixed [sidewalk, driving, driving, sidewalk] configuration. We could get
// fancier and copy the tags of one of the roads we're connected to, but there might be
// turn lanes or something extraneous there.
let mut tags = Tags::empty();
tags.insert("highway", "residential");
tags.insert("lanes", "2");
tags.insert("sidewalk", "both");
new.lanes_ltr = raw_map::get_lane_specs_ltr(&tags, app.map.get_config());
}));
filtered_roads.push(r.id);
}

View File

@ -538,7 +538,7 @@ impl LaneSpec {
/// Put a list of forward and backward lanes into left-to-right order, depending on the driving
/// side. Both input lists should be ordered from the center of the road going outwards.
pub fn assemble_ltr(
pub(crate) fn assemble_ltr(
mut fwd_side: Vec<LaneSpec>,
mut back_side: Vec<LaneSpec>,
driving_side: DrivingSide,