chore: added route control abbrevs

This commit is contained in:
2025-01-28 00:17:10 +01:00
parent c862164f69
commit 519d5ec5fa
3 changed files with 39 additions and 12 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
class="text-center align-top border-l border-t-white print:border-l-black" class="text-center align-top border-l border-t-white print:border-l-black"
:class="{ :class="{
'border-t print:border-t-black': i != 0 && computedTimetable[i - 1].realLine != row.realLine, 'border-t print:border-t-black': i != 0 && computedTimetable[i - 1].realLine != row.realLine,
'border-b': i == computedTimetable.length - 1, 'border-b print:border-b-black': i == computedTimetable.length - 1,
}" }"
> >
{{ i == 0 || computedTimetable[i - 1].realLine != row.realLine ? row.realLine : ' ' }} {{ i == 0 || computedTimetable[i - 1].realLine != row.realLine ? row.realLine : ' ' }}
@@ -90,7 +90,7 @@
<div class="flex justify-between"> <div class="flex justify-between">
<span>{{ row.pointKm }}</span> <span>{{ row.pointKm }}</span>
<span>R1, PP</span> <span>{{ row.abbrevs.join(', ') }}</span>
</div> </div>
</div> </div>
</div> </div>
+36 -8
View File
@@ -20,7 +20,7 @@ import { useApiStore } from '../../stores/api.store';
import { useGlobalStore } from '../../stores/global.store'; import { useGlobalStore } from '../../stores/global.store';
import TimetableBody from './TimetableBody.vue'; import TimetableBody from './TimetableBody.vue';
import TimetableHeader from './TimetableHeader.vue'; import TimetableHeader from './TimetableHeader.vue';
import type { StopRow } from '../../types/common.types'; import type { SceneryRoute, StopRow } from '../../types/common.types';
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const apiStore = useApiStore(); const apiStore = useApiStore();
@@ -70,13 +70,23 @@ const computedTimetable = computed(() => {
let lastDepartureTimestamp = 0; let lastDepartureTimestamp = 0;
let arrivalKm = 0, let arrivalKm = 0,
arrivalSpeed = currentPath.departureLineData?.routeSpeed ?? 0, arrivalSpeed = 0,
arrivalTracks = currentPath.departureLineData?.routeTracks ?? 0; arrivalTracks = 0,
departureSpeed = 0,
departureTracks = 2,
realLineNo = 0,
abbrevs = [] as string[];
let departureSpeed = currentPath.departureLineData?.routeSpeed ?? 0, if (currentPath.departureLineData) {
departureTracks = currentPath.departureLineData?.routeTracks ?? 2; arrivalSpeed = currentPath.departureLineData.routeSpeed;
arrivalTracks = currentPath.departureLineData.routeTracks;
let realLineNo = currentPath.departureLineData?.realLineNo ?? 0; departureSpeed = currentPath.departureLineData.routeSpeed;
departureTracks = currentPath.departureLineData.routeTracks;
realLineNo = currentPath.departureLineData?.realLineNo ?? 0;
abbrevs = getAbbrevs(currentPath.departureLineData);
}
// console.debug('=========== ' + this.selectedTrain.trainNo + ' ==========='); // console.debug('=========== ' + this.selectedTrain.trainNo + ' ===========');
@@ -88,6 +98,7 @@ const computedTimetable = computed(() => {
arrivalSpeed = currentPath.arrivalLineData.routeSpeed; arrivalSpeed = currentPath.arrivalLineData.routeSpeed;
arrivalTracks = currentPath.arrivalLineData.routeTracks; arrivalTracks = currentPath.arrivalLineData.routeTracks;
realLineNo = currentPath.arrivalLineData.realLineNo ?? 0; realLineNo = currentPath.arrivalLineData.realLineNo ?? 0;
abbrevs = getAbbrevs(currentPath.arrivalLineData);
} }
departureSpeed = arrivalSpeed; departureSpeed = arrivalSpeed;
@@ -106,6 +117,7 @@ const computedTimetable = computed(() => {
correctedDepartureSpeed = internalRouteInfo.routeSpeed; correctedDepartureSpeed = internalRouteInfo.routeSpeed;
departureSpeed = internalRouteInfo.routeSpeed; departureSpeed = internalRouteInfo.routeSpeed;
realLineNo = internalRouteInfo.realLineNo ?? realLineNo; realLineNo = internalRouteInfo.realLineNo ?? realLineNo;
abbrevs = getAbbrevs(internalRouteInfo);
correctedDepartureTracks = internalRouteInfo.routeTracks; correctedDepartureTracks = internalRouteInfo.routeTracks;
departureTracks = internalRouteInfo.routeTracks; departureTracks = internalRouteInfo.routeTracks;
@@ -122,8 +134,8 @@ const computedTimetable = computed(() => {
sceneryName: currentPath.sceneryName, sceneryName: currentPath.sceneryName,
realLine: realLineNo == 0 ? '' : realLineNo.toString(), realLine: realLineNo == 0 ? '' : realLineNo.toString(),
driveTime: lastDepartureTimestamp ? stop.arrivalTimestamp - lastDepartureTimestamp : 0, driveTime: lastDepartureTimestamp ? stop.arrivalTimestamp - lastDepartureTimestamp : 0,
additionalAbbrevs: [],
controlAbbrevs: [], abbrevs,
arrivalKm: arrivalKm.toFixed(3), arrivalKm: arrivalKm.toFixed(3),
departureKm: stop.stopDistance.toFixed(3), departureKm: stop.stopDistance.toFixed(3),
@@ -162,6 +174,9 @@ const computedTimetable = computed(() => {
if (stopRows[i].isMain || stopRows[i].pointName.endsWith(', podg')) { if (stopRows[i].isMain || stopRows[i].pointName.endsWith(', podg')) {
stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed; stopRows[i].departureSpeed = currentPath.departureLineData.routeSpeed;
stopRows[i].departureTracks = currentPath.departureLineData.routeTracks; stopRows[i].departureTracks = currentPath.departureLineData.routeTracks;
abbrevs = getAbbrevs(currentPath.departureLineData);
stopRows[i].abbrevs = abbrevs;
break; break;
} }
@@ -180,4 +195,17 @@ const computedTimetable = computed(() => {
return stopRows; return stopRows;
}); });
function getAbbrevs(routeData: SceneryRoute) {
const abbrevs = [];
if (routeData.isRouteSBL == true) abbrevs.push(`${routeData.routeSpeed > 130 ? '4' : ''}S${routeData.routeTracks == 2 ? 'S' : ''}`);
else if (routeData.routeTracks == 2) abbrevs.push('PP');
return abbrevs;
}
// function getRadioChannel() {
// return Math.floor(Math.random() * 6 + 1);
// }
</script> </script>
+1 -2
View File
@@ -132,8 +132,7 @@ export interface StopRow {
scheduledDepartureDate: Date | null; scheduledDepartureDate: Date | null;
realLine: string; realLine: string;
driveTime: number; driveTime: number;
controlAbbrevs: string[]; abbrevs: string[];
additionalAbbrevs: string[];
sceneryName: string; sceneryName: string;
arrivalKm: string; arrivalKm: string;
arrivalSpeed: number; arrivalSpeed: number;