From 09026ab2d191df0a50f3cbd5ab83531e0f09c31f Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Mon, 18 Sep 2023 11:11:03 +0200 Subject: [PATCH] Make distinction between cleaned sites WITH and WITHOUT symptoms [PAER-20] --- .../map_applications/fireblight/js/map.js | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/src/main/webapp/map_applications/fireblight/js/map.js b/src/main/webapp/map_applications/fireblight/js/map.js index d017125b..a6b0f098 100755 --- a/src/main/webapp/map_applications/fireblight/js/map.js +++ b/src/main/webapp/map_applications/fireblight/js/map.js @@ -71,20 +71,30 @@ var styles = { features: features }), style: function(feature, resolution){ - // Site that has been cleared is all black - var observationData = JSON.parse(feature.get("observationData")); - if(observationData["tiltak"] == "Ryddet") - { - return [new ol.style.Style({ - image: new ol.style.Circle({ - fill: new ol.style.Fill({ color: [0,0,0,1] }), - stroke: new ol.style.Stroke({ color: [0,0,0,1] }), - radius: iconRadius - }) - })]; - } - - var retVal = null; + // Site that has been cleared is all black + var observationData = JSON.parse(feature.get("observationData")); + if(observationData["tiltak"] == "Ryddet" && observationData["symptom"] == "Ikke symptom") + { + return [new ol.style.Style({ + image: new ol.style.Circle({ + fill: new ol.style.Fill({ color: [0,0,0,1] }), + stroke: new ol.style.Stroke({ color: [0,0,0,1] }), + radius: iconRadius + }) + })]; + } + else if(observationData["tiltak"] == "Ryddet" && observationData["symptom"] == "Symptom") + { + return [new ol.style.Style({ + image: new ol.style.Circle({ + fill: new ol.style.Fill({ color: [255,255,255,1] }), + stroke: new ol.style.Stroke({ width: 8, color: [0,0,0,1] }), + radius: iconRadius + }) + })]; + } + + var retVal = null; if(feature.get("cropOrganism") != null && feature.get("cropOrganism")["latinName"] != null) { retVal = styles[feature.get("cropOrganism")["latinName"].toLowerCase()]; @@ -93,21 +103,21 @@ var styles = { { retVal = styles["plantae"]; } - //console.info(retVal[0].getImage().getStroke().getWidth()); - // If symptom has been registered, mark with inner black dot - if(observationData["symptom"] == "Symptom") - { - retVal = [ - new ol.style.Style({ - image: new ol.style.Circle({ - fill: new ol.style.Fill({ color: [0,0,0,1] }), - stroke: new ol.style.Stroke({ width: 8, color: retVal[0].getImage().getFill().getColor() }), - radius: iconRadius - }) - }) - ]; - } - return retVal; + //console.info(retVal[0].getImage().getStroke().getWidth()); + // If symptom has been registered, mark with inner black dot + if(observationData["symptom"] == "Symptom") + { + retVal = [ + new ol.style.Style({ + image: new ol.style.Circle({ + fill: new ol.style.Fill({ color: [0,0,0,1] }), + stroke: new ol.style.Stroke({ width: 8, color: retVal[0].getImage().getFill().getColor() }), + radius: iconRadius + }) + }) + ]; + } + return retVal; } }); -- GitLab