mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
Simplify traffic signal rendering before big turn icon overhaul by
removing some older styles.
This commit is contained in:
parent
ddb933d682
commit
f59b738692
@ -871,7 +871,7 @@ fn draw_multiple_signals(
|
||||
None,
|
||||
&mut piece,
|
||||
app,
|
||||
TrafficSignalStyle::Sidewalks,
|
||||
TrafficSignalStyle::Yuwen,
|
||||
);
|
||||
if members.len() > 1 && hovering.map(|x| x == *i).unwrap_or(false) {
|
||||
// TODO This makes the side-panel jump a little, because the outline slightly increases
|
||||
|
@ -283,7 +283,7 @@ pub fn traffic_signal(
|
||||
None,
|
||||
&mut orig_batch,
|
||||
app,
|
||||
TrafficSignalStyle::Sidewalks,
|
||||
TrafficSignalStyle::Yuwen,
|
||||
);
|
||||
|
||||
let mut normal = GeomBatch::new();
|
||||
|
@ -53,9 +53,7 @@ impl Options {
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub enum TrafficSignalStyle {
|
||||
BAP,
|
||||
GroupArrows,
|
||||
Sidewalks,
|
||||
Icons,
|
||||
Yuwen,
|
||||
IndividualTurnArrows,
|
||||
}
|
||||
|
||||
@ -127,24 +125,8 @@ impl OptionsPanel {
|
||||
"Traffic signal rendering",
|
||||
app.opts.traffic_signal_style.clone(),
|
||||
vec![
|
||||
Choice::new(
|
||||
"Brian's variation of arrows showing the protected and \
|
||||
permitted movements",
|
||||
TrafficSignalStyle::BAP,
|
||||
),
|
||||
Choice::new(
|
||||
"arrows showing the protected and permitted movements",
|
||||
TrafficSignalStyle::GroupArrows,
|
||||
),
|
||||
Choice::new(
|
||||
"arrows showing the protected and permitted movements, with \
|
||||
sidewalks",
|
||||
TrafficSignalStyle::Sidewalks,
|
||||
),
|
||||
Choice::new(
|
||||
"icons for movements (like the editor UI)",
|
||||
TrafficSignalStyle::Icons,
|
||||
),
|
||||
Choice::new("Default (Brian's style)", TrafficSignalStyle::BAP),
|
||||
Choice::new("Yuwen's style", TrafficSignalStyle::Yuwen),
|
||||
Choice::new(
|
||||
"arrows showing individual turns (to debug)",
|
||||
TrafficSignalStyle::IndividualTurnArrows,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::app::App;
|
||||
use crate::options::TrafficSignalStyle;
|
||||
use crate::render::intersection::make_crosswalk;
|
||||
use crate::render::{DrawMovement, BIG_ARROW_THICKNESS};
|
||||
use crate::render::BIG_ARROW_THICKNESS;
|
||||
use geom::{Angle, ArrowCap, Circle, Distance, Duration, Line, PolyLine, Pt2D};
|
||||
use map_model::{IntersectionID, Stage, TurnPriority, SIDEWALK_THICKNESS};
|
||||
use std::collections::BTreeSet;
|
||||
@ -137,53 +137,7 @@ pub fn draw_signal_stage(
|
||||
// No time_left box
|
||||
return;
|
||||
}
|
||||
TrafficSignalStyle::GroupArrows => {
|
||||
for m in &stage.yield_movements {
|
||||
assert!(!m.crosswalk);
|
||||
let arrow = signal.movements[m]
|
||||
.geom
|
||||
.make_arrow(BIG_ARROW_THICKNESS * 2.0, ArrowCap::Triangle);
|
||||
batch.push(app.cs.signal_permitted_turn.alpha(0.3), arrow.clone());
|
||||
if let Ok(p) = arrow.to_outline(BIG_ARROW_THICKNESS / 2.0) {
|
||||
batch.push(app.cs.signal_permitted_turn, p);
|
||||
}
|
||||
}
|
||||
let mut dont_walk = BTreeSet::new();
|
||||
for m in signal.movements.keys() {
|
||||
if m.crosswalk {
|
||||
dont_walk.insert(m);
|
||||
}
|
||||
}
|
||||
for m in &stage.protected_movements {
|
||||
if !m.crosswalk {
|
||||
batch.push(
|
||||
app.cs.signal_protected_turn,
|
||||
signal.movements[m]
|
||||
.geom
|
||||
.make_arrow(BIG_ARROW_THICKNESS * 2.0, ArrowCap::Triangle),
|
||||
);
|
||||
} else {
|
||||
let (center, angle) = crosswalk_icon(&signal.movements[m].geom);
|
||||
batch.append(
|
||||
GeomBatch::load_svg(prerender, "system/assets/map/walk.svg")
|
||||
.scale(0.07)
|
||||
.centered_on(center)
|
||||
.rotate(angle),
|
||||
);
|
||||
dont_walk.remove(m);
|
||||
}
|
||||
}
|
||||
for m in dont_walk {
|
||||
let (center, angle) = crosswalk_icon(&signal.movements[m].geom);
|
||||
batch.append(
|
||||
GeomBatch::load_svg(prerender, "system/assets/map/dont_walk.svg")
|
||||
.scale(0.07)
|
||||
.centered_on(center)
|
||||
.rotate(angle),
|
||||
);
|
||||
}
|
||||
}
|
||||
TrafficSignalStyle::Sidewalks => {
|
||||
TrafficSignalStyle::Yuwen => {
|
||||
for m in &stage.yield_movements {
|
||||
assert!(!m.crosswalk);
|
||||
let arrow = signal.movements[m]
|
||||
@ -196,6 +150,8 @@ pub fn draw_signal_stage(
|
||||
}
|
||||
for m in &stage.protected_movements {
|
||||
if m.crosswalk {
|
||||
// TODO This only works on the side panel. On the full map, the crosswalks are
|
||||
// always drawn, so this awkwardly doubles some of them.
|
||||
make_crosswalk(
|
||||
batch,
|
||||
app.primary.map.get_t(signal.movements[m].members[0]),
|
||||
@ -212,17 +168,6 @@ pub fn draw_signal_stage(
|
||||
}
|
||||
}
|
||||
}
|
||||
TrafficSignalStyle::Icons => {
|
||||
for m in DrawMovement::for_i(i, &app.primary.map) {
|
||||
batch.push(app.cs.signal_turn_block_bg, m.block.clone());
|
||||
let arrow_color = match stage.get_priority_of_movement(m.id) {
|
||||
TurnPriority::Protected => app.cs.signal_protected_turn,
|
||||
TurnPriority::Yield => app.cs.signal_permitted_turn.alpha(1.0),
|
||||
TurnPriority::Banned => app.cs.signal_banned_turn,
|
||||
};
|
||||
batch.push(arrow_color, m.arrow.clone());
|
||||
}
|
||||
}
|
||||
TrafficSignalStyle::IndividualTurnArrows => {
|
||||
for turn in app.primary.map.get_turns_in_intersection(i) {
|
||||
if turn.between_sidewalks() {
|
||||
|
Loading…
Reference in New Issue
Block a user