Compare commits

..

2 Commits

Author SHA1 Message Date
a4c7833d87 Clean up 2020-04-25 13:33:34 +02:00
6ceae7d7c2 Add polygons (city outlines) to search results 2020-04-25 13:33:13 +02:00

View File

@ -58,7 +58,7 @@ var style_outlines = {
radius: 8, radius: 8,
fillColor: "#ff7800", fillColor: "#ff7800",
color: "black", color: "black",
opacity: 1, opacity: 1.0,
fillOpacity: 0.5 fillOpacity: 0.5
}; };
@ -346,6 +346,16 @@ function search(e) {
results.appendChild(el); results.appendChild(el);
} }
break; break;
case "Polygon":
regex = new RegExp(query, 'i');
if (item.feature.properties.name.match(regex)) {
el = document.createElement("li");
zpos = layers._layers[i].layer._layers[item._leaflet_id].getCenter();
el.innerHTML = "[" + layers._layers[i].name + "] " + '<a href="#" onclick="latLng2 = L.latLng(' + Math.round(zpos.lat) + ',' + Math.round(zpos.lng) + '); jump_to(latLng2, ' + polyconf_show_cities + '); return false;">' + htmlEntities(item.feature.properties.name) + "</a>";
results.appendChild(el);
}
break;
default: default:
break; break;
} }
@ -462,15 +472,15 @@ function update_outline_visibility() {
zoom = mymap.getZoom(); zoom = mymap.getZoom();
mymap.eachLayer( function(layer) { mymap.eachLayer( function(layer) {
if ( layer.myTag && layer.myTag === "outline") { if ( layer.myTag && layer.myTag === "outline") {
var opacity; var fillOpacity;
if (zoom <= polyconf_show_cities) if (zoom <= polyconf_show_cities)
opacity = 0.5; fillOpacity = 0.5;
//else if (zoom == polyconf_show_cities + 1) //else if (zoom == polyconf_show_cities + 1)
// opacity = 0.2; // opacity = 0.2;
else else
opacity = 0.0; fillOpacity = 0.0;
layer.setStyle({fillOpacity: opacity}); layer.setStyle({fillOpacity: fillOpacity});
} }
}); });
} }