From d3226e8ccb167c493dfa0f3fd0d477dd82ce18fa Mon Sep 17 00:00:00 2001 From: Orestis Moresis Date: Wed, 22 Feb 2023 14:25:44 +0200 Subject: [PATCH] improvements in legends --- public/js/extras.js | 16 +++++++++------- public/js/layers.js | 2 +- public/js/treeview.js | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/public/js/extras.js b/public/js/extras.js index 8649e1f..67de201 100644 --- a/public/js/extras.js +++ b/public/js/extras.js @@ -165,9 +165,10 @@ function getBathymetry() { legends['DPTH'] = L.control.Legend({ position: "bottomright", + title: 'Bathymetry', symbolWidth: 150, symbolHeight: 208, - collapsed: true, + collapsed: false, legends: [{ type: "image", label: ' ', @@ -282,7 +283,7 @@ function getHabitat(layerCode) { position: "bottomright", symbolWidth: 400, symbolHeight: 600, - collapsed: true, + collapsed: false, title: 'Habitat Type', legends: [{ type: "image", @@ -376,7 +377,7 @@ function getProduct(layer) { position: "bottomright", symbolWidth: 100, symbolHeight: 200, - collapsed: true, + collapsed: false, title: 'Probability of habitat presence', legends: [{ type: "image", @@ -435,9 +436,9 @@ function initializeLayerTree() { } -function getWFD(layerName) { +function getWFD(layerName, layerTitle) { const legendName = layerName.split('_').slice(1,3).join('_'); - const lgndUrl = BASE_URL + "/images/legends/" + legendName + ".png"; + const lgndUrl = BASE_URL + "/img/legends/" + legendName + ".png"; console.debug(lgndUrl); let l; @@ -445,12 +446,13 @@ function getWFD(layerName) { legends[layerName] = L.control.Legend({ position: "bottomright", + title: layerTitle, symbolWidth: 90, symbolHeight: 130, - collapsed: true, + collapsed: false, legends: [{ type: "image", - label: ' ', + label: '', url: lgndUrl }] }).addTo(mapL); diff --git a/public/js/layers.js b/public/js/layers.js index 079fb93..5555eda 100644 --- a/public/js/layers.js +++ b/public/js/layers.js @@ -487,7 +487,7 @@ async function layerTreeSwitch(node) { } else if (intId === 'PHPL') { l = getWMSSeries(node.checkStatus); } else if (intId.substr(0,3) === 'wfd') { - l = getWFD(intId); + l = getWFD(intId, node.title); } else if (layer.format === 'image') { l = L.tileLayer.betterWms(BASE_URL + '/geoserver/wms', { layers: intId, transparent: true, format: "image/png"}); } else { diff --git a/public/js/treeview.js b/public/js/treeview.js index 30187d8..42c0c22 100644 --- a/public/js/treeview.js +++ b/public/js/treeview.js @@ -28,7 +28,7 @@ let citation = [{ //context button click event onClick : async (node) => { //console.log('add - '+node.id); - window.open(URL, '_blank'); + window.open(node.data.n_citation, '_blank'); } }]; @@ -332,11 +332,12 @@ const myData = [{ n_hyperlink: "http://gis.ices.dk/geonetwork/srv/eng/catalog.search#/metadata/a93cffc8-8f45-47a4-a9bd-c8ffd9ad53fb" },{ n_id: 327 , - n_title: 'Seagrass Meadows (citation)', + n_title: 'Seagrass Meadows', code: 'greek_seagrass_meadows_v0906_espg3035', n_parentid: 32, - n_elements: nodeContext.concat(nodeContextLink), - n_hyperlink: "https://www.seanoe.org/data/00765/87740/" + n_elements: nodeContext.concat(nodeContextLink, citation), + n_hyperlink: "https://www.seanoe.org/data/00765/87740/", + n_citation: "https://doi.org/10.1515/bot-2022-0011" },{ n_id: 331, n_title: 'Integrated Ecological Status',