mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 17:34:58 +03:00
really hacky start to classifying driving lanes as parking blackholes.
reveals some turn restriction data issues...
This commit is contained in:
parent
f9376cddcb
commit
bffd1ebe08
@ -51,6 +51,12 @@ pub struct Lane {
|
||||
// Sorted by distance of the front path
|
||||
pub building_paths: Vec<BuildingID>,
|
||||
pub bus_stops: Vec<BusStopID>,
|
||||
|
||||
// For Driving lanes, is some arbitrary parking lane reachable from this lane? If not, this
|
||||
// likely leads to a border. Cars trying to park near here should actually try to park
|
||||
// somewhere else.
|
||||
// TODO Precompute where the parking search should start.
|
||||
pub parking_blackhole: bool,
|
||||
}
|
||||
|
||||
impl Lane {
|
||||
|
@ -126,6 +126,7 @@ pub fn make_half_map(
|
||||
parent: road_id,
|
||||
building_paths: Vec::new(),
|
||||
bus_stops: Vec::new(),
|
||||
parking_blackhole: false,
|
||||
});
|
||||
}
|
||||
if road.get_name() == "???" {
|
||||
|
@ -8,7 +8,7 @@ use crate::{
|
||||
};
|
||||
use abstutil;
|
||||
use abstutil::{deserialize_btreemap, serialize_btreemap, Error, Timer};
|
||||
use geom::{Bounds, GPSBounds, Polygon, Pt2D};
|
||||
use geom::{Bounds, Distance, GPSBounds, Polygon, Pt2D};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque};
|
||||
use std::io;
|
||||
@ -178,6 +178,49 @@ impl Map {
|
||||
m.pathfinder = Some(pathfinder);
|
||||
timer.stop("setup rest of Pathfinder (walking with transit)");
|
||||
|
||||
{
|
||||
timer.start("find parking blackholes");
|
||||
// Pick an arbitrary parking lane to classify blackholes.
|
||||
// TODO Don't do this! Some strongly-connected component classification instead.
|
||||
let driving_goal = m.all_lanes().iter().find_map(|l| {
|
||||
if !l.is_parking() {
|
||||
return None;
|
||||
}
|
||||
m.get_parent(l.id).parking_to_driving(l.id)
|
||||
});
|
||||
timer.note(format!(
|
||||
"Using {:?} as the arbitrary driving_goal for parking_blackhole",
|
||||
driving_goal
|
||||
));
|
||||
|
||||
let mut blackholes = Vec::new();
|
||||
timer.start_iter("classify driving lanes", m.all_lanes().len());
|
||||
for l in m.all_lanes() {
|
||||
timer.next();
|
||||
if !l.is_driving() {
|
||||
continue;
|
||||
}
|
||||
if driving_goal
|
||||
.map(|to| {
|
||||
m.pathfind(PathRequest {
|
||||
start: Position::new(l.id, Distance::ZERO),
|
||||
end: Position::new(to, Distance::ZERO),
|
||||
can_use_bike_lanes: false,
|
||||
can_use_bus_lanes: false,
|
||||
})
|
||||
.is_none()
|
||||
})
|
||||
.unwrap_or(true)
|
||||
{
|
||||
blackholes.push(l.id);
|
||||
}
|
||||
}
|
||||
for l in blackholes {
|
||||
m.lanes[l.0].parking_blackhole = true;
|
||||
}
|
||||
timer.stop("find parking blackholes");
|
||||
}
|
||||
|
||||
timer.stop("finalize Map");
|
||||
m
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user