summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-06 09:52:26 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-06 09:52:26 +0100
commitd5967c1b91b14b3b4e5b0d9663e8a4d2a5e80533 (patch)
tree4ac34f1e81b73b24139ac0eafa2db72f524f2a42 /crates
parentdbc0fd52a8497c5002e8311eb1728050a4e97c7a (diff)
wasm front end becomes the main gipfel; add desktop installers
- rename crates/wipfel -> crates/gipfel (crate, wasm artifact, dist, scripts, page titles); slogan back to "Photogrammetry for Mountain Images"; crates/wipfel-tauri -> crates/gipfel-desktop - new features in the wasm app: Save image (gipfel JPEG comment, same format as before, via browser download) and lens distortion profiles stored in localStorage in FLTK prefs format with camera auto-match on image load; profile name field, save/load and dropdown - gipfel-core: read GPSImgDirection from EXIF (magnetic -> true) as azimuth fallback; expose parse_prefs/serialize_prefs for the wasm build; ?file=/?az=/?pitch=/?roll=/?focal=/?vis= URL parameters - Tauri v2 wrapper crate building .deb, AppImage and (cross-compiled) Windows NSIS installers; safe stage-and-swap build-release.sh - README: web-centric Installation, concise Build section for the official targets (Web, Windows, Linux); drop native/Android mentions - release site moved dist/wipfel -> dist/gipfel
Diffstat (limited to 'crates')
-rw-r--r--crates/gipfel-cli/examples/overlay.rs30
-rw-r--r--crates/gipfel-core/src/metadata.rs16
-rw-r--r--crates/gipfel-core/src/profile.rs14
-rw-r--r--crates/gipfel-desktop/.cargo/config.toml3
-rw-r--r--crates/gipfel-desktop/.gitignore4
-rw-r--r--crates/gipfel-desktop/Cargo.toml12
-rw-r--r--crates/gipfel-desktop/app-icon.pngbin0 -> 63626 bytes
-rwxr-xr-xcrates/gipfel-desktop/build-frontend.sh15
-rw-r--r--crates/gipfel-desktop/build.rs3
-rw-r--r--crates/gipfel-desktop/icons/128x128.pngbin0 -> 5415 bytes
-rw-r--r--crates/gipfel-desktop/icons/128x128@2x.pngbin0 -> 10888 bytes
-rw-r--r--crates/gipfel-desktop/icons/32x32.pngbin0 -> 1367 bytes
-rw-r--r--crates/gipfel-desktop/icons/64x64.pngbin0 -> 2660 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square107x107Logo.pngbin0 -> 4586 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square142x142Logo.pngbin0 -> 5855 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square150x150Logo.pngbin0 -> 6145 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square284x284Logo.pngbin0 -> 11800 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square30x30Logo.pngbin0 -> 1271 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square310x310Logo.pngbin0 -> 12924 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square44x44Logo.pngbin0 -> 1828 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square71x71Logo.pngbin0 -> 3038 bytes
-rw-r--r--crates/gipfel-desktop/icons/Square89x89Logo.pngbin0 -> 3766 bytes
-rw-r--r--crates/gipfel-desktop/icons/StoreLogo.pngbin0 -> 2100 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-anydpi-v26/ic_launcher.xml5
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher.pngbin0 -> 3064 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_foreground.pngbin0 -> 6740 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_round.pngbin0 -> 3356 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher.pngbin0 -> 1978 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_foreground.pngbin0 -> 4518 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_round.pngbin0 -> 2227 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher.pngbin0 -> 4198 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_foreground.pngbin0 -> 9042 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_round.pngbin0 -> 4640 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher.pngbin0 -> 6431 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_foreground.pngbin0 -> 13480 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_round.pngbin0 -> 6943 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 8554 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.pngbin0 -> 18545 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_round.pngbin0 -> 9196 bytes
-rw-r--r--crates/gipfel-desktop/icons/android/values/ic_launcher_background.xml4
-rw-r--r--crates/gipfel-desktop/icons/icon.icnsbin0 -> 111593 bytes
-rw-r--r--crates/gipfel-desktop/icons/icon.icobin0 -> 20635 bytes
-rw-r--r--crates/gipfel-desktop/icons/icon.pngbin0 -> 23994 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-20x20@1x.pngbin0 -> 843 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x-1.pngbin0 -> 1692 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x.pngbin0 -> 1692 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-20x20@3x.pngbin0 -> 2490 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-29x29@1x.pngbin0 -> 1229 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x-1.pngbin0 -> 2410 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x.pngbin0 -> 2410 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-29x29@3x.pngbin0 -> 3752 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-40x40@1x.pngbin0 -> 1692 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x-1.pngbin0 -> 3294 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x.pngbin0 -> 3294 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-40x40@3x.pngbin0 -> 5078 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-512@2x.pngbin0 -> 28749 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-60x60@2x.pngbin0 -> 5078 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-60x60@3x.pngbin0 -> 7445 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-76x76@1x.pngbin0 -> 3147 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-76x76@2x.pngbin0 -> 6291 bytes
-rw-r--r--crates/gipfel-desktop/icons/ios/AppIcon-83.5x83.5@2x.pngbin0 -> 7163 bytes
-rw-r--r--crates/gipfel-desktop/package.json14
-rw-r--r--crates/gipfel-desktop/src/main.rs11
-rw-r--r--crates/gipfel-desktop/tauri.conf.json37
-rw-r--r--crates/gipfel/Cargo.toml (renamed from crates/wipfel/Cargo.toml)10
-rw-r--r--crates/gipfel/README.md (renamed from crates/wipfel/README.md)0
-rwxr-xr-xcrates/gipfel/build-release.sh46
-rw-r--r--crates/gipfel/index.html (renamed from crates/wipfel/index.html)2
-rwxr-xr-xcrates/gipfel/serve-here.sh12
-rw-r--r--crates/gipfel/src/app.rs (renamed from crates/wipfel/src/app.rs)298
-rw-r--r--crates/gipfel/src/bridge.rs (renamed from crates/wipfel/src/bridge.rs)38
-rw-r--r--crates/gipfel/src/canvas_view.rs (renamed from crates/wipfel/src/canvas_view.rs)0
-rw-r--r--crates/gipfel/src/compass.rs (renamed from crates/wipfel/src/compass.rs)0
-rw-r--r--crates/gipfel/src/main.rs (renamed from crates/wipfel/src/main.rs)0
-rw-r--r--crates/gipfel/src/markers.rs (renamed from crates/wipfel/src/markers.rs)0
-rw-r--r--crates/gipfel/src/widgets.rs (renamed from crates/wipfel/src/widgets.rs)0
-rw-r--r--crates/gipfel/www/index.html (renamed from crates/wipfel/www/index.html)2
-rw-r--r--crates/gipfel/www/loader.js (renamed from crates/wipfel/www/loader.js)2
-rw-r--r--crates/gipfel/www/style.css (renamed from crates/wipfel/www/style.css)21
-rwxr-xr-xcrates/wipfel/build-release.sh21
-rwxr-xr-xcrates/wipfel/serve-here.sh12
81 files changed, 591 insertions, 41 deletions
diff --git a/crates/gipfel-cli/examples/overlay.rs b/crates/gipfel-cli/examples/overlay.rs
new file mode 100644
index 0000000..3ce8745
--- /dev/null
+++ b/crates/gipfel-cli/examples/overlay.rs
@@ -0,0 +1,30 @@
+// Dev helper: project hills for a given viewpoint and print image coords.
+// usage: overlay <lat> <lon> <height> <az> <pitch> <roll> <focal35> <w> <h>
+use gipfel_core::panorama::Panorama;
+
+fn main() {
+ let a: Vec<String> = std::env::args().collect();
+ let n: Vec<f64> = a[1..].iter().map(|s| s.parse().unwrap()).collect();
+ let (lat, lon, height, az, pitch, roll, focal, w, h) =
+ (n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8]);
+ let mut p = Panorama::new();
+ p.load_data("gipfel.dat").unwrap();
+ p.set_view_lat(lat);
+ p.set_view_long(lon);
+ p.set_view_height(height);
+ p.set_scale(focal * w.max(h) / 36.0);
+ p.set_center_angle(az);
+ p.set_pitch_angle(pitch);
+ p.set_roll_angle(roll);
+ p.max_view_angle = 60_f64.to_radians();
+ p.update_visible_mountains(None);
+ println!("# az={az} pitch={pitch} scale={}", focal * w.max(h) / 36.0);
+ for &i in &p.visible {
+ let hill = &p.hills[i];
+ let d = p.get_real_distance(i) / 1000.0;
+ if hill.x.abs() < w / 2.0 && hill.y.abs() < h / 2.0 && hill.height > 1500.0 {
+ // convert center-relative coords to full image coords
+ println!("{:.0} {:.0} {} {:.0}m {:.1}km", hill.x + w / 2.0, hill.y + h / 2.0, hill.name, hill.height, d);
+ }
+ }
+}
diff --git a/crates/gipfel-core/src/metadata.rs b/crates/gipfel-core/src/metadata.rs
index 9d73a8d..428cf79 100644
--- a/crates/gipfel-core/src/metadata.rs
+++ b/crates/gipfel-core/src/metadata.rs
@@ -232,6 +232,22 @@ impl ImageMetaData {
}
}
}
+ // Phone cameras record the shooting direction as GPSImgDirection.
+ // Used only when no gipfel comment provided a direction. A magnetic
+ // reference ('M') is converted to true north with the current
+ // declination of the Eastern Alps (~+2.4 deg east, IGRF 2020s);
+ // the residual error stays below typical phone compass noise.
+ if self.direction.is_nan() {
+ if let Some(f) = exif.get_field(Tag::GPSImgDirection, In::PRIMARY) {
+ if let Some(v) = field_tofloat(f, 0) {
+ let mut dir = v;
+ if exif_ref_is(&exif, Tag::GPSImgDirectionRef, "M") {
+ dir += 2.4;
+ }
+ self.direction = dir;
+ }
+ }
+ }
}
}
diff --git a/crates/gipfel-core/src/profile.rs b/crates/gipfel-core/src/profile.rs
index e8bda68..2eff8f6 100644
--- a/crates/gipfel-core/src/profile.rs
+++ b/crates/gipfel-core/src/profile.rs
@@ -112,7 +112,19 @@ pub fn sanitize_name(name: &str) -> Result<(), Error> {
Ok(())
}
-/// Parse a prefs file into ordered (name, profile) pairs. Tolerant:
+/// Parse a prefs file into ordered (name, profile) pairs. Tolerant: comments
+/// (`;`), the root group `[.]`, blank lines and unknown keys are ignored;
+/// values are parsed with Rust's `f64` (superset of C `%g`).
+pub fn parse_prefs(text: &str) -> Vec<(String, Profile)> {
+ parse(text)
+}
+
+/// Serialize profiles in FLTK's layout so the C version can read our file.
+pub fn serialize_prefs(profiles: &[(String, Profile)]) -> String {
+ serialize(profiles)
+}
+
+/// Parse a prefs file into ordered (name, profile) pairs. Tolerant:
/// comments (`;`), the root group `[.]`, blank lines and unknown keys are
/// ignored; values are parsed with Rust's `f64` (superset of C `%g`).
fn parse(text: &str) -> Vec<(String, Profile)> {
diff --git a/crates/gipfel-desktop/.cargo/config.toml b/crates/gipfel-desktop/.cargo/config.toml
new file mode 100644
index 0000000..10d19b9
--- /dev/null
+++ b/crates/gipfel-desktop/.cargo/config.toml
@@ -0,0 +1,3 @@
+# cross-link Windows PE binaries with mingw-w64
+[target.x86_64-pc-windows-gnu]
+linker = "x86_64-w64-mingw32-gcc"
diff --git a/crates/gipfel-desktop/.gitignore b/crates/gipfel-desktop/.gitignore
new file mode 100644
index 0000000..6b0406a
--- /dev/null
+++ b/crates/gipfel-desktop/.gitignore
@@ -0,0 +1,4 @@
+dist/
+node_modules/
+package-lock.json
+gen/
diff --git a/crates/gipfel-desktop/Cargo.toml b/crates/gipfel-desktop/Cargo.toml
new file mode 100644
index 0000000..468bd4c
--- /dev/null
+++ b/crates/gipfel-desktop/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "gipfel-desktop"
+version.workspace = true
+edition.workspace = true
+license.workspace = true
+description = "gipfel — native desktop shell (Tauri) around the WASM front end"
+
+[build-dependencies]
+tauri-build = { version = "2", features = [] }
+
+[dependencies]
+tauri = { version = "2", features = [] }
diff --git a/crates/gipfel-desktop/app-icon.png b/crates/gipfel-desktop/app-icon.png
new file mode 100644
index 0000000..9c999de
--- /dev/null
+++ b/crates/gipfel-desktop/app-icon.png
Binary files differ
diff --git a/crates/gipfel-desktop/build-frontend.sh b/crates/gipfel-desktop/build-frontend.sh
new file mode 100755
index 0000000..72a1687
--- /dev/null
+++ b/crates/gipfel-desktop/build-frontend.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Build the gipfel WASM front end into dist/ for tauri to bundle.
+# Runs from crates/gipfel-desktop (tauri beforeBuildCommand).
+set -e
+HERE="$(cd "$(dirname "$0")" && pwd)"
+DIST="$HERE/dist"
+mkdir -p "$DIST"
+cd "$HERE/../.."
+cargo build -p gipfel --target wasm32-unknown-unknown --release
+wasm-bindgen --target web --out-dir "$DIST" \
+ target/wasm32-unknown-unknown/release/gipfel.wasm
+cp crates/gipfel/www/index.html crates/gipfel/www/style.css \
+ crates/gipfel/www/loader.js "$DIST/"
+gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz"
+echo "frontend dist ready: $DIST"
diff --git a/crates/gipfel-desktop/build.rs b/crates/gipfel-desktop/build.rs
new file mode 100644
index 0000000..d860e1e
--- /dev/null
+++ b/crates/gipfel-desktop/build.rs
@@ -0,0 +1,3 @@
+fn main() {
+ tauri_build::build()
+}
diff --git a/crates/gipfel-desktop/icons/128x128.png b/crates/gipfel-desktop/icons/128x128.png
new file mode 100644
index 0000000..677f7e3
--- /dev/null
+++ b/crates/gipfel-desktop/icons/128x128.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/128x128@2x.png b/crates/gipfel-desktop/icons/128x128@2x.png
new file mode 100644
index 0000000..7c6ca8f
--- /dev/null
+++ b/crates/gipfel-desktop/icons/128x128@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/32x32.png b/crates/gipfel-desktop/icons/32x32.png
new file mode 100644
index 0000000..b89ad45
--- /dev/null
+++ b/crates/gipfel-desktop/icons/32x32.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/64x64.png b/crates/gipfel-desktop/icons/64x64.png
new file mode 100644
index 0000000..06e1baa
--- /dev/null
+++ b/crates/gipfel-desktop/icons/64x64.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square107x107Logo.png b/crates/gipfel-desktop/icons/Square107x107Logo.png
new file mode 100644
index 0000000..be100d3
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square107x107Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square142x142Logo.png b/crates/gipfel-desktop/icons/Square142x142Logo.png
new file mode 100644
index 0000000..c392f48
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square142x142Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square150x150Logo.png b/crates/gipfel-desktop/icons/Square150x150Logo.png
new file mode 100644
index 0000000..bc97d99
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square150x150Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square284x284Logo.png b/crates/gipfel-desktop/icons/Square284x284Logo.png
new file mode 100644
index 0000000..c5164ec
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square284x284Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square30x30Logo.png b/crates/gipfel-desktop/icons/Square30x30Logo.png
new file mode 100644
index 0000000..803d0b5
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square30x30Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square310x310Logo.png b/crates/gipfel-desktop/icons/Square310x310Logo.png
new file mode 100644
index 0000000..61b7cb9
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square310x310Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square44x44Logo.png b/crates/gipfel-desktop/icons/Square44x44Logo.png
new file mode 100644
index 0000000..0632827
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square44x44Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square71x71Logo.png b/crates/gipfel-desktop/icons/Square71x71Logo.png
new file mode 100644
index 0000000..959fa73
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square71x71Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/Square89x89Logo.png b/crates/gipfel-desktop/icons/Square89x89Logo.png
new file mode 100644
index 0000000..a40b586
--- /dev/null
+++ b/crates/gipfel-desktop/icons/Square89x89Logo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/StoreLogo.png b/crates/gipfel-desktop/icons/StoreLogo.png
new file mode 100644
index 0000000..2f6d80f
--- /dev/null
+++ b/crates/gipfel-desktop/icons/StoreLogo.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-anydpi-v26/ic_launcher.xml b/crates/gipfel-desktop/icons/android/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..2ffbf24
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
+ <background android:drawable="@color/ic_launcher_background"/>
+</adaptive-icon> \ No newline at end of file
diff --git a/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher.png b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..89cf08d
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_foreground.png b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..6e365db
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_foreground.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_round.png b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..569b423
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher.png b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f694785
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_foreground.png b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..248af68
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_foreground.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_round.png b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..624ac76
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher.png b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..9b8f176
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_foreground.png b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..b60251d
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_foreground.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_round.png b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..2f3158a
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher.png b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..bbac643
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..c13ec89
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_round.png b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..48d697d
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher.png b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..1ac2c2b
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 0000000..4a7c684
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_round.png b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..d6dfa8d
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/android/values/ic_launcher_background.xml b/crates/gipfel-desktop/icons/android/values/ic_launcher_background.xml
new file mode 100644
index 0000000..16cdd5a
--- /dev/null
+++ b/crates/gipfel-desktop/icons/android/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="ic_launcher_background">#FFFFFF</color>
+</resources> \ No newline at end of file
diff --git a/crates/gipfel-desktop/icons/icon.icns b/crates/gipfel-desktop/icons/icon.icns
new file mode 100644
index 0000000..a467c34
--- /dev/null
+++ b/crates/gipfel-desktop/icons/icon.icns
Binary files differ
diff --git a/crates/gipfel-desktop/icons/icon.ico b/crates/gipfel-desktop/icons/icon.ico
new file mode 100644
index 0000000..cc0ac92
--- /dev/null
+++ b/crates/gipfel-desktop/icons/icon.ico
Binary files differ
diff --git a/crates/gipfel-desktop/icons/icon.png b/crates/gipfel-desktop/icons/icon.png
new file mode 100644
index 0000000..6a3880e
--- /dev/null
+++ b/crates/gipfel-desktop/icons/icon.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-20x20@1x.png b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@1x.png
new file mode 100644
index 0000000..d563874
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@1x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x-1.png b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x-1.png
new file mode 100644
index 0000000..09ff5d1
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x-1.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x.png
new file mode 100644
index 0000000..09ff5d1
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-20x20@3x.png b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@3x.png
new file mode 100644
index 0000000..d137cbf
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-20x20@3x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-29x29@1x.png b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@1x.png
new file mode 100644
index 0000000..9dbc33f
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@1x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x-1.png b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x-1.png
new file mode 100644
index 0000000..3cb954c
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x-1.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x.png
new file mode 100644
index 0000000..3cb954c
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-29x29@3x.png b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@3x.png
new file mode 100644
index 0000000..9fae2c7
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-29x29@3x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-40x40@1x.png b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@1x.png
new file mode 100644
index 0000000..09ff5d1
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@1x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x-1.png b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x-1.png
new file mode 100644
index 0000000..8255b8c
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x-1.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x.png
new file mode 100644
index 0000000..8255b8c
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-40x40@3x.png b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@3x.png
new file mode 100644
index 0000000..a8dbcb6
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-40x40@3x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-512@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-512@2x.png
new file mode 100644
index 0000000..90fba83
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-512@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-60x60@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-60x60@2x.png
new file mode 100644
index 0000000..a8dbcb6
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-60x60@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-60x60@3x.png b/crates/gipfel-desktop/icons/ios/AppIcon-60x60@3x.png
new file mode 100644
index 0000000..036dede
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-60x60@3x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-76x76@1x.png b/crates/gipfel-desktop/icons/ios/AppIcon-76x76@1x.png
new file mode 100644
index 0000000..5888f0f
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-76x76@1x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-76x76@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-76x76@2x.png
new file mode 100644
index 0000000..7675933
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-76x76@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/icons/ios/AppIcon-83.5x83.5@2x.png b/crates/gipfel-desktop/icons/ios/AppIcon-83.5x83.5@2x.png
new file mode 100644
index 0000000..21a1598
--- /dev/null
+++ b/crates/gipfel-desktop/icons/ios/AppIcon-83.5x83.5@2x.png
Binary files differ
diff --git a/crates/gipfel-desktop/package.json b/crates/gipfel-desktop/package.json
new file mode 100644
index 0000000..466edf2
--- /dev/null
+++ b/crates/gipfel-desktop/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "gipfel-desktop",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "type": "commonjs",
+ "devDependencies": {
+ "@tauri-apps/cli": "^2.12.4"
+ }
+}
diff --git a/crates/gipfel-desktop/src/main.rs b/crates/gipfel-desktop/src/main.rs
new file mode 100644
index 0000000..a6cd4ff
--- /dev/null
+++ b/crates/gipfel-desktop/src/main.rs
@@ -0,0 +1,11 @@
+//! gipfel desktop shell: a webview window around the static WASM build
+//! in `dist/` (produced by build-frontend.sh). All real work happens in
+//! the wasm front end; this binary only hosts it.
+
+#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+
+fn main() {
+ tauri::Builder::default()
+ .run(tauri::generate_context!())
+ .expect("error while running gipfel");
+}
diff --git a/crates/gipfel-desktop/tauri.conf.json b/crates/gipfel-desktop/tauri.conf.json
new file mode 100644
index 0000000..0f434f3
--- /dev/null
+++ b/crates/gipfel-desktop/tauri.conf.json
@@ -0,0 +1,37 @@
+{
+ "$schema": "https://schema.tauri.app/config/2",
+ "productName": "gipfel",
+ "mainBinaryName": "gipfel",
+ "version": "0.5.5",
+ "identifier": "org.flpsed.gipfel",
+ "build": {
+ "frontendDist": "dist",
+ "beforeBuildCommand": "sh build-frontend.sh"
+ },
+ "app": {
+ "windows": [
+ {
+ "title": "gipfel — Photogrammetry for Mountain Images",
+ "width": 1280,
+ "height": 860,
+ "resizable": true
+ }
+ ],
+ "security": {
+ "csp": null
+ }
+ },
+ "bundle": {
+ "active": true,
+ "targets": "all",
+ "category": "Utility",
+ "shortDescription": "Mountain photo peak identification (photogrammetry)",
+ "longDescription": "gipfel: open a mountain photo, identify peaks, fit the camera projection and save annotated images. All processing is local; images never leave the machine.",
+ "icon": [
+ "icons/32x32.png",
+ "icons/128x128.png",
+ "icons/icon.png",
+ "icons/icon.ico"
+ ]
+ }
+}
diff --git a/crates/wipfel/Cargo.toml b/crates/gipfel/Cargo.toml
index 47faa60..55b4e05 100644
--- a/crates/wipfel/Cargo.toml
+++ b/crates/gipfel/Cargo.toml
@@ -1,9 +1,9 @@
[package]
-name = "wipfel"
+name = "gipfel"
version.workspace = true
edition.workspace = true
license.workspace = true
-description = "wipfel — web based gipfel photogrammetry for mountain images"
+description = "gipfel — web based photogrammetry for mountain images"
[dependencies]
gipfel-core = { path = "../gipfel-core" }
@@ -17,6 +17,7 @@ yew = { version = "0.21", features = ["csr"] }
version = "0.3"
features = [
"Blob",
+ "BlobPropertyBag",
"CanvasRenderingContext2d",
"DataTransfer",
"CssStyleDeclaration",
@@ -31,14 +32,19 @@ features = [
"HtmlCanvasElement",
"HtmlElement",
"HtmlInputElement",
+ "HtmlSelectElement",
"ImageBitmap",
+ "Location",
+ "UrlSearchParams",
"InputEvent",
"MouseEvent",
"PointerEvent",
"Request",
"Response",
"ResizeObserver",
+ "Storage",
"TextMetrics",
+ "Url",
"Window",
"WheelEvent",
]
diff --git a/crates/wipfel/README.md b/crates/gipfel/README.md
index 37c09ea..37c09ea 100644
--- a/crates/wipfel/README.md
+++ b/crates/gipfel/README.md
diff --git a/crates/gipfel/build-release.sh b/crates/gipfel/build-release.sh
new file mode 100755
index 0000000..1e429ca
--- /dev/null
+++ b/crates/gipfel/build-release.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Build gipfel and assemble a deployable static site in dist/gipfel/.
+# Everything the app loads (wasm, hill database, stylesheet) is fetched
+# relative to the page URL, so the directory can be mounted under any
+# path on any static server.
+set -e
+cd "$(dirname "$0")/../.."
+ROOT="$(pwd -P)"
+# sanity check: refuse to run anywhere that is not the repo root
+[ -f "$ROOT/Cargo.toml" ] && [ -d "$ROOT/crates/gipfel" ] || {
+ echo "error: $ROOT does not look like the gipfel repo root" >&2
+ exit 1
+}
+DIST="$ROOT/dist/gipfel"
+# belt and braces: the only path this script may ever delete
+case "$DIST" in
+ "$ROOT"/dist/gipfel) ;;
+ *) echo "error: refusing to touch unexpected path $DIST" >&2; exit 1 ;;
+esac
+
+# size-optimized build for the web (the workspace default profile
+# targets native binaries); --remove-name-section drops the debug
+# symbol names wasm-bindgen adds for devtools
+CARGO_PROFILE_RELEASE_OPT_LEVEL=z cargo build -p gipfel --target wasm32-unknown-unknown --release
+
+# stage into a fresh temp dir and swap it in only on success, so a
+# failing build never destroys the previous site and the old site is
+# removed at the last possible moment
+mkdir -p "$ROOT/dist"
+TMP="$(mktemp -d "$ROOT/dist/.gipfel-stage.XXXXXX")"
+trap 'rm -rf "$TMP"' EXIT INT TERM
+
+wasm-bindgen --remove-name-section --target web --out-dir "$TMP" \
+ target/wasm32-unknown-unknown/release/gipfel.wasm
+# the loader page (not the trunk entry point, which is dev-only)
+rm -f "$TMP"/gipfel.d.ts "$TMP"/gipfel_bg.wasm.d.ts
+cp crates/gipfel/www/index.html crates/gipfel/www/style.css crates/gipfel/www/loader.js "$TMP/"
+gzip -9 -n -c gipfel.dat > "$TMP/gipfel.dat.gz"
+
+rm -rf "$DIST"
+chmod 755 "$TMP"
+mv "$TMP" "$DIST"
+trap - EXIT INT TERM
+
+echo "site assembled in $DIST ($(du -sh "$DIST" | cut -f1)):"
+ls "$DIST"
diff --git a/crates/wipfel/index.html b/crates/gipfel/index.html
index 2da0c81..bdd883a 100644
--- a/crates/wipfel/index.html
+++ b/crates/gipfel/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
- <title>wipfel — web based gipfel photogrammetry</title>
+ <title>gipfel — Photogrammetry for Mountain Images</title>
<link data-trunk rel="css" href="www/style.css" />
<link data-trunk rel="rust" />
</head>
diff --git a/crates/gipfel/serve-here.sh b/crates/gipfel/serve-here.sh
new file mode 100755
index 0000000..2eaaf4d
--- /dev/null
+++ b/crates/gipfel/serve-here.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Build gipfel for wasm and refresh the static dist dir served from
+# /tmp/gipfel-dist (python http.server on :8090). Dev-only helper.
+set -e
+cd "$(dirname "$0")/../.."
+cargo build -p gipfel --target wasm32-unknown-unknown --release
+DIST=/tmp/gipfel-dist
+mkdir -p "$DIST"
+wasm-bindgen --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/gipfel.wasm
+cp crates/gipfel/www/index.html crates/gipfel/www/style.css crates/gipfel/www/loader.js "$DIST/"
+gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz"
+echo "dist refreshed: $(ls -la "$DIST" | awk '{s+=$5} END {print s" bytes"}')"
diff --git a/crates/wipfel/src/app.rs b/crates/gipfel/src/app.rs
index 96325eb..7479b8e 100644
--- a/crates/wipfel/src/app.rs
+++ b/crates/gipfel/src/app.rs
@@ -52,6 +52,17 @@ impl Default for UiParams {
}
}
+/// view parameter overrides from the URL (degrees / mm), applied on
+/// top of whatever the image metadata provides
+#[derive(Clone, Copy, Default)]
+struct Overrides {
+ az: Option<f64>,
+ pitch: Option<f64>,
+ roll: Option<f64>,
+ focal: Option<f64>,
+ vis: Option<f64>,
+}
+
/// open Find Peak popup: anchor (screen + image coords) and search query
#[derive(Clone, PartialEq)]
struct FindPeak {
@@ -62,6 +73,13 @@ struct FindPeak {
query: String,
}
+/// Read a query parameter from the page URL (e.g. `/?file=test.jpg`).
+fn url_param(name: &str) -> Option<String> {
+ let search = bridge::window().location().search().ok()?;
+ let params = web_sys::UrlSearchParams::new_with_str(&search).ok()?;
+ params.get(name)
+}
+
fn gunzip(gz: &[u8]) -> Result<Vec<u8>, String> {
let mut raw = Vec::new();
GzDecoder::new(gz)
@@ -70,6 +88,21 @@ fn gunzip(gz: &[u8]) -> Result<Vec<u8>, String> {
.map_err(|e| format!("gunzip: {e}"))
}
+/// localStorage key holding the distortion profile store, in the same
+/// FLTK prefs format the desktop app uses on disk (so files can be
+/// exported/imported between the two).
+const PREFS_KEY: &str = "gipfel-distortion-profiles";
+
+fn load_prefs() -> Vec<(String, gipfel_core::profile::Profile)> {
+ bridge::store_get(PREFS_KEY)
+ .map(|t| gipfel_core::profile::parse_prefs(&t))
+ .unwrap_or_default()
+}
+
+fn save_prefs(list: &[(String, gipfel_core::profile::Profile)]) -> Result<(), String> {
+ bridge::store_set(PREFS_KEY, &gipfel_core::profile::serialize_prefs(list))
+}
+
#[derive(Properties, PartialEq)]
struct FpProps {
fp: FindPeak,
@@ -195,6 +228,17 @@ pub fn app() -> Html {
// set once the user pans or zooms by hand; auto-fit is then suppressed
// until the next image load
let user_moved = use_mut_ref(|| false);
+ // view parameter overrides from the URL query string
+ let overrides = use_mut_ref(Overrides::default);
+ // original bytes + name of the loaded image, kept for "Save image"
+ // (the annotated JPEG is the source image plus a gipfel comment)
+ let orig = use_mut_ref(|| Option::<(Vec<u8>, String)>::None);
+ // EXIF metadata of the loaded image (camera name for profile matching)
+ let img_md = use_mut_ref(ImageMetaData::new);
+ // distortion profile store (localStorage, FLTK prefs format)
+ let profile_name = use_state(String::new);
+ let profiles = use_state(Vec::<String>::new);
+ let profile_overwrite = use_mut_ref(|| false);
// force a redraw when the window is resized so the canvas backing
// store tracks its CSS size (listener lives as long as the app).
@@ -391,6 +435,11 @@ pub fn app() -> Html {
let find_peak = find_peak.clone();
let user_moved = user_moved.clone();
let nav_open = nav_open.clone();
+ let overrides = overrides.clone();
+ let orig = orig.clone();
+ let img_md = img_md.clone();
+ let profile_name = profile_name.clone();
+ let profiles = profiles.clone();
Callback::from(move |(bytes, name): (Vec<u8>, String)| {
let (bitmap, status, fit, pan, markers, fit_info) =
(bitmap.clone(), status.clone(), fit.clone(), pan.clone(), markers.clone(), fit_info.clone());
@@ -399,6 +448,11 @@ pub fn app() -> Html {
let find_peak = find_peak.clone();
let user_moved = user_moved.clone();
let nav_open = nav_open.clone();
+ let overrides = overrides.clone();
+ let orig = orig.clone();
+ let img_md = img_md.clone();
+ let profile_name = profile_name.clone();
+ let profiles = profiles.clone();
spawn_local(async move {
match bridge::decode_bitmap(&bytes).await {
Ok(bmp) => {
@@ -417,6 +471,47 @@ pub fn app() -> Html {
let mut md = ImageMetaData::new();
md.load_image_from_bytes(&bytes);
let have = apply_image_metadata(&mut pan.borrow_mut(), &md, w, h);
+ // explicit URL parameters win over the metadata,
+ // e.g. /?file=img.jpg&pitch=-20 for a photo whose
+ // EXIF lacks (or fakes) the camera orientation
+ {
+ let ov = *overrides.borrow();
+ let mut p = pan.borrow_mut();
+ if let Some(v) = ov.az {
+ p.set_center_angle(v);
+ }
+ if let Some(v) = ov.pitch {
+ p.set_pitch_angle(v);
+ }
+ if let Some(v) = ov.roll {
+ p.set_roll_angle(v);
+ }
+ if let Some(v) = ov.focal {
+ p.set_scale(v * w.max(h) as f64 / 36.0);
+ }
+ if let Some(v) = ov.vis {
+ // same mapping as the Visibility slider
+ p.set_height_dist_ratio((0.11 - v).clamp(0.01, 0.1));
+ }
+ }
+ // keep the source bytes and EXIF for "Save image"
+ *orig.borrow_mut() = Some((bytes.clone(), name.clone()));
+ *img_md.borrow_mut() = md.clone();
+ // distortion profile: prefill the name field with
+ // the camera/focal auto-match and apply it when a
+ // stored profile of that name exists (desktop does
+ // the same on image load)
+ {
+ let auto = gipfel_core::metadata::distortion_profile_name(&md);
+ profile_name.set(auto.clone().unwrap_or_default());
+ let all = load_prefs();
+ profiles.set(all.iter().map(|(n, _)| n.clone()).collect());
+ if let Some(n) = &auto {
+ if let Some((_, pr)) = all.iter().find(|(m, _)| m == n) {
+ pan.borrow_mut().set_distortion_params(pr.k0, pr.k1, pr.x0);
+ }
+ }
+ }
let vis = pan.borrow().visible.len();
let u = {
let p = pan.borrow();
@@ -466,6 +561,39 @@ pub fn app() -> Html {
})
};
+ // Auto-load an image given as ?file=<same-origin path> so a photo can
+ // be opened by URL alone, e.g. /?file=test.jpg. It goes through the
+ // normal load pipeline, so EXIF viewpoint/focal metadata is applied
+ // exactly as for a picked file.
+ {
+ let load_bytes = load_bytes.clone();
+ let status = status.clone();
+ let overrides = overrides.clone();
+ use_effect_with((), move |_| {
+ let Some(path) = url_param("file") else { return };
+ if path.is_empty() || path.starts_with("http") || path.contains(":/") {
+ status.set("?file= must be a same-origin path".to_string());
+ return;
+ }
+ let name = path.rsplit('/').next().unwrap_or(&path).to_string();
+ *overrides.borrow_mut() = Overrides {
+ az: url_param("az").and_then(|s| s.parse().ok()),
+ pitch: url_param("pitch").and_then(|s| s.parse().ok()),
+ roll: url_param("roll").and_then(|s| s.parse().ok()),
+ focal: url_param("focal").and_then(|s| s.parse().ok()),
+ vis: url_param("vis").and_then(|s| s.parse().ok()),
+ };
+ let (load_bytes, status) = (load_bytes.clone(), status.clone());
+ let path2 = path.clone();
+ spawn_local(async move {
+ match bridge::fetch_bytes(&path).await {
+ Ok(bytes) => load_bytes.emit((bytes, name)),
+ Err(e) => status.set(format!("Could not fetch {path2}: {e}")),
+ }
+ });
+ });
+ }
+
let read_file = {
let load_bytes = load_bytes.clone();
let status = status.clone();
@@ -624,6 +752,149 @@ pub fn app() -> Html {
})
};
+ // "Save image": re-encode the original JPEG with the current fit as
+ // gipfel comment (same bytes + format as the desktop app writes),
+ // delivered as a browser download.
+ let on_save_image = {
+ let orig = orig.clone();
+ let img_md = img_md.clone();
+ let pan = pan.clone();
+ let img_size = img_size.clone();
+ let status = status.clone();
+ Callback::from(move |_: MouseEvent| {
+ let Some((bytes, name)) = orig.borrow().clone() else {
+ status.set("No image loaded.".to_string());
+ return;
+ };
+ // mirror of the desktop md_from_state; the comment keeps the
+ // historical scale * 35 / max(w,h) focal encoding so saved
+ // files stay interchangeable with the desktop versions
+ let mut out = ImageMetaData::new();
+ {
+ let m = img_md.borrow();
+ out.manufacturer = m.manufacturer.clone();
+ out.model = m.model.clone();
+ }
+ {
+ let p = pan.borrow();
+ out.longitude = p.get_view_long();
+ out.latitude = p.get_view_lat();
+ out.height = p.get_view_height();
+ out.direction = p.get_center_angle();
+ out.pitch = p.get_pitch_angle();
+ out.roll = p.get_roll_angle();
+ out.focal_length_35mm =
+ p.get_scale() * 35.0 / (img_size.0.max(img_size.1) as f64).max(1.0);
+ out.projection_type = p.projection_type as i32;
+ out.k0 = p.parms.k0;
+ out.k1 = p.parms.k1;
+ out.x0 = p.parms.x0;
+ }
+ match out.save_image_to_bytes(&bytes) {
+ Ok(jpg) => {
+ let stem = name
+ .rsplit_once('.')
+ .map(|(s, _)| s.to_string())
+ .unwrap_or_else(|| name.clone());
+ let outname = format!("{stem}-gipfel.jpg");
+ match bridge::download(&outname, &jpg, "image/jpeg") {
+ Ok(()) => status.set(format!("Saved {outname} (browser download).")),
+ Err(e) => status.set(format!("Download failed: {e}")),
+ }
+ }
+ Err(e) => status.set(format!("Save failed: {e} (input must be JPEG)")),
+ }
+ })
+ };
+
+ // distortion profiles: localStorage store in FLTK prefs format
+ let refresh_profiles = {
+ let profiles = profiles.clone();
+ Rc::new(move || {
+ profiles.set(load_prefs().into_iter().map(|(n, _)| n).collect())
+ })
+ };
+ let apply_profile = {
+ let pan = pan.clone();
+ let status = status.clone();
+ Rc::new(move |name: &str| {
+ match load_prefs().into_iter().find(|(n, _)| n == name) {
+ Some((_, p)) => {
+ pan.borrow_mut().set_distortion_params(p.k0, p.k1, p.x0);
+ status.set(format!("Loaded distortion profile '{name}'."));
+ }
+ None => status.set(format!("Profile '{name}' not found.")),
+ }
+ })
+ };
+ let on_profile_name = {
+ let profile_name = profile_name.clone();
+ let profile_overwrite = profile_overwrite.clone();
+ Callback::from(move |e: InputEvent| {
+ let input: HtmlInputElement = e.target_unchecked_into();
+ profile_name.set(input.value());
+ *profile_overwrite.borrow_mut() = false;
+ })
+ };
+ let on_profile_save = {
+ let profile_name = profile_name.clone();
+ let pan = pan.clone();
+ let status = status.clone();
+ let profile_overwrite = profile_overwrite.clone();
+ let refresh = refresh_profiles.clone();
+ Callback::from(move |_: MouseEvent| {
+ let name = profile_name.trim().to_string();
+ if name.is_empty() {
+ status.set("Enter a profile name.".into());
+ return;
+ }
+ if let Err(e) = gipfel_core::profile::sanitize_name(&name) {
+ status.set(format!("Invalid profile name: {e}"));
+ return;
+ }
+ let prof = {
+ let p = pan.borrow();
+ gipfel_core::profile::Profile {
+ k0: p.parms.k0,
+ k1: p.parms.k1,
+ x0: p.parms.x0,
+ }
+ };
+ let mut all = load_prefs();
+ let exists = all.iter().any(|(n, _)| *n == name);
+ if exists && !*profile_overwrite.borrow() {
+ *profile_overwrite.borrow_mut() = true;
+ status.set(format!("Profile '{name}' exists — press Save again to overwrite."));
+ return;
+ }
+ all.retain(|(n, _)| *n != name);
+ all.push((name.clone(), prof));
+ match save_prefs(&all) {
+ Ok(()) => {
+ *profile_overwrite.borrow_mut() = false;
+ refresh();
+ status.set(format!("Saved distortion profile '{name}'."));
+ }
+ Err(e) => status.set(format!("Profile save failed: {e}")),
+ }
+ })
+ };
+ let on_profile_load = {
+ let profile_name = profile_name.clone();
+ let apply = apply_profile.clone();
+ Callback::from(move |_: MouseEvent| apply(profile_name.trim()))
+ };
+ let on_profile_select = {
+ let profile_name = profile_name.clone();
+ let apply = apply_profile.clone();
+ Callback::from(move |e: Event| {
+ let sel: web_sys::HtmlSelectElement = e.target_unchecked_into();
+ let name = sel.value();
+ profile_name.set(name.clone());
+ apply(&name);
+ })
+ };
+
let on_distortion_toggle = {
let fit_distortion = fit_distortion.clone();
let markers = markers.clone();
@@ -1034,12 +1305,13 @@ pub fn app() -> Html {
<aside class={if *nav_open { "sidebar" } else { "sidebar collapsed" }}>
<button class="collapse-btn" title="Hide controls"
onclick={collapse_cb}>{ "◀" }</button>
- <h1>{ "wipfel" }</h1>
+ <h1>{ "gipfel" }</h1>
<a class="tag" href="https://flpsed.org/gipfel.html" target="_blank"
- rel="noopener noreferrer">{ "web gipfel photogrammetry" }</a>
+ rel="noopener noreferrer">{ "Photogrammetry for Mountain Images" }</a>
<button onclick={open_picker}>{ "Open image…" }</button>
if bitmap.is_some() {
<button onclick={fit}>{ "Fit to window" }</button>
+ <button onclick={on_save_image}>{ "Save image…" }</button>
}
<input
type="file"
@@ -1082,6 +1354,28 @@ pub fn app() -> Html {
<input type="checkbox" checked={*fit_distortion} onchange={on_distortion_toggle} />
{ "Fit distortion (needs ≥ 4 markers)" }
</label>
+ <div class="subsection">{ "Distortion profiles" }</div>
+ <input
+ type="text"
+ class="textinput"
+ placeholder="profile name"
+ value={(*profile_name).clone()}
+ oninput={on_profile_name}
+ />
+ <div class="row gap">
+ <button onclick={on_profile_save}>{ "Save" }</button>
+ <button onclick={on_profile_load}>{ "Load" }</button>
+ </div>
+ if !profiles.is_empty() {
+ <select class="textinput" onchange={on_profile_select}>
+ <option value="" selected={true}>{ "saved profiles…" }</option>
+ {
+ profiles.iter().map(|n| html! {
+ <option value={n.clone()} key={n.clone()}>{ n.clone() }</option>
+ }).collect::<Html>()
+ }
+ </select>
+ }
<div class="section">{ "Display" }</div>
<label class="row">
<input type="checkbox" checked={*show_hidden} onchange={on_show_hidden} />
diff --git a/crates/wipfel/src/bridge.rs b/crates/gipfel/src/bridge.rs
index 0f252c1..2a23c46 100644
--- a/crates/wipfel/src/bridge.rs
+++ b/crates/gipfel/src/bridge.rs
@@ -36,6 +36,44 @@ pub async fn read_blob(blob: &Blob) -> Result<Vec<u8>, String> {
Ok(Uint8Array::new(&buf).to_vec())
}
+/// Offer `bytes` as a browser download under the given file name.
+pub fn download(filename: &str, bytes: &[u8], mime: &str) -> Result<(), String> {
+ let array = js_sys::Array::new();
+ array.push(&Uint8Array::from(bytes).buffer());
+ let opts = web_sys::BlobPropertyBag::new();
+ opts.set_type(mime);
+ let blob = Blob::new_with_u8_array_sequence_and_options(&array, &opts)
+ .map_err(|_| "blob failed".to_string())?;
+ let url = web_sys::Url::create_object_url_with_blob(&blob)
+ .map_err(|_| "object url failed".to_string())?;
+ let doc = window().document().ok_or("no document")?;
+ let a = doc.create_element("a").map_err(|_| "no anchor".to_string())?;
+ a.set_attribute("href", &url).map_err(|_| "href".to_string())?;
+ a.set_attribute("download", filename).map_err(|_| "download".to_string())?;
+ if let Ok(el) = a.dyn_into::<web_sys::HtmlElement>() {
+ el.click();
+ }
+ let _ = web_sys::Url::revoke_object_url(&url);
+ Ok(())
+}
+
+/// localStorage read (None when unavailable or unset).
+pub fn store_get(key: &str) -> Option<String> {
+ let store = window().local_storage().ok()??;
+ store.get_item(key).ok().flatten()
+}
+
+/// localStorage write.
+pub fn store_set(key: &str, value: &str) -> Result<(), String> {
+ let store = window()
+ .local_storage()
+ .map_err(|_| "no localStorage")?
+ .ok_or("no localStorage")?;
+ store
+ .set_item(key, value)
+ .map_err(|_| "localStorage denied or full".to_string())
+}
+
/// Fetch a URL (same-origin) into memory.
pub async fn fetch_bytes(url: &str) -> Result<Vec<u8>, String> {
let resp = JsFuture::from(window().fetch_with_str(url))
diff --git a/crates/wipfel/src/canvas_view.rs b/crates/gipfel/src/canvas_view.rs
index df46b5c..df46b5c 100644
--- a/crates/wipfel/src/canvas_view.rs
+++ b/crates/gipfel/src/canvas_view.rs
diff --git a/crates/wipfel/src/compass.rs b/crates/gipfel/src/compass.rs
index 5e91c9a..5e91c9a 100644
--- a/crates/wipfel/src/compass.rs
+++ b/crates/gipfel/src/compass.rs
diff --git a/crates/wipfel/src/main.rs b/crates/gipfel/src/main.rs
index 741393b..741393b 100644
--- a/crates/wipfel/src/main.rs
+++ b/crates/gipfel/src/main.rs
diff --git a/crates/wipfel/src/markers.rs b/crates/gipfel/src/markers.rs
index b8c00aa..b8c00aa 100644
--- a/crates/wipfel/src/markers.rs
+++ b/crates/gipfel/src/markers.rs
diff --git a/crates/wipfel/src/widgets.rs b/crates/gipfel/src/widgets.rs
index 93e2cdc..93e2cdc 100644
--- a/crates/wipfel/src/widgets.rs
+++ b/crates/gipfel/src/widgets.rs
diff --git a/crates/wipfel/www/index.html b/crates/gipfel/www/index.html
index e56de5c..3356815 100644
--- a/crates/wipfel/www/index.html
+++ b/crates/gipfel/www/index.html
@@ -15,7 +15,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#101014" media="(prefers-color-scheme: dark)" />
<meta name="theme-color" content="#e9eaf0" media="(prefers-color-scheme: light)" />
- <title>wipfel — web based gipfel photogrammetry</title>
+ <title>gipfel — Photogrammetry for Mountain Images</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
diff --git a/crates/wipfel/www/loader.js b/crates/gipfel/www/loader.js
index 8880478..5fbd558 100644
--- a/crates/wipfel/www/loader.js
+++ b/crates/gipfel/www/loader.js
@@ -1,4 +1,4 @@
// External loader so the page needs no inline <script>, keeping
// `script-src 'self'` in the Content-Security-Policy sufficient.
-import init from './wipfel.js';
+import init from './gipfel.js';
init();
diff --git a/crates/wipfel/www/style.css b/crates/gipfel/www/style.css
index 9ed7bd8..1a0173c 100644
--- a/crates/wipfel/www/style.css
+++ b/crates/gipfel/www/style.css
@@ -355,3 +355,24 @@ canvas.compass {
background: var(--btn);
color: #fff;
}
+.subsection {
+ margin-top: 10px;
+ font-size: 12px;
+ color: var(--text-dim);
+}
+.textinput {
+ width: 100%;
+ box-sizing: border-box;
+ padding: 6px 8px;
+ background: var(--btn);
+ color: var(--text);
+ border: 1px solid var(--panel-border);
+ border-radius: 6px;
+ font-size: 13px;
+}
+select.textinput {
+ margin-top: 6px;
+}
+.row.gap {
+ margin-top: 6px;
+}
diff --git a/crates/wipfel/build-release.sh b/crates/wipfel/build-release.sh
deleted file mode 100755
index 4375491..0000000
--- a/crates/wipfel/build-release.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Build wipfel and assemble a deployable static site in dist/wipfel/.
-# Everything the app loads (wasm, hill database, stylesheet) is fetched
-# relative to the page URL, so the directory can be mounted under any
-# path on any static server.
-set -e
-cd "$(dirname "$0")/../.."
-# size-optimized build for the web (the workspace default profile
-# targets native binaries); --remove-name-section drops the debug
-# symbol names wasm-bindgen adds for devtools
-CARGO_PROFILE_RELEASE_OPT_LEVEL=z cargo build -p wipfel --target wasm32-unknown-unknown --release
-DIST=dist/wipfel
-rm -rf "$DIST"
-mkdir -p "$DIST"
-wasm-bindgen --remove-name-section --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm
-# the loader page (not the trunk entry point, which is dev-only)
-rm -f "$DIST"/wipfel.d.ts "$DIST"/wipfel_bg.wasm.d.ts
-cp crates/wipfel/www/index.html crates/wipfel/www/style.css crates/wipfel/www/loader.js "$DIST/"
-gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz"
-echo "site assembled in $DIST ($(du -sh "$DIST" | cut -f1)):"
-ls "$DIST"
diff --git a/crates/wipfel/serve-here.sh b/crates/wipfel/serve-here.sh
deleted file mode 100755
index c43fbd8..0000000
--- a/crates/wipfel/serve-here.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Build wipfel for wasm and refresh the static dist dir served from
-# /tmp/wipfel-dist (python http.server on :8090). Dev-only helper.
-set -e
-cd "$(dirname "$0")/../.."
-cargo build -p wipfel --target wasm32-unknown-unknown --release
-DIST=/tmp/wipfel-dist
-mkdir -p "$DIST"
-wasm-bindgen --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm
-cp crates/wipfel/www/index.html crates/wipfel/www/style.css crates/wipfel/www/loader.js "$DIST/"
-gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz"
-echo "dist refreshed: $(ls -la "$DIST" | awk '{s+=$5} END {print s" bytes"}')"