csr rendering v2
This commit is contained in:
parent
c2f7e7816e
commit
61df1e725c
7 changed files with 81 additions and 23 deletions
38
.idea/workspace.xml
generated
38
.idea/workspace.xml
generated
|
@ -8,16 +8,13 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="2d855648-9644-469a-afa2-59beb52bb1d6" name="Changes" comment="mostly functional v2 rendering">
|
||||
<change afterPath="$PROJECT_DIR$/client/src/lib/map/fragment_old.glsl" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/client/src/lib/vincenty.ts" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/crates/pal/src/wasm.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/client/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/lib/Map.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/lib/Map.svelte" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/lib/map/fragment.glsl" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/lib/map/fragment.glsl" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/client/src/lib/map/vertex.glsl" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/lib/map/vertex.glsl" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crates/interchange/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/crates/interchange/Cargo.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crates/interchange/src/ar2.rs" beforeDir="false" afterPath="$PROJECT_DIR$/crates/interchange/src/ar2.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crates/tiler/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/crates/tiler/Cargo.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crates/pal/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/crates/pal/Cargo.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crates/pal/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/crates/pal/src/lib.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -25,7 +22,14 @@
|
|||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DarkyenusTimeTracker">
|
||||
<option name="totalTimeSeconds" value="9035" />
|
||||
<option name="totalTimeSeconds" value="11086" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Rust File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
|
@ -146,7 +150,23 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1748386111953</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<task id="LOCAL-00002" summary="mostly functional v2 rendering">
|
||||
<option name="closed" value="true" />
|
||||
<created>1748662716741</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1748662716741</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="mostly functional v2 rendering">
|
||||
<option name="closed" value="true" />
|
||||
<created>1748662734805</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1748662734805</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -1759,6 +1759,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2103,6 +2105,7 @@ dependencies = [
|
|||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.4",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2143,6 +2146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom 0.2.15",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2505,6 +2509,17 @@ dependencies = [
|
|||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-wasm-bindgen"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.219"
|
||||
|
@ -3717,7 +3732,10 @@ name = "wxbox-pal"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ordered-float 4.6.0",
|
||||
"serde",
|
||||
"serde-wasm-bindgen",
|
||||
"thiserror 1.0.69",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"format": "prettier --write .",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"protobuf:update": "protoc --ts_out src/lib/generated_interop --proto_path ../crates/interchange/src/ ../crates/interchange/src/*.proto"
|
||||
"update:protobuf": "protoc --ts_out src/lib/generated_interop --proto_path ../crates/interchange/src/ ../crates/interchange/src/*.proto",
|
||||
"update:wxbox-pal": "cd ../crates/pal && wasm-pack build --target web --features wasm && rm -rf ../../client/src/lib/map/pal && mv pkg ../../client/src/lib/map/pal"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.5",
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
|
||||
if (radial.product && radial.product.data && radial.product.data.data) {
|
||||
const angle_a = radial.azimuthAngleDegrees;
|
||||
const angle_b = angle_a + 2*radial.azimuthSpacingDegrees;
|
||||
const angle_b = angle_a + radial.azimuthSpacingDegrees * 1.2;
|
||||
|
||||
const start_range = radial.product.data.startRange; // m
|
||||
const sample_interval = radial.product.data.sampleInterval; // m
|
||||
|
@ -222,17 +222,16 @@
|
|||
const range = sample_interval * number_of_samples + start_range; // m
|
||||
// add an extra sample for good measure
|
||||
const padded_range = range + sample_interval; // m
|
||||
// calculate the two points
|
||||
const [pointALat, pointALong] = forwardGeodesic(degToRad(angle_a), degToRad(lat), degToRad(long), padded_range);
|
||||
const pointA = maplibregl.MercatorCoordinate.fromLngLat({
|
||||
lng: radToDeg(pointALong),
|
||||
lat: radToDeg(pointALat)
|
||||
});
|
||||
const [pointBLat, pointBLong] = forwardGeodesic(degToRad(angle_b), degToRad(lat), degToRad(long), padded_range);
|
||||
const pointB = maplibregl.MercatorCoordinate.fromLngLat({
|
||||
lng: radToDeg(pointBLong),
|
||||
lat: radToDeg(pointBLat)
|
||||
});
|
||||
|
||||
const in_weird_mercator_units = padded_range / radarCoordinate.meterInMercatorCoordinateUnits();
|
||||
const pointAX = radarCoordinate.x + in_weird_mercator_units * Math.sin(degToRad(-angle_a + 180));
|
||||
const pointAY = radarCoordinate.y + in_weird_mercator_units * Math.cos(degToRad(-angle_a + 180));
|
||||
const pointA = new maplibregl.MercatorCoordinate(pointAX, pointAY, 0);
|
||||
|
||||
const pointBX = radarCoordinate.x + in_weird_mercator_units * Math.sin(degToRad(-angle_b + 180));
|
||||
const pointBY = radarCoordinate.y + in_weird_mercator_units * Math.cos(degToRad(-angle_b + 180));
|
||||
const pointB = new maplibregl.MercatorCoordinate(pointBX, pointBY, 0);
|
||||
|
||||
vertexData.push(radarCoordinate.x);
|
||||
vertexData.push(radarCoordinate.y);
|
||||
vertexData.push(pointA.x);
|
||||
|
|
|
@ -3,6 +3,17 @@ name = "wxbox-pal"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["rlib", "cdylib"]
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1"
|
||||
ordered-float = "4"
|
||||
ordered-float = "4"
|
||||
|
||||
wasm-bindgen = { version = "0.2", optional = true }
|
||||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
serde-wasm-bindgen = { version = "0.6", optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
wasm = ["dep:wasm-bindgen", "dep:serde", "dep:serde-wasm-bindgen", "ordered-float/serde"]
|
|
@ -1,9 +1,11 @@
|
|||
pub mod default_palettes;
|
||||
pub mod parser;
|
||||
mod wasm;
|
||||
|
||||
pub use ordered_float::OrderedFloat;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "wasm", derive(::serde::Serialize))]
|
||||
pub struct Color {
|
||||
pub red: u8,
|
||||
pub green: u8,
|
||||
|
|
7
crates/pal/src/wasm.rs
Normal file
7
crates/pal/src/wasm.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use wasm_bindgen::prelude::*;
|
||||
use crate::parser::parse;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_palette(pal_str: &str) -> JsValue {
|
||||
serde_wasm_bindgen::to_value(&parse(pal_str).ok()).unwrap()
|
||||
}
|
Loading…
Add table
Reference in a new issue