mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 17:37:22 +03:00
exclude cul-de-sacs
This commit is contained in:
parent
88334d50ca
commit
8f15eccf8d
@ -261,6 +261,7 @@ I thought I had a list of these somewhere else?
|
||||
|
||||
- min length for lanes, turns
|
||||
- connectivity
|
||||
- no loop lanes (same src and dst endpt)... but what about cul-de-sacs then?
|
||||
|
||||
## Border nodes
|
||||
|
||||
|
@ -108,9 +108,9 @@ impl Map {
|
||||
|
||||
let mut counter = 0;
|
||||
timer.start_iter("expand roads to lanes", data.roads.len());
|
||||
for (idx, r) in data.roads.iter().enumerate() {
|
||||
for (_, r) in data.roads.iter().enumerate() {
|
||||
timer.next();
|
||||
let road_id = RoadID(idx);
|
||||
let road_id = RoadID(m.roads.len());
|
||||
let road_center_pts = PolyLine::new(
|
||||
r.points
|
||||
.iter()
|
||||
@ -120,6 +120,12 @@ impl Map {
|
||||
let i1 = pt_to_intersection[&HashablePt2D::from(road_center_pts.first_pt())];
|
||||
let i2 = pt_to_intersection[&HashablePt2D::from(road_center_pts.last_pt())];
|
||||
|
||||
if i1 == i2 {
|
||||
// TODO Cul-de-sacs should be valid, but it really makes pathfinding screwy
|
||||
error!("OSM way {} is a loop on {}, skipping", r.osm_way_id, i1);
|
||||
continue;
|
||||
}
|
||||
|
||||
m.roads.push(Road {
|
||||
id: road_id,
|
||||
osm_tags: r.osm_tags.clone(),
|
||||
|
@ -378,8 +378,18 @@ fn validate(map: &Map, steps: &Vec<PathStep>) {
|
||||
error!("All steps in invalid path:");
|
||||
for s in steps {
|
||||
match s {
|
||||
PathStep::Lane(l) => error!(" {:?} from {} to {}", s, map.get_l(*l).src_i, map.get_l(*l).dst_i),
|
||||
PathStep::ContraflowLane(l) => error!(" {:?} from {} to {}", s, map.get_l(*l).dst_i, map.get_l(*l).src_i),
|
||||
PathStep::Lane(l) => error!(
|
||||
" {:?} from {} to {}",
|
||||
s,
|
||||
map.get_l(*l).src_i,
|
||||
map.get_l(*l).dst_i
|
||||
),
|
||||
PathStep::ContraflowLane(l) => error!(
|
||||
" {:?} from {} to {}",
|
||||
s,
|
||||
map.get_l(*l).dst_i,
|
||||
map.get_l(*l).src_i
|
||||
),
|
||||
PathStep::Turn(_) => error!(" {:?}", s),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user