From f9c10271afc477b9b5d5d13331bed6fdcc13fe80 Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 6 May 2024 22:18:10 +0200 Subject: [PATCH] changed markers to divicons --- .../resources/html/default/js/startscripts.js | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/sparqlunicorn_ontdoc/resources/html/default/js/startscripts.js b/src/sparqlunicorn_ontdoc/resources/html/default/js/startscripts.js index b075205..00f7102 100644 --- a/src/sparqlunicorn_ontdoc/resources/html/default/js/startscripts.js +++ b/src/sparqlunicorn_ontdoc/resources/html/default/js/startscripts.js @@ -1628,8 +1628,15 @@ function restyleLayer(propertyName,geojsonLayer) { // property name and value. console.log(layerr) layerr.setStyle(function(layer) { + thecolor=getColor(layer.feature, propertyName, propertyValue, rangesByAttribute) + if( layer instanceof L.Marker ) { + layer.setIcon(L.divIcon({ + iconSize: "auto", + html: "" + })) + } return { - fillColor: getColor(layer.feature, propertyName, propertyValue, rangesByAttribute), + fillColor: thecolor, fillOpacity:0.8, weight:0.5 } @@ -1638,14 +1645,14 @@ function restyleLayer(propertyName,geojsonLayer) { function rangestoLegendHTML(rangesByAttribute){ - result="" + result="
" console.log(rangesByAttribute) for(rang in rangesByAttribute){ console.log(rang) for(therange of rangesByAttribute[rang]){ result+="
" if("min" in therange && "max" in therange){ - result+=therange["min"]+" - "+therange["max"] + result+=therange["min"]+" - "+therange["max"] }else{ result+=therange["label"] } @@ -1866,6 +1873,7 @@ function createDropdownOptions(featurecolls){ var centerpoints=[] var clustersfrozen=false var layerr; +var markerlist=[] function setupLeaflet(baselayers,epsg,baseMaps,overlayMaps,map,featurecolls,dateatt="",ajax=true){ if(ajax){ @@ -1922,12 +1930,18 @@ function setupLeaflet(baselayers,epsg,baseMaps,overlayMaps,map,featurecolls,date } layerr=L.geoJSON.css(feature,{ pointToLayer: function(feature, latlng){ - var greenIcon = new L.Icon({ + greenIcon=L.divIcon({ + iconSize: "auto", + html: "" + }) + /* var greenIcon = new L.Icon({ iconUrl: 'https://cdn.rawgit.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-black.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png', iconSize: [25, 41],iconAnchor: [12, 41], popupAnchor: [1, -34],shadowSize: [41, 41] - }); - return L.marker(latlng, {icon: greenIcon}); + });*/ + themarker=L.marker(latlng, {icon: greenIcon}); + markerlist.push(themarker); + return themarker },onEachFeature: function (feature, layer) {layer.bindPopup(generateLeafletPopup(feature, layer))}}) layername="Content "+counter if("name" in feature) {