diff --git a/convert_osm/src/osm.rs b/convert_osm/src/osm.rs index ea8a2577cf..b636bf54ed 100644 --- a/convert_osm/src/osm.rs +++ b/convert_osm/src/osm.rs @@ -78,12 +78,6 @@ pub fn osm_to_raw_roads(osm_path: &str) -> raw_data::Map { }); } else if let Some(at) = get_area_type(&way.tags) { // TODO need to handle inner/outer relations from OSM - // TODO waterway with non-closed points is a polyline creek... draw with some amount of - // thickness - if pts.len() < 3 || pts[0] != *pts.last().unwrap() { - println!("Skipping area {:?} with weird points", way.tags); - continue; - } map.areas.push(raw_data::Area { area_type: at, osm_way_id: way.id, diff --git a/editor/src/plugins/hider.rs b/editor/src/plugins/hider.rs index 73b01cedab..53c62a8ee8 100644 --- a/editor/src/plugins/hider.rs +++ b/editor/src/plugins/hider.rs @@ -25,16 +25,14 @@ impl Hider { } let item = match selected { - // TODO why not be able to hide anything? - Some(id) => match id { - ID::Intersection(_) => id.clone(), - ID::Lane(_) => id.clone(), - ID::Building(_) => id.clone(), - ID::ExtraShape(_) => id.clone(), - _ => { - return false; - } - }, + // No real use case for hiding moving stuff + Some(ID::Car(_)) => { + return false; + } + Some(ID::Pedestrian(_)) => { + return false; + } + Some(id) => id.clone(), _ => { return false; } diff --git a/editor/src/render/area.rs b/editor/src/render/area.rs index 218a4897f9..f45437d431 100644 --- a/editor/src/render/area.rs +++ b/editor/src/render/area.rs @@ -17,7 +17,7 @@ impl DrawArea { pub fn new(area: &Area) -> DrawArea { DrawArea { id: area.id, - fill_polygon: Polygon::new(&area.points), + fill_polygon: area.get_polygon(), color: match area.area_type { AreaType::Park => Colors::ParkArea, AreaType::Swamp => Colors::SwampArea, diff --git a/import.sh b/import.sh index b2fd85c432..aae159ccd2 100755 --- a/import.sh +++ b/import.sh @@ -31,7 +31,7 @@ fi COMMON="--elevation=$ELEVATION --traffic_signals=$TRAFFIC_SIGNALS --parcels=../data/seattle_parcels.abst --gtfs=$GTFS" cd convert_osm -time cargo run -- --osm=$SMALL_OSM $COMMON --output=../data/small.abst -#time cargo run --release -- --osm=$MEDIUM_OSM $COMMON --output=../data/medium.abst -#time cargo run --release -- --osm=$LARGE_OSM $COMMON --output=../data/large.abst -#time cargo run --release -- --osm=$HUGE_OSM $COMMON --output=../data/huge.abst +time cargo run --release -- --osm=$SMALL_OSM $COMMON --output=../data/small.abst +time cargo run --release -- --osm=$MEDIUM_OSM $COMMON --output=../data/medium.abst +time cargo run --release -- --osm=$LARGE_OSM $COMMON --output=../data/large.abst +time cargo run --release -- --osm=$HUGE_OSM $COMMON --output=../data/huge.abst diff --git a/map_model/src/area.rs b/map_model/src/area.rs index f73ae7c16f..d4f44193a3 100644 --- a/map_model/src/area.rs +++ b/map_model/src/area.rs @@ -1,5 +1,6 @@ use abstutil; -use geom::{PolyLine, Pt2D}; +use geom::{PolyLine, Polygon, Pt2D}; +use geometry::LANE_THICKNESS; use std::collections::BTreeMap; use std::fmt; @@ -24,6 +25,7 @@ pub enum AreaType { pub struct Area { pub id: AreaID, pub area_type: AreaType, + // Might be a closed loop or not -- waterways can be linear. pub points: Vec, pub osm_tags: BTreeMap, pub osm_way_id: i64, @@ -40,4 +42,11 @@ impl Area { println!("{}", abstutil::to_json(self)); println!("{}", PolyLine::new(self.points.clone())); } + + pub fn get_polygon(&self) -> Polygon { + if self.points[0] == *self.points.last().unwrap() { + return Polygon::new(&self.points); + } + PolyLine::new(self.points.clone()).make_polygons_blindly(LANE_THICKNESS) + } }