disabled: import and render pedestrian traffic islands. include them in

search results.
This commit is contained in:
Dustin Carlino 2019-11-14 10:54:11 -08:00
parent 53bbf4e272
commit 98ef31fa24
5 changed files with 32 additions and 31 deletions

View File

@ -329,6 +329,17 @@ fn get_area_type(tags: &BTreeMap<String, String>) -> Option<AreaType> {
if tags.get("natural") == Some(&"water".to_string()) {
return Some(AreaType::Water);
}
// TODO These just cover up poorly inferred road geometry now. Figure out how to use these.
if false {
if tags.get("traffic_calming") == Some(&"island".to_string()) {
return Some(AreaType::PedestrianIsland);
}
if tags.get("highway") == Some(&"pedestrian".to_string())
&& tags.get("area") == Some(&"yes".to_string())
{
return Some(AreaType::PedestrianIsland);
}
}
None
}

View File

@ -336,6 +336,15 @@ fn search_osm(wiz: &mut Wizard, ctx: &mut EventCtx, ui: &mut UI) -> Option<Trans
batch.push(color, b.polygon.clone());
}
}
for a in map.all_areas() {
if a.osm_tags
.iter()
.any(|(k, v)| format!("{} = {}", k, v).contains(&filter))
{
ids.insert(ID::Area(a.id));
batch.push(color, a.polygon.clone());
}
}
let results = SearchResults {
query: filter,

View File

@ -1,6 +1,6 @@
use crate::helpers::ID;
use crate::render::{DrawCtx, DrawOptions, Renderable};
use ezgui::{EventCtx, GeomBatch, GfxCtx};
use ezgui::{Color, EventCtx, GeomBatch, GfxCtx};
use geom::Polygon;
use map_model::{Area, AreaID, AreaType, Map};
@ -9,26 +9,13 @@ pub struct DrawArea {
}
impl DrawArea {
pub fn new(
area: &Area,
ctx: &EventCtx,
all_park_areas: &mut GeomBatch,
all_water_areas: &mut GeomBatch,
) -> DrawArea {
match area.area_type {
AreaType::Park => {
all_park_areas.push(
ctx.canvas.texture("assets/grass_texture.png"),
area.polygon.clone(),
);
}
AreaType::Water => {
all_water_areas.push(
ctx.canvas.texture("assets/water_texture.png"),
area.polygon.clone(),
);
}
}
pub fn new(area: &Area, ctx: &EventCtx, all_areas: &mut GeomBatch) -> DrawArea {
let color = match area.area_type {
AreaType::Park => ctx.canvas.texture("assets/grass_texture.png"),
AreaType::Water => ctx.canvas.texture("assets/water_texture.png"),
AreaType::PedestrianIsland => Color::grey(0.3),
};
all_areas.push(color, area.polygon.clone());
DrawArea { id: area.id }
}
}

View File

@ -209,21 +209,14 @@ impl DrawMap {
}
let mut areas: Vec<DrawArea> = Vec::new();
let mut all_park_areas = GeomBatch::new();
let mut all_water_areas = GeomBatch::new();
let mut all_areas = GeomBatch::new();
timer.start_iter("make DrawAreas", map.all_areas().len());
for a in map.all_areas() {
timer.next();
areas.push(DrawArea::new(
a,
ctx,
&mut all_park_areas,
&mut all_water_areas,
));
areas.push(DrawArea::new(a, ctx, &mut all_areas));
}
timer.start("upload all areas");
all_park_areas.append(all_water_areas);
let draw_all_areas = ctx.prerender.upload(all_park_areas);
let draw_all_areas = ctx.prerender.upload(all_areas);
timer.stop("upload all areas");
let boundary_polygon = ctx.prerender.upload_borrowed(vec![(

View File

@ -18,6 +18,7 @@ impl fmt::Display for AreaID {
pub enum AreaType {
Park,
Water,
PedestrianIsland,
}
#[derive(Serialize, Deserialize, Debug)]