Skip to content

Commit

Permalink
More workarounds for clipping, found while upgrading A/B Street. #127
Browse files Browse the repository at this point in the history
- traffic signals should never wind up on map edges
- multipolygons and OSM document-level clipping are still strange
  • Loading branch information
dabreegster committed Dec 23, 2022
1 parent ac5623a commit ca1f718
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 1 addition & 4 deletions osm2streets/src/intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ impl StreetNetwork {
intersection.kind = kind;
}

pub fn calculate_movements_and_kind(
&self,
i: IntersectionID,
) -> (Vec<Movement>, IntersectionKind) {
fn calculate_movements_and_kind(&self, i: IntersectionID) -> (Vec<Movement>, IntersectionKind) {
let roads: Vec<_> = self
.roads_per_intersection(i)
.into_iter()
Expand Down
5 changes: 4 additions & 1 deletion streets_reader/src/osm_reader/multipolygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ impl Document {
for (role, member) in &rel.members {
if let OsmID::Way(w) = member {
if role == "outer" {
pts_per_way.push((*w, self.ways[w].pts.clone()));
// TODO Hack. Clipping doesn't handle relations / members yet
if let Some(way) = self.ways.get(w) {
pts_per_way.push((*w, way.pts.clone()));
}
} else {
println!("{} has unhandled member role {}, ignoring it", id, role);
}
Expand Down
6 changes: 4 additions & 2 deletions streets_reader/src/split_ways.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ pub fn split_up_roads(
} else {
road.src_i
};
streets.intersections.get_mut(&i).unwrap().control =
IntersectionControl::Signalled;
let i = streets.intersections.get_mut(&i).unwrap();
if !i.is_map_edge() {
i.control = IntersectionControl::Signalled;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/leeds_cycleway/geometry.json
Original file line number Diff line number Diff line change
Expand Up @@ -18245,7 +18245,7 @@
"type": "Polygon"
},
"properties": {
"control": "Signalled",
"control": "Uncontrolled",
"id": 1,
"intersection_kind": "MapEdge",
"movements": [],
Expand Down

0 comments on commit ca1f718

Please sign in to comment.