var displayFeatureInfo = function (pixel) {
var currentZoom = map.getView().getZoom();
var feature = map.forEachFeatureAtPixel(pixel, function (feature, layer) {
return feature;
});
if (feature) {
var f=feature;
var myStyle=feature.getStyleFunction();
var att = feature.getProperties();
styleUrl = att.styleUrl.split("#");
styleUrlFull = att.styleUrl;
maille=att.description.split("~");
switch (styleUrl[1])
{
case "wnat_3":
feature.set('styleUrl', "#wnat_0");
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: 'rgba(255,255,255,1)'}),
fill: new ol.style.Fill({color: 'rgba(0,0,0,1)'})
}));
break;
case "wnat_2":
feature.set('styleUrl', "#wnat_3");
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: 'rgba(255,255,255,1)'}),
fill: new ol.style.Fill({color: 'rgba(255,0,0,1)'})
}));
break;
case "wnat_1":
feature.set('styleUrl', "#wnat_2");
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: 'rgba(255,255,255,1)'}),
fill: new ol.style.Fill({color: 'rgba(255,127,0,1)'})
}));
break;
default:
feature.set('styleUrl', "#wnat_1");
feature.setStyle(new ol.style.Style({
stroke: new ol.style.Stroke({color: 'rgba(255,255,255,1)'}),
fill: new ol.style.Fill({color: 'rgba(0,255,0,1)'})
}));
break;
}
return 1;
} else {
return 0;
}
};
Partager