sidewalks for two-ways

This commit is contained in:
Dustin Carlino 2018-06-19 10:09:55 -07:00
parent 854eee4fd0
commit 52b8570e6c
4 changed files with 18 additions and 10 deletions

12
TODO.md
View File

@ -46,19 +46,27 @@
- multiple lanes
- display + mouseover parking lane and sidewalk
- make parking lanes on one-ways work
- add in sidewalks (update the ID offset!)
- make the center lines in geom layer work (use debug mode to verify)
- something broke curved roads
- make extra lanes for oneways work
- have to switch from Centered to DrivingDirection somehow
- either translate points up-front and be normal or fix geom layer (for turns and intersections)
- model cars parking
- maybe render numbers on the cars to distinguish them
- document the FSM (on lane driving, waiting, turning, parking, etc)
- model bikes in driving lanes (as slow cars)
- add random bike lanes, figure out how turns would work
- be able to convert between parking and bike lanes, recompute the turns
- model pdestrians
- maybe draw crosswalks?
- when rendering sidewalks, have an option for a grass buffer
- regression testing
- goldenfile approach for map_model, geom, and render layer from a small OSM chunk
- or maybe a visual demo approach with a list of things to manually check
- unit test that Centered thick line yields same geometry with points reversed
## Code cleanup

View File

@ -17,7 +17,7 @@ use std::f64;
#[derive(Debug)]
pub struct DrawRoad {
pub id: RoadID,
pub polygons: Vec<Vec<Vec2d>>, // TODO pub for DrawIntersection
polygons: Vec<Vec<Vec2d>>,
// Empty for one-ways and one side of two-ways.
// TODO ideally this could be done in the shader or something
yellow_center_lines: Vec<Pt2D>,
@ -27,7 +27,6 @@ impl DrawRoad {
pub fn new(road: &map_model::Road, geom_map: &geom::GeomMap) -> DrawRoad {
let geom_r = geom_map.get_r(road.id);
// TODO handle offset for Centered
let thick_line = if road.one_way_road {
geometry::ThickLine::Centered(geom::LANE_THICKNESS)
} else {

View File

@ -55,7 +55,6 @@ impl ThickLine {
(-1.0 * w * offset, -1.0 * w * (offset + 1.0))
}
}
// TODO this case
ThickLine::Centered(w) => (w / -2.0, w / 2.0),
}
}

View File

@ -279,18 +279,20 @@ impl Map {
LaneType::Driving,
0,
orig_direction,
if oneway { None } else { Some(2) },
if oneway { None } else { Some(3) },
),
(LaneType::Parking, 1, orig_direction, None),
//(LaneType::Sidewalk, 2, orig_direction, None),
(LaneType::Sidewalk, 2, orig_direction, None),
];
if oneway {
lanes.pop();
lanes.pop();
//lanes.push((LaneType::Sidewalk, 0, reverse_direction, None));
} else {
lanes.extend(vec![
(LaneType::Driving, 0, reverse_direction, Some(-2)),
(LaneType::Driving, 0, reverse_direction, Some(-3)),
(LaneType::Parking, 1, reverse_direction, None),
//(LaneType::Sidewalk, 2, reverse_direction, None),
(LaneType::Sidewalk, 2, reverse_direction, None),
]);
}