1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::collections::BTreeSet;
use crate::osm::NodeID;
use crate::raw::RawMap;
pub fn merge_short_roads(map: &mut RawMap) -> BTreeSet<NodeID> {
let mut merged = BTreeSet::new();
loop {
let mut changes = false;
for (id, road) in map.roads.clone() {
if road.osm_tags.is("junction", "intersection") {
match map.merge_short_road(id) {
Ok((i, _, _, _)) => {
merged.insert(i);
changes = true;
break;
}
Err(err) => {
warn!("Ignoring junction=intersection: {}", err);
}
}
}
}
if !changes {
break;
}
}
merged
}