diff --git a/index.html b/index.html index 585905a..de4ea83 100644 --- a/index.html +++ b/index.html @@ -78166,7 +78166,7 @@ if (geojson == null) { continue; } - var layer_style = window.configuration.style.ebenen[layer_name]; + var layer_style = JSON.parse(get_layer_style(JSON.stringify(window.configuration), ln)); var myLayer = null; if (L.geoJson) { myLayer = L.geoJson(geojson, { @@ -78211,11 +78211,6 @@ permanent: true, interactive: true, }); - t.on({ - click: function() { - - } - }); t.addTo(myLayer); } } diff --git a/skeleton.html b/skeleton.html index d8d82d8..b828dde 100644 --- a/skeleton.html +++ b/skeleton.html @@ -801,7 +801,7 @@ if (geojson == null) { continue; } - var layer_style = window.configuration.style.ebenen[layer_name]; + var layer_style = JSON.parse(get_layer_style(JSON.stringify(window.configuration), ln)); var myLayer = null; if (L.geoJson) { myLayer = L.geoJson(geojson, { @@ -846,11 +846,6 @@ permanent: true, interactive: true, }); - t.on({ - click: function() { - - } - }); t.addTo(myLayer); } } diff --git a/src/lib.rs b/src/lib.rs index 230b537..bf2413d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -337,6 +337,14 @@ pub fn get_geojson_fuer_ebene(json: String, layer: String) -> String { xml.get_geojson_ebene(&layer) } +pub fn get_layer_style(konfiguration: String, layer_name: String) -> String { + let konfiguration = serde_json::from_str::(&konfiguration).unwrap_or_default(); + let ls = konfiguration.style.ebenen.iter() + .find(|(_, s)| s.name == layer_name).map(|(k, v)| v.clone()) + .unwrap_or(EbenenStyle::default()); + serde_json::to_string(&ls).unwrap_or_default() +} + #[wasm_bindgen] pub fn get_gebaeude_geojson_fuer_aktive_flst(json: String, csv: String, aenderungen: String) -> String { let xml = match serde_json::from_str::(&json) {