Skip to content

Commit

Permalink
Render shared-use and footway dashed outlines
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Mar 15, 2024
1 parent ecad848 commit 69bb5fc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions osm2streets/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,17 @@ impl StreetNetwork {
features.push(f);
}
}

for (lane, center) in road.lane_specs_ltr.iter().zip(lane_centers.iter()) {
if lane.lt != LaneType::SharedUse && lane.lt != LaneType::Footway {
continue;
}
for polygon in draw_path_outlines(lane, center) {
let mut f = Feature::from(polygon.to_geojson(gps_bounds));
f.set_property("type", "path outline");
features.push(f);
}
}
}

serialize_features(features)
Expand Down Expand Up @@ -634,6 +645,22 @@ fn draw_sidewalk_lines(lane: &LaneSpec, center: &PolyLine) -> Vec<Polygon> {
.collect()
}

fn draw_path_outlines(lane: &LaneSpec, center: &PolyLine) -> Vec<Polygon> {
let mut result = Vec::new();
// Dashed lines on both sides
for dir in [-1.0, 1.0] {
let pl = center
.shift_either_direction(dir * lane.width / 2.0)
.unwrap();
result.extend(pl.exact_dashed_polygons(
Distance::meters(0.25),
Distance::meters(1.0),
Distance::meters(1.5),
));
}
result
}

// this always does it at pt1
fn perp_line(l: Line, length: Distance) -> Line {
let pt1 = l.shift_right(length / 2.0).pt1();
Expand Down
1 change: 1 addition & 0 deletions web/src/common/layers/RenderLaneMarkings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"vehicle stop line": general_road_marking,
"sidewalk line": "#BBBBBB",
"bike stop line": "green",
"path outline": "black",
},
"red",
),
Expand Down
2 changes: 1 addition & 1 deletion web/src/common/layers/RenderLanePolygons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Construction: "#FF6D00",
LightRail: "#844204",
Footway: "#DDDDE8",
SharedUse: "#E5E1BB",
SharedUse: "#DED68A",
// This is the only type used currently
"Buffer(Planters)": "#555555",
},
Expand Down

0 comments on commit 69bb5fc

Please sign in to comment.