add stops info

This commit is contained in:
2025-12-15 14:51:30 +01:00
parent a43bdda953
commit 10d1d133ef
3 changed files with 41 additions and 4 deletions

View File

@@ -68,11 +68,13 @@ export default class MhdMapClient {
this.baseMapLayer = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap',
maxZoom: 19
maxZoom: this.map.options.maxZoom,
maxNativeZoom: 19
}).addTo(this.map);
this.georefLayer = L.tileLayer('https://maps.georeferencer.com/georeferences/e886f898-04e0-4479-8cd3-bbe4ae7537b3/2022-06-22T09:24:26.012877Z/map/{z}/{x}/{y}.png?key=c0WCCJEkXmpgh7TxHg2U', {
maxZoom: 17
maxZoom: this.map.options.maxZoom,
maxNativeZoom: 17,
});
this.layerControl = L.control.layers({
@@ -277,6 +279,16 @@ export default class MhdMapClient {
}
async fillStopInfo(stop, event) {
let stopData = await this.sendWs('requestStopInfo', {
stationStopId: stop.stationStopId,
});
if (stopData.data.departures.length === 0)
return;
console.log(stopData.data.departures.length);
}
async drawVehicleTrace(vehId) {
this.currentVehicleTrace.clearLayers();
if (vehId === null)
@@ -414,6 +426,12 @@ export default class MhdMapClient {
this.drawVehicleTrace(veh.vehicleNumber);
}
let stop = event?.popup?._source?.options?.data?.stop;
if (stop) {
// the user has clicked a stop marker
this.fillStopInfo(stop, event);
}
}
_popupCloseEvent(event) {