lifted unshifted pts to road

This commit is contained in:
Dustin Carlino 2018-07-24 08:58:55 -07:00
parent 4bf72b36c8
commit 549aa75d9c
5 changed files with 19 additions and 19 deletions

View File

@ -5,8 +5,10 @@
- trim buidings and parcels that're nowhere near roads (aka, the bbox is kinda wrong)
- road with many lanes
- make/turns can use this especially. intersections should refer to different things.
- this will clean up other_side and siblings
- make road know about children in each direction
- make intersection know about roads, not lanes
- make/turns can use this especially. intersections should refer to different things.
- clean up all state in lane
- maybe also the time to split into different lane types? what's similar/not between them?

View File

@ -40,7 +40,8 @@ impl DrawLane {
let mut markings: Vec<Marking> = Vec::new();
if lane.use_yellow_center_lines {
markings.push(Marking {
lines: lane.unshifted_pts
lines: map.get_r(lane.parent)
.center_pts
.points()
.windows(2)
.map(|pair| [pair[0].x(), pair[0].y(), pair[1].x(), pair[1].y()])

View File

@ -43,7 +43,6 @@ pub struct Lane {
pub probably_broken: bool,
// TODO i think everything else should be moved to road, honestly.
pub src_i: IntersectionID,
pub dst_i: IntersectionID,
@ -59,10 +58,6 @@ pub struct Lane {
pub other_side: Option<LaneID>,
// TODO alright, we might need a Road-vs-Lanes distinction
pub siblings: Vec<LaneID>,
// Unshifted center points. consider computing these twice or otherwise not storing them
// Order implies road orientation.
pub unshifted_pts: PolyLine,
}
impl PartialEq for Lane {
@ -120,10 +115,6 @@ impl Lane {
"\nlet lane_center_r{}_pts = {}",
self.id.0, self.lane_center_pts
);
println!(
"\nlet unshifted_r{}_pts = {}",
self.id.0, self.unshifted_pts
);
}
// TODO different types for each lane type might be reasonable

View File

@ -62,10 +62,18 @@ impl Map {
let mut counter = 0;
for (idx, r) in data.roads.iter().enumerate() {
let road_id = RoadID(idx);
let road_center_pts = PolyLine::new(
r.points
.iter()
.map(|coord| Pt2D::from_gps(coord, &bounds))
.collect(),
);
m.roads.push(Road {
id: road_id,
osm_tags: r.osm_tags.clone(),
osm_way_id: r.osm_way_id,
center_pts: road_center_pts.clone(),
});
// TODO move this to make/lanes.rs too
@ -79,12 +87,7 @@ impl Map {
.map(|offset| LaneID(((id.0 as isize) + offset) as usize))
.collect();
let mut unshifted_pts = PolyLine::new(
r.points
.iter()
.map(|coord| Pt2D::from_gps(coord, &bounds))
.collect(),
);
let mut unshifted_pts = road_center_pts.clone();
if lane.reverse_pts {
unshifted_pts = unshifted_pts.reversed();
}
@ -118,7 +121,6 @@ impl Map {
use_yellow_center_lines,
lane_center_pts,
probably_broken,
unshifted_pts,
offset: lane.offset,
src_i: i1,
dst_i: i2,

View File

@ -1,3 +1,4 @@
use geom::PolyLine;
use std::collections::BTreeMap;
use std::fmt;
@ -17,4 +18,7 @@ pub struct Road {
pub id: RoadID,
pub osm_tags: BTreeMap<String, String>,
pub osm_way_id: i64,
// Unshifted center points. Order implies road orientation.
pub center_pts: PolyLine,
}