-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prioritize neighborhood by SIMD (UI only) (#152)
* Expose "neighbourhood" boundary to rust. Previously we dealt with these as "opaque" GeoJSON Features, but for the prioritization work, we're going to be working directly with these entities in rust, so it makes sense to have a 1st class rust representation, rather than going through GeoJSON. The GeoJSON representation is now only used for serialization, and relegated to the js/rust boundary. * Show area on hover. * Mock SIMD output * WIP: new binary to gen simd data * WIP: show prioritization in left column Also zhuzh the project list a bit TODO -[ ] Only cnt -[/] Color map accordingly -[x] simd is colored -[ ] area is colored strangely -[x] info hierarchy of neighborhood list * Highlight list item when hovering map. Unfortunately, the reverse seems tricky: highlighting the map when hovering on the list: I had a go at using `<JoinedData>` to associate a highlighted feature-state. Doing so requires joining the source layer by layer id and thus specifying a specific layer id for the GeoJSON. But then the JoinedData calls some maplibre code that complained: > GeoJSON sources cannot have a sourceLayer parameter. * wip: url params * extract selection widget * Prioritize on autogen * better name? * unpatch now that PR is merged * minimize diff, clarify code placement * revert failed ui experiment * Only prioritize in CNT I'm still showing "area" when hovering over neighbourhoods in the PickeNeighbourhoodMode and AutoBoundariesMode, even in non-CNT, cuz why not? * more exciting font icons
- Loading branch information
1 parent
e6133f8
commit 2846e97
Showing
24 changed files
with
602 additions
and
162 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use geo::{Area, Polygon}; | ||
use nanorand::{RandomGen, WyRand}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] | ||
pub struct BoundaryStats { | ||
pub area_km2: f64, | ||
pub simd: f64, | ||
} | ||
|
||
impl BoundaryStats { | ||
pub fn new(polygon: &Polygon) -> Self { | ||
// Convert from m^2 to km^2. Use unsigned area to ignore polygon orientation. | ||
let area_km2 = polygon.unsigned_area() / 1_000_000.0; | ||
// TODO: SIMD | ||
let mut rng = WyRand::new_seed((area_km2 * 1000000.0) as u64); | ||
let simd = f64::random(&mut rng) * 100.0; | ||
Self { area_km2, simd } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.