mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 11:44:25 +03:00
depicting stop signs very primitively
This commit is contained in:
parent
2f9ff9d069
commit
73455017c2
@ -126,7 +126,7 @@ wait slow down even more -- before any of this change, lanes on adjacent roads s
|
||||
- https://www.politesi.polimi.it/bitstream/10589/112826/4/2015_10_TOPTAS.pdf
|
||||
- just make polygons around center lines, then intersect?
|
||||
- shift turn icons and stop markings and such away from crosswalk
|
||||
- depict stop signs, traffic lights, yields?
|
||||
- depict traffic lights
|
||||
- figure out what to do about yellow center lines
|
||||
- yellow and white lines intersect cars and turn icons and such
|
||||
- who should own drawing them?
|
||||
|
@ -66,6 +66,12 @@
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"StopSignMarking": [
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"ChangedStopSignIntersection": [
|
||||
0.0,
|
||||
1.0,
|
||||
|
@ -21,6 +21,7 @@ pub enum Colors {
|
||||
Sidewalk,
|
||||
SidewalkMarking,
|
||||
Crosswalk,
|
||||
StopSignMarking,
|
||||
ChangedStopSignIntersection,
|
||||
ChangedTrafficSignalIntersection,
|
||||
TrafficSignalIntersection,
|
||||
|
@ -31,7 +31,7 @@ impl DrawMap {
|
||||
pub fn new(map: &Map) -> (DrawMap, Pt2D) {
|
||||
let mut roads: Vec<DrawRoad> = Vec::new();
|
||||
for r in map.all_roads() {
|
||||
roads.push(DrawRoad::new(r));
|
||||
roads.push(DrawRoad::new(r, map));
|
||||
}
|
||||
|
||||
let mut turn_to_road_offset: HashMap<TurnID, usize> = HashMap::new();
|
||||
|
@ -30,7 +30,7 @@ pub struct DrawRoad {
|
||||
}
|
||||
|
||||
impl DrawRoad {
|
||||
pub fn new(road: &map_model::Road) -> DrawRoad {
|
||||
pub fn new(road: &map_model::Road, map: &map_model::Map) -> DrawRoad {
|
||||
let start = perp_line(road.first_line(), geometry::LANE_THICKNESS);
|
||||
let end = perp_line(road.last_line().reverse(), geometry::LANE_THICKNESS);
|
||||
|
||||
@ -57,6 +57,12 @@ impl DrawRoad {
|
||||
} {
|
||||
markings.push(m);
|
||||
}
|
||||
// TODO not all sides of the road have to stop
|
||||
if road.lane_type == map_model::LaneType::Driving
|
||||
&& !map.get_i(road.dst_i).has_traffic_signal
|
||||
{
|
||||
markings.push(calculate_stop_sign_line(road));
|
||||
}
|
||||
|
||||
DrawRoad {
|
||||
id: road.id,
|
||||
@ -267,3 +273,15 @@ fn calculate_driving_lines(road: &map_model::Road) -> Option<Marking> {
|
||||
round: false,
|
||||
})
|
||||
}
|
||||
|
||||
fn calculate_stop_sign_line(road: &map_model::Road) -> Marking {
|
||||
let (pt1, angle) = road.dist_along(road.length() - (2.0 * geometry::LANE_THICKNESS * si::M));
|
||||
// Reuse perp_line. Project away an arbitrary amount
|
||||
let pt2 = pt1.project_away(1.0, angle);
|
||||
Marking {
|
||||
lines: vec![perp_line(Line::new(pt1, pt2), geometry::LANE_THICKNESS)],
|
||||
color: Colors::StopSignMarking,
|
||||
thickness: 0.25,
|
||||
round: true,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user