mirror of
https://forge.chapril.org/tykayn/libre-charge-map
synced 2025-06-20 01:34:43 +02:00
up details binding
This commit is contained in:
parent
d34b753d53
commit
68e7dc19fc
1 changed files with 47 additions and 32 deletions
|
@ -600,9 +600,9 @@ function makePopupOfFeature(feature) {
|
|||
* @param layer
|
||||
*/
|
||||
function eachFeature(feature, layer, stats) {
|
||||
let outPowerGuessed = lcm_utils.guessOutputPowerFromFeature(feature);
|
||||
const maxPowerFilter = parseInt($('#filter_max_output').val()) || lcm_config.filter_max_output_default_value;
|
||||
|
||||
const maxPowerFilter = parseInt($('#filter_max_output').val()) || lcm_config.filter_max_output_default_value;
|
||||
let outPowerGuessed = lcm_utils.guessOutputPowerFromFeature(feature);
|
||||
// Filtrage par puissance
|
||||
if (outPowerGuessed === 0 || outPowerGuessed === null) {
|
||||
if (display_unknown_max_power_station === 'hide') {
|
||||
|
@ -618,12 +618,10 @@ function eachFeature(feature, layer, stats) {
|
|||
// Incrémenter le compteur de stations affichées
|
||||
displayedStationsCount++;
|
||||
|
||||
let link_josm = createJOSMEditLink(feature);
|
||||
|
||||
let popupContent = makePopupOfFeature(feature);
|
||||
layer.bindPopup(popupContent);
|
||||
|
||||
let displayOutPowerGuessed = '? kW';
|
||||
|
||||
// Vérifier les filtres activés
|
||||
if (lcm_config.filterCCS && !feature.properties.tags['socket:type2_combo']) {
|
||||
|
@ -670,6 +668,7 @@ function eachFeature(feature, layer, stats) {
|
|||
}
|
||||
}
|
||||
|
||||
let displayOutPowerGuessed = '? kW';
|
||||
if (outPowerGuessed) {
|
||||
displayOutPowerGuessed = outPowerGuessed + ' kW max';
|
||||
if (display_unknown_max_power_station === 'show_only') {
|
||||
|
@ -689,9 +688,6 @@ function eachFeature(feature, layer, stats) {
|
|||
<a class="edit-button" href="https://www.openstreetmap.org/edit?editor=remote&node=${feature.properties.id}">ajoutez la dans OpenStreetMap!</a></span>`;
|
||||
}
|
||||
|
||||
// Ajout du lien vers Panoramax
|
||||
const panoramaxLink = `https://api.panoramax.xyz/#focus=map&map=16.7/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}&speed=250`;
|
||||
|
||||
|
||||
// contenu de la popup
|
||||
let html = `<span class="color-indication" style="background-color: ${lcm_color_utils.getColor(feature)};">${displayOutPowerGuessed}</span>
|
||||
|
@ -819,30 +815,52 @@ function eachFeature(feature, layer, stats) {
|
|||
bindFullDetails(feature);
|
||||
|
||||
// Remplir automatiquement #current_station_infos lors du clic
|
||||
fillDetailsWithFeature(feature);
|
||||
},
|
||||
});
|
||||
|
||||
let content = '';
|
||||
let table_details = '';
|
||||
let count_features_in_table = 0;
|
||||
table_details += '<div class="key-values" >'
|
||||
// ne montrer que certains champs dans la popup
|
||||
lcm_config.tags_to_display_in_popup.forEach(function (key) {
|
||||
if (lcm_config.tags_to_display_in_popup.indexOf(key)) {
|
||||
let value = feature.properties.tags[key]
|
||||
if (value) {
|
||||
if (value.indexOf('http') !== -1) {
|
||||
value = '<a href="' + value + '">' + value + '</a>'
|
||||
}
|
||||
table_details += '<br/><strong class="popup-key">' + key + ' :</strong><span class="popup-value">' + value + '</span>'
|
||||
count_features_in_table++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remplit le contenu de #current_station_infos avec les informations de la station
|
||||
* @param {*} feature
|
||||
*/
|
||||
function fillDetailsWithFeature(feature) {
|
||||
|
||||
|
||||
// Ajout du lien vers Panoramax
|
||||
const panoramaxLink = `https://api.panoramax.xyz/#focus=map&map=16.7/${feature.geometry.coordinates[1]}/${feature.geometry.coordinates[0]}&speed=250`;
|
||||
|
||||
|
||||
let link_josm = createJOSMEditLink(feature);
|
||||
let outPowerGuessed = lcm_utils.guessOutputPowerFromFeature(feature);
|
||||
let displayOutPowerGuessed = '? kW';
|
||||
if (outPowerGuessed) {
|
||||
displayOutPowerGuessed = outPowerGuessed + ' kW max';
|
||||
}
|
||||
let content = '';
|
||||
let table_details = '';
|
||||
let count_features_in_table = 0;
|
||||
table_details += '<div class="key-values" >'
|
||||
// ne montrer que certains champs dans la popup
|
||||
lcm_config.tags_to_display_in_popup.forEach(function (key) {
|
||||
if (lcm_config.tags_to_display_in_popup.indexOf(key)) {
|
||||
let value = feature.properties.tags[key]
|
||||
if (value) {
|
||||
if (value.indexOf('http') !== -1) {
|
||||
value = '<a href="' + value + '">' + value + '</a>'
|
||||
}
|
||||
})
|
||||
table_details += '</div>'
|
||||
|
||||
if (!count_features_in_table) {
|
||||
table_details += '<div class="no-feature-in-table">Aucune information renseignée</div>'
|
||||
table_details += '<br/><strong class="popup-key">' + key + ' :</strong><span class="popup-value">' + value + '</span>'
|
||||
count_features_in_table++;
|
||||
}
|
||||
content += ` <span class="color-indication" style="background-color: ${lcm_color_utils.getColor(feature)};">${displayOutPowerGuessed}</span>
|
||||
}
|
||||
})
|
||||
table_details += '</div>'
|
||||
|
||||
if (!count_features_in_table) {
|
||||
table_details += '<div class="no-feature-in-table">Aucune information renseignée</div>'
|
||||
}
|
||||
content += ` <span class="color-indication" style="background-color: ${lcm_color_utils.getColor(feature)};">${displayOutPowerGuessed}</span>
|
||||
|
||||
<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>
|
||||
|
@ -862,10 +880,7 @@ function eachFeature(feature, layer, stats) {
|
|||
${table_details}
|
||||
</div>
|
||||
`
|
||||
$('#current_station_infos').html(`<div class='island irve-details'><h2>Détails</h2>${content}</div>`);
|
||||
},
|
||||
});
|
||||
|
||||
$('#current_station_infos').html(`<div class='island irve-details'><h2>Détails</h2>${content}</div>`);
|
||||
}
|
||||
|
||||
function bindFullDetails(feature) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue