From af4edca4a753783d57a96b54112def881b215dc8 Mon Sep 17 00:00:00 2001 From: Marc Froehlich Date: Mon, 22 Jun 2026 23:31:10 +0200 Subject: [PATCH] debugging map failure --- .../view/map/MapHtmlResources.java | 64 +- src/main/resources/web/leaflet/leaflet.css | 661 ++++++++++++++++++ src/main/resources/web/leaflet/leaflet.js | 6 + 3 files changed, 717 insertions(+), 14 deletions(-) create mode 100644 src/main/resources/web/leaflet/leaflet.css create mode 100644 src/main/resources/web/leaflet/leaflet.js diff --git a/src/main/java/kst4contest/view/map/MapHtmlResources.java b/src/main/java/kst4contest/view/map/MapHtmlResources.java index 0dcced9..f4c6671 100644 --- a/src/main/java/kst4contest/view/map/MapHtmlResources.java +++ b/src/main/java/kst4contest/view/map/MapHtmlResources.java @@ -1,5 +1,10 @@ package kst4contest.view.map; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; + /** * HTML host for the JavaFX WebView map. * @@ -16,7 +21,21 @@ public final class MapHtmlResources { private MapHtmlResources() { } + private static String readRequiredResource(String resourcePath) { + try (InputStream inputStream = MapHtmlResources.class.getResourceAsStream(resourcePath)) { + if (inputStream == null) { + throw new IllegalStateException("Missing map resource: " + resourcePath); + } + return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + } catch (IOException exception) { + throw new UncheckedIOException("Could not read map resource: " + resourcePath, exception); + } + } + public static String createStationMapHtml() { + String leafletCss = readRequiredResource("/web/leaflet/leaflet.css"); + String leafletJs = readRequiredResource("/web/leaflet/leaflet.js"); + return """ @@ -24,10 +43,9 @@ public final class MapHtmlResources { KST4Contest Station Map - +