Show maki icons in overpass markers

This commit is contained in:
Stefan Siegl 2021-04-03 21:20:42 +02:00
parent c3a9221c52
commit d60ab7937c
No known key found for this signature in database
GPG key ID: 73942AF5642F3DDA
4 changed files with 55 additions and 5 deletions

View file

@ -183,7 +183,13 @@ BR.LayersConfig = L.Class.extend({
}
},
createOverpassLayer: function (query) {
createOverpassLayer: function (query, icon) {
let markerSign = '<i class="fa fa-search icon-white" style="width: 25px;"></i>';
if (icon && icon.startsWith('maki-')) {
markerSign = `<img class="icon-invert" src="dist/images/${icon.substr(5)}-11.svg" />`;
}
return Object.assign(
new OverpassLayer({
overpassFrontend: this.overpassFrontend,
@ -195,7 +201,7 @@ BR.LayersConfig = L.Class.extend({
'<table class="overpass-tags">{% for k, v in tags %}{% if k[:5] != "addr:" %}<tr><th>{{ k }}</th><td>{% if k matches "/email/" %}<a href="mailto:{{ v }}">{{ v }}</a>{% elseif v matches "/^http/" %}<a href="{{ v }}">{{ v }}</a>{% elseif v matches "/^www/" %}<a href="http://{{ v }}">{{ v }}</a>{% else %}{{ v }}{% endif %}</td></tr>{% endif %}{% endfor %}</table>',
markerSymbol:
'<svg width="25px" height="41px" anchorX="12" anchorY="41" viewBox="0 0 32 52" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M16,1 C7.7146,1 1,7.65636364 1,15.8648485 C1,24.0760606 16,51 16,51 C16,51 31,24.0760606 31,15.8648485 C31,7.65636364 24.2815,1 16,1 L16,1 Z" fill="#436978"></path></svg>',
markerSign: '<i class="fa fa-search icon-white" style="width: 25px;"></i>',
markerSign,
style: function (overpassObject) {
return {
nodeFeature: 'Marker',
@ -294,7 +300,7 @@ BR.LayersConfig = L.Class.extend({
layer.subdomains = props.subdomains;
}
} else if (props.dataSource === 'OverpassAPI') {
layer = this.createOverpassLayer(props.query);
layer = this.createOverpassLayer(props.query, props.icon);
} else {
// JOSM
var josmUrl = url;