-
-
wxbox
- {status}
-
- data reload in {timeUntilReload}s
-
-
-
- {#if view === 'two' || view === 'four'}
-
- {/if}
-
- {#if view === 'four'}
-
-
-
-
- {/if}
-
-
-
-
diff --git a/wxbox-web/static/favicon.png b/wxbox-web/static/favicon.png
deleted file mode 100644
index 825b9e6..0000000
Binary files a/wxbox-web/static/favicon.png and /dev/null differ
diff --git a/wxbox-web/svelte.config.js b/wxbox-web/svelte.config.js
deleted file mode 100644
index e0a641e..0000000
--- a/wxbox-web/svelte.config.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import adapter from '@sveltejs/adapter-node';
-import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
-
-/** @type {import('@sveltejs/kit').Config} */
-const config = {
- // Consult https://svelte.dev/docs/kit/integrations
- // for more information about preprocessors
- preprocess: vitePreprocess(),
-
- kit: {
- // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
- // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
- // See https://svelte.dev/docs/kit/adapters for more information about adapters.
- adapter: adapter()
- }
-};
-
-export default config;
diff --git a/wxbox-web/tsconfig.json b/wxbox-web/tsconfig.json
deleted file mode 100644
index 0b2d886..0000000
--- a/wxbox-web/tsconfig.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "extends": "./.svelte-kit/tsconfig.json",
- "compilerOptions": {
- "allowJs": true,
- "checkJs": true,
- "esModuleInterop": true,
- "forceConsistentCasingInFileNames": true,
- "resolveJsonModule": true,
- "skipLibCheck": true,
- "sourceMap": true,
- "strict": true,
- "moduleResolution": "bundler"
- }
- // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
- // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
- //
- // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
- // from the referenced tsconfig.json - TypeScript does not merge them in
-}
diff --git a/wxbox-web/vite.config.ts b/wxbox-web/vite.config.ts
deleted file mode 100644
index bbf8c7d..0000000
--- a/wxbox-web/vite.config.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { sveltekit } from '@sveltejs/kit/vite';
-import { defineConfig } from 'vite';
-
-export default defineConfig({
- plugins: [sveltekit()]
-});
diff --git a/wxbox_client/Cargo.toml b/wxbox_client/Cargo.toml
new file mode 100644
index 0000000..86c8c28
--- /dev/null
+++ b/wxbox_client/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "wxbox_client"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+walkers = "0.32"
+eframe = "0.30"
+egui = "0.30"
+egui_extras = "0.30"
+wxbox_common = { path = "../wxbox_common" }
+serde_json = "1"
diff --git a/wxbox_client/src/lib.rs b/wxbox_client/src/lib.rs
new file mode 100644
index 0000000..f8abb8d
--- /dev/null
+++ b/wxbox_client/src/lib.rs
@@ -0,0 +1,96 @@
+use std::collections::HashMap;
+use std::env::var;
+use egui::{Align2, Frame, Window};
+use egui::Context;
+use walkers::{HttpOptions, HttpTiles, MapMemory, Position, TileId, Tiles};
+use walkers::sources::{Attribution, TileSource};
+use wxbox_common::TileRequestOptions;
+
+pub struct WxboxApp {
+ provider: HttpTiles,
+ map_memory: MapMemory
+}
+
+pub struct DynamicUrlSource {
+ pub url_query: String
+}
+impl DynamicUrlSource {
+ pub fn new_from(options: &TileRequestOptions) -> Self {
+ Self {
+ url_query: serde_json::to_string(options).unwrap()
+ }
+ }
+}
+impl TileSource for DynamicUrlSource {
+ fn tile_url(&self, tile_id: TileId) -> String {
+ format!(
+ "{}/{}/{}/{}.png?settings={}",
+ var("TILER_BASE_URL").unwrap(),
+ tile_id.zoom, tile_id.x, tile_id.y,
+ self.url_query
+ )
+ }
+
+ fn attribution(&self) -> Attribution {
+ Attribution {
+ text: "OpenStreetMap contributors, NOAA, wxbox",
+ url: "https://copyright.wxbox.e3t.cc",
+ logo_light: None,
+ logo_dark: None
+ }
+ }
+}
+
+
+impl WxboxApp {
+ pub fn new(ctx: Context) -> Self {
+ egui_extras::install_image_loaders(&ctx);
+
+ Self {
+ provider: HttpTiles::with_options(
+ DynamicUrlSource::new_from(&TileRequestOptions {
+ baselayer: "osm".to_string(),
+
+ data: "grib2/noaa_mrms_merged_composite_reflectivity_qc".to_string(),
+ data_transparency: 0.5,
+ }),
+ Default::default(),
+ ctx.clone()
+ ),
+ map_memory: MapMemory::default()
+ }
+ }
+}
+
+impl eframe::App for WxboxApp {
+ fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
+ let rimless = Frame {
+ fill: ctx.style().visuals.panel_fill,
+ ..Default::default()
+ };
+
+ egui::CentralPanel::default()
+ .frame(rimless)
+ .show(ctx, |ui| {
+ let position = Position::from_lat_lon(44.967243, -103.771556);
+
+ let tiles = &mut self.provider;
+ let attribution = tiles.attribution();
+
+ let map = walkers::Map::new(Some(tiles), &mut self.map_memory, position);
+
+ ui.add(map);
+
+ Window::new("Attribution")
+ .collapsible(false)
+ .resizable(false)
+ .title_bar(false)
+ .anchor(Align2::LEFT_TOP, [10.0, 10.0])
+ .show(ui.ctx(), |ui| {
+ ui.horizontal(|ui| {
+ ui.hyperlink_to(attribution.text, attribution.url);
+ })
+ })
+ });
+ }
+}
\ No newline at end of file
diff --git a/wxbox_client_native/Cargo.toml b/wxbox_client_native/Cargo.toml
new file mode 100644
index 0000000..b208c67
--- /dev/null
+++ b/wxbox_client_native/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "wxbox_client_native"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+wxbox_client = { path = "../wxbox_client" }
+eframe = "0.30"
+egui = "0.30"
+tracing-subscriber = "0.3"
diff --git a/wxbox_client_native/src/main.rs b/wxbox_client_native/src/main.rs
new file mode 100644
index 0000000..6724612
--- /dev/null
+++ b/wxbox_client_native/src/main.rs
@@ -0,0 +1,10 @@
+use wxbox_client::WxboxApp;
+
+fn main() -> Result<(), eframe::Error> {
+ tracing_subscriber::fmt::init();
+ eframe::run_native(
+ "wxbox",
+ Default::default(),
+ Box::new(|cc| Ok(Box::new(WxboxApp::new(cc.egui_ctx.clone()))))
+ )
+}
\ No newline at end of file
diff --git a/wxbox_client_wasm/Cargo.toml b/wxbox_client_wasm/Cargo.toml
new file mode 100644
index 0000000..79f5ea5
--- /dev/null
+++ b/wxbox_client_wasm/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "wxbox_client_wasm"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
diff --git a/wxbox_client_wasm/src/lib.rs b/wxbox_client_wasm/src/lib.rs
new file mode 100644
index 0000000..b93cf3f
--- /dev/null
+++ b/wxbox_client_wasm/src/lib.rs
@@ -0,0 +1,14 @@
+pub fn add(left: u64, right: u64) -> u64 {
+ left + right
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn it_works() {
+ let result = add(2, 2);
+ assert_eq!(result, 4);
+ }
+}
diff --git a/wxbox_common/Cargo.toml b/wxbox_common/Cargo.toml
new file mode 100644
index 0000000..d953d4b
--- /dev/null
+++ b/wxbox_common/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "wxbox_common"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+serde = "1"
\ No newline at end of file
diff --git a/wxbox_common/src/lib.rs b/wxbox_common/src/lib.rs
new file mode 100644
index 0000000..a839f83
--- /dev/null
+++ b/wxbox_common/src/lib.rs
@@ -0,0 +1,9 @@
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize)]
+pub struct TileRequestOptions {
+ pub baselayer: String,
+
+ pub data: String,
+ pub data_transparency: f64
+}
\ No newline at end of file