diff --git a/backend/src/heatmap.rs b/backend/src/heatmap.rs index 115dd27..da029b8 100644 --- a/backend/src/heatmap.rs +++ b/backend/src/heatmap.rs @@ -1,9 +1,5 @@ -use std::collections::HashSet; - use geo::{Coord, Densify, Line, LineString}; use geojson::FeatureCollection; -use graph::IntersectionID; -use rstar::{primitives::GeomWithData, RTree}; use crate::{MapModel, RoadKind}; @@ -24,42 +20,6 @@ pub fn along_severances(map: &MapModel) -> FeatureCollection { calculate(map, requests) } -// For every intersection involving a footway, look for any other nearby intersection and see how -// hard it is to walk there. -#[allow(unused)] -pub fn nearby_footway_intersections(map: &MapModel, dist_meters: f64) -> FeatureCollection { - // Look for intersections we want to connect - let mut footway_intersections = HashSet::new(); - for r in &map.graph.roads { - if map.road_kinds[r.id.0] == Some(RoadKind::Footway) { - footway_intersections.insert(r.src_i); - footway_intersections.insert(r.dst_i); - } - } - - // Make an rtree - let mut points: Vec> = Vec::new(); - for i in &footway_intersections { - points.push(GeomWithData::new( - map.graph.intersections[i.0].point.into(), - *i, - )); - } - let rtree = RTree::bulk_load(points); - - // For every intersection, try to go to every nearby intersection - let mut requests = Vec::new(); - for i1 in &footway_intersections { - let i1_pt: Coord = map.graph.intersections[i1.0].point.into(); - for i2 in rtree.locate_within_distance(i1_pt.into(), dist_meters) { - // TODO Skip trivial things connected by a road - let i2_pt = map.graph.intersections[i2.data.0].point.into(); - requests.push((i1_pt, i2_pt)); - } - } - calculate(map, requests) -} - fn calculate(map: &MapModel, requests: Vec<(Coord, Coord)>) -> FeatureCollection { let mut samples = Vec::new(); let mut max_score = 0.0_f64; diff --git a/backend/src/lib.rs b/backend/src/lib.rs index e9d3aa4..13bc1d8 100644 --- a/backend/src/lib.rs +++ b/backend/src/lib.rs @@ -111,8 +111,6 @@ impl MapModel { #[wasm_bindgen(js_name = makeHeatmap)] pub fn make_heatmap(&self) -> Result { let samples = heatmap::along_severances(self); - // TODO unit here is weird or wrong or something - //let samples = heatmap::nearby_footway_intersections(self, 500.0); let out = serde_json::to_string(&samples).map_err(err_to_js)?; Ok(out) }