mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
missed a few right_shift calls in importer. and speed up traffic signal
matching while I'm there
This commit is contained in:
parent
a27b029ff6
commit
eb74e05407
@ -62,14 +62,14 @@ fn use_parking_hints(map: &mut RawMap, path: String, timer: &mut Timer) {
|
|||||||
(*id, true),
|
(*id, true),
|
||||||
map.config
|
map.config
|
||||||
.driving_side
|
.driving_side
|
||||||
.right_shift(center.clone(), DIRECTED_ROAD_THICKNESS)
|
.must_right_shift(center.clone(), DIRECTED_ROAD_THICKNESS)
|
||||||
.points(),
|
.points(),
|
||||||
);
|
);
|
||||||
closest.add(
|
closest.add(
|
||||||
(*id, false),
|
(*id, false),
|
||||||
map.config
|
map.config
|
||||||
.driving_side
|
.driving_side
|
||||||
.left_shift(center, DIRECTED_ROAD_THICKNESS)
|
.must_left_shift(center, DIRECTED_ROAD_THICKNESS)
|
||||||
.points(),
|
.points(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -172,28 +172,28 @@ pub fn split_up_roads(
|
|||||||
.push((via, to));
|
.push((via, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timer.start("match traffic signals to intersections");
|
||||||
// Handle traffic signals tagged on incoming ways and not at intersections
|
// Handle traffic signals tagged on incoming ways and not at intersections
|
||||||
// (https://wiki.openstreetmap.org/wiki/Tag:highway=traffic%20signals?uselang=en#Tag_all_incoming_ways).
|
// (https://wiki.openstreetmap.org/wiki/Tag:highway=traffic%20signals?uselang=en#Tag_all_incoming_ways).
|
||||||
timer.start_iter(
|
let mut pt_to_road: HashMap<HashablePt2D, OriginalRoad> = HashMap::new();
|
||||||
"match traffic signals to intersections",
|
for (id, r) in &map.roads {
|
||||||
input.traffic_signals.len(),
|
for (idx, pt) in r.center_points.iter().enumerate() {
|
||||||
);
|
if idx != 0 && idx != r.center_points.len() - 1 {
|
||||||
for (pt, forwards) in input.traffic_signals {
|
pt_to_road.insert(pt.to_hashable(), *id);
|
||||||
timer.next();
|
|
||||||
for (id, r) in &map.roads {
|
|
||||||
if r.center_points.contains(&pt.to_pt2d()) {
|
|
||||||
// Example: https://www.openstreetmap.org/node/26734224
|
|
||||||
if r.osm_tags.is(osm::HIGHWAY, "construction") {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let i = if forwards { id.i2 } else { id.i1 };
|
|
||||||
map.intersections.get_mut(&i).unwrap().intersection_type =
|
|
||||||
IntersectionType::TrafficSignal;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (pt, forwards) in input.traffic_signals {
|
||||||
|
if let Some(r) = pt_to_road.get(&pt) {
|
||||||
|
// Example: https://www.openstreetmap.org/node/26734224
|
||||||
|
if !map.roads[r].osm_tags.is(osm::HIGHWAY, "construction") {
|
||||||
|
let i = if forwards { r.i2 } else { r.i1 };
|
||||||
|
map.intersections.get_mut(&i).unwrap().intersection_type =
|
||||||
|
IntersectionType::TrafficSignal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
timer.stop("match traffic signals to intersections");
|
||||||
|
|
||||||
timer.stop("splitting up roads");
|
timer.stop("splitting up roads");
|
||||||
(input.amenities, pt_to_road)
|
(input.amenities, pt_to_road)
|
||||||
|
Loading…
Reference in New Issue
Block a user