This commit is contained in:
fan 2023-12-08 11:09:42 +08:00
commit 664a085d92
39 changed files with 642 additions and 433 deletions

View File

@ -105,7 +105,7 @@ export async function setSwitchPosition(data: SetSwitchParams) {
} }
export interface IbpButtonOperationParams { export interface IbpButtonOperationParams {
buttonCode: string; buttonId: string;
down: boolean; down: boolean;
mapId: number; mapId: number;
simulationId: string; simulationId: string;
@ -131,7 +131,7 @@ export interface IbpKeyOperationParams {
mapId: number; mapId: number;
stationId: string; stationId: string;
gear: number; gear: number;
keyCode: string; keyId: string;
} }
export async function ibpKeyOperation(params: IbpKeyOperationParams) { export async function ibpKeyOperation(params: IbpKeyOperationParams) {
@ -142,7 +142,7 @@ export function checkMapData(data: { mapProto: string }) {
return api.post(`${UriBase}/check/data`, data); return api.post(`${UriBase}/check/data`, data);
} }
export interface SimulationIem { export interface SimulationItem {
mapId: number; mapId: number;
projectId: number; projectId: number;
simulationId: string; simulationId: string;
@ -155,7 +155,7 @@ export interface SimulationIem {
* @param * @param
* @returns * @returns
*/ */
export async function getSimulationList(): Promise<Array<SimulationIem>> { export async function getSimulationList(): Promise<Array<SimulationItem>> {
const response = await api.get(`${UriBase}/list`); const response = await api.get(`${UriBase}/list`);
return response.data; return response.data;
} }
@ -171,7 +171,7 @@ export interface createByProject {
*/ */
export async function createSimulationByProject( export async function createSimulationByProject(
data: createByProject data: createByProject
): Promise<SimulationIem> { ): Promise<SimulationItem> {
const response = await api.post(`${UriBase}/createByProject`, data); const response = await api.post(`${UriBase}/createByProject`, data);
return response.data; return response.data;
} }

View File

@ -17,7 +17,7 @@ export function useFormData<T extends GraphicDataBase>(
}); });
function onUpdate() { function onUpdate() {
const graphic = app.selectedGraphics[0]; const graphic = app.queryStore.queryById(data.id);
if (graphic) { if (graphic) {
app.updateGraphicAndRecord(graphic, toRaw(data)); app.updateGraphicAndRecord(graphic, toRaw(data));
} }

View File

@ -52,7 +52,7 @@ import {
deleteStationRelateDevice, deleteStationRelateDevice,
loadStationRelateDeviceList, loadStationRelateDeviceList,
RelateDevicelistItem, RelateDevicelistItem,
} from 'src/drawApp/thApp'; } from 'src/drawApp/commonApp';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
const drawStore = useDrawStore(); const drawStore = useDrawStore();

View File

@ -26,6 +26,14 @@
@update:model-value="onUpdate" @update:model-value="onUpdate"
label="右边关联的集中站" label="右边关联的集中站"
/> />
<q-toggle
v-model="
concentrationDividingLineModel.isOtherLineConcentrationDividingLine
"
label="是否与其它线的边界处"
emit-value
@update:model-value="onUpdate"
/>
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-item <q-item
v-for="sectionRelation in sectionRelations" v-for="sectionRelation in sectionRelations"
@ -74,6 +82,7 @@ const sectionRelations = computed(() => {
enum devicePort { enum devicePort {
'A', 'A',
'B', 'B',
'C',
} }
const concentrationDividingLine = const concentrationDividingLine =
drawStore.selectedGraphic as ConcentrationDividingLine; drawStore.selectedGraphic as ConcentrationDividingLine;
@ -108,7 +117,7 @@ onMounted(() => {
.queryStore.queryByType<Station>(Station.Type); .queryStore.queryByType<Station>(Station.Type);
centralizedStations.value = []; centralizedStations.value = [];
stations.forEach((station) => { stations.forEach((station) => {
if (station.datas.concentrationStations) { if (station.datas.concentrationStations || station.datas.depots) {
centralizedStations.value.push({ centralizedStations.value.push({
label: station.datas.stationName, label: station.datas.stationName,
value: station.datas.id, value: station.datas.id,

View File

@ -13,6 +13,7 @@ import {
createIbpRelateDevice, createIbpRelateDevice,
RelateDevicelistItem, RelateDevicelistItem,
} from 'src/drawApp/ibpDrawApp'; } from 'src/drawApp/ibpDrawApp';
import { IbpLight } from 'src/graphics/ibpLight/IbpLight';
defineExpose({ editRelateDevices }); defineExpose({ editRelateDevices });
@ -42,12 +43,13 @@ watch(
() => ibpDrawStore.selectedGraphics, () => ibpDrawStore.selectedGraphics,
(val) => { (val) => {
if (val && val.length > 0 && clickIndex !== null) { if (val && val.length > 0 && clickIndex !== null) {
const selectFilter = ibpDrawStore.selectedGraphics?.filter( const selectFilter = ibpDrawStore.selectedGraphics!.filter(
(g) => (g): g is JlGraphic =>
g.type == IBPButton.Type || g instanceof IBPButton ||
g.type == IbpAlarm.Type || g instanceof IbpAlarm ||
g.type == IbpKey.Type g instanceof IbpKey ||
) as JlGraphic[]; g instanceof IbpLight
);
selectGraphic.push(...selectFilter); selectGraphic.push(...selectFilter);
selectGraphic = Array.from(new Set(selectGraphic)); selectGraphic = Array.from(new Set(selectGraphic));
ibpDrawStore.getDrawApp().updateSelected(...selectGraphic); ibpDrawStore.getDrawApp().updateSelected(...selectGraphic);

View File

@ -79,7 +79,10 @@ const screenDoorConfig = ref<{
}); });
onMounted(() => { onMounted(() => {
if (loadScreenDoorConfig() == undefined) { if (
loadScreenDoorConfig() == undefined ||
loadScreenDoorConfig().screenDoorGroupList.length == 0
) {
const stopPositions = drawStore const stopPositions = drawStore
.getDrawApp() .getDrawApp()
.queryStore.queryByType<StopPosition>(StopPosition.Type); .queryStore.queryByType<StopPosition>(StopPosition.Type);

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { QForm } from 'quasar'; import { QForm } from 'quasar';
import { Section } from 'src/graphics/section/Section'; import { Section, DevicePort } from 'src/graphics/section/Section';
import { Turnout } from 'src/graphics/turnout/Turnout'; import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
@ -58,45 +58,36 @@ async function onSubmit() {
) => { ) => {
if (visited.includes(current.datas.id)) return; if (visited.includes(current.datas.id)) return;
visited.push(current.datas.id); visited.push(current.datas.id);
if (current instanceof Section) {
[ [
[current.datas.paRef?.id, 'A'], current.getConnectElement(DevicePort.A),
[current.datas.pbRef?.id, 'B'], current.getConnectElement(DevicePort.B),
] ].forEach((item, idx) => {
.filter((item): item is [string, 'A' | 'B'] => !!item[0]) if (!item) return;
.forEach(([id, port]) => { const { g, port } = item;
const target = current.queryStore.queryById<Section | Turnout>(id); if (g instanceof Turnout) {
if (target instanceof Turnout) { if (port === DevicePort.C) return;
queue.push({ queue.push({
node: target, node: g,
runningDirection, runningDirection,
}); });
} else { } else {
const isPortDiffrent = const isPortDiffrent =
(port === 'B' && target.datas.paRef?.id === current.datas.id) || (idx === 0 && port === DevicePort.B) ||
(port === 'A' && target.datas.pbRef?.id === current.datas.id); (idx === 1 && port === DevicePort.A);
const flip = current instanceof Section && !isPortDiffrent;
queue.push({ queue.push({
node: target, node: g,
runningDirection: isPortDiffrent runningDirection: flip
? runningDirection ? reverseDirection(runningDirection)
: reverseDirection(runningDirection), : runningDirection,
}); });
} }
}); });
if (current instanceof Section) {
const data = current.datas.clone(); const data = current.datas.clone();
data.normalRunningDirection = runningDirection; data.normalRunningDirection = runningDirection;
data.direction = direction.value; data.direction = direction.value;
current.updateData(data); current.updateData(data);
} else {
[current.datas.paRef?.id, current.datas.pbRef?.id]
.filter((id): id is string => !!id)
.forEach((id) => {
const target = current.queryStore.queryById<Section | Turnout>(id);
queue.push({
node: target,
runningDirection,
});
});
} }
}; };

View File

@ -46,7 +46,7 @@ import {
creatStationRelateDevice, creatStationRelateDevice,
editStationRelateDevice, editStationRelateDevice,
RelateDevicelistItem, RelateDevicelistItem,
} from 'src/drawApp/thApp'; } from 'src/drawApp/commonApp';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import SelectConfigUtils from 'src/components/common/SelectConfigUtils.vue'; import SelectConfigUtils from 'src/components/common/SelectConfigUtils.vue';

View File

@ -402,22 +402,13 @@ const signalTypeOptions = [
value: signalModel.HBU_DU, value: signalModel.HBU_DU,
}, },
]; ];
const signalTypeMap = new Map<graphicData.Signal.Model, string>([
[signalModel.HL, '红绿'],
[signalModel.HLU_FU, '红绿黄,封黄灯,无引导'],
[signalModel.HLU_DU_YY, '红绿黄,不封灯,有单黄,带引导'],
[signalModel.HLU_YY, '红绿黄,不封灯,无单黄,带引导'],
[signalModel.HLU_FL_DU_YY, '红绿黄,封绿灯,有单黄,带引导'],
[signalModel.HLU_DU, '红绿黄,不封灯,有单黄,无引导'],
[signalModel.AB, '蓝白'],
[signalModel.HBU_DU, '红白黄,不封灯,有单黄,无引导'],
]);
function setSignalType() { function setSignalType() {
if (signalType.value) { if (signalType.value >= 0) {
const showType = signalTypeOptions.find(
(item) => item.value == signalType.value
)?.label;
$q.dialog({ $q.dialog({
message: `确定批量设置选中信号机的类型为【${signalTypeMap.get( message: `确定批量设置选中信号机的类型为【${showType}】吗?`,
signalType.value
)}?`,
cancel: true, cancel: true,
}).onOk(() => { }).onOk(() => {
drawStore.selectedGraphics?.forEach((signal) => { drawStore.selectedGraphics?.forEach((signal) => {

View File

@ -13,13 +13,6 @@
label="id" label="id"
hint="" hint=""
/> />
<QInput
outlined
readonly
v-model="platformState.index"
label="索引"
hint=""
/>
<QInput <QInput
outlined outlined
readonly readonly
@ -39,6 +32,7 @@
disable disable
/> />
</QItem> </QItem>
<template v-if="isSpksInfoShow">
<QSeparator class="q-mt-sm" /> <QSeparator class="q-mt-sm" />
<QItemLabel header>Spks继电器状态</QItemLabel> <QItemLabel header>Spks继电器状态</QItemLabel>
<QItem> <QItem>
@ -53,6 +47,8 @@
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
</template>
<template v-if="isMkxInfoShow">
<QSeparator class="q-mt-sm" /> <QSeparator class="q-mt-sm" />
<QItemLabel header <QItemLabel header
>门控箱继电器状态 ({{ platformState.mkxJState.code }})</QItemLabel >门控箱继电器状态 ({{ platformState.mkxJState.code }})</QItemLabel
@ -69,13 +65,14 @@
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
</template>
</QList> </QList>
</QCardSection> </QCardSection>
</QCard> </QCard>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import { ref, watch, watchEffect, onUnmounted } from 'vue'; import { ref, watch, watchEffect, onUnmounted, computed } from 'vue';
import { Platform } from 'src/graphics/platform/Platform'; import { Platform } from 'src/graphics/platform/Platform';
import { state } from 'src/protos/device_state'; import { state } from 'src/protos/device_state';
import { PlatformState } from 'src/drawApp/graphics/PlatformInteraction'; import { PlatformState } from 'src/drawApp/graphics/PlatformInteraction';
@ -83,14 +80,12 @@ import { PlatformState } from 'src/drawApp/graphics/PlatformInteraction';
const lineStore = useLineStore(); const lineStore = useLineStore();
const platformState = ref<{ const platformState = ref<{
id: string; id: string;
index: number;
code: string; code: string;
empj: boolean; empj: boolean;
spksState: state.ReplyState[]; spksState: state.ReplyState[];
mkxJState: state.MkxJState; mkxJState: state.MkxJState;
}>({ }>({
id: '', id: '',
index: 0,
code: '', code: '',
empj: false, empj: false,
spksState: [], spksState: [],
@ -126,10 +121,25 @@ watch(
} }
} }
); );
const isSpksInfoShow = computed(() => {
const selected = lineStore.selectedGraphics;
if (!selected) return;
const platform = selected[0] as Platform;
console.log(platform.states);
return platform.states.spksState?.length !== 0;
});
const isMkxInfoShow = computed(() => {
const selected = lineStore.selectedGraphics;
if (!selected) return;
const platform = selected[0] as Platform;
return platform.states.mkxJState?.replyState?.length !== 0;
});
function setPlatformState(platform: Platform) { function setPlatformState(platform: Platform) {
platformState.value = { platformState.value = {
id: platform.datas.id, id: platform.datas.id,
index: platform.datas.index,
code: platform.datas.code, code: platform.datas.code,
empj: platform.states.empj ?? false, empj: platform.states.empj ?? false,
spksState: platform.states.spksState ?? [], spksState: platform.states.spksState ?? [],

View File

@ -1,16 +1,17 @@
<template> <template>
<q-card flat bordered> <q-card flat bordered>
<q-card-section> <q-card-section class="row justify-between items-center q-pb-none">
<div class="text-h6">车站状态</div> <div class="text-h6">车站状态</div>
<q-btn color="primary" @click="openIbp">打开IBP</q-btn>
</q-card-section> </q-card-section>
<q-separator inset /> <q-separator inset />
<q-card-section>
<q-form> <q-form>
<q-input outlined readonly v-model="stationState.id" label="id" hint="" />
<q-input <q-input
outlined outlined
readonly readonly
v-model="stationState.index" v-model="stationState.id"
label="索引" label="id"
hint="" hint=""
/> />
<q-input <q-input
@ -20,15 +21,17 @@
label="名称" label="名称"
/> />
</q-form> </q-form>
</q-card-section>
</q-card> </q-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import { ref, watch, onMounted } from 'vue'; import { ref, watch, onMounted, computed } from 'vue';
import { Station } from 'src/graphics/station/Station'; import { Station } from 'src/graphics/station/Station';
import { useIbpStore } from 'src/stores/ibp-store';
const lineStore = useLineStore(); const lineStore = useLineStore();
const stationState = ref({ id: '', index: 0, code: '' }); const stationState = ref({ id: '', code: '' });
watch( watch(
() => lineStore.selectedGraphics, () => lineStore.selectedGraphics,
@ -38,28 +41,26 @@ watch(
} else { } else {
stationState.value = { stationState.value = {
id: '', id: '',
index: 0,
code: '', code: '',
}; };
} }
} }
); );
function openIbp() {
const selected = lineStore.selectedGraphics;
if (!selected) return;
const station = selected[0] as Station;
if (!station) return;
useIbpStore().openIbpScene(station);
}
function setStationState(station: Station) { function setStationState(station: Station) {
stationState.value = { stationState.value = {
id: station.datas.id, id: station.datas.id,
index: station.datas.index,
code: station.datas.code, code: station.datas.code,
}; };
} }
function submitState() {
if (lineStore.simulationId) {
}
}
function onReset() {
if (lineStore.selectedGraphics) {
setStationState(lineStore.selectedGraphics[0] as Station);
}
}
onMounted(() => { onMounted(() => {
if (lineStore.selectedGraphics) { if (lineStore.selectedGraphics) {

View File

@ -255,6 +255,7 @@ export function loadCommonDrawDatas(
kilometerConvertList = storage.kilometerConvertList; kilometerConvertList = storage.kilometerConvertList;
sectionCodePointList = storage.sectionCodePointList; sectionCodePointList = storage.sectionCodePointList;
otherLineList = storage.otherLineList; otherLineList = storage.otherLineList;
refDevicesList = storage.stationRelateDeviceList;
storage.Platforms.forEach((platform) => { storage.Platforms.forEach((platform) => {
datas.push(new PlatformData(platform)); datas.push(new PlatformData(platform));
}); });
@ -318,10 +319,7 @@ export function loadCommonDrawDatas(
return datas; return datas;
} }
export function saveCommonDrawDatas( export function saveCommonDrawDatas(app: IDrawApp) {
app: IDrawApp,
refDevicesList?: graphicData.StationRelateDevice[]
) {
const storage = new graphicData.RtssGraphicStorage(); const storage = new graphicData.RtssGraphicStorage();
const canvasData = app.canvas.saveData(); const canvasData = app.canvas.saveData();
storage.canvas = new graphicData.Canvas({ storage.canvas = new graphicData.Canvas({
@ -398,15 +396,13 @@ export function saveCommonDrawDatas(
); );
} }
}); });
if (refDevicesList) {
storage.stationRelateDeviceList = refDevicesList;
}
storage.UniqueIdPrefix = UniqueIdPrefix; storage.UniqueIdPrefix = UniqueIdPrefix;
storage.screenDoorConfig = screenDoorConfig; storage.screenDoorConfig = screenDoorConfig;
storage.generateAxleCountingConfig = generateAxleCountingConfig; storage.generateAxleCountingConfig = generateAxleCountingConfig;
storage.kilometerConvertList = kilometerConvertList; storage.kilometerConvertList = kilometerConvertList;
storage.sectionCodePointList = sectionCodePointList; storage.sectionCodePointList = sectionCodePointList;
storage.otherLineList = otherLineList; storage.otherLineList = otherLineList;
storage.stationRelateDeviceList = refDevicesList;
return storage; return storage;
} }
@ -562,3 +558,59 @@ export function editOtherLine(row: graphicData.OtherLine) {
export function deleteOtherLine(index: number) { export function deleteOtherLine(index: number) {
otherLineList.splice(index, 1); otherLineList.splice(index, 1);
} }
//关联设备列表的增删改查
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode?: string[];
expanded?: boolean;
}[];
}
let refDevicesList: graphicData.StationRelateDevice[] = [];
export function loadStationRelateDeviceList() {
return refDevicesList;
}
export function creatStationRelateDevice(row: graphicData.StationRelateDevice) {
refDevicesList.push(row);
}
export function editStationRelateDevice(
editRow: RelateDevicelistItem,
newData: graphicData.StationRelateDevice
) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == editRow.deviceType &&
refDevicesList[i].code == editRow.code
) {
refDevicesList[i] = newData;
break;
}
}
}
export function deleteStationRelateDevice(row: RelateDevicelistItem) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == row.deviceType &&
refDevicesList[i].code == row.code
) {
refDevicesList.splice(i, 1);
break;
}
}
}
export function deleteStationRelateDeviceByType(
deviceType: graphicData.RelatedRef.DeviceType
) {
refDevicesList = refDevicesList.filter(
(item) => item.deviceType !== deviceType
);
}

View File

@ -59,6 +59,12 @@ export class ConcentrationDividingLineData
set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]) { set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]) {
this.data.nodeConWithSecs = nodes; this.data.nodeConWithSecs = nodes;
} }
get isOtherLineConcentrationDividingLine(): boolean {
return this.data.isOtherLineConcentrationDividingLine;
}
set isOtherLineConcentrationDividingLine(v: boolean) {
this.data.isOtherLineConcentrationDividingLine = v;
}
clone(): ConcentrationDividingLineData { clone(): ConcentrationDividingLineData {
return new ConcentrationDividingLineData(this.data.cloneMessage()); return new ConcentrationDividingLineData(this.data.cloneMessage());
} }

View File

@ -136,23 +136,23 @@ export class IbpButtonInteraction extends GraphicInteractionPlugin<IBPButton> {
const g = e.target as IBPButton; const g = e.target as IBPButton;
const changeState = useIbpStore().ibpButtonOperation; const changeState = useIbpStore().ibpButtonOperation;
if (g.datas.isSelfReset) { if (g.datas.isSelfReset) {
changeState(g.datas.code, true); changeState(g.datas.id, true);
} else { } else {
changeState(g.datas.code, !g.state.down); changeState(g.datas.id, !g.state.down);
} }
} }
onMouseUp(e: FederatedMouseEvent) { onMouseUp(e: FederatedMouseEvent) {
const changeState = useIbpStore().ibpButtonOperation; const changeState = useIbpStore().ibpButtonOperation;
const g = e.target as IBPButton; const g = e.target as IBPButton;
if (g.datas.isSelfReset) { if (g.datas.isSelfReset) {
changeState(g.datas.code, false); changeState(g.datas.id, false);
} }
} }
onMouseLeave(e: FederatedMouseEvent) { onMouseLeave(e: FederatedMouseEvent) {
const changeState = useIbpStore().ibpButtonOperation; const changeState = useIbpStore().ibpButtonOperation;
const g = e.target as IBPButton; const g = e.target as IBPButton;
if (g.datas.isSelfReset) { if (g.datas.isSelfReset) {
changeState(g.datas.code, false); changeState(g.datas.id, false);
} }
} }
} }

View File

@ -101,6 +101,6 @@ export class IbpKeyInteraction extends GraphicInteractionPlugin<IbpKey> {
onClick(e: FederatedMouseEvent): void { onClick(e: FederatedMouseEvent): void {
const g = e.target as IbpKey; const g = e.target as IbpKey;
const changeState = useIbpStore().ibpKeyOperation; const changeState = useIbpStore().ibpKeyOperation;
changeState(g.datas.code, g.state.gear === 0 ? 1 : 0); changeState(g.datas.id, g.state.gear === 0 ? 1 : 0);
} }
} }

View File

@ -245,18 +245,23 @@ export class SectionOperateInteraction extends GraphicInteractionPlugin<Section>
); );
let AKm; let AKm;
let BKm; let BKm;
if (relations.length == 2) {
relations.forEach((item) => { relations.forEach((item) => {
const rp = item.getRelationParam(section); const rp = item.getRelationParam(section);
const other = item.getOtherGraphic(section) as AxleCounting; const other = item.getOtherGraphic(section) as AxleCounting;
if (
(other.datas.axleCountingRef.length > 1 &&
other.datas.type ==
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
other.datas.axleCountingRef.length == 1
) {
if (rp.getParam() == 'A') { if (rp.getParam() == 'A') {
AKm = other.datas.kilometerSystem; AKm = other.datas.kilometerSystem;
} }
if (rp.getParam() == 'B') { if (rp.getParam() == 'B') {
BKm = other.datas.kilometerSystem; BKm = other.datas.kilometerSystem;
} }
});
} }
});
const d = getKmDistance(BKm, AKm); const d = getKmDistance(BKm, AKm);
Dialog.create({ Dialog.create({
title: '创建列车', title: '创建列车',

View File

@ -121,7 +121,15 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
); );
const findAc = relations.find((item) => { const findAc = relations.find((item) => {
const rp = item.getRelationParam(turnout); const rp = item.getRelationParam(turnout);
return rp.getParam() == port; const orp = item.getOtherRelationParam(turnout as Turnout);
const ac = orp.g as AxleCounting;
return (
rp.getParam() == port &&
((ac.datas.axleCountingRef.length > 1 &&
ac.datas.type ==
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
ac.datas.axleCountingRef.length == 1)
);
}); });
const oKm = turnout.datas.kilometerSystem; const oKm = turnout.datas.kilometerSystem;
let pKm; let pKm;

View File

@ -124,7 +124,6 @@ export async function loadThDrawDatas(): Promise<IGraphicStorage> {
storage.esbButtons.forEach((esbButton) => { storage.esbButtons.forEach((esbButton) => {
datas.push(new EsbButtonData(esbButton)); datas.push(new EsbButtonData(esbButton));
}); });
refDevicesList = storage.stationRelateDeviceList;
return Promise.resolve({ return Promise.resolve({
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,
@ -137,7 +136,7 @@ export async function loadThDrawDatas(): Promise<IGraphicStorage> {
} }
export function saveThDrawDatas(app: IDrawApp) { export function saveThDrawDatas(app: IDrawApp) {
const storage = saveCommonDrawDatas(app, refDevicesList); const storage = saveCommonDrawDatas(app);
console.log(storage, '保存数据'); console.log(storage, '保存数据');
const graphics = app.queryStore.getAllGraphics(); const graphics = app.queryStore.getAllGraphics();
graphics.forEach((g) => { graphics.forEach((g) => {
@ -157,53 +156,3 @@ export function saveThDrawDatas(app: IDrawApp) {
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
return base64; return base64;
} }
//关联设备列表的增删改查
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode?: string[];
expanded?: boolean;
}[];
}
let refDevicesList: graphicData.StationRelateDevice[] = [];
export function loadStationRelateDeviceList() {
return refDevicesList;
}
export function creatStationRelateDevice(row: graphicData.StationRelateDevice) {
refDevicesList.push(row);
thDrawApp?.emit('postdataloaded');
}
export function editStationRelateDevice(
editRow: RelateDevicelistItem,
newData: graphicData.StationRelateDevice
) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == editRow.deviceType &&
refDevicesList[i].code == editRow.code
) {
refDevicesList[i] = newData;
break;
}
}
thDrawApp?.emit('postdataloaded');
}
export function deleteStationRelateDevice(row: RelateDevicelistItem) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == row.deviceType &&
refDevicesList[i].code == row.code
) {
refDevicesList.splice(i, 1);
break;
}
}
}

View File

@ -173,7 +173,6 @@ export async function loadZdwxDrawDatas(): Promise<IGraphicStorage> {
storage.autoReturnBoxs.forEach((autoReturnBox) => { storage.autoReturnBoxs.forEach((autoReturnBox) => {
datas.push(new AutoReturnBoxData(autoReturnBox)); datas.push(new AutoReturnBoxData(autoReturnBox));
}); });
refDevicesList = storage.stationRelateDeviceList;
return Promise.resolve({ return Promise.resolve({
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,
@ -186,7 +185,7 @@ export async function loadZdwxDrawDatas(): Promise<IGraphicStorage> {
} }
export function saveZdwxDrawDatas(app: IDrawApp) { export function saveZdwxDrawDatas(app: IDrawApp) {
const storage = saveCommonDrawDatas(app, refDevicesList); const storage = saveCommonDrawDatas(app);
console.log(storage, '保存数据'); console.log(storage, '保存数据');
const graphics = app.queryStore.getAllGraphics(); const graphics = app.queryStore.getAllGraphics();
graphics.forEach((g) => { graphics.forEach((g) => {
@ -219,17 +218,3 @@ export function saveZdwxDrawDatas(app: IDrawApp) {
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
return base64; return base64;
} }
//关联设备列表的增删改查
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode?: string[];
expanded?: boolean;
}[];
}
let refDevicesList: graphicData.StationRelateDevice[] = [];

View File

@ -1,8 +1,8 @@
import { Graphics } from 'pixi.js'; import { Graphics } from 'pixi.js';
import { calculateMirrorPoint } from 'src/jl-graphic'; import { calculateMirrorPoint } from 'src/jl-graphic';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { Turnout, TurnoutPort } from './turnout/Turnout'; import { Turnout } from './turnout/Turnout';
import { Section, SectionPort } from './section/Section'; import { Section, DevicePort } from './section/Section';
import { TrainWindow } from './trainWindow/TrainWindow'; import { TrainWindow } from './trainWindow/TrainWindow';
import { AxleCounting } from './axleCounting/AxleCounting'; import { AxleCounting } from './axleCounting/AxleCounting';
import { Station } from './station/Station'; import { Station } from './station/Station';
@ -80,7 +80,7 @@ export function drawArrow(
export function createRelatedRefProto( export function createRelatedRefProto(
type: string, type: string,
id: string, id: string,
port?: TurnoutPort | SectionPort port?: DevicePort
) { ) {
const typeMap = new Map([ const typeMap = new Map([
[Section.Type, graphicData.RelatedRef.DeviceType.Section], [Section.Type, graphicData.RelatedRef.DeviceType.Section],
@ -97,11 +97,11 @@ export function createRelatedRefProto(
id, id,
}); });
if (port) { if (port) {
if (port === 'A') if (port === DevicePort.A)
protoData.devicePort = graphicData.RelatedRef.DevicePort.A; protoData.devicePort = graphicData.RelatedRef.DevicePort.A;
if (port === 'B') if (port === DevicePort.B)
protoData.devicePort = graphicData.RelatedRef.DevicePort.B; protoData.devicePort = graphicData.RelatedRef.DevicePort.B;
if (port === 'C') if (port === DevicePort.C)
protoData.devicePort = graphicData.RelatedRef.DevicePort.C; protoData.devicePort = graphicData.RelatedRef.DevicePort.C;
} }
return protoData; return protoData;

View File

@ -15,28 +15,17 @@ import {
AxleCounting, AxleCounting,
AxleCountingTemplate, AxleCountingTemplate,
} from './AxleCounting'; } from './AxleCounting';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, DevicePort, SectionType } from '../section/Section';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics'; import { IRelatedRefData, createRelatedRefProto } from '../CommonGraphics';
import { Signal } from '../signal/Signal'; import { Signal } from '../signal/Signal';
import { loadGenerateAxleCountingConfig } from 'src/drawApp/commonApp'; import { loadGenerateAxleCountingConfig } from 'src/drawApp/commonApp';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface IAxleCountingDrawOptions { export interface IAxleCountingDrawOptions {
newData: () => IAxleCountingData; newData: () => IAxleCountingData;
} }
enum DevicePort {
A = 0,
B = 1,
C = 2,
}
enum DevicePortN {
A,
B,
C,
}
export class AxleCountingDraw extends GraphicDrawAssistant< export class AxleCountingDraw extends GraphicDrawAssistant<
AxleCountingTemplate, AxleCountingTemplate,
IAxleCountingData IAxleCountingData
@ -74,11 +63,11 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
ps: IPoint, ps: IPoint,
direction: number, direction: number,
graphic: Section | Turnout, graphic: Section | Turnout,
port: TurnoutPort | SectionPort, port: DevicePort,
map: Map<string, number>, map: Map<string, number>,
reftype: string, reftype: string,
refGraphic: Section | Turnout, refGraphic: Section | Turnout,
refPort: TurnoutPort | SectionPort refPort: DevicePort
) { ) {
const generateAxleCountingConfig = loadGenerateAxleCountingConfig(); const generateAxleCountingConfig = loadGenerateAxleCountingConfig();
if (generateAxleCountingConfig?.noGenerateGroup !== undefined) { if (generateAxleCountingConfig?.noGenerateGroup !== undefined) {
@ -98,8 +87,8 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
if ( if (
graphic.type == 'Turnout' && graphic.type == 'Turnout' &&
reftype == 'Turnout' && reftype == 'Turnout' &&
port == TurnoutPort.B && port == DevicePort.B &&
refPort == TurnoutPort.B refPort == DevicePort.B
) { ) {
//查看生成计轴bb配置 //查看生成计轴bb配置
let hasBB = false; let hasBB = false;
@ -155,7 +144,7 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
ps: IPoint, ps: IPoint,
direction: number, direction: number,
graphic: Section | Turnout, graphic: Section | Turnout,
port: TurnoutPort | SectionPort, port: DevicePort,
map: Map<string, number> map: Map<string, number>
) { ) {
if (!map.has(`${graphic.id}-${port}`)) { if (!map.has(`${graphic.id}-${port}`)) {
@ -186,7 +175,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
}); });
axleCountingRefs.forEach((axleCountingRef) => { axleCountingRefs.forEach((axleCountingRef) => {
map.set( map.set(
`${axleCountingRef.id}-${DevicePortN[axleCountingRef.devicePort]}`, `${axleCountingRef.id}-${
graphicData.RelatedRef.DevicePort[axleCountingRef.devicePort]
}`,
1 1
); );
}); });
@ -244,12 +235,12 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
if (axleCountingRelations.length < 2) { if (axleCountingRelations.length < 2) {
axleCountingRelations.forEach((relation) => { axleCountingRelations.forEach((relation) => {
const port = relation.getRelationParam(section).param; const port = relation.getRelationParam(section).param;
let addPort = SectionPort.A; let addPort = DevicePort.A;
let direction = 1; let direction = 1;
let axleCountingPs = ps; let axleCountingPs = ps;
if (port == 'A') { if (port == 'A') {
axleCountingPs = pe; axleCountingPs = pe;
addPort = SectionPort.B; addPort = DevicePort.B;
} }
if (axleCountingPs.y > height.y) { if (axleCountingPs.y > height.y) {
direction = -1; direction = -1;
@ -282,8 +273,10 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
Turnout.Type Turnout.Type
); );
turnoutRelations.forEach((relation) => { turnoutRelations.forEach((relation) => {
const port = relation.getRelationParam(turnout).param; const port = relation.getRelationParam(turnout).getParam<DevicePort>();
const portIndex = DevicePort[port] as unknown as number; const portIndex = Object.values(DevicePort).findIndex(
(p) => p === port
);
const refTurnout = relation.getOtherGraphic<Turnout>(turnout); const refTurnout = relation.getOtherGraphic<Turnout>(turnout);
const refTurnoutPort = relation.getOtherRelationParam(turnout).param; const refTurnoutPort = relation.getOtherRelationParam(turnout).param;
const portPs = turnout.localToCanvasPoints(...points[portIndex])[ const portPs = turnout.localToCanvasPoints(...points[portIndex])[
@ -309,14 +302,16 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
AxleCounting.Type AxleCounting.Type
); );
const points = turnout.getPortPoints(); const points = turnout.getPortPoints();
const turnoutPort = [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C]; const turnoutPort = [DevicePort.A, DevicePort.B, DevicePort.C];
if (axleCountingRelations.length == 1) { if (axleCountingRelations.length == 1) {
const port = axleCountingRelations[0].getRelationParam(turnout).param; const port = axleCountingRelations[0].getRelationParam(turnout).param;
const otherPort = turnoutPort.filter((p) => { const otherPort = turnoutPort.filter((p) => {
return p !== port && p; return p !== port && p;
}); });
otherPort.forEach((port) => { otherPort.forEach((port) => {
const portIndex = DevicePort[port] as unknown as number; const portIndex = Object.values(DevicePort).findIndex(
(p) => p === port
);
const axleCountingPs1 = turnout.localToCanvasPoints( const axleCountingPs1 = turnout.localToCanvasPoints(
...points[portIndex] ...points[portIndex]
)[points[portIndex].length - 1]; )[points[portIndex].length - 1];
@ -330,7 +325,9 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
return p !== port[0] && p !== port[1] && p; return p !== port[0] && p !== port[1] && p;
}); });
if (otherPort.length) { if (otherPort.length) {
const portIndex = DevicePort[otherPort[0]] as unknown as number; const portIndex = Object.values(DevicePort).findIndex(
(p) => p === otherPort[0]
);
const axleCountingPs1 = turnout.localToCanvasPoints( const axleCountingPs1 = turnout.localToCanvasPoints(
...points[portIndex] ...points[portIndex]
)[points[portIndex].length - 1]; )[points[portIndex].length - 1];
@ -339,8 +336,8 @@ export class AxleCountingDraw extends GraphicDrawAssistant<
} else if (axleCountingRelations.length == 0) { } else if (axleCountingRelations.length == 0) {
const axleCountingPsA = turnout.localToCanvasPoints(points[0][0])[0]; const axleCountingPsA = turnout.localToCanvasPoints(points[0][0])[0];
const axleCountingPsC = turnout.localToCanvasPoints(points[2][0])[0]; const axleCountingPsC = turnout.localToCanvasPoints(points[2][0])[0];
this.drawAdd(axleCountingPsA, 1, turnout, TurnoutPort.A, map); this.drawAdd(axleCountingPsA, 1, turnout, DevicePort.A, map);
this.drawAdd(axleCountingPsC, 1, turnout, TurnoutPort.C, map); this.drawAdd(axleCountingPsC, 1, turnout, DevicePort.C, map);
} }
}); });
} }

View File

@ -8,7 +8,7 @@ import {
calculateLineMidpoint, calculateLineMidpoint,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { IRelatedRefData, protoPort2Data } from '../CommonGraphics'; import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
import { SectionPort } from '../section/Section'; import { DevicePort } from '../section/Section';
export interface ITurnoutPosRefData { export interface ITurnoutPosRefData {
get id(): string; //道岔的ID get id(): string; //道岔的ID
@ -100,7 +100,7 @@ export class AxleCountingSection extends JlGraphic {
loadRelations() { loadRelations() {
if (this.datas?.paRef?.id) { if (this.datas?.paRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, SectionPort.A), new GraphicRelationParam(this, DevicePort.A),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.paRef.id), this.queryStore.queryById(this.datas.paRef.id),
protoPort2Data(this.datas.paRef.devicePort) protoPort2Data(this.datas.paRef.devicePort)
@ -109,7 +109,7 @@ export class AxleCountingSection extends JlGraphic {
} }
if (this.datas?.pbRef?.id) { if (this.datas?.pbRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, SectionPort.B), new GraphicRelationParam(this, DevicePort.B),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.pbRef.id), this.queryStore.queryById(this.datas.pbRef.id),
protoPort2Data(this.datas.pbRef.devicePort) protoPort2Data(this.datas.pbRef.devicePort)

View File

@ -9,10 +9,10 @@ import {
import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin'; import { ILineGraphic } from 'src/jl-graphic/plugins/GraphicEditPlugin';
import { SectionGraphic } from '../sectionGraphic/SectionGraphic'; import { SectionGraphic } from '../sectionGraphic/SectionGraphic';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, DevicePort, SectionType } from '../section/Section';
import { arePolylinesIntersect } from './ConcentrationDividingLineUtils'; import { arePolylinesIntersect } from './ConcentrationDividingLineUtils';
import { createRelatedRefProto } from '../CommonGraphics'; import { createRelatedRefProto } from '../CommonGraphics';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
export interface IConcentrationDividingLineData extends GraphicData { export interface IConcentrationDividingLineData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
@ -25,6 +25,8 @@ export interface IConcentrationDividingLineData extends GraphicData {
set refRightStationId(v: string); set refRightStationId(v: string);
get nodeConWithSecs(): graphicData.NodeConWithSec[]; // 集中区分割线与区段的交点 get nodeConWithSecs(): graphicData.NodeConWithSec[]; // 集中区分割线与区段的交点
set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]); set nodeConWithSecs(nodes: graphicData.NodeConWithSec[]);
get isOtherLineConcentrationDividingLine(): boolean; //集中区分割线绘制在其它线的边界处
set isOtherLineConcentrationDividingLine(v: boolean);
clone(): IConcentrationDividingLineData; clone(): IConcentrationDividingLineData;
copyFrom(data: IConcentrationDividingLineData): void; copyFrom(data: IConcentrationDividingLineData): void;
eq(other: IConcentrationDividingLineData): boolean; eq(other: IConcentrationDividingLineData): boolean;
@ -108,7 +110,7 @@ export class ConcentrationDividingLine
hasNode.segment2[1], hasNode.segment2[1],
section.localToCanvasPoint(section.getEndPoint()) section.localToCanvasPoint(section.getEndPoint())
); );
const relationParam = minA > minB ? SectionPort.B : SectionPort.A; const relationParam = minA > minB ? DevicePort.B : DevicePort.A;
const portRefOtherDevice = const portRefOtherDevice =
relationParam == 'A' ? section.datas.paRef : section.datas.pbRef; relationParam == 'A' ? section.datas.paRef : section.datas.pbRef;
if ( if (
@ -131,7 +133,7 @@ export class ConcentrationDividingLine
device: refDevice, device: refDevice,
port: devicePort[ port: devicePort[
portRefOtherDevice.devicePort portRefOtherDevice.devicePort
] as TurnoutPort, ] as DevicePort,
}, },
{ device: section, port: relationParam }, { device: section, port: relationParam },
] ]
@ -141,7 +143,7 @@ export class ConcentrationDividingLine
device: refDevice, device: refDevice,
port: devicePort[ port: devicePort[
portRefOtherDevice.devicePort portRefOtherDevice.devicePort
] as TurnoutPort, ] as DevicePort,
}, },
]; ];
hasNodeSection.set(leftDevice.device.id, '1'); hasNodeSection.set(leftDevice.device.id, '1');
@ -169,12 +171,12 @@ export class ConcentrationDividingLine
leftSection: createRelatedRefProto( leftSection: createRelatedRefProto(
Section.Type, Section.Type,
leftSectionId, leftSectionId,
SectionPort.B DevicePort.B
), ),
rightSection: createRelatedRefProto( rightSection: createRelatedRefProto(
Section.Type, Section.Type,
rightSectionId, rightSectionId,
SectionPort.A DevicePort.A
), ),
}) })
); );

View File

@ -33,11 +33,6 @@ export enum SectionType {
TurnoutPhysical = 2, TurnoutPhysical = 2,
} }
export enum SectionPort {
A = 'A',
B = 'B',
}
export interface ISectionData extends GraphicData { export interface ISectionData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
set code(v: string); set code(v: string);
@ -83,6 +78,12 @@ export const SectionConsts = {
lineWidth: 5, lineWidth: 5,
}; };
export enum DevicePort {
A = 'A',
B = 'B',
C = 'C',
}
export class Section extends JlGraphic implements ILineGraphic { export class Section extends JlGraphic implements ILineGraphic {
static Type = 'Section'; static Type = 'Section';
lineGraphic: SectionGraphic; lineGraphic: SectionGraphic;
@ -189,6 +190,24 @@ export class Section extends JlGraphic implements ILineGraphic {
this.updateData(old); this.updateData(old);
} }
getConnectElement(port: DevicePort) {
const relation = this.relationManage
.getRelationsOfGraphic(this)
.find(
(relation) =>
relation.getRelationParam(this).getParam<DevicePort>() === port &&
(relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout)
);
if (!relation) {
return;
}
return {
g: relation?.getOtherGraphic(this) as Section | Turnout,
port: relation?.getOtherRelationParam(this).getParam<DevicePort>(),
};
}
/** 获取拆分逻辑区段数据 */ /** 获取拆分逻辑区段数据 */
getSplitPoints(count: number): IPointData[][] { getSplitPoints(count: number): IPointData[][] {
if (this.datas.points.length !== 2) { if (this.datas.points.length !== 2) {
@ -243,14 +262,14 @@ export class Section extends JlGraphic implements ILineGraphic {
this.queryStore.queryByType<Section>(Section.Type).forEach((section) => { this.queryStore.queryByType<Section>(Section.Type).forEach((section) => {
if (section.id === this.id) return; if (section.id === this.id) return;
let param: SectionPort[] = []; let param: DevicePort[] = [];
if ( if (
distance2( distance2(
this.localToCanvasPoint(this.getStartPoint()), this.localToCanvasPoint(this.getStartPoint()),
section.localToCanvasPoint(section.getStartPoint()) section.localToCanvasPoint(section.getStartPoint())
) <= tolerance ) <= tolerance
) { ) {
param = [SectionPort.A, SectionPort.A]; param = [DevicePort.A, DevicePort.A];
} }
if ( if (
distance2( distance2(
@ -258,7 +277,7 @@ export class Section extends JlGraphic implements ILineGraphic {
section.localToCanvasPoint(section.getStartPoint()) section.localToCanvasPoint(section.getStartPoint())
) <= tolerance ) <= tolerance
) { ) {
param = [SectionPort.B, SectionPort.A]; param = [DevicePort.B, DevicePort.A];
} }
if ( if (
distance2( distance2(
@ -266,7 +285,7 @@ export class Section extends JlGraphic implements ILineGraphic {
section.localToCanvasPoint(section.getEndPoint()) section.localToCanvasPoint(section.getEndPoint())
) <= tolerance ) <= tolerance
) { ) {
param = [SectionPort.A, SectionPort.B]; param = [DevicePort.A, DevicePort.B];
} }
if ( if (
distance2( distance2(
@ -274,7 +293,7 @@ export class Section extends JlGraphic implements ILineGraphic {
section.localToCanvasPoint(section.getEndPoint()) section.localToCanvasPoint(section.getEndPoint())
) <= tolerance ) <= tolerance
) { ) {
param = [SectionPort.B, SectionPort.B]; param = [DevicePort.B, DevicePort.B];
} }
if (param.length) { if (param.length) {
this.relationManage.addRelation( this.relationManage.addRelation(
@ -291,7 +310,7 @@ export class Section extends JlGraphic implements ILineGraphic {
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.find( .find(
(relation) => (relation) =>
relation.getRelationParam(this).param === SectionPort.A && relation.getRelationParam(this).param === DevicePort.A &&
(relation.getOtherGraphic(this) instanceof Section || (relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout) relation.getOtherGraphic(this) instanceof Turnout)
); );
@ -309,7 +328,7 @@ export class Section extends JlGraphic implements ILineGraphic {
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.find( .find(
(relation) => (relation) =>
relation.getRelationParam(this).param === SectionPort.B && relation.getRelationParam(this).param === DevicePort.B &&
(relation.getOtherGraphic(this) instanceof Section || (relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout) relation.getOtherGraphic(this) instanceof Turnout)
); );
@ -331,7 +350,7 @@ export class Section extends JlGraphic implements ILineGraphic {
loadRelations() { loadRelations() {
if (this.datas?.paRef?.id) { if (this.datas?.paRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, SectionPort.A), new GraphicRelationParam(this, DevicePort.A),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.paRef.id), this.queryStore.queryById(this.datas.paRef.id),
protoPort2Data(this.datas.paRef.devicePort) protoPort2Data(this.datas.paRef.devicePort)
@ -340,7 +359,7 @@ export class Section extends JlGraphic implements ILineGraphic {
} }
if (this.datas?.pbRef?.id) { if (this.datas?.pbRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, SectionPort.B), new GraphicRelationParam(this, DevicePort.B),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.pbRef.id), this.queryStore.queryById(this.datas.pbRef.id),
protoPort2Data(this.datas.pbRef.devicePort) protoPort2Data(this.datas.pbRef.devicePort)

View File

@ -48,10 +48,11 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
import { AxleCounting } from '../axleCounting/AxleCounting'; import { AxleCounting } from '../axleCounting/AxleCounting';
import { LogicSection } from '../logicSection/LogicSection'; import { LogicSection } from '../logicSection/LogicSection';
import { LogicSectionDraw } from '../logicSection/LogicSectionDrawAssistant'; import { LogicSectionDraw } from '../logicSection/LogicSectionDrawAssistant';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
import { import {
ISectionData, ISectionData,
Section, Section,
DevicePort,
SectionConsts, SectionConsts,
SectionTemplate, SectionTemplate,
SectionType, SectionType,
@ -222,7 +223,7 @@ export class SectionDraw extends GraphicDrawAssistant<
turnouts.push(turnout); turnouts.push(turnout);
Object.values(TurnoutPort).forEach((port) => { Object.values(DevicePort).forEach((port) => {
const currentPortRelated = turnout.getGraphicOfPort(port); const currentPortRelated = turnout.getGraphicOfPort(port);
if ( if (
currentPortRelated.some((graphic) => graphic instanceof AxleCounting) currentPortRelated.some((graphic) => graphic instanceof AxleCounting)

View File

@ -17,8 +17,8 @@ import {
createRelatedRefProto, createRelatedRefProto,
} from '../CommonGraphics'; } from '../CommonGraphics';
import { SignalCode } from './SignalCode'; import { SignalCode } from './SignalCode';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, DevicePort, SectionType } from '../section/Section';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics'; import { graphicData } from 'src/protos/stationLayoutGraphics';
export enum Direction { export enum Direction {
@ -201,7 +201,7 @@ export class Signal extends JlGraphic {
let deviceId = ''; let deviceId = '';
let deviceType = ''; let deviceType = '';
let minD = Number.MAX_SAFE_INTEGER; let minD = Number.MAX_SAFE_INTEGER;
let port: SectionPort | TurnoutPort = SectionPort.A; let port: DevicePort = DevicePort.A;
sections.forEach((sec: Section) => { sections.forEach((sec: Section) => {
const verticesList = sec.getVerticesList(); const verticesList = sec.getVerticesList();
for (let i = 0; i < verticesList.length - 1; i++) { for (let i = 0; i < verticesList.length - 1; i++) {
@ -224,7 +224,7 @@ export class Signal extends JlGraphic {
minD = d; minD = d;
deviceId = sec.id; deviceId = sec.id;
deviceType = sec.type; deviceType = sec.type;
port = SectionPort.A; port = DevicePort.A;
} }
} }
}); });
@ -242,7 +242,7 @@ export class Signal extends JlGraphic {
minD = d; minD = d;
deviceId = turnout.id; deviceId = turnout.id;
deviceType = turnout.type; deviceType = turnout.type;
port = TurnoutPort.A; port = DevicePort.A;
} }
} }
for (let i = 0; i < turnout.datas.pointB.length; i++) { for (let i = 0; i < turnout.datas.pointB.length; i++) {
@ -257,7 +257,7 @@ export class Signal extends JlGraphic {
minD = d; minD = d;
deviceId = turnout.id; deviceId = turnout.id;
deviceType = turnout.type; deviceType = turnout.type;
port = TurnoutPort.B; port = DevicePort.B;
} }
} }
for (let i = 0; i < turnout.datas.pointC.length; i++) { for (let i = 0; i < turnout.datas.pointC.length; i++) {
@ -272,7 +272,7 @@ export class Signal extends JlGraphic {
minD = d; minD = d;
deviceId = turnout.id; deviceId = turnout.id;
deviceType = turnout.type; deviceType = turnout.type;
port = TurnoutPort.C; port = DevicePort.C;
} }
} }
}); });

View File

@ -6,6 +6,7 @@ import {
VectorText, VectorText,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { KilometerSystem } from '../signal/Signal'; import { KilometerSystem } from '../signal/Signal';
import { Platform } from '../platform/Platform';
export interface IStationData extends GraphicData { export interface IStationData extends GraphicData {
get code(): string; // 车站站名 get code(): string; // 车站站名
@ -80,6 +81,14 @@ export class Station extends JlGraphic {
kilometerGraph.anchor.set(0.5); kilometerGraph.anchor.set(0.5);
kilometerGraph.position.set(0, stationConsts.kilometerCodeOffsetY); kilometerGraph.position.set(0, stationConsts.kilometerCodeOffsetY);
} }
getPlatforms(): Platform[] {
const relations = this.relationManage.getRelationsOfGraphicAndOtherType(
this,
Platform.Type
);
return relations.map((r) => r.getOtherGraphic(this));
}
} }
export class StationTemplate extends JlGraphicTemplate<Station> { export class StationTemplate extends JlGraphicTemplate<Station> {

View File

@ -14,7 +14,7 @@ import {
createRelatedRefProto, createRelatedRefProto,
protoPort2Data, protoPort2Data,
} from '../CommonGraphics'; } from '../CommonGraphics';
import { Section, SectionPort } from '../section/Section'; import { Section, DevicePort } from '../section/Section';
export enum CoachNum { export enum CoachNum {
Four = 0, Four = 0,
@ -106,7 +106,7 @@ export class StopPosition extends JlGraphic {
let deviceId = ''; let deviceId = '';
let deviceType = ''; let deviceType = '';
let minD = Number.MAX_SAFE_INTEGER; let minD = Number.MAX_SAFE_INTEGER;
let port = SectionPort.A; let port = DevicePort.A;
sections.forEach((sec: Section) => { sections.forEach((sec: Section) => {
const verticesList = sec.getVerticesList(); const verticesList = sec.getVerticesList();
for (let i = 0; i < verticesList.length - 1; i++) { for (let i = 0; i < verticesList.length - 1; i++) {
@ -129,7 +129,7 @@ export class StopPosition extends JlGraphic {
minD = d; minD = d;
deviceId = sec.id; deviceId = sec.id;
deviceType = sec.type; deviceType = sec.type;
port = SectionPort.A; port = DevicePort.A;
} }
} }
}); });

View File

@ -9,11 +9,12 @@ import {
calculateMirrorPoint, calculateMirrorPoint,
distance, distance,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout } from '../turnout/Turnout';
import { Section } from '../section/Section'; import { DevicePort, Section } from '../section/Section';
import { AxleCounting } from '../axleCounting/AxleCounting'; import { AxleCounting } from '../axleCounting/AxleCounting';
import { state } from 'src/protos/device_state'; import { state } from 'src/protos/device_state';
import { getKmDistance } from 'src/drawApp/lineScene'; import { getKmDistance } from 'src/drawApp/lineScene';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface ITrainData extends GraphicData { export interface ITrainData extends GraphicData {
get code(): string; // 车号 get code(): string; // 车号
@ -335,7 +336,7 @@ export class Train extends JlGraphic {
if (!dev) { if (!dev) {
return; return;
} }
const portArr = [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C]; const portArr = [DevicePort.A, DevicePort.B, DevicePort.C];
const findIndex = portArr.findIndex((item) => { const findIndex = portArr.findIndex((item) => {
return item == this.states.devicePort; return item == this.states.devicePort;
}); });
@ -347,7 +348,15 @@ export class Train extends JlGraphic {
); );
const findAc = relations.find((item) => { const findAc = relations.find((item) => {
const rp = item.getRelationParam(dev as Turnout); const rp = item.getRelationParam(dev as Turnout);
return rp.getParam() == this.states.devicePort; const orp = item.getOtherRelationParam(dev as Turnout);
const ac = orp.g as AxleCounting;
return (
rp.getParam() == this.states.devicePort &&
((ac.datas.axleCountingRef.length > 1 &&
ac.datas.type ==
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
ac.datas.axleCountingRef.length == 1)
);
}); });
const oKm = dev.datas.kilometerSystem; const oKm = dev.datas.kilometerSystem;
let pKm; let pKm;
@ -398,6 +407,12 @@ export class Train extends JlGraphic {
relations.forEach((item) => { relations.forEach((item) => {
const rp = item.getRelationParam(dev as Section); const rp = item.getRelationParam(dev as Section);
const other = item.getOtherGraphic(dev as Section) as AxleCounting; const other = item.getOtherGraphic(dev as Section) as AxleCounting;
if (
(other.datas.axleCountingRef.length > 1 &&
other.datas.type ==
graphicData.AxleCounting.TypeDetectionPoint.AxleCounting) ||
other.datas.axleCountingRef.length == 1
) {
if (rp.getParam() == 'A') { if (rp.getParam() == 'A') {
AKm = other.datas.kilometerSystem; AKm = other.datas.kilometerSystem;
hasA = true; hasA = true;
@ -406,6 +421,7 @@ export class Train extends JlGraphic {
BKm = other.datas.kilometerSystem; BKm = other.datas.kilometerSystem;
hasB = true; hasB = true;
} }
}
}); });
if (hasA && hasB) { if (hasA && hasB) {
allLength = getKmDistance(BKm, AKm); allLength = getKmDistance(BKm, AKm);

View File

@ -16,10 +16,10 @@ import {
import { import {
Section, Section,
SectionConsts, SectionConsts,
SectionPort, DevicePort,
SectionType, SectionType,
} from '../section/Section'; } from '../section/Section';
import { Turnout, TurnoutConsts, TurnoutPort } from '../turnout/Turnout'; import { Turnout, TurnoutConsts } from '../turnout/Turnout';
export interface ITransponderData extends GraphicData { export interface ITransponderData extends GraphicData {
get code(): string; // 编号 get code(): string; // 编号
@ -238,12 +238,12 @@ export class Transponder extends JlGraphic {
if (findSection) { if (findSection) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this), new GraphicRelationParam(this),
new GraphicRelationParam(findSection, SectionPort.A) new GraphicRelationParam(findSection, DevicePort.A)
); );
return; return;
} }
let tPort: TurnoutPort | null = null; let tPort: DevicePort | null = null;
const portList = [TurnoutPort.A, TurnoutPort.B, TurnoutPort.C]; const portList = [DevicePort.A, DevicePort.B, DevicePort.C];
const turnouts = this.queryStore.queryByType<Turnout>(Turnout.Type); const turnouts = this.queryStore.queryByType<Turnout>(Turnout.Type);
const findTurnout = turnouts.find((turnout) => { const findTurnout = turnouts.find((turnout) => {
let s = false; let s = false;

View File

@ -10,8 +10,7 @@ import {
angleOfIncludedAngle, angleOfIncludedAngle,
distance2, distance2,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, DevicePort, SectionType } from '../section/Section';
import { epsilon } from 'src/jl-graphic/math';
import { import {
IRelatedRefData, IRelatedRefData,
createRelatedRefProto, createRelatedRefProto,
@ -90,12 +89,6 @@ export enum TurnoutPosition {
REVERSE = 1, REVERSE = 1,
} }
export enum TurnoutPort {
A = 'A',
B = 'B',
C = 'C',
}
export function getForkPoint(r: number, p: IPointData): IPointData { export function getForkPoint(r: number, p: IPointData): IPointData {
if (r === 0) return { x: 0, y: 0 }; if (r === 0) return { x: 0, y: 0 };
const len = Math.sqrt((-p.x) ** 2 + (-p.y) ** 2); const len = Math.sqrt((-p.x) ** 2 + (-p.y) ** 2);
@ -105,8 +98,8 @@ export function getForkPoint(r: number, p: IPointData): IPointData {
export class TurnoutSection extends Graphics { export class TurnoutSection extends Graphics {
turnout: Turnout; turnout: Turnout;
port: TurnoutPort; port: DevicePort;
constructor(turnout: Turnout, port: TurnoutPort) { constructor(turnout: Turnout, port: DevicePort) {
super(); super();
this.turnout = turnout; this.turnout = turnout;
this.port = port; this.port = port;
@ -115,23 +108,23 @@ export class TurnoutSection extends Graphics {
paint() { paint() {
let pList: IPointData[] = []; let pList: IPointData[] = [];
switch (this.port) { switch (this.port) {
case TurnoutPort.A: case DevicePort.A:
pList = this.turnout.datas.pointA; pList = this.turnout.datas.pointA;
break; break;
case TurnoutPort.B: case DevicePort.B:
pList = this.turnout.datas.pointB; pList = this.turnout.datas.pointB;
break; break;
case TurnoutPort.C: case DevicePort.C:
pList = this.turnout.datas.pointC; pList = this.turnout.datas.pointC;
break; break;
} }
const gap = this.port === TurnoutPort.A ? 0 : TurnoutConsts.forkLenth; const gap = this.port === DevicePort.A ? 0 : TurnoutConsts.forkLenth;
let color = TurnoutConsts.lineColor; let color = TurnoutConsts.lineColor;
if (this.turnout.states.occupied) { if (this.turnout.states.occupied) {
if ( if (
this.port === TurnoutPort.A || this.port === DevicePort.A ||
(this.turnout.states.dw && this.port === TurnoutPort.B) || (this.turnout.states.dw && this.port === DevicePort.B) ||
(this.turnout.states.fw && this.port === TurnoutPort.C) (this.turnout.states.fw && this.port === DevicePort.C)
) { ) {
color = TurnoutConsts.occupiedColor; color = TurnoutConsts.occupiedColor;
} }
@ -181,9 +174,9 @@ export class Turnout extends JlGraphic {
this.graphics = { this.graphics = {
fork: new ForkGraphic(this), fork: new ForkGraphic(this),
sections: [ sections: [
new TurnoutSection(this, TurnoutPort.A), new TurnoutSection(this, DevicePort.A),
new TurnoutSection(this, TurnoutPort.B), new TurnoutSection(this, DevicePort.B),
new TurnoutSection(this, TurnoutPort.C), new TurnoutSection(this, DevicePort.C),
], ],
label: new VectorText(), label: new VectorText(),
}; };
@ -259,6 +252,24 @@ export class Turnout extends JlGraphic {
} }
} }
getConnectElement(port: DevicePort) {
const relation = this.relationManage
.getRelationsOfGraphic(this)
.find(
(relation) =>
relation.getRelationParam(this).getParam<DevicePort>() === port &&
(relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout)
);
if (!relation) {
return;
}
return {
g: relation?.getOtherGraphic(this) as Section | Turnout,
port: relation?.getOtherRelationParam(this).getParam<DevicePort>(),
};
}
buildRelation(): void { buildRelation(): void {
this.relationManage.deleteRelationOfGraphic(this); this.relationManage.deleteRelationOfGraphic(this);
@ -275,9 +286,9 @@ export class Turnout extends JlGraphic {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam( new GraphicRelationParam(
this, this,
[TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] [DevicePort.A, DevicePort.B, DevicePort.C][i]
), ),
new GraphicRelationParam(section, SectionPort.A) new GraphicRelationParam(section, DevicePort.A)
); );
} }
if ( if (
@ -289,9 +300,9 @@ export class Turnout extends JlGraphic {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam( new GraphicRelationParam(
this, this,
[TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] [DevicePort.A, DevicePort.B, DevicePort.C][i]
), ),
new GraphicRelationParam(section, SectionPort.B) new GraphicRelationParam(section, DevicePort.B)
); );
} }
}); });
@ -324,11 +335,11 @@ export class Turnout extends JlGraphic {
params = [ params = [
new GraphicRelationParam( new GraphicRelationParam(
this, this,
[TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][i] [DevicePort.A, DevicePort.B, DevicePort.C][i]
), ),
new GraphicRelationParam( new GraphicRelationParam(
turnout, turnout,
[TurnoutPort.A, TurnoutPort.B, TurnoutPort.C][j] [DevicePort.A, DevicePort.B, DevicePort.C][j]
), ),
]; ];
} }
@ -346,7 +357,7 @@ export class Turnout extends JlGraphic {
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.find( .find(
(relation) => (relation) =>
relation.getRelationParam(this).param === TurnoutPort.A && relation.getRelationParam(this).param === DevicePort.A &&
(relation.getOtherGraphic(this) instanceof Section || (relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout) relation.getOtherGraphic(this) instanceof Turnout)
); );
@ -364,7 +375,7 @@ export class Turnout extends JlGraphic {
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.find( .find(
(relation) => (relation) =>
relation.getRelationParam(this).param === TurnoutPort.B && relation.getRelationParam(this).param === DevicePort.B &&
(relation.getOtherGraphic(this) instanceof Section || (relation.getOtherGraphic(this) instanceof Section ||
relation.getOtherGraphic(this) instanceof Turnout) relation.getOtherGraphic(this) instanceof Turnout)
); );
@ -381,7 +392,7 @@ export class Turnout extends JlGraphic {
const pcRelation = this.relationManage const pcRelation = this.relationManage
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.find( .find(
(relation) => relation.getRelationParam(this).param === TurnoutPort.C (relation) => relation.getRelationParam(this).param === DevicePort.C
); );
const pcDevice = pcRelation?.getOtherGraphic<Section | Turnout>(this); const pcDevice = pcRelation?.getOtherGraphic<Section | Turnout>(this);
if (pcDevice) { if (pcDevice) {
@ -398,7 +409,7 @@ export class Turnout extends JlGraphic {
loadRelations() { loadRelations() {
if (this.datas.paRef?.id) { if (this.datas.paRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.A), new GraphicRelationParam(this, DevicePort.A),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.paRef.id), this.queryStore.queryById(this.datas.paRef.id),
protoPort2Data(this.datas.paRef.devicePort) protoPort2Data(this.datas.paRef.devicePort)
@ -407,7 +418,7 @@ export class Turnout extends JlGraphic {
} }
if (this.datas.pbRef?.id) { if (this.datas.pbRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.B), new GraphicRelationParam(this, DevicePort.B),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.pbRef.id), this.queryStore.queryById(this.datas.pbRef.id),
protoPort2Data(this.datas.pbRef.devicePort) protoPort2Data(this.datas.pbRef.devicePort)
@ -416,7 +427,7 @@ export class Turnout extends JlGraphic {
} }
if (this.datas.pcRef?.id) { if (this.datas.pcRef?.id) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.C), new GraphicRelationParam(this, DevicePort.C),
new GraphicRelationParam( new GraphicRelationParam(
this.queryStore.queryById(this.datas.pcRef.id), this.queryStore.queryById(this.datas.pcRef.id),
protoPort2Data(this.datas.pcRef.devicePort) protoPort2Data(this.datas.pcRef.devicePort)
@ -425,30 +436,30 @@ export class Turnout extends JlGraphic {
} }
if (this.datas.paTrackSectionId) { if (this.datas.paTrackSectionId) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.A), new GraphicRelationParam(this, DevicePort.A),
this.queryStore.queryById<TrackSection>(this.datas.paTrackSectionId) this.queryStore.queryById<TrackSection>(this.datas.paTrackSectionId)
); );
} }
if (this.datas.pbTrackSectionId) { if (this.datas.pbTrackSectionId) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.B), new GraphicRelationParam(this, DevicePort.B),
this.queryStore.queryById<TrackSection>(this.datas.pbTrackSectionId) this.queryStore.queryById<TrackSection>(this.datas.pbTrackSectionId)
); );
} }
if (this.datas.paTrackSectionId) { if (this.datas.paTrackSectionId) {
this.relationManage.addRelation( this.relationManage.addRelation(
new GraphicRelationParam(this, TurnoutPort.C), new GraphicRelationParam(this, DevicePort.C),
this.queryStore.queryById<TrackSection>(this.datas.pcTrackSectionId) this.queryStore.queryById<TrackSection>(this.datas.pcTrackSectionId)
); );
} }
} }
getGraphicOfPort(port: TurnoutPort) { getGraphicOfPort(port: DevicePort) {
return this.relationManage return this.relationManage
.getRelationsOfGraphic(this) .getRelationsOfGraphic(this)
.filter( .filter(
(relation) => (relation) =>
relation.getRelationParam(this).getParam<TurnoutPort>() === port relation.getRelationParam(this).getParam<DevicePort>() === port
) )
.map((relation) => { .map((relation) => {
return relation.getOtherGraphic(this); return relation.getOtherGraphic(this);

View File

@ -16,7 +16,6 @@ import {
ITurnoutData, ITurnoutData,
Turnout, Turnout,
TurnoutConsts, TurnoutConsts,
TurnoutPort,
TurnoutSection, TurnoutSection,
TurnoutTemplate, TurnoutTemplate,
getForkPoint, getForkPoint,
@ -32,7 +31,7 @@ import {
GraphicEditPlugin, GraphicEditPlugin,
getWaypointRangeIndex, getWaypointRangeIndex,
} from 'src/jl-graphic/plugins/GraphicEditPlugin'; } from 'src/jl-graphic/plugins/GraphicEditPlugin';
import { Section } from '../section/Section'; import { DevicePort, Section } from '../section/Section';
import AbsorbablePoint, { import AbsorbablePoint, {
AbsorbableLine, AbsorbableLine,
} from 'src/jl-graphic/graphic/AbsorbablePosition'; } from 'src/jl-graphic/graphic/AbsorbablePosition';
@ -110,15 +109,15 @@ export class TurnoutSectionHitArea implements IHitArea {
let points: IPointData[]; let points: IPointData[];
let start: IPointData; let start: IPointData;
switch (this.section.port) { switch (this.section.port) {
case TurnoutPort.A: case DevicePort.A:
points = this.section.turnout.datas.pointA; points = this.section.turnout.datas.pointA;
start = { x: 0, y: 0 }; start = { x: 0, y: 0 };
break; break;
case TurnoutPort.B: case DevicePort.B:
points = this.section.turnout.datas.pointB; points = this.section.turnout.datas.pointB;
start = getForkPoint(TurnoutConsts.forkLenth, points[0]); start = getForkPoint(TurnoutConsts.forkLenth, points[0]);
break; break;
case TurnoutPort.C: case DevicePort.C:
points = this.section.turnout.datas.pointC; points = this.section.turnout.datas.pointC;
start = getForkPoint(TurnoutConsts.forkLenth, points[0]); start = getForkPoint(TurnoutConsts.forkLenth, points[0]);
break; break;
@ -217,7 +216,7 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
onSectionContextMenu(e: FederatedMouseEvent, section: TurnoutSection) { onSectionContextMenu(e: FederatedMouseEvent, section: TurnoutSection) {
const p = section.turnout.screenToLocalPoint(e.global); const p = section.turnout.screenToLocalPoint(e.global);
addPointConfig.handler = () => { addPointConfig.handler = () => {
if (section.port === TurnoutPort.A) { if (section.port === DevicePort.A) {
const { start } = getWaypointRangeIndex( const { start } = getWaypointRangeIndex(
[{ x: 0, y: 0 }, ...section.turnout.datas.pointA], [{ x: 0, y: 0 }, ...section.turnout.datas.pointA],
false, false,
@ -230,7 +229,7 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
ps.push(...points.slice(start)); ps.push(...points.slice(start));
section.turnout.datas.pointA = ps; section.turnout.datas.pointA = ps;
} }
if (section.port === TurnoutPort.B) { if (section.port === DevicePort.B) {
const { start } = getWaypointRangeIndex( const { start } = getWaypointRangeIndex(
[{ x: 0, y: 0 }, ...section.turnout.datas.pointB], [{ x: 0, y: 0 }, ...section.turnout.datas.pointB],
false, false,
@ -243,7 +242,7 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
ps.push(...points.slice(start)); ps.push(...points.slice(start));
section.turnout.datas.pointB = ps; section.turnout.datas.pointB = ps;
} }
if (section.port === TurnoutPort.C) { if (section.port === DevicePort.C) {
const { start } = getWaypointRangeIndex( const { start } = getWaypointRangeIndex(
[{ x: 0, y: 0 }, ...section.turnout.datas.pointC], [{ x: 0, y: 0 }, ...section.turnout.datas.pointC],
false, false,
@ -259,15 +258,15 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
this.onSelected(section.turnout); this.onSelected(section.turnout);
}; };
clearPointConfig.handler = () => { clearPointConfig.handler = () => {
if (section.port === TurnoutPort.A) if (section.port === DevicePort.A)
section.turnout.datas.pointA = [ section.turnout.datas.pointA = [
section.turnout.datas.pointA[section.turnout.datas.pointA.length - 1], section.turnout.datas.pointA[section.turnout.datas.pointA.length - 1],
]; ];
if (section.port === TurnoutPort.B) if (section.port === DevicePort.B)
section.turnout.datas.pointB = [ section.turnout.datas.pointB = [
section.turnout.datas.pointB[section.turnout.datas.pointB.length - 1], section.turnout.datas.pointB[section.turnout.datas.pointB.length - 1],
]; ];
if (section.port === TurnoutPort.C) if (section.port === DevicePort.C)
section.turnout.datas.pointC = [ section.turnout.datas.pointC = [
section.turnout.datas.pointC[section.turnout.datas.pointC.length - 1], section.turnout.datas.pointC[section.turnout.datas.pointC.length - 1],
]; ];

View File

@ -196,9 +196,13 @@ import {
checkDataToServer, checkDataToServer,
loadUniqueIdPrefix, loadUniqueIdPrefix,
setUniqueIdPrefix, setUniqueIdPrefix,
creatStationRelateDevice,
deleteStationRelateDeviceByType,
loadOtherLineList,
} from 'src/drawApp/commonApp'; } from 'src/drawApp/commonApp';
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp'; import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp'; import { RelateDevicelistItem } from 'src/drawApp/commonApp';
import { saveThDrawDatas } from 'src/drawApp/thApp';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue'; import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
@ -266,7 +270,7 @@ import OtherLineList from 'src/components/draw-app/dialogs/OtherLineList.vue';
import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue'; import OtherLineConfig from 'src/components/draw-app/properties/OtherLineConfig.vue';
import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue'; import SectionDirectionConfig from 'src/components/draw-app/properties/SectionDirectionConfig.vue';
import SignalDirectionConfig from 'src/components/draw-app/properties/SignalDirectionConfig.vue'; import SignalDirectionConfig from 'src/components/draw-app/properties/SignalDirectionConfig.vue';
import { distance2 } from 'src/jl-graphic'; import { distance2, JlGraphic } from 'src/jl-graphic';
import { Point } from 'pixi.js'; import { Point } from 'pixi.js';
const $q = useQuasar(); const $q = useQuasar();
@ -364,6 +368,10 @@ const leftMenuConfig = [
label: '一键生成所有紧急停车继电器的编号', label: '一键生成所有紧急停车继电器的编号',
click: oneClickGenerateEsbRelayCode, click: oneClickGenerateEsbRelayCode,
}, },
{
label: '一键生成所有紧急停车按钮组合数据',
click: oneClickGenerateEsbCombinationData,
},
]; ];
// //
@ -641,72 +649,18 @@ function oneClickRelateCentralizedStation() {
const drawApp = drawStore.getDrawApp(); const drawApp = drawStore.getDrawApp();
const concentrationDividingLines = drawApp.queryStore const concentrationDividingLines = drawApp.queryStore
.queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type) .queryByType<ConcentrationDividingLine>(ConcentrationDividingLine.Type)
.filter((g) => !g.datas.isOtherLineConcentrationDividingLine)
.sort((a, b) => a.datas.points[0].x - b.datas.points[0].x); .sort((a, b) => a.datas.points[0].x - b.datas.points[0].x);
// const hasHandleStation: string[] = [];
const leftBoundary = concentrationDividingLines[0];
if (leftBoundary.datas.refLeftStationId) {
let containDeviceIds: string[] = [];
const leftSections: {
section: Section;
port: graphicData.RelatedRef.DevicePort;
}[] = [];
leftBoundary.datas.nodeConWithSecs.forEach((node) => {
if (node.leftSection.id !== '') {
leftSections.push({
section: drawApp.queryStore.queryById(node.leftSection.id),
port: node.leftSection.devicePort,
});
}
});
containDeviceIds = [...leftSections.map((g) => g.section.id)];
leftSections.forEach((leftSection) => {
findContainDevice(
leftSection.section,
leftSection.port,
containDeviceIds,
drawApp
);
containDeviceIds = Array.from(new Set(containDeviceIds));
});
handleContainDevices(containDeviceIds, [
leftBoundary.datas.refLeftStationId,
]);
}
//
const rightBoundary =
concentrationDividingLines[concentrationDividingLines.length - 1];
if (rightBoundary.datas.refRightStationId) {
let containDeviceIds: string[] = [];
const rightSections: {
section: Section;
port: graphicData.RelatedRef.DevicePort;
}[] = [];
rightBoundary.datas.nodeConWithSecs.forEach((node) => {
if (node.rightSection.id !== '') {
rightSections.push({
section: drawApp.queryStore.queryById(node.rightSection.id),
port: node.rightSection.devicePort,
});
}
});
containDeviceIds = [...rightSections.map((g) => g.section.id)];
rightSections.forEach((rightSections) => {
findContainDevice(
rightSections.section,
rightSections.port,
containDeviceIds,
drawApp
);
containDeviceIds = Array.from(new Set(containDeviceIds));
});
handleContainDevices(containDeviceIds, [
rightBoundary.datas.refRightStationId,
]);
}
for (let i = 0; i < concentrationDividingLines.length - 1; i++) { for (let i = 0; i < concentrationDividingLines.length - 1; i++) {
let containDeviceIds: string[] = []; let containDeviceIds: string[] = [];
// //
const rightDatas = concentrationDividingLines[i].datas; const rightDatas = concentrationDividingLines[i].datas;
if (hasHandleStation.includes(rightDatas.refRightStationId)) {
continue;
} else {
hasHandleStation.push(rightDatas.refRightStationId);
}
const rightSections: { const rightSections: {
section: Section; section: Section;
port: graphicData.RelatedRef.DevicePort; port: graphicData.RelatedRef.DevicePort;
@ -749,6 +703,27 @@ function oneClickRelateCentralizedStation() {
handleContainDevices(containDeviceIds, [rightDatas.refRightStationId]); handleContainDevices(containDeviceIds, [rightDatas.refRightStationId]);
} }
} }
//
const leftBoundary = concentrationDividingLines[0];
handleLeftBoundary(leftBoundary);
const rightBoundary =
concentrationDividingLines[concentrationDividingLines.length - 1];
handleRightBoundary(rightBoundary);
concentrationDividingLines.forEach((concentrationDividingLine) => {
const datas = concentrationDividingLine.datas;
if (
datas.refLeftStationId &&
drawApp.queryStore.queryById<Station>(datas.refLeftStationId).datas.depots
) {
handleLeftBoundary(concentrationDividingLine);
} else if (
datas.refRightStationId &&
drawApp.queryStore.queryById<Station>(datas.refRightStationId).datas
.depots
) {
handleRightBoundary(concentrationDividingLine);
}
});
// //
const axleCountings = drawApp.queryStore const axleCountings = drawApp.queryStore
.queryByType<AxleCounting>(AxleCounting.Type) .queryByType<AxleCounting>(AxleCounting.Type)
@ -789,6 +764,16 @@ function oneClickRelateCentralizedStation() {
} }
); );
}); });
//线
const otherLineList = loadOtherLineList();
const otherLineListDevice: JlGraphic[] = [];
otherLineList.forEach((otherLine) => {
otherLine.ids.forEach((id) => {
const device = drawApp.queryStore.queryById(id);
otherLineListDevice.push(device);
});
});
handleCentralizedStationsData(otherLineListDevice, []);
function handleNodeConWithSec( function handleNodeConWithSec(
relatedRef: graphicData.RelatedRef, relatedRef: graphicData.RelatedRef,
@ -850,6 +835,70 @@ function oneClickRelateCentralizedStation() {
centralizedStations centralizedStations
); );
} }
function handleLeftBoundary(leftBoundary: ConcentrationDividingLine) {
let containDeviceIds: string[] = [];
const leftSections: {
section: Section;
port: graphicData.RelatedRef.DevicePort;
}[] = [];
leftBoundary.datas.nodeConWithSecs.forEach((node) => {
if (node.leftSection.id !== '') {
leftSections.push({
section: drawApp.queryStore.queryById(node.leftSection.id),
port: node.leftSection.devicePort,
});
}
});
containDeviceIds = [...leftSections.map((g) => g.section.id)];
leftSections.forEach((leftSection) => {
findContainDevice(
leftSection.section,
leftSection.port,
containDeviceIds,
drawApp
);
containDeviceIds = Array.from(new Set(containDeviceIds));
});
if (leftBoundary.datas.refLeftStationId == '') {
handleContainDevices(containDeviceIds, []);
} else {
handleContainDevices(containDeviceIds, [
leftBoundary.datas.refLeftStationId,
]);
}
}
function handleRightBoundary(rightBoundary: ConcentrationDividingLine) {
let containDeviceIds: string[] = [];
const rightSections: {
section: Section;
port: graphicData.RelatedRef.DevicePort;
}[] = [];
rightBoundary.datas.nodeConWithSecs.forEach((node) => {
if (node.rightSection.id !== '') {
rightSections.push({
section: drawApp.queryStore.queryById(node.rightSection.id),
port: node.rightSection.devicePort,
});
}
});
containDeviceIds = [...rightSections.map((g) => g.section.id)];
rightSections.forEach((rightSections) => {
findContainDevice(
rightSections.section,
rightSections.port,
containDeviceIds,
drawApp
);
containDeviceIds = Array.from(new Set(containDeviceIds));
});
if (rightBoundary.datas.refRightStationId == '') {
handleContainDevices(containDeviceIds, []);
} else {
handleContainDevices(containDeviceIds, [
rightBoundary.datas.refRightStationId,
]);
}
}
} }
function oneClickGeneratePlatformType() { function oneClickGeneratePlatformType() {
@ -894,6 +943,56 @@ function oneClickGenerateEsbRelayCode() {
}); });
} }
function oneClickGenerateEsbCombinationData() {
deleteStationRelateDeviceByType(graphicData.RelatedRef.DeviceType.station);
const stations = drawStore
.getDrawApp()
.queryStore.queryByType<Station>(Station.Type)
.filter((g) => g.datas.depots == false);
stations.forEach((station) => {
const platforms = drawStore
.getDrawApp()
.queryStore.queryByType<Platform>(Platform.Type)
.filter((g) => g.datas.refStation == station?.id);
let refEsbRelayCodes = platforms.map((g) => g.datas.refEsbRelayCode);
refEsbRelayCodes = Array.from(new Set(refEsbRelayCodes));
const combinationtypes: graphicData.DeviceCombinationtype[] = [];
const esbButtons = drawStore
.getDrawApp()
.queryStore.queryByType<EsbButton>(EsbButton.Type);
if (refEsbRelayCodes.length == 1) {
const platformIds = platforms.map((g) => g.id);
const esbButtonIds = esbButtons
.filter((g) => platformIds.includes(g.datas.refStand))
.map((g) => g.id);
combinationtypes.push(
new graphicData.DeviceCombinationtype({
code: refEsbRelayCodes[0],
refDevices: esbButtonIds,
})
);
} else {
platforms.forEach((platform) => {
const esbButtonIds = esbButtons
.filter((g) => g.datas.refStand == platform.id)
.map((g) => g.id);
combinationtypes.push(
new graphicData.DeviceCombinationtype({
code: platform.datas.refEsbRelayCode,
refDevices: esbButtonIds,
})
);
});
}
const stationRelateDevice = new graphicData.StationRelateDevice({
deviceType: graphicData.RelatedRef.DeviceType.station,
code: station.datas.stationName,
combinationtypes: combinationtypes,
});
creatStationRelateDevice(stationRelateDevice);
});
}
function backConfirm() { function backConfirm() {
router.go(-1); router.go(-1);
} }
@ -949,6 +1048,10 @@ onUnmounted(() => {
drawStore.setEditOtherLineIndex(-1); drawStore.setEditOtherLineIndex(-1);
drawStore.destroy(); drawStore.destroy();
drawStore.setCategoryType(null); drawStore.setCategoryType(null);
drawStore.setRelateDeviceConfigVisible(false);
if (relateDeviceDialogInstance) {
relateDeviceDialogInstance.hide();
}
}); });
const dialogInstance = ref(); const dialogInstance = ref();

View File

@ -466,7 +466,7 @@ watch(changeScreenDoorGroup, (group) => {
if (group?.length == 1) { if (group?.length == 1) {
downScreenDoorCjList[0].refDeviceCodesAndPos.unshift([ downScreenDoorCjList[0].refDeviceCodesAndPos.unshift([
{ {
code: 'KMJ', code: 'XKMJ',
position: PostionType.Q, position: PostionType.Q,
}, },
]); ]);

View File

@ -99,7 +99,7 @@ upScreenDoorQdList.forEach((qdData) => {
watch(changeScreenDoorGroup, (group) => { watch(changeScreenDoorGroup, (group) => {
downScreenDoorQdList[0].refDeviceCodes = [['XGMJ']]; downScreenDoorQdList[0].refDeviceCodes = [['XGMJ']];
if (group?.length == 1) { if (group?.length == 1) {
downScreenDoorQdList[0].refDeviceCodes.unshift(['KMJ']); downScreenDoorQdList[0].refDeviceCodes.unshift(['XKMJ']);
} else { } else {
group?.forEach((trainGroupAmount) => { group?.forEach((trainGroupAmount) => {
switch (trainGroupAmount) { switch (trainGroupAmount) {

View File

@ -118,4 +118,8 @@ export function generateRelayLayout(relays: GenerateRelaysCongig[]) {
); );
} }
} }
const canvasWidth =
relayCabinet[relayCabinet.length - 1].position.x + relayCabinetConsts.width;
relayCabinetStore.getJlCanvas().properties.width =
canvasWidth > 1920 ? canvasWidth : 1920;
} }

View File

@ -28,7 +28,7 @@
<q-btn color="primary" label="启动" @click="createFormShow = true" /> <q-btn color="primary" label="启动" @click="createFormShow = true" />
</template> </template>
<template v-slot:body-cell-operations="props"> <template #body-cell-operations="props">
<q-td :props="props"> <q-td :props="props">
<div class="q-gutter-sm row justify-center"> <div class="q-gutter-sm row justify-center">
<q-btn <q-btn
@ -46,6 +46,18 @@
</div> </div>
</q-td> </q-td>
</template> </template>
<template #body-cell="props">
<td class="text-center" v-if="props.col.name === 'mapIds'">
<q-tooltip>{{ props.value }} </q-tooltip>
{{
props.value.length > 40
? props.value.slice(0, 40) + '…'
: props.value
}}
</td>
<td class="text-center" v-else>{{ props.value }}</td>
</template>
</q-table> </q-table>
<q-dialog <q-dialog
@ -99,7 +111,7 @@ import { useQuasar, type QTableColumn, QForm } from 'quasar';
import { getProjectList } from '../api/ProjectApi'; import { getProjectList } from '../api/ProjectApi';
import { ApiError } from 'src/boot/axios'; import { ApiError } from 'src/boot/axios';
import { import {
SimulationIem, SimulationItem,
createByProject, createByProject,
createSimulationByProject, createSimulationByProject,
getSimulationList, getSimulationList,
@ -168,7 +180,7 @@ const columnDefs: QTableColumn[] = [
const operateDisabled = ref(false); const operateDisabled = ref(false);
const tableRef = ref(); const tableRef = ref();
const rows = reactive<SimulationIem[]>([]); const rows = reactive<SimulationItem[]>([]);
const filter = reactive({ const filter = reactive({
name: '', name: '',
}); });
@ -317,7 +329,7 @@ function getProjectName(id: number): string {
return name; return name;
} }
function joinTest(val: SimulationIem) { function joinTest(val: SimulationItem) {
const query = { const query = {
defaultMapId: val.mapId, defaultMapId: val.mapId,
simulationId: val.simulationId, simulationId: val.simulationId,
@ -325,7 +337,7 @@ function joinTest(val: SimulationIem) {
}; };
router.push({ path: '/linemap', query }); router.push({ path: '/linemap', query });
} }
function endTest(val: SimulationIem) { function endTest(val: SimulationItem) {
operateDisabled.value = true; operateDisabled.value = true;
const name = getProjectName(val.projectId); const name = getProjectName(val.projectId);
$q.dialog({ $q.dialog({

View File

@ -1698,6 +1698,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: NodeConWithSec[]; nodeConWithSecs?: NodeConWithSec[];
isOtherLineConcentrationDividingLine?: boolean;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 6], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 6], this.#one_of_decls);
@ -1720,6 +1721,9 @@ export namespace graphicData {
if ("nodeConWithSecs" in data && data.nodeConWithSecs != undefined) { if ("nodeConWithSecs" in data && data.nodeConWithSecs != undefined) {
this.nodeConWithSecs = data.nodeConWithSecs; this.nodeConWithSecs = data.nodeConWithSecs;
} }
if ("isOtherLineConcentrationDividingLine" in data && data.isOtherLineConcentrationDividingLine != undefined) {
this.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine;
}
} }
} }
get common() { get common() {
@ -1761,6 +1765,12 @@ export namespace graphicData {
set nodeConWithSecs(value: NodeConWithSec[]) { set nodeConWithSecs(value: NodeConWithSec[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value); pb_1.Message.setRepeatedWrapperField(this, 6, value);
} }
get isOtherLineConcentrationDividingLine() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set isOtherLineConcentrationDividingLine(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
@ -1768,6 +1778,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[]; nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[];
isOtherLineConcentrationDividingLine?: boolean;
}): ConcentrationDividingLine { }): ConcentrationDividingLine {
const message = new ConcentrationDividingLine({}); const message = new ConcentrationDividingLine({});
if (data.common != null) { if (data.common != null) {
@ -1788,6 +1799,9 @@ export namespace graphicData {
if (data.nodeConWithSecs != null) { if (data.nodeConWithSecs != null) {
message.nodeConWithSecs = data.nodeConWithSecs.map(item => NodeConWithSec.fromObject(item)); message.nodeConWithSecs = data.nodeConWithSecs.map(item => NodeConWithSec.fromObject(item));
} }
if (data.isOtherLineConcentrationDividingLine != null) {
message.isOtherLineConcentrationDividingLine = data.isOtherLineConcentrationDividingLine;
}
return message; return message;
} }
toObject() { toObject() {
@ -1798,6 +1812,7 @@ export namespace graphicData {
refLeftStationId?: string; refLeftStationId?: string;
refRightStationId?: string; refRightStationId?: string;
nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[]; nodeConWithSecs?: ReturnType<typeof NodeConWithSec.prototype.toObject>[];
isOtherLineConcentrationDividingLine?: boolean;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -1817,6 +1832,9 @@ export namespace graphicData {
if (this.nodeConWithSecs != null) { if (this.nodeConWithSecs != null) {
data.nodeConWithSecs = this.nodeConWithSecs.map((item: NodeConWithSec) => item.toObject()); data.nodeConWithSecs = this.nodeConWithSecs.map((item: NodeConWithSec) => item.toObject());
} }
if (this.isOtherLineConcentrationDividingLine != null) {
data.isOtherLineConcentrationDividingLine = this.isOtherLineConcentrationDividingLine;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -1835,6 +1853,8 @@ export namespace graphicData {
writer.writeString(5, this.refRightStationId); writer.writeString(5, this.refRightStationId);
if (this.nodeConWithSecs.length) if (this.nodeConWithSecs.length)
writer.writeRepeatedMessage(6, this.nodeConWithSecs, (item: NodeConWithSec) => item.serialize(writer)); writer.writeRepeatedMessage(6, this.nodeConWithSecs, (item: NodeConWithSec) => item.serialize(writer));
if (this.isOtherLineConcentrationDividingLine != false)
writer.writeBool(7, this.isOtherLineConcentrationDividingLine);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -1862,6 +1882,9 @@ export namespace graphicData {
case 6: case 6:
reader.readMessage(message.nodeConWithSecs, () => pb_1.Message.addToRepeatedWrapperField(message, 6, NodeConWithSec.deserialize(reader), NodeConWithSec)); reader.readMessage(message.nodeConWithSecs, () => pb_1.Message.addToRepeatedWrapperField(message, 6, NodeConWithSec.deserialize(reader), NodeConWithSec));
break; break;
case 7:
message.isOtherLineConcentrationDividingLine = reader.readBool();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }

View File

@ -46,8 +46,9 @@ export const useIbpStore = defineStore('ibp', {
const stations = lineScene.queryStore const stations = lineScene.queryStore
.queryByType<Station>(Station.Type) .queryByType<Station>(Station.Type)
.filter( .filter(
(station) => (s) =>
station.datas.kilometerSystem.coordinateSystem === 'MAIN_LINE' s.datas.kilometerSystem.coordinateSystem ===
station.datas.kilometerSystem.coordinateSystem
) )
.sort( .sort(
(a, b) => (a, b) =>
@ -69,16 +70,16 @@ export const useIbpStore = defineStore('ibp', {
}, },
async ibpButtonOperation(id: string, down: boolean) { async ibpButtonOperation(id: string, down: boolean) {
return await ibpButtonOperation({ return await ibpButtonOperation({
buttonCode: id, buttonId: id,
down, down,
mapId: Number(this.mapId), mapId: Number(this.mapId),
simulationId: this.simulationId, simulationId: this.simulationId,
stationId: this.stationId, stationId: this.stationId,
}); });
}, },
async ibpKeyOperation(keyCode: string, gear: number) { async ibpKeyOperation(keyId: string, gear: number) {
return await ibpKeyOperation({ return await ibpKeyOperation({
keyCode, keyId,
gear, gear,
mapId: Number(this.mapId), mapId: Number(this.mapId),
simulationId: this.simulationId, simulationId: this.simulationId,