mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
displaying names for more roads
This commit is contained in:
parent
71be19163d
commit
cca6f4b5ec
@ -5,6 +5,7 @@
|
||||
- need intersection merging before this is understandable
|
||||
- close interior neighborhoods to most cars (except for src/dst), see how traffic restricted to arterials would work
|
||||
- puzzle: with only X miles of retained road, where would you leave them? what roads would go away?
|
||||
- parking garages on the edges of neighborhoods?
|
||||
- create a bike network with minimal hills, dedicated roads, minimal crossings
|
||||
|
||||
- easter eggs
|
||||
|
@ -126,6 +126,12 @@ pub fn make_half_map(
|
||||
bus_stops: Vec::new(),
|
||||
});
|
||||
}
|
||||
if road.get_name() == "???" {
|
||||
timer.warn(format!(
|
||||
"{} has no name. Tags: {:?}",
|
||||
road.id, road.osm_tags
|
||||
));
|
||||
}
|
||||
half_map.roads.push(road);
|
||||
}
|
||||
|
||||
|
@ -333,9 +333,29 @@ impl Road {
|
||||
}
|
||||
|
||||
pub fn get_name(&self) -> String {
|
||||
self.osm_tags
|
||||
.get("name")
|
||||
.unwrap_or(&"???".to_string())
|
||||
.to_string()
|
||||
if let Some(name) = self.osm_tags.get("name") {
|
||||
return name.to_string();
|
||||
}
|
||||
if let Some(name) = self.osm_tags.get("ref") {
|
||||
return name.to_string();
|
||||
}
|
||||
if self
|
||||
.osm_tags
|
||||
.get("highway")
|
||||
.map(|hwy| hwy.ends_with("_link"))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if let Some(name) = self.osm_tags.get("destination:street") {
|
||||
return format!("Exit for {}", name);
|
||||
}
|
||||
if let Some(name) = self.osm_tags.get("destination:ref") {
|
||||
return format!("Exit for {}", name);
|
||||
}
|
||||
if let Some(name) = self.osm_tags.get("destination") {
|
||||
return format!("Exit for {}", name);
|
||||
}
|
||||
// Sometimes 'directions' is filled out, but incorrectly...
|
||||
}
|
||||
"???".to_string()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user