diff --git a/Cargo.lock b/Cargo.lock index ffd10fdf2e..b6b0cefcda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,11 +351,10 @@ dependencies = [ [[package]] name = "built" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96f9cdd34d6eb553f9ea20e5bf84abb7b13c729f113fc1d8e49dc00ad9fa8738" +checksum = "38d17f4d6e4dc36d1a02fbedc2753a096848e7c1b0772f7654eab8e2c927dd53" dependencies = [ - "cargo-lock", "chrono", ] @@ -427,18 +426,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "cargo-lock" -version = "8.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996" -dependencies = [ - "semver 1.0.3", - "serde", - "toml", - "url", -] - [[package]] name = "cc" version = "1.0.73" @@ -4201,9 +4188,6 @@ name = "semver" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f3aac57ee7f3272d8395c6e4f502f434f0e289fcd62876f70daa008c20dcabe" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" diff --git a/Cargo.toml b/Cargo.toml index 94c6073338..b369f82841 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ [workspace] +resolver = "2" + members = [ "abstio", "abstutil", diff --git a/apps/ltn/src/render/mod.rs b/apps/ltn/src/render/mod.rs index 1c5a9a22ce..c79a353483 100644 --- a/apps/ltn/src/render/mod.rs +++ b/apps/ltn/src/render/mod.rs @@ -5,7 +5,7 @@ mod filters; use std::collections::HashMap; use geom::{Angle, Distance, Pt2D}; -use map_model::{AmenityType, ExtraPOIType, FilterType, Map, RestrictionType, Road, TurnType, RoadID}; +use map_model::{AmenityType, ExtraPOIType, FilterType, Map, RestrictionType, Road, TurnType}; use widgetry::mapspace::DrawCustomUnzoomedShapes; use widgetry::{Color, Drawable, EventCtx, GeomBatch, GfxCtx, Line, RewriteColor, Text}; @@ -79,7 +79,6 @@ pub fn render_bus_routes(ctx: &EventCtx, map: &Map) -> Drawable { ctx.upload(batch) } - pub fn render_turn_restrictions(ctx: &EventCtx, map: &Map) -> Drawable { let mut batch = GeomBatch::new(); for r1 in map.all_roads() { @@ -87,17 +86,15 @@ pub fn render_turn_restrictions(ctx: &EventCtx, map: &Map) -> Drawable { // allowed / banned in practice? // Count the number of turn restrictions at each end of the road - let mut icon_counter = HashMap::from([ - (r1.dst_i, 1), - (r1.src_i, 1), - ]); + let mut icon_counter = HashMap::from([(r1.dst_i, 1), (r1.src_i, 1)]); for (restriction, r2) in &r1.turn_restrictions { // TODO "Invert" OnlyAllowTurns so we can just draw banned things if *restriction == RestrictionType::BanTurns { - let (t_type, sign_pt, r1_angle, i) = map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); + let (t_type, sign_pt, r1_angle, i) = + map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); // add to the counter - icon_counter.entry(i).and_modify(|n| *n+=1); + icon_counter.entry(i).and_modify(|n| *n += 1); batch.append(draw_turn_restriction_icon( ctx, t_type, sign_pt, r1, r1_angle, )); @@ -105,8 +102,9 @@ pub fn render_turn_restrictions(ctx: &EventCtx, map: &Map) -> Drawable { } for (_via, r2) in &r1.complicated_turn_restrictions { // TODO Show the 'via'? Or just draw the entire shape? - let (t_type, sign_pt, r1_angle, i) = map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); - icon_counter.entry(i).and_modify(|n| *n+=1); + let (t_type, sign_pt, r1_angle, i) = + map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); + icon_counter.entry(i).and_modify(|n| *n += 1); batch.append(draw_turn_restriction_icon( ctx, t_type, sign_pt, r1, r1_angle, )); diff --git a/map_gui/Cargo.toml b/map_gui/Cargo.toml index c7216826f2..e9c82231e0 100644 --- a/map_gui/Cargo.toml +++ b/map_gui/Cargo.toml @@ -14,7 +14,7 @@ release_s3 = [] abstio = { path = "../abstio" } abstutil = { path = "../abstutil" } anyhow = { workspace = true } -built = { version = "0.6.0", optional = true, features=["chrono"] } +built = { version = "0.7.1", optional = true, features=["chrono"] } chrono = "0.4.24" colorous = { workspace = true } contour = { workspace = true } @@ -39,4 +39,4 @@ widgetry = { path = "../widgetry" } fs-err = { workspace = true } [build-dependencies] -built = "0.6.0" +built = { version = "0.7.1", features=["chrono"] } diff --git a/map_model/src/map.rs b/map_model/src/map.rs index 71366db028..be6751274c 100644 --- a/map_model/src/map.rs +++ b/map_model/src/map.rs @@ -1139,13 +1139,15 @@ impl Map { ideal_dist_from_intersection = 0.3 * r1.center_pts.length(); } } - + // Adjust according to which end of the road we've measuring from - let dist_from_intersection = if r1.src_i == i { ideal_dist_from_intersection } else { r1.center_pts.length() - ideal_dist_from_intersection }; + let dist_from_intersection = if r1.src_i == i { + ideal_dist_from_intersection + } else { + r1.center_pts.length() - ideal_dist_from_intersection + }; - let (sign_pt, mut r1_angle) = r1 - .center_pts - .must_dist_along(dist_from_intersection); + let (sign_pt, mut r1_angle) = r1.center_pts.must_dist_along(dist_from_intersection); // Correct the angle, based on whether the vector direction is towards or away from the intersection // TODO what is the standard way of describing the vector direction (rather than the traffic direction) for roads? diff --git a/tests/src/main.rs b/tests/src/main.rs index 5680073c2b..9fdbde3d68 100644 --- a/tests/src/main.rs +++ b/tests/src/main.rs @@ -1,6 +1,6 @@ //! Integration tests -use std::{io::Write, collections::HashMap}; +use std::{collections::HashMap, io::Write}; use anyhow::{bail, Result}; use fs_err::File; @@ -113,14 +113,11 @@ fn all_turn_info_as_string(map: &Map) -> String { s.push_str("\n------------\nRestrictions:\n------------\n"); for r1 in map.all_roads() { - - let icon_counter = HashMap::from([ - (r1.dst_i, 1), - (r1.src_i, 1), - ]); + let icon_counter = HashMap::from([(r1.dst_i, 1), (r1.src_i, 1)]); for (restriction, r2) in &r1.turn_restrictions { - let (t_type, sign_pt, _, i_id) = map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); + let (t_type, sign_pt, _, i_id) = + map.get_ban_turn_info(r1, map.get_r(*r2), &icon_counter); let i = map.get_i(i_id); s.push_str(&format!( "Turn from {} into {}, at intersection {:?} is a {:?}, type {:?}, location {}\n",