feature: vmax szlaków

This commit is contained in:
2023-02-11 03:08:24 +01:00
parent 3f818069cd
commit 8bedc4dfc6
7 changed files with 207 additions and 199 deletions
@@ -4,12 +4,10 @@
<b>{{ $t('scenery.one-way-routes') }}</b> <b>{{ $t('scenery.one-way-routes') }}</b>
<ul class="routes-list"> <ul class="routes-list">
<li <li v-for="route in station.generalInfo.routes.oneWay">
v-for="route in station.generalInfo.routes.oneWay" <span :class="{ 'no-catenary': !route.catenary, internal: route.isInternal }"> {{ route.name }}</span>
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }" <span v-if="route.speed" class="speed">{{ route.speed }}</span>
> <span v-if="route.SBL" class="sbl">SBL</span>
{{ route.name }}
<b v-if="route.SBL">SBL</b>
</li> </li>
</ul> </ul>
</div> </div>
@@ -18,41 +16,13 @@
<b>{{ $t('scenery.two-way-routes') }}</b> <b>{{ $t('scenery.two-way-routes') }}</b>
<ul class="routes-list"> <ul class="routes-list">
<li <li v-for="route in station.generalInfo.routes.twoWay">
v-for="route in station.generalInfo.routes.twoWay" <span :class="{ 'no-catenary': !route.catenary, internal: route.isInternal }">{{ route.name }}</span>
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }" <span v-if="route.speed" class="speed">{{ route.speed }}</span>
> <span v-if="route.SBL" class="sbl">SBL</span>
{{ route.name }} <b v-if="route.SBL">SBL</b>
</li> </li>
</ul> </ul>
</div> </div>
<!-- <div
class="route-info"
:class="{ 'no-catenary': !route.catenary, internal: route.isInternal }"
v-for="route in [...station.generalInfo.routes.oneWay, ...station.generalInfo.routes.twoWay].filter(
(route) => route.name != '-'
)"
:key="route.name"
:title="`Szlak ${route.name}: ${route.isInternal ? 'wewnętrzny' : 'zewnętrzny'}, ${
route.tracks == 2 ? 'dwutorowy' : 'jednotorowy'
}, ${route.catenary ? 'zelektryfikowany' : 'niezelektryfikowany'} z ${route.SBL ? 'SBL' : 'PBL'} ${
route.TWB ? 'i blokadą dwukierunkową' : ''
}`"
> -->
<!-- <span class="track-name">
<b>{{ route.name }}</b>
</span> -->
<!--
<span class="track-specs">
{{ route.tracks }}tor
<img v-if="route.catenary" :src="icons.trackCatenary" alt="icon track catenary" />
<img v-else :src="icons.trackNoCatenary" alt="icon track no catenary" />
<img v-if="route.TWB" :src="icons.trackTWB" alt="icon track twb" />
<img v-if="route.SBL" :src="icons.trackSBL" alt="icon track sbl" />
</span> -->
<!-- </div> -->
</section> </section>
</template> </template>
@@ -93,21 +63,43 @@ ul.routes-list {
display: flex; display: flex;
li { li {
background-color: #007599; margin: 0.2em 0.25em;
padding: 0.2em 0.25em; span {
margin-left: 0.25em; padding: 0.2em 0.25em;
background-color: #007599;
font-weight: bold;
&.no-catenary { &.no-catenary {
background-color: #686868; background-color: #686868;
} }
&.internal { &.internal {
text-decoration: underline; text-decoration: underline;
} }
b { &.speed {
color: var(--clr-primary); background-color: #404040;
color: #cfcfcf;
}
&.sbl {
color: var(--clr-primary);
background-color: #404040;
}
&:last-child {
border-radius: 0 0.5em 0.5em 0;
}
&:first-child {
border-radius: 0.5em 0 0 0.5em;
}
&:only-child {
border-radius: 0.5em;
}
} }
} }
} }
@@ -89,6 +89,7 @@ import dateMixin from '../../mixins/dateMixin';
import imageMixin from '../../mixins/imageMixin'; import imageMixin from '../../mixins/imageMixin';
import Train from '../../scripts/interfaces/Train'; import Train from '../../scripts/interfaces/Train';
import TrainStop from '../../scripts/interfaces/TrainStop'; import TrainStop from '../../scripts/interfaces/TrainStop';
import { useStore } from '../../store/store';
import StopDate from '../Global/StopDate.vue'; import StopDate from '../Global/StopDate.vue';
export default defineComponent({ export default defineComponent({
@@ -106,6 +107,8 @@ export default defineComponent({
setup(props) { setup(props) {
return { return {
store: useStore(),
lastConfirmed: computed(() => { lastConfirmed: computed(() => {
return props.train.timetableData!.followingStops.findIndex( return props.train.timetableData!.followingStops.findIndex(
(stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed && !stops[i + 1]?.stopped (stop, i, stops) => stop.confirmed && !stops[i + 1]?.confirmed && !stops[i + 1]?.stopped
@@ -424,3 +427,4 @@ ul.stop_list > li.stop {
} }
} }
</style> </style>
+26 -23
View File
@@ -1,27 +1,30 @@
export default interface StationRoutes { export default interface StationRoutes {
oneWay: oneWay: {
{ name: string;
name: string; catenary: boolean;
catenary: boolean; SBL: boolean;
SBL: boolean; TWB: boolean;
TWB: boolean; isInternal: boolean;
isInternal: boolean; tracks: number;
tracks: number; speed: number;
}[]; length: number;
}[];
twoWay: { twoWay: {
name: string; name: string;
catenary: boolean; catenary: boolean;
SBL: boolean; SBL: boolean;
TWB: boolean; TWB: boolean;
isInternal: boolean; isInternal: boolean;
tracks: number; tracks: number;
}[]; speed: number;
length: number;
}[];
/* [catenary, noCatenary] */ /* [catenary, noCatenary] */
oneWayCatenaryRouteNames: string[]; oneWayCatenaryRouteNames: string[];
oneWayNoCatenaryRouteNames: string[]; oneWayNoCatenaryRouteNames: string[];
twoWayCatenaryRouteNames: string[]; twoWayCatenaryRouteNames: string[];
twoWayNoCatenaryRouteNames: string[]; twoWayNoCatenaryRouteNames: string[];
sblRouteNames: string[]; sblRouteNames: string[];
} }
+1 -1
View File
@@ -12,7 +12,7 @@ export default interface Train {
driverId: number; driverId: number;
trainNo: number; trainNo: number;
driverName: string; driverName: string;
driverLevel: number; driverLevel?: number;
currentStationName: string; currentStationName: string;
currentStationHash: string; currentStationHash: string;
locoURL: string; locoURL: string;
+1 -1
View File
@@ -1,4 +1,4 @@
export default interface TrainStop { export default interface TrainStop {
stopName: string; stopName: string;
stopNameRAW: string; stopNameRAW: string;
stopType: string; stopType: string;
+63 -55
View File
@@ -24,6 +24,7 @@ export const useStore = defineStore('store', {
stationList: [], stationList: [],
trainList: [], trainList: [],
routesList: [],
sceneryData: [], sceneryData: [],
lastDispatcherStatuses: [], lastDispatcherStatuses: [],
@@ -115,8 +116,8 @@ export const useStore = defineStore('store', {
sceneries: timetable.sceneries, sceneries: timetable.sceneries,
} }
: undefined, : undefined,
}; } as Train;
}) as Train[]; });
}, },
getDispatcherStatus(onlineStationData: StationAPIData) { getDispatcherStatus(onlineStationData: StationAPIData) {
@@ -294,65 +295,72 @@ export const useStore = defineStore('store', {
return; return;
} }
this.stationList = sceneryData.map((scenery) => ({ this.stationList = sceneryData.map((scenery) => {
name: scenery.name, return {
name: scenery.name,
generalInfo: { generalInfo: {
...scenery, ...scenery,
authors: scenery.authors?.split(',').map((a) => a.trim()), authors: scenery.authors?.split(',').map((a) => a.trim()),
routes: routes:
scenery.routes scenery.routes
?.split(';') ?.split(';')
.filter((routeString) => routeString) .filter((routeString) => routeString)
.reduce( .reduce(
(acc, routeString) => { (acc, routeString) => {
const specs1 = routeString.split('_')[0]; const specs1 = routeString.split('_')[0];
const isInternal = specs1.startsWith('!'); const isInternal = specs1.startsWith('!');
const name = isInternal ? specs1.replace('!', '') : specs1; const name = isInternal ? specs1.replace('!', '') : specs1;
const specs2 = routeString.split('_')[1].split(''); const specs2 = routeString.split('_')[1].split('');
const twoWay = specs2[0] == '2'; const twoWay = specs2[0] == '2';
const catenary = specs2[1] == 'E'; const catenary = specs2[1] == 'E';
const SBL = specs2[2] == 'S'; const SBL = specs2[2] == 'S';
const TWB = specs2[3] ? true : false; const TWB = specs2[3] ? true : false;
const speed = Number(routeString.split(':')[1]) || 0;
const length = Number(routeString.split(':')[2]) || 0;
const propName = twoWay
? catenary
? 'twoWayCatenaryRouteNames'
: 'twoWayNoCatenaryRouteNames'
: catenary
? 'oneWayCatenaryRouteNames'
: 'oneWayNoCatenaryRouteNames';
acc[twoWay ? 'twoWay' : 'oneWay'].push({ const propName = twoWay
name, ? catenary
SBL, ? 'twoWayCatenaryRouteNames'
TWB, : 'twoWayNoCatenaryRouteNames'
catenary, : catenary
isInternal, ? 'oneWayCatenaryRouteNames'
tracks: twoWay ? 2 : 1, : 'oneWayNoCatenaryRouteNames';
});
if (!isInternal) acc[propName].push(name);
if (SBL) acc['sblRouteNames'].push(name); acc[twoWay ? 'twoWay' : 'oneWay'].push({
name,
SBL,
TWB,
catenary,
isInternal,
tracks: twoWay ? 2 : 1,
length,
speed,
});
if (!isInternal) acc[propName].push(name);
return acc; if (SBL) acc['sblRouteNames'].push(name);
},
{ return acc;
oneWay: [], },
twoWay: [], {
sblRouteNames: [], oneWay: [],
oneWayCatenaryRouteNames: [], twoWay: [],
oneWayNoCatenaryRouteNames: [], sblRouteNames: [],
twoWayCatenaryRouteNames: [], oneWayCatenaryRouteNames: [],
twoWayNoCatenaryRouteNames: [], oneWayNoCatenaryRouteNames: [],
} as StationRoutes twoWayCatenaryRouteNames: [],
) || {}, twoWayNoCatenaryRouteNames: [],
checkpoints: scenery.checkpoints } as StationRoutes
? scenery.checkpoints.split(';').map((sub) => ({ checkpointName: sub, scheduledTrains: [] })) ) || {},
: [], checkpoints: scenery.checkpoints
}, ? scenery.checkpoints.split(';').map((sub) => ({ checkpointName: sub, scheduledTrains: [] }))
})); : [],
},
};
});
}, },
connectToWebsocket() { connectToWebsocket() {
+1
View File
@@ -69,6 +69,7 @@ export interface StationJSONData {
SUP: boolean; SUP: boolean;
routes: string; routes: string;
checkpoints: string | null; checkpoints: string | null;
authors?: string; authors?: string;