mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
cap hill's rainbow crosswalks! [rebuild]
This commit is contained in:
parent
4dd2835cd4
commit
b231809ba2
@ -100,7 +100,7 @@ data/input/screenshots/downtown/08x02_i11.gif,b32a0707a42efe5743ddd0c7b0eb7158,h
|
||||
data/input/screenshots/downtown/08x03_i219.gif,df11ea5609438589184705d2e8b1f3d3,https://www.dropbox.com/s/i484j3yjiivbh7l/08x03_i219.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x04_i210.gif,c17e7ad6826033bbf7883ebbd00ef715,https://www.dropbox.com/s/mm4tyj28oemznr2/08x04_i210.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x05_i126.gif,16fec94ab1e56952928a74d97090284e,https://www.dropbox.com/s/nyuiw5cxq6onihm/08x05_i126.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x06_i123.gif,6e15aa746656c61de7acf55786e6cc73,https://www.dropbox.com/s/win6ackppf7jqig/08x06_i123.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x06_i123.gif,ac313d913a372c6618b3183cb7279b52,https://www.dropbox.com/s/win6ackppf7jqig/08x06_i123.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x07_i114.gif,82a9784cb2c4f5e503b149fe59ce2bb9,https://www.dropbox.com/s/zgdlxs819w7jm3u/08x07_i114.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x08_i100.gif,63557091985fe6f288ce2143dd28c3ae,https://www.dropbox.com/s/6zmreieujfyfijz/08x08_i100.gif.zip?dl=0
|
||||
data/input/screenshots/downtown/08x09_i119.gif,39310bbebbc9fa1be034c4d507799ebe,https://www.dropbox.com/s/zyobqtke0bvao1m/08x09_i119.gif.zip?dl=0
|
||||
|
@ -6,7 +6,7 @@ use crate::render::{
|
||||
draw_signal_phase, DrawOptions, Renderable, CROSSWALK_LINE_THICKNESS, OUTLINE_THICKNESS,
|
||||
};
|
||||
use abstutil::Timer;
|
||||
use ezgui::{Drawable, FancyColor, GeomBatch, GfxCtx, Line, Prerender, RewriteColor, Text};
|
||||
use ezgui::{Color, Drawable, FancyColor, GeomBatch, GfxCtx, Line, Prerender, RewriteColor, Text};
|
||||
use geom::{Angle, ArrowCap, Distance, Line, PolyLine, Polygon, Pt2D, Time, EPSILON_DIST};
|
||||
use map_model::raw::DrivingSide;
|
||||
use map_model::{
|
||||
@ -318,6 +318,10 @@ fn make_octagon(center: Pt2D, radius: Distance, facing: Angle) -> Polygon {
|
||||
}
|
||||
|
||||
pub fn make_crosswalk(batch: &mut GeomBatch, turn: &Turn, map: &Map, cs: &ColorScheme) {
|
||||
if make_rainbow_crosswalk(batch, turn, map) {
|
||||
return;
|
||||
}
|
||||
|
||||
let width = map.get_l(turn.id.src).width;
|
||||
// Start at least width out to not hit sidewalk corners. Also account for the thickness of the
|
||||
// crosswalk line itself. Center the lines inside these two boundaries.
|
||||
@ -357,6 +361,58 @@ pub fn make_crosswalk(batch: &mut GeomBatch, turn: &Turn, map: &Map, cs: &ColorS
|
||||
}
|
||||
}
|
||||
|
||||
fn make_rainbow_crosswalk(batch: &mut GeomBatch, turn: &Turn, map: &Map) -> bool {
|
||||
// TODO The crosswalks aren't tagged in OSM yet. Manually hardcoding some now.
|
||||
let node = map.get_i(turn.id.parent).orig_id.osm_node_id;
|
||||
let way = map.get_parent(turn.id.src).orig_id.osm_way_id;
|
||||
match (node, way) {
|
||||
// Broadway and Pine
|
||||
(53073255, 428246441) |
|
||||
(53073255, 332601014) |
|
||||
// Broadway and Pike
|
||||
(53073254, 6447455) |
|
||||
(53073254, 607690679) |
|
||||
// 10th and Pine
|
||||
(53168934, 6456052) |
|
||||
// 10th and Pike
|
||||
(53200834, 6456052) |
|
||||
// 11th and Pine
|
||||
(53068795, 607691081) |
|
||||
(53068795, 65588105) |
|
||||
// 11th and Pike
|
||||
(53068794, 65588105) => {}
|
||||
_ => { return false; }
|
||||
}
|
||||
|
||||
let total_width = map.get_l(turn.id.src).width;
|
||||
let colors = vec![
|
||||
Color::WHITE,
|
||||
Color::RED,
|
||||
Color::ORANGE,
|
||||
Color::YELLOW,
|
||||
Color::GREEN,
|
||||
Color::BLUE,
|
||||
Color::hex("#8B00FF"),
|
||||
Color::WHITE,
|
||||
];
|
||||
let band_width = total_width / (colors.len() as f64);
|
||||
let slice = turn
|
||||
.geom
|
||||
.exact_slice(total_width, turn.geom.length() - total_width)
|
||||
.shift_left(total_width / 2.0 - band_width / 2.0)
|
||||
.unwrap();
|
||||
for (idx, color) in colors.into_iter().enumerate() {
|
||||
batch.push(
|
||||
color,
|
||||
slice
|
||||
.shift_right(band_width * (idx as f64))
|
||||
.unwrap()
|
||||
.make_polygons(band_width),
|
||||
);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
// TODO copied from DrawLane
|
||||
fn perp_line(l: Line, length: Distance) -> Line {
|
||||
let pt1 = l.shift_right(length / 2.0).pt1();
|
||||
|
Loading…
Reference in New Issue
Block a user