mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-06-20 01:34:43 +02:00
up style detail
This commit is contained in:
parent
6ac7a95020
commit
7c809b9629
3 changed files with 93 additions and 60 deletions
|
@ -22,7 +22,7 @@ const lcm_color_utils = {
|
||||||
getColor: (feature) => {
|
getColor: (feature) => {
|
||||||
|
|
||||||
let outputPower = lcm_utils.guessOutputPowerFromFeature(feature)
|
let outputPower = lcm_utils.guessOutputPowerFromFeature(feature)
|
||||||
feature.properties.tags.has_output_of_irve_specified = outputPower
|
// feature.properties.tags.has_output_of_irve_specified = outputPower
|
||||||
if (outputPower) {
|
if (outputPower) {
|
||||||
|
|
||||||
if (outputPower > max_out_legit_power) {
|
if (outputPower > max_out_legit_power) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import lcm_config from './lcm_config.js'
|
||||||
import lcm_utils from './lcm_utils.js'
|
import lcm_utils from './lcm_utils.js'
|
||||||
import lcm_color_utils from './lcm_color_utils.js'
|
import lcm_color_utils from './lcm_color_utils.js'
|
||||||
import {sendToJOSM, createJOSMEditLink} from './lcm_editor.js'
|
import {sendToJOSM, createJOSMEditLink} from './lcm_editor.js'
|
||||||
|
|
||||||
let geojsondata;
|
let geojsondata;
|
||||||
let lastLatLng;
|
let lastLatLng;
|
||||||
|
|
||||||
|
@ -144,7 +145,6 @@ function buildOverpassApiUrl(map, overpassQuery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function supprimerMarqueurs() {
|
function supprimerMarqueurs() {
|
||||||
all_stations_markers.clearLayers();
|
all_stations_markers.clearLayers();
|
||||||
|
|
||||||
|
@ -384,8 +384,7 @@ function eachFeature(feature, layer) {
|
||||||
if (display_unknown_max_power_station === 'show_only') {
|
if (display_unknown_max_power_station === 'show_only') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
// on cache cette station si on ne veut pas voir les stations à la puissance inconnue
|
// on cache cette station si on ne veut pas voir les stations à la puissance inconnue
|
||||||
if (display_unknown_max_power_station === 'hide') {
|
if (display_unknown_max_power_station === 'hide') {
|
||||||
return;
|
return;
|
||||||
|
@ -403,7 +402,6 @@ function eachFeature(feature, layer) {
|
||||||
const panoramaxLink = `https://api.panoramax.xyz/#focus=map&map=16.7/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}&speed=250`;
|
const panoramaxLink = `https://api.panoramax.xyz/#focus=map&map=16.7/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}&speed=250`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let html = ` <a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_car#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire en voiture vers cette station"> 🚗</a>
|
let html = ` <a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_car#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire en voiture vers cette station"> 🚗</a>
|
||||||
<a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_bike#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire en vélo vers cette station">🚴♀️</a>
|
<a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_bike#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire en vélo vers cette station">🚴♀️</a>
|
||||||
<a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_foot#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire à pied vers cette station">👠</a>
|
<a href="https://www.openstreetmap.org/directions?from=&to=${feature.geometry.coordinates[1]},${feature.geometry.coordinates[0]}&engine=fossgis_osrm_foot#map=14/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}" class="navigation-link by-car" title="itinéraire à pied vers cette station">👠</a>
|
||||||
|
@ -412,7 +410,7 @@ function eachFeature(feature, layer) {
|
||||||
<a href="${panoramaxLink}" target="_blank" class="panoramax-link" title="Voir sur Panoramax">
|
<a href="${panoramaxLink}" target="_blank" class="panoramax-link" title="Voir sur Panoramax">
|
||||||
<img src="styles/images/panoramax.ico" alt="icone"></a>
|
<img src="styles/images/panoramax.ico" alt="icone"></a>
|
||||||
<span class="color-indication" style="background-color: ${color};">${displayOutPowerGuessed}</span>
|
<span class="color-indication" style="background-color: ${color};">${displayOutPowerGuessed}</span>
|
||||||
<button id="fullDetails" >détails</button>
|
<button class="edit-button" id="fullDetails" >détails</button>
|
||||||
<span class="popup-content">${popupContent}</span>`;
|
<span class="popup-content">${popupContent}</span>`;
|
||||||
|
|
||||||
let zoom = map.getZoom();
|
let zoom = map.getZoom();
|
||||||
|
@ -459,10 +457,8 @@ function eachFeature(feature, layer) {
|
||||||
*/
|
*/
|
||||||
// info de câble manquant
|
// info de câble manquant
|
||||||
if (display_alert_cable_missing) {
|
if (display_alert_cable_missing) {
|
||||||
console.log('display_alert_cable_missing', display_alert_cable_missing)
|
|
||||||
|
|
||||||
let keys = Object.keys(feature.properties)
|
let keys = Object.keys(feature.properties)
|
||||||
console.log('feature.properties', keys)
|
|
||||||
/**
|
/**
|
||||||
* on considère l'information de câble manquante uniquement dans le cas où une info de socket de type 2 est présente mais pas le tag socket:type2_cable.
|
* on considère l'information de câble manquante uniquement dans le cas où une info de socket de type 2 est présente mais pas le tag socket:type2_cable.
|
||||||
*/
|
*/
|
||||||
|
@ -524,6 +520,7 @@ function eachFeature(feature, layer) {
|
||||||
mouseover: function () {
|
mouseover: function () {
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
bindEventsOnJosmRemote();
|
bindEventsOnJosmRemote();
|
||||||
|
bindFullDetails(feature);
|
||||||
},
|
},
|
||||||
mouseout: function () {
|
mouseout: function () {
|
||||||
// setTimeout(() => this.closePopup(), 15000);
|
// setTimeout(() => this.closePopup(), 15000);
|
||||||
|
@ -531,17 +528,37 @@ function eachFeature(feature, layer) {
|
||||||
click: function () {
|
click: function () {
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
bindEventsOnJosmRemote();
|
bindEventsOnJosmRemote();
|
||||||
|
bindFullDetails(feature);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindFullDetails(feature) {
|
function bindFullDetails(feature) {
|
||||||
|
|
||||||
$('#fullDetails'.on('click', ()=>{
|
$('#fullDetails').on('click', () => {
|
||||||
|
console.log('details', feature)
|
||||||
|
console.log("$('#current_station_infos')", $('#current_station_infos')[0])
|
||||||
|
|
||||||
$('#current_station_infos').html('<pre>'+feature.properties+'</pre>')
|
let content = '<table>' +
|
||||||
}))
|
'<tbody>' + ''
|
||||||
|
|
||||||
|
let ii=0
|
||||||
|
let keys = Object.keys(feature.properties.tags)
|
||||||
|
keys.forEach( (elem, val) => {
|
||||||
|
console.log('elem, val', elem, val)
|
||||||
|
content += '<tr><td>'+elem+'</td><td>'+feature.properties.tags[elem]+'</td></tr>';
|
||||||
|
ii++;
|
||||||
|
})
|
||||||
|
content += '</tbody>' +
|
||||||
|
'</table>'
|
||||||
|
|
||||||
|
console.log('content', content)
|
||||||
|
$('#current_station_infos')[0].innerHTML = `<h2>Détails</h2>
|
||||||
|
${content}`
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeCssClassFromTags(tags) {
|
function makeCssClassFromTags(tags) {
|
||||||
let tagKeys = Object.keys(tags)
|
let tagKeys = Object.keys(tags)
|
||||||
if (!tags) {
|
if (!tags) {
|
||||||
|
@ -706,6 +723,7 @@ function updateExternalEditorsLinks(){
|
||||||
idLink(center.lat, center.lng, zoom)
|
idLink(center.lat, center.lng, zoom)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapCompleteLink(lat, lon, zoom) {
|
function mapCompleteLink(lat, lon, zoom) {
|
||||||
$("mapCompleteLink").attr('href', `https://mapcomplete.org/charging_stations?z=${zoom}&lat=${lat}&lon=${lon}`)
|
$("mapCompleteLink").attr('href', `https://mapcomplete.org/charging_stations?z=${zoom}&lat=${lat}&lon=${lon}`)
|
||||||
}
|
}
|
||||||
|
@ -820,7 +838,6 @@ function init() {
|
||||||
L.control.layers(null, overlayMaps).addTo(map);
|
L.control.layers(null, overlayMaps).addTo(map);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#sendToJOSM').on('click', () => {
|
$('#sendToJOSM').on('click', () => {
|
||||||
sendToJOSM(map, geojsondata)
|
sendToJOSM(map, geojsondata)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
@ -56,6 +56,21 @@ p {
|
||||||
border: solid 2px;
|
border: solid 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table {
|
||||||
|
tr {
|
||||||
|
td {
|
||||||
|
border-bottom: #ccc 1px solid;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-of-type(odd) {
|
||||||
|
background: #dedede;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.padded {
|
.padded {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
@ -584,6 +599,7 @@ header {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue