mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
fix a bug where a crosswalk and road turn group incorrectly conflicted.
was causing a crash trying to edit traffic signals downtown
This commit is contained in:
parent
2e374ef684
commit
6d9695fb59
@ -209,9 +209,9 @@ d02d0d103f7b00672a5f1145c5169d8c data/system/fonts/Overpass-Bold.ttf
|
|||||||
2a13391023ce8787887331530cac35a7 data/system/fonts/BungeeInline-Regular.ttf
|
2a13391023ce8787887331530cac35a7 data/system/fonts/BungeeInline-Regular.ttf
|
||||||
17a1468e62195d0688a6f3bd12da2e92 data/system/fonts/Overpass-SemiBold.ttf
|
17a1468e62195d0688a6f3bd12da2e92 data/system/fonts/Overpass-SemiBold.ttf
|
||||||
259d4afad7edca07e727ef80f5bbce07 data/system/fonts/Bungee-Regular.ttf
|
259d4afad7edca07e727ef80f5bbce07 data/system/fonts/Bungee-Regular.ttf
|
||||||
c97768b6b014d1a9fb49f4560915ab7d data/system/maps/huge_seattle.bin
|
60752b2c8b73c0fb567930407d2da7a5 data/system/maps/huge_seattle.bin
|
||||||
08d407ab1b9688eee0b83cd65e698560 data/system/maps/ballard.bin
|
08d407ab1b9688eee0b83cd65e698560 data/system/maps/ballard.bin
|
||||||
e3634cc9018e4c30cba8a64eaec3c50d data/system/maps/downtown.bin
|
19ae5adf392679c4264069bbca23710c data/system/maps/downtown.bin
|
||||||
511b8cd22bf463d5d26e1e23d314b376 data/system/maps/caphill.bin
|
511b8cd22bf463d5d26e1e23d314b376 data/system/maps/caphill.bin
|
||||||
30590c4756973ceb5f2ae0142c06b1b0 data/system/maps/montlake.bin
|
30590c4756973ceb5f2ae0142c06b1b0 data/system/maps/montlake.bin
|
||||||
750b8e4f996f12d4105a771e26e83192 data/system/maps/intl_district.bin
|
750b8e4f996f12d4105a771e26e83192 data/system/maps/intl_district.bin
|
||||||
|
@ -117,6 +117,7 @@ struct Entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Composite {
|
fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Composite {
|
||||||
|
// Gather raw data
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
let sim = &app.primary.sim;
|
let sim = &app.primary.sim;
|
||||||
for (_, id, maybe_mode, duration_after) in &sim.get_analytics().finished_trips {
|
for (_, id, maybe_mode, duration_after) in &sim.get_analytics().finished_trips {
|
||||||
@ -144,6 +145,7 @@ fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Compos
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort
|
||||||
match sort {
|
match sort {
|
||||||
SortBy::Departure => data.sort_by_key(|x| x.departure),
|
SortBy::Departure => data.sort_by_key(|x| x.departure),
|
||||||
SortBy::Duration => data.sort_by_key(|x| x.duration_after),
|
SortBy::Duration => data.sort_by_key(|x| x.duration_after),
|
||||||
@ -157,8 +159,8 @@ fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Compos
|
|||||||
data.reverse();
|
data.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render data
|
||||||
let mut rows = Vec::new();
|
let mut rows = Vec::new();
|
||||||
|
|
||||||
for x in data.into_iter().take(30) {
|
for x in data.into_iter().take(30) {
|
||||||
let mut row = vec![
|
let mut row = vec![
|
||||||
Text::from(Line(x.trip.0.to_string())).render_ctx(ctx),
|
Text::from(Line(x.trip.0.to_string())).render_ctx(ctx),
|
||||||
@ -218,35 +220,53 @@ fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Compos
|
|||||||
headers.push(Line("Time spent waiting").draw(ctx));
|
headers.push(Line("Time spent waiting").draw(ctx));
|
||||||
headers.push(btn(SortBy::PercentWaiting, "Percent waiting"));
|
headers.push(btn(SortBy::PercentWaiting, "Percent waiting"));
|
||||||
|
|
||||||
|
let mut col = vec![DashTab::TripTable.picker(ctx)];
|
||||||
|
col.extend(make_table(
|
||||||
|
ctx,
|
||||||
|
app,
|
||||||
|
headers,
|
||||||
|
rows,
|
||||||
|
0.88 * ctx.canvas.window_width,
|
||||||
|
));
|
||||||
|
|
||||||
|
Composite::new(Widget::col(col).bg(app.cs.panel_bg).padding(10))
|
||||||
|
.max_size_percent(90, 90)
|
||||||
|
.build(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Figure out a nicer API to construct generic sortable tables.
|
||||||
|
fn make_table(
|
||||||
|
ctx: &mut EventCtx,
|
||||||
|
app: &App,
|
||||||
|
headers: Vec<Widget>,
|
||||||
|
rows: Vec<(String, Vec<GeomBatch>)>,
|
||||||
|
total_width: f64,
|
||||||
|
) -> Vec<Widget> {
|
||||||
let mut width_per_col: Vec<f64> = headers.iter().map(|w| w.get_width_for_forcing()).collect();
|
let mut width_per_col: Vec<f64> = headers.iter().map(|w| w.get_width_for_forcing()).collect();
|
||||||
for (_, row) in &rows {
|
for (_, row) in &rows {
|
||||||
for (col, width) in row.iter().zip(width_per_col.iter_mut()) {
|
for (col, width) in row.iter().zip(width_per_col.iter_mut()) {
|
||||||
*width = width.max(col.get_dims().width);
|
*width = width.max(col.get_dims().width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let total_width = 0.88 * ctx.canvas.window_width;
|
|
||||||
let extra_margin = ((total_width - width_per_col.clone().into_iter().sum::<f64>())
|
let extra_margin = ((total_width - width_per_col.clone().into_iter().sum::<f64>())
|
||||||
/ (width_per_col.len() - 1) as f64)
|
/ (width_per_col.len() - 1) as f64)
|
||||||
.max(0.0);
|
.max(0.0);
|
||||||
|
|
||||||
let mut col = vec![
|
let mut col = vec![Widget::row(
|
||||||
DashTab::TripTable.picker(ctx),
|
headers
|
||||||
Widget::row(
|
.into_iter()
|
||||||
headers
|
.enumerate()
|
||||||
.into_iter()
|
.map(|(idx, w)| {
|
||||||
.enumerate()
|
let margin = extra_margin + width_per_col[idx] - w.get_width_for_forcing();
|
||||||
.map(|(idx, w)| {
|
if idx == width_per_col.len() - 1 {
|
||||||
let margin = extra_margin + width_per_col[idx] - w.get_width_for_forcing();
|
w.margin_right((margin - extra_margin) as usize)
|
||||||
if idx == width_per_col.len() - 1 {
|
} else {
|
||||||
w.margin_right((margin - extra_margin) as usize)
|
w.margin_right(margin as usize)
|
||||||
} else {
|
}
|
||||||
w.margin_right(margin as usize)
|
})
|
||||||
}
|
.collect(),
|
||||||
})
|
)
|
||||||
.collect(),
|
.bg(app.cs.section_bg)];
|
||||||
)
|
|
||||||
.bg(app.cs.section_bg),
|
|
||||||
];
|
|
||||||
|
|
||||||
for (label, row) in rows {
|
for (label, row) in rows {
|
||||||
let mut batch = GeomBatch::new();
|
let mut batch = GeomBatch::new();
|
||||||
@ -269,7 +289,5 @@ fn make(ctx: &mut EventCtx, app: &App, sort: SortBy, descending: bool) -> Compos
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Composite::new(Widget::col(col).bg(app.cs.panel_bg).padding(10))
|
col
|
||||||
.max_size_percent(90, 90)
|
|
||||||
.build(ctx)
|
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,10 @@ impl TurnGroup {
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if self.id.to == other.id.to {
|
if self.id.to == other.id.to
|
||||||
|
&& self.turn_type != TurnType::Crosswalk
|
||||||
|
&& other.turn_type != TurnType::Crosswalk
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
self.geom.intersection(&other.geom).is_some()
|
self.geom.intersection(&other.geom).is_some()
|
||||||
|
Loading…
Reference in New Issue
Block a user