From 5f622454ff8d24e5c29dc3320bd17d568181b9a7 Mon Sep 17 00:00:00 2001 From: fan Date: Thu, 19 Oct 2023 16:44:39 +0800 Subject: [PATCH 01/22] =?UTF-8?q?psl=E6=B5=81=E7=A8=8B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Simulation.ts | 13 +++ src/drawApp/graphics/GatedBoxInteraction.ts | 12 +- src/drawApp/graphics/PslButtonInteraction.ts | 98 +++++++++++++++-- src/drawApp/pslScene.ts | 50 +++++---- src/graphics/pslButton/pslButton.ts | 6 +- src/layouts/LineLayout.vue | 92 ++++++---------- src/stores/line-store.ts | 9 -- src/stores/psl-store.ts | 109 +++---------------- 8 files changed, 200 insertions(+), 189 deletions(-) diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts index 1801ac9..74612b6 100644 --- a/src/api/Simulation.ts +++ b/src/api/Simulation.ts @@ -135,3 +135,16 @@ export async function setRelayState(data: { }) { return await api.post(`${UriBase}/relay/operation`, data); } + +/** + * PSL操作 + */ +export async function pslOperate(data: { + simulationId: string; + mapId: number; + gateBoxId: string; + buttonCode: string; + down: boolean; +}) { + return await api.post(`${UriBase}/psl/operation`, data); +} diff --git a/src/drawApp/graphics/GatedBoxInteraction.ts b/src/drawApp/graphics/GatedBoxInteraction.ts index bad8458..21f37ee 100644 --- a/src/drawApp/graphics/GatedBoxInteraction.ts +++ b/src/drawApp/graphics/GatedBoxInteraction.ts @@ -11,8 +11,8 @@ import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { graphicData } from 'src/protos/stationLayoutGraphics'; -import { useLineStore } from 'src/stores/line-store'; import { GraphicDataBase } from './GraphicDataBase'; +import { usePslStore } from 'src/stores/psl-store'; export class GatedBoxData extends GraphicDataBase implements IGatedBox { constructor(data?: graphicData.GatedBox) { @@ -141,8 +141,12 @@ export class GatedBoxOperateInteraction extends GraphicInteractionPlugin(); + } + clone(): PslButtonState { + return new PslButtonState(this.states.cloneMessage()); + } + copyFrom(data: GraphicStateBase): void { + pb_1.Message.copyInto(data._state, this._state); + } + eq(data: GraphicStateBase): boolean { + return pb_1.Message.equals(this._state, data._state); + } +} + export class PslButtonOperateInteraction extends GraphicInteractionPlugin { static Name = 'psl_button_operate_menu'; constructor(app: IGraphicScene) { @@ -70,16 +117,53 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin { + errorNotify('操作失败', { message: err.origin.response.data.title }); + }); + } + onMouseUp(e: FederatedMouseEvent) { + const simulationId = useLineStore().simulationId; + const mapId = useLineStore().mapId; + const gateBoxId = usePslStore().gatedBoxId; + const target = e.target as DisplayObject; + const pslButton = target.getGraphic() as PslButton; + if (!simulationId || !mapId) { + return; + } + pslOperate({ + simulationId, + mapId, + buttonCode: pslButton.datas.code, + gateBoxId: gateBoxId, + down: false, + }).catch((err) => { + errorNotify('操作失败', { message: err.origin.response.data.title }); + }); } } diff --git a/src/drawApp/pslScene.ts b/src/drawApp/pslScene.ts index 47d0bcc..79b85b3 100644 --- a/src/drawApp/pslScene.ts +++ b/src/drawApp/pslScene.ts @@ -5,7 +5,7 @@ import { IGraphicScene, IGraphicStorage, } from 'src/jl-graphic'; -import { getPublishMapInfoByLineId } from 'src/api/PublishApi'; +import { getPublishMapInfoByName } from 'src/api/PublishApi'; import { usePslStore } from 'src/stores/psl-store'; import { toUint8Array } from 'js-base64'; import { PslKeyTemplate } from 'src/graphics/pslKey/pslKey'; @@ -14,6 +14,7 @@ import { PslButtonTemplate } from 'src/graphics/pslButton/pslButton'; import { PslButtonData, PslButtonOperateInteraction, + PslButtonState, } from './graphics/PslButtonInteraction'; import { PslLightTemplate } from 'src/graphics/pslLight/pslLight'; import { PslLightData } from './graphics/PslLightInteraction'; @@ -21,6 +22,7 @@ import { pslGraphicData } from 'src/protos/pslGraphics'; import { PslTextData } from './graphics/TextContentInteraction'; import { TextContentTemplate } from 'src/graphics/textContent/TextContent'; import { useLineStore } from 'src/stores/line-store'; +import { state } from 'src/protos/device_state'; export function initPslScene(lineApp: IGraphicApp, sceneName: string) { // psl @@ -28,8 +30,8 @@ export function initPslScene(lineApp: IGraphicApp, sceneName: string) { dataLoader: loadPslDatas, mouseToolOptions: { boxSelect: false, - viewportDrag: true, - wheelZoom: true, + viewportDrag: false, + wheelZoom: false, }, }); const graphicTemplate = [ @@ -43,28 +45,38 @@ export function initPslScene(lineApp: IGraphicApp, sceneName: string) { pslScene.on('postdataloaded', () => { handleSubscribe(pslScene); }); - pslScene.setOptions({ - mouseToolOptions: { - boxSelect: false, - viewportDrag: false, - wheelZoom: false, - }, - }); - return lineApp; + // pslScene.setOptions({ + // mouseToolOptions: { + // boxSelect: false, + // viewportDrag: false, + // wheelZoom: false, + // }, + // }); + return pslScene; } function handleSubscribe(pslScene: IGraphicScene) { const lineStore = useLineStore(); + const pslStore = usePslStore(); const simulationId = lineStore.simulationId; const mapId = lineStore.mapId; - const pslId = lineStore.pslId; + const pslId = pslStore.gatedBoxId; const app = pslScene; app.subscribe({ destination: `simulation-psl-${simulationId}_${mapId}_${pslId}-status`, messageConverter: (message: Uint8Array) => { - // console.log('收到消息', message); + console.log('收到消息', message); const states: GraphicState[] = []; - // const storage = state.PushedDevicesStatus.deserialize(message); + const storage = state.PushedDevicesStatus.deserialize(message); + if (storage.all) { + storage.allStatus.buttonState.forEach((item) => { + // 道岔 + if (item.id) { + states.push(new PslButtonState(item)); + } + }); + } + console.log(states, 'states'); return states; }, }); @@ -72,12 +84,10 @@ function handleSubscribe(pslScene: IGraphicScene) { async function loadPslDatas(): Promise { const pslStore = usePslStore(); - const mapId = pslStore.mapId; - const simulationId = pslStore.simulationId; - if (!mapId || !simulationId) { - throw new Error('获取数据异常:未获取到地图ID或仿真ID'); - } - const { proto: base64 } = await getPublishMapInfoByLineId(mapId + ''); + const { proto: base64 } = await getPublishMapInfoByName({ + name: pslStore.pslMapCode, + detail: true, + }); if (base64) { const storage = pslGraphicData.PslGraphicStorage.deserialize( toUint8Array(base64) diff --git a/src/graphics/pslButton/pslButton.ts b/src/graphics/pslButton/pslButton.ts index 8684211..34e368c 100644 --- a/src/graphics/pslButton/pslButton.ts +++ b/src/graphics/pslButton/pslButton.ts @@ -27,8 +27,10 @@ export interface IPslButtonData extends GraphicData { } export interface IPslButtonState extends GraphicState { - get state(): number; - set state(v: number); + get code(): string; + set code(v: string); + get down(): boolean; + set down(v: boolean); } export class PslButton extends JlGraphic { diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index b59d43c..f203887 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -37,11 +37,18 @@
- - -
-
-
+ +
+
{ lineStore.setSimulationId(null); } drawerRight.value = false; - // setTimeout(() => { - // pslShow(); - // }, 5000); }); onUnmounted(() => { if (dialogInstance.value && lineStore.showLayerDialog) { @@ -215,16 +217,34 @@ watch( } ); +const pslCanvasWidth = ref(500); +const pslCanvasHeight = ref(600); watch( - () => lineStore.gatedBoxCount, - () => { - if (lineStore.selectedGraphics) { - const gatedBox = lineStore.selectedGraphics[0] as GatedBox; - pslShow(gatedBox); + () => pslStore.isPslDialogOpen, + (val: boolean) => { + if (val === true) { + nextTick(async () => { + const container = document.getElementById('psl-app-container'); + if (!container) return; + const pslScene = pslStore.getPslScene(); + pslScene?.bindDom(container); + await pslScene?.reload(); + if (pslScene) { + pslCanvasWidth.value = pslScene.canvas.width; + pslCanvasHeight.value = pslScene.canvas.height; + container.style.width = pslCanvasWidth.value + 'px'; + container.style.height = pslCanvasHeight.value + 'px'; + } + }); } } ); +function pslHide() { + pslStore.clearPslParam(); + lineApp.getScene('psl').destroy(); +} + const dialogInstance = ref(); watch( @@ -301,46 +321,6 @@ function switchScene(val: MapInfo) { } } -function pslShow(gatedBox: GatedBox) { - pslDialog.value = true; - const pslApp = usePslStore().initLineApp(); - if (gatedBox.datas.refGatedBoxMapCode) { - const params = { - name: gatedBox.datas.refGatedBoxMapCode, - detail: false, - }; - lineStore.setPslId(gatedBox.datas.id); - getPublishMapInfoByName(params).then(async (mapInfo) => { - const dom = document.getElementById('psl-app-container'); - if (dom) { - usePslStore().addAllScene([mapInfo]); - usePslStore().setMapId(mapInfo.id); - usePslStore().setSimulationId(simulationId); - sceneName = getSceneNameFn(mapInfo); - usePslStore().setSceneName(sceneName); - scene = pslApp.getScene(sceneName); - scene.bindDom(dom); - await scene.reload(); - dom.style.width = scene.canvas.width + 'px'; - dom.style.height = scene.canvas.height + 'px'; - } - }); - } else { - $q.notify({ - type: 'negative', - message: '未获取到关联门控箱地图数据', - }); - } -} - -function pslHide() { - const pslApp = usePslStore().initLineApp(); - lineStore.setPslId(''); - pslApp.unbindDom(); - pslApp.destroy(); - pslDialog.value = false; -} - watch( () => ibpStore.isIbpDialogOpen, (val) => { diff --git a/src/stores/line-store.ts b/src/stores/line-store.ts index 9dbad96..f776f77 100644 --- a/src/stores/line-store.ts +++ b/src/stores/line-store.ts @@ -33,8 +33,6 @@ export const useLineStore = defineStore('line', { categoryType: null as CategoryType | null, echartsTrainId: '', trainStateMap: new Map() as Map, - gatedBoxCount: 0, - pslId: '', }), getters: { selectedGraphicType: (state) => { @@ -64,7 +62,6 @@ export const useLineStore = defineStore('line', { ); }); this.selectedGraphics = []; - this.gatedBoxCount = 0; return app; }, addAllScene(list: MapInfo[]) { @@ -135,11 +132,5 @@ export const useLineStore = defineStore('line', { setCategoryType(type: CategoryType | null) { this.categoryType = type; }, - increaseGatedBoxCount() { - this.gatedBoxCount++; - }, - setPslId(id: string) { - this.pslId = id; - }, }, }); diff --git a/src/stores/psl-store.ts b/src/stores/psl-store.ts index 045ea49..e8d3a57 100644 --- a/src/stores/psl-store.ts +++ b/src/stores/psl-store.ts @@ -1,102 +1,29 @@ import { defineStore } from 'pinia'; -import { - IJlCanvas, - JlGraphic, - IGraphicApp, - GraphicState, -} from 'src/jl-graphic'; -import { - initLineApp, - getLineApp, - destroyLineApp, - addSceneList, - ISceneName, -} from 'src/drawApp/lineApp'; -import { markRaw } from 'vue'; -import { MapInfo } from 'src/api/ProjectLinkApi'; +import { initPslScene } from 'src/drawApp/pslScene'; +import { getLineApp } from 'src/drawApp/lineApp'; export const usePslStore = defineStore('psl', { state: () => ({ - selectedGraphics: null as JlGraphic[] | null, - lineId: null as number | null, - lineName: null as string | null, - simulationId: null as string | null, - socketStates: null as GraphicState[] | null, - stateProCount: 0, - showLayer: [] as string[], // 显示的图层(草稿和发布图公用) - showLayerDialog: false, // 显示图层控制弹窗(草稿和发布图公用) - mapId: null as number | null, - sceneName: '', // 场景名称 + pslMapCode: '', + gatedBoxId: '', + isPslDialogOpen: false, }), - getters: { - selectedGraphicType: (state) => { - if (state.selectedGraphics) { - if (state.selectedGraphics.length === 1) { - return state.selectedGraphics[0].type; - } - } - }, - }, actions: { - getLineApp(): IGraphicApp { - const app = getLineApp(); - if (app == null) { - throw new Error('未初始化app'); - } - return app; + getPslScene() { + const lineApp = getLineApp(); + if (!lineApp) return; + const pslScene = initPslScene(lineApp, 'psl'); + return pslScene; }, - getJlCanvas(): IJlCanvas { - return this.getLineApp().canvas; + setPslParam(gatedBoxId: string, pslMapCode: string) { + this.gatedBoxId = gatedBoxId; + this.pslMapCode = pslMapCode; + this.isPslDialogOpen = true; }, - initLineApp() { - const app = initLineApp(); - app.on('graphicselected', () => { - this.selectedGraphics = markRaw( - app.getScene(this.sceneName).selectedGraphics - ); - }); - this.selectedGraphics = []; - return app; - }, - addAllScene(list: MapInfo[]) { - const arr: ISceneName[] = list.map((item) => { - return { type: item.type, id: item.id }; - }); - addSceneList(arr); - }, - appCurrentScene() { - return this.getLineApp().getScene(this.sceneName); - }, - destroy() { - this.selectedGraphics = null; - destroyLineApp(); - }, - setLineId(id: number | null) { - this.lineId = id; - }, - setLineName(name: string | null) { - this.lineName = name; - }, - setSimulationId(id: string | null) { - this.simulationId = id; - }, - setSocketStates(v: GraphicState[] | null) { - this.socketStates = v; - }, - stateProCountIncrease() { - this.stateProCount++; - }, - setShowLayer(v: string[]) { - this.showLayer = v; - }, - setShowLayerDialog(v: boolean) { - this.showLayerDialog = v; - }, - setMapId(id: number | null) { - this.mapId = id; - }, - setSceneName(sceneName: string) { - this.sceneName = sceneName; + clearPslParam() { + this.gatedBoxId = ''; + this.pslMapCode = ''; + this.isPslDialogOpen = false; }, }, }); From a42a3e79c7078b473893aea0081bcd8278c8756c Mon Sep 17 00:00:00 2001 From: fan Date: Thu, 19 Oct 2023 16:52:41 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bj-rtss-message | 2 +- graphic-pixi | 2 +- src/drawApp/pslScene.ts | 20 ++++++++++---------- src/jl-graphic/plugins/AnimationManager.ts | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bj-rtss-message b/bj-rtss-message index 4ea207e..cff3d23 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 4ea207ebba3bce4ff022de42d8fbd5235f172a81 +Subproject commit cff3d23475a6352e560e27f7b006727b3b884217 diff --git a/graphic-pixi b/graphic-pixi index 023c84c..8550a45 160000 --- a/graphic-pixi +++ b/graphic-pixi @@ -1 +1 @@ -Subproject commit 023c84c4ccf7f38e477253e1b49856bfb50aca18 +Subproject commit 8550a458fccb2171a7b0889c9853f4716a48823d diff --git a/src/drawApp/pslScene.ts b/src/drawApp/pslScene.ts index 79b85b3..70e2123 100644 --- a/src/drawApp/pslScene.ts +++ b/src/drawApp/pslScene.ts @@ -67,16 +67,16 @@ function handleSubscribe(pslScene: IGraphicScene) { messageConverter: (message: Uint8Array) => { console.log('收到消息', message); const states: GraphicState[] = []; - const storage = state.PushedDevicesStatus.deserialize(message); - if (storage.all) { - storage.allStatus.buttonState.forEach((item) => { - // 道岔 - if (item.id) { - states.push(new PslButtonState(item)); - } - }); - } - console.log(states, 'states'); + // const storage = state.PushedDevicesStatus.deserialize(message); + // if (storage.all) { + // storage.allStatus.buttonState.forEach((item) => { + // // 道岔 + // if (item.id) { + // states.push(new PslButtonState(item)); + // } + // }); + // } + // console.log(states, 'states'); return states; }, }); diff --git a/src/jl-graphic/plugins/AnimationManager.ts b/src/jl-graphic/plugins/AnimationManager.ts index d783098..fe88038 100644 --- a/src/jl-graphic/plugins/AnimationManager.ts +++ b/src/jl-graphic/plugins/AnimationManager.ts @@ -42,7 +42,7 @@ export class AnimationManager { } destroy() { - this.app.pixi.ticker.remove(this.run, this); + this.app.pixi?.ticker.remove(this.run, this); } /** * 图形对象的所有动画map From e08dfdefc1eee8ba54d86d2a7a4d3e6f64b8a954 Mon Sep 17 00:00:00 2001 From: fan Date: Thu, 19 Oct 2023 17:00:31 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- graphic-pixi | 2 +- src/jl-graphic/plugins/AnimationManager.ts | 2 +- src/layouts/LineLayout.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/graphic-pixi b/graphic-pixi index 8550a45..4327e3c 160000 --- a/graphic-pixi +++ b/graphic-pixi @@ -1 +1 @@ -Subproject commit 8550a458fccb2171a7b0889c9853f4716a48823d +Subproject commit 4327e3c282182b2a1de2d28046f08c24750a3e95 diff --git a/src/jl-graphic/plugins/AnimationManager.ts b/src/jl-graphic/plugins/AnimationManager.ts index fe88038..d783098 100644 --- a/src/jl-graphic/plugins/AnimationManager.ts +++ b/src/jl-graphic/plugins/AnimationManager.ts @@ -42,7 +42,7 @@ export class AnimationManager { } destroy() { - this.app.pixi?.ticker.remove(this.run, this); + this.app.pixi.ticker.remove(this.run, this); } /** * 图形对象的所有动画map diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index ede820e..d09ceb8 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -242,7 +242,7 @@ watch( function pslHide() { pslStore.clearPslParam(); - lineApp.getScene('psl').destroy(); + lineApp.getScene('psl').unbindDom(); } const dialogInstance = ref(); From 6c9c3f9a403dce5164d4f4aa7da43b6a58acdbf0 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 19 Oct 2023 17:26:56 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E4=B8=BB=E5=9D=90=E6=A0=87=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/DrawLayout.vue | 8 ++++ src/protos/stationLayoutGraphics.ts | 57 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 3a151b3..7a85343 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -152,6 +152,14 @@ v-model="UniqueIdPrefix.lineId" :rules="[(val) => val.trim() != '' || '集中站名称不能为空']" /> + diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index e91ba43..a3e538e 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -2798,6 +2798,7 @@ export namespace graphicData { index?: number; refDev?: RelatedRef; centralizedStations?: string[]; + mt?: Signal.ModelType; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [9], this.#one_of_decls); @@ -2823,6 +2824,9 @@ export namespace graphicData { if ("centralizedStations" in data && data.centralizedStations != undefined) { this.centralizedStations = data.centralizedStations; } + if ("mt" in data && data.mt != undefined) { + this.mt = data.mt; + } } } get common() { @@ -2876,6 +2880,12 @@ export namespace graphicData { set centralizedStations(value: string[]) { pb_1.Message.setField(this, 9, value); } + get mt() { + return pb_1.Message.getFieldWithDefault(this, 10, Signal.ModelType.N) as Signal.ModelType; + } + set mt(value: Signal.ModelType) { + pb_1.Message.setField(this, 10, value); + } static fromObject(data: { common?: ReturnType; code?: string; @@ -2884,6 +2894,7 @@ export namespace graphicData { index?: number; refDev?: ReturnType; centralizedStations?: string[]; + mt?: Signal.ModelType; }): Signal { const message = new Signal({}); if (data.common != null) { @@ -2907,6 +2918,9 @@ export namespace graphicData { if (data.centralizedStations != null) { message.centralizedStations = data.centralizedStations; } + if (data.mt != null) { + message.mt = data.mt; + } return message; } toObject() { @@ -2918,6 +2932,7 @@ export namespace graphicData { index?: number; refDev?: ReturnType; centralizedStations?: string[]; + mt?: Signal.ModelType; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -2940,6 +2955,9 @@ export namespace graphicData { if (this.centralizedStations != null) { data.centralizedStations = this.centralizedStations; } + if (this.mt != null) { + data.mt = this.mt; + } return data; } serialize(): Uint8Array; @@ -2960,6 +2978,8 @@ export namespace graphicData { writer.writeMessage(8, this.refDev, () => this.refDev.serialize(writer)); if (this.centralizedStations.length) writer.writeRepeatedString(9, this.centralizedStations); + if (this.mt != Signal.ModelType.N) + writer.writeEnum(10, this.mt); if (!w) return writer.getResultBuffer(); } @@ -2990,6 +3010,9 @@ export namespace graphicData { case 9: pb_1.Message.addToRepeatedField(message, 9, reader.readString()); break; + case 10: + message.mt = reader.readEnum(); + break; default: reader.skipField(); } } @@ -3002,6 +3025,17 @@ export namespace graphicData { return Signal.deserialize(bytes); } } + export namespace Signal { + export enum ModelType { + N = 0, + HL = 1, + HLU_FU = 2, + HLU = 3, + HLU_FL = 4, + AB = 5, + HBU = 6 + } + } export class Section extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -6644,6 +6678,7 @@ export namespace graphicData { constructor(data?: any[] | { city?: string; lineId?: string; + mainCoordinateSystem?: string; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -6654,6 +6689,9 @@ export namespace graphicData { if ("lineId" in data && data.lineId != undefined) { this.lineId = data.lineId; } + if ("mainCoordinateSystem" in data && data.mainCoordinateSystem != undefined) { + this.mainCoordinateSystem = data.mainCoordinateSystem; + } } } get city() { @@ -6668,9 +6706,16 @@ export namespace graphicData { set lineId(value: string) { pb_1.Message.setField(this, 2, value); } + get mainCoordinateSystem() { + return pb_1.Message.getFieldWithDefault(this, 3, "") as string; + } + set mainCoordinateSystem(value: string) { + pb_1.Message.setField(this, 3, value); + } static fromObject(data: { city?: string; lineId?: string; + mainCoordinateSystem?: string; }): UniqueIdOfStationLayout { const message = new UniqueIdOfStationLayout({}); if (data.city != null) { @@ -6679,12 +6724,16 @@ export namespace graphicData { if (data.lineId != null) { message.lineId = data.lineId; } + if (data.mainCoordinateSystem != null) { + message.mainCoordinateSystem = data.mainCoordinateSystem; + } return message; } toObject() { const data: { city?: string; lineId?: string; + mainCoordinateSystem?: string; } = {}; if (this.city != null) { data.city = this.city; @@ -6692,6 +6741,9 @@ export namespace graphicData { if (this.lineId != null) { data.lineId = this.lineId; } + if (this.mainCoordinateSystem != null) { + data.mainCoordinateSystem = this.mainCoordinateSystem; + } return data; } serialize(): Uint8Array; @@ -6702,6 +6754,8 @@ export namespace graphicData { writer.writeString(1, this.city); if (this.lineId.length) writer.writeString(2, this.lineId); + if (this.mainCoordinateSystem.length) + writer.writeString(3, this.mainCoordinateSystem); if (!w) return writer.getResultBuffer(); } @@ -6717,6 +6771,9 @@ export namespace graphicData { case 2: message.lineId = reader.readString(); break; + case 3: + message.mainCoordinateSystem = reader.readString(); + break; default: reader.skipField(); } } From b82039db7e4d233dbe52ea955b28f186e9af650b Mon Sep 17 00:00:00 2001 From: fan Date: Thu, 19 Oct 2023 17:30:46 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E6=9C=BA=E6=95=85?= =?UTF-8?q?=E9=9A=9C=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Simulation.ts | 1 + .../line-app/states/SignalState.vue | 125 +++++++++++++++++- src/drawApp/graphics/SignalInteraction.ts | 6 + 3 files changed, 127 insertions(+), 5 deletions(-) diff --git a/src/api/Simulation.ts b/src/api/Simulation.ts index 74612b6..885fa43 100644 --- a/src/api/Simulation.ts +++ b/src/api/Simulation.ts @@ -60,6 +60,7 @@ export async function setSignalState(data: { simulationId: string; mapId: number; id: string; + operation: number; aspect: number; }) { return await api.post(`${UriBase}/signal/operation`, data); diff --git a/src/components/line-app/states/SignalState.vue b/src/components/line-app/states/SignalState.vue index 85851bb..181247d 100644 --- a/src/components/line-app/states/SignalState.vue +++ b/src/components/line-app/states/SignalState.vue @@ -1,7 +1,22 @@ From 0ca8662b0b7dfcf15a1ffa42654ffc5c56edaa0b Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 20 Oct 2023 15:53:58 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/lineScene.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts index 613a315..d28efb1 100644 --- a/src/drawApp/lineScene.ts +++ b/src/drawApp/lineScene.ts @@ -182,6 +182,9 @@ export const layerList = [ export function initLineScene(lineApp: IGraphicApp, sceneName: string) { const options: GraphicAppOptions = { dataLoader: loadLineDatas, + }; + const lineScene = lineApp.initScene(sceneName, options); + lineScene.setOptions({ mouseToolOptions: { boxSelect: false, viewportDrag: true, @@ -197,8 +200,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) { Section.Type, Transponder.Type, ], - }; - const lineScene = lineApp.initScene(sceneName, options); + }); const categoryType = useLineStore().categoryType; if (!categoryType) { throw new Error('未获取到厂商信息'); From 3bf6e09acb5a97f2861c14f49715efd2f98d4d4e Mon Sep 17 00:00:00 2001 From: fan Date: Fri, 20 Oct 2023 16:04:27 +0800 Subject: [PATCH 13/22] =?UTF-8?q?psl=E6=8C=89=E9=92=AE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=B0=83=E7=94=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/psl-store.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stores/psl-store.ts b/src/stores/psl-store.ts index e8d3a57..aee55e8 100644 --- a/src/stores/psl-store.ts +++ b/src/stores/psl-store.ts @@ -1,6 +1,7 @@ import { defineStore } from 'pinia'; import { initPslScene } from 'src/drawApp/pslScene'; import { getLineApp } from 'src/drawApp/lineApp'; +import { GraphicApp } from 'src/jl-graphic/app/JlGraphicApp'; export const usePslStore = defineStore('psl', { state: () => ({ @@ -10,10 +11,12 @@ export const usePslStore = defineStore('psl', { }), actions: { getPslScene() { - const lineApp = getLineApp(); + const lineApp = getLineApp() as GraphicApp; if (!lineApp) return; - const pslScene = initPslScene(lineApp, 'psl'); - return pslScene; + if (lineApp.scenes.get('psl')) { + return lineApp.getScene('psl'); + } + return initPslScene(lineApp, 'psl'); }, setPslParam(gatedBoxId: string, pslMapCode: string) { this.gatedBoxId = gatedBoxId; From 6fd7e6191e6919a128ec42199f0a4b579240be92 Mon Sep 17 00:00:00 2001 From: fan Date: Fri, 20 Oct 2023 16:16:54 +0800 Subject: [PATCH 14/22] =?UTF-8?q?psl=E6=8C=89=E4=B8=8B=E6=8A=AC=E8=B5=B7?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/PslButtonInteraction.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/drawApp/graphics/PslButtonInteraction.ts b/src/drawApp/graphics/PslButtonInteraction.ts index 2795dab..6526ff9 100644 --- a/src/drawApp/graphics/PslButtonInteraction.ts +++ b/src/drawApp/graphics/PslButtonInteraction.ts @@ -159,9 +159,14 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin { - errorNotify('操作失败', { message: err.origin.response.data.title }); - }); + down: !pslButton.states.down, + }) + .then(() => { + pslButton.states.down = !pslButton.states.down; + pslButton.doRepaint(); + }) + .catch((err) => { + errorNotify('操作失败', { message: err.origin.response.data.title }); + }); } } From 565900536afaece54ba107c863a2fef31b9100f9 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 20 Oct 2023 17:33:30 +0800 Subject: [PATCH 15/22] =?UTF-8?q?=E6=89=93=E5=8C=85=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 ++ quasar.config.js | 4 ++++ src/configs/UrlManage.ts | 31 +++++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a6cd46f..3198a09 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "test": "echo \"No test specified\" && exit 0", "dev": "quasar dev", "build": "quasar build", + "build:test": "set NODE_ENV=test&&quasar build", + "build:publish": "set NODE_ENV=publish&&quasar build", "protoc": "node scripts/proto.cjs", "sync": "node scripts/sync.cjs" }, diff --git a/quasar.config.js b/quasar.config.js index 3f02c23..7973526 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -52,6 +52,10 @@ module.exports = configure(function (/* ctx */) { // Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#build build: { + env: { + // test:测试服务器;publish:正式服务器;其他本地 + ENV_MODE: process.env.NODE_ENV, + }, target: { browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'], node: 'node16', diff --git a/src/configs/UrlManage.ts b/src/configs/UrlManage.ts index 73b2dcd..48def03 100644 --- a/src/configs/UrlManage.ts +++ b/src/configs/UrlManage.ts @@ -1,4 +1,9 @@ function getHost(): string { + if (process.env.ENV_MODE == 'test') { + return 'test.joylink.club/bjrtss-server'; + } else if (process.env.ENV_MODE == 'publish') { + return 'joylink.club/bjrtss-server'; + } // return '192.168.3.7:9091'; // return '192.168.3.47:9091'; // return '192.168.3.37:9091'; @@ -6,18 +11,28 @@ function getHost(): string { // return '192.168.3.5:9091'; // return '192.168.3.37:9091'; return '192.168.3.233:9091'; - // return 'test.joylink.club/bjrtss-server'; } export function getHttpBase() { - return `http://${getHost()}`; - // return `https://${getHost()}`; + let protocol = 'http'; + if (['test', 'publish'].includes(process.env.ENV_MODE as string)) { + protocol = 'https'; + } + return `${protocol}://${getHost()}`; } export function getWebsocketUrl() { - const host = '192.168.3.233'; - const port = 8000; - // return `ws://${host}/ws-bj`; - return `ws://${host}:${port}/connection/websocket`; - // return `wss://${getHost()}/ws-bj`; + let protocol = 'ws'; + let host = '192.168.3.233'; + let port = '8000'; + if (process.env.ENV_MODE == 'test') { + protocol = 'wss'; + host = 'test.joylink.club/bjrtss-server'; + port = ''; + } else if (process.env.ENV_MODE == 'publish') { + protocol = 'wss'; + host = 'joylink.club/bjrtss-server'; + port = ''; + } + return `${protocol}://${host}:${port}/connection/websocket`; } From c5e186911a76535ff95b3b3beda48f8feede8f48 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 20 Oct 2023 17:50:22 +0800 Subject: [PATCH 16/22] =?UTF-8?q?=E5=85=AC=E9=87=8C=E6=A0=87=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/DrawLayout.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 7a85343..69c7db1 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -36,12 +36,6 @@ - 关联设备列表 + + + 公里标转换 + + From 3e8da3eec056281542fb27149b847f63afaa53d6 Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 23 Oct 2023 11:04:36 +0800 Subject: [PATCH 17/22] =?UTF-8?q?psl=E6=8C=89=E9=92=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/PslButtonInteraction.ts | 59 ++++++++++++-------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/src/drawApp/graphics/PslButtonInteraction.ts b/src/drawApp/graphics/PslButtonInteraction.ts index 6526ff9..60af0ff 100644 --- a/src/drawApp/graphics/PslButtonInteraction.ts +++ b/src/drawApp/graphics/PslButtonInteraction.ts @@ -116,36 +116,27 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin { - // errorNotify('操作失败', { message: err.origin.response.data.title }); - // }); - // } - onMouseUp(e: FederatedMouseEvent) { + onMouseOut(e: FederatedMouseEvent) { + const target = e.target as DisplayObject; + const pslButton = target.getGraphic() as PslButton; + if (pslButton.states.down && pslButton.datas.isSelfReset) { + pslButton.states.down = false; + pslButton.doRepaint(); + } + } + onMouseDown(e: FederatedMouseEvent) { const simulationId = useLineStore().simulationId; const mapId = useLineStore().mapId; const gateBoxId = usePslStore().gatedBoxId; @@ -169,4 +160,28 @@ export class PslButtonOperateInteraction extends GraphicInteractionPlugin { + pslButton.states.down = false; + pslButton.doRepaint(); + }) + .catch((err) => { + errorNotify('操作失败', { message: err.origin.response.data.title }); + }); + } } From 4d4169a6e6c83beea8a8326347514659c4c53fe4 Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 23 Oct 2023 13:33:10 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E9=97=A8=E6=8E=A7=E7=AE=B1spks=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/gatedBox/GatedBox.ts | 12 +++++++++++- src/graphics/spksSwitch/SpksSwitch.ts | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/graphics/gatedBox/GatedBox.ts b/src/graphics/gatedBox/GatedBox.ts index e556d01..01195c0 100644 --- a/src/graphics/gatedBox/GatedBox.ts +++ b/src/graphics/gatedBox/GatedBox.ts @@ -59,8 +59,18 @@ export class GatedBox extends JlGraphic { codeGraph.text = this.datas.code; codeGraph.style.fill = gatedBoxConsts.codeColor; codeGraph.setVectorFontSize(gatedBoxConsts.codeFontSize); + const codeTransform = this.datas?.childTransforms?.find( + (item) => item.name === 'gated_box_code' + ); + if (codeTransform) { + const position = codeTransform?.transform.position; + const rotation = codeTransform?.transform?.rotation; + codeGraph.position.set(position?.x, position?.y); + codeGraph.rotation = rotation || 0; + } else { + codeGraph.position.set(20, 0); + } codeGraph.anchor.set(0.5); - codeGraph.position.set(20, 0); this.textGraph.style.fill = gatedBoxConsts.codeColor; this.textGraph.setVectorFontSize(gatedBoxConsts.codeFontSize); this.textGraph.anchor.set(0.5); diff --git a/src/graphics/spksSwitch/SpksSwitch.ts b/src/graphics/spksSwitch/SpksSwitch.ts index 6bb43f9..0af4b06 100644 --- a/src/graphics/spksSwitch/SpksSwitch.ts +++ b/src/graphics/spksSwitch/SpksSwitch.ts @@ -59,8 +59,18 @@ export class SpksSwitch extends JlGraphic { codeGraph.text = this.datas.code; codeGraph.style.fill = spksSwitchConsts.codeColor; codeGraph.setVectorFontSize(spksSwitchConsts.codeFontSize); + const codeTransform = this.datas?.childTransforms?.find( + (item) => item.name === 'spks_switch_code' + ); + if (codeTransform) { + const position = codeTransform?.transform.position; + const rotation = codeTransform?.transform?.rotation; + codeGraph.position.set(position?.x, position?.y); + codeGraph.rotation = rotation || 0; + } else { + codeGraph.position.set(20, 0); + } codeGraph.anchor.set(0.5); - codeGraph.position.set(20, 0); this.textGraph.style.fill = spksSwitchConsts.codeColor; this.textGraph.setVectorFontSize(spksSwitchConsts.codeFontSize); this.textGraph.anchor.set(0.5); From b5794cd8546569b8cba8ed3a19f2a76f681cdbaf Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 23 Oct 2023 14:09:15 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=9B=86=E4=B8=AD=E7=AB=99=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/multipleSelectProperty.vue | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/draw-app/properties/multipleSelectProperty.vue b/src/components/draw-app/properties/multipleSelectProperty.vue index ce2e95d..9cefd1c 100644 --- a/src/components/draw-app/properties/multipleSelectProperty.vue +++ b/src/components/draw-app/properties/multipleSelectProperty.vue @@ -54,28 +54,38 @@ function addCentralizedStation() { if (device.type === Section.Type) { const data = new SectionData(); data.copyFrom(device.saveData()); - data.centralizedStations.push(stationName.value); - device.updateData(data); + if (!data.centralizedStations.includes(stationName.value)) { + data.centralizedStations.push(stationName.value); + device.updateData(data); + } } else if (device.type === Signal.Type) { const data = new SignalData(); data.copyFrom(device.saveData()); - data.centralizedStations.push(stationName.value); - device.updateData(data); + if (!data.centralizedStations.includes(stationName.value)) { + data.centralizedStations.push(stationName.value); + device.updateData(data); + } } else if (device.type === Turnout.Type) { const data = new TurnoutData(); data.copyFrom(device.saveData()); - data.centralizedStations.push(stationName.value); - device.updateData(data); + if (!data.centralizedStations.includes(stationName.value)) { + data.centralizedStations.push(stationName.value); + device.updateData(data); + } } else if (device.type === AxleCounting.Type) { const data = new AxleCountingData(); data.copyFrom(device.saveData()); - data.centralizedStations.push(stationName.value); - device.updateData(data); + if (!data.centralizedStations.includes(stationName.value)) { + data.centralizedStations.push(stationName.value); + device.updateData(data); + } } else if (device.type === Transponder.Type) { const data = new TransponderData(); data.copyFrom(device.saveData()); - data.centralizedStations.push(stationName.value); - device.updateData(data); + if (!data.centralizedStations.includes(stationName.value)) { + data.centralizedStations.push(stationName.value); + device.updateData(data); + } } }); stationName.value = ''; From 40061eef034aec4cfbdb3d71d59047bd60df565a Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 23 Oct 2023 16:13:45 +0800 Subject: [PATCH 20/22] =?UTF-8?q?=E5=88=97=E8=BD=A6=E6=9B=B2=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../line-app/infos/TrainInfoEcharts.vue | 66 ++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/components/line-app/infos/TrainInfoEcharts.vue b/src/components/line-app/infos/TrainInfoEcharts.vue index cefc178..c766e51 100644 --- a/src/components/line-app/infos/TrainInfoEcharts.vue +++ b/src/components/line-app/infos/TrainInfoEcharts.vue @@ -40,6 +40,9 @@ let tractionForceList: [Date, number][] = []; let brakeForceList: [Date, number][] = []; let kmList: number[] = []; let km_speedList: [number, number][] = []; +let km_accelerationList: [number, number][] = []; +let km_tractionForceList: [number, number][] = []; +let km_brakeForceList: [number, number][] = []; let maxKm: number; let minKm: number; @@ -62,6 +65,9 @@ function getDataList() { brakeForceList = []; kmList = []; km_speedList = []; + km_accelerationList = []; + km_tractionForceList = []; + km_brakeForceList = []; lineStore.trainStateMap.forEach((list, key) => { const find = list.find((ii) => { return ii.id == props.trainId; @@ -74,6 +80,18 @@ function getDataList() { if (!kmList.includes(find.trainKilometer)) { kmList.push(find.trainKilometer); km_speedList.push([find.trainKilometer, find.dynamicState.speed / 100]); + km_accelerationList.push([ + find.trainKilometer, + find.dynamicState.acceleration, + ]); + km_tractionForceList.push([ + find.trainKilometer, + find.vobcState.tractionForce / 100, + ]); + km_brakeForceList.push([ + find.trainKilometer, + find.vobcState.brakeForce / 100, + ]); } } }); @@ -121,6 +139,28 @@ let km_series: SeriesObj[] = [ data: km_speedList, unit: 'km/h', }, + { + name: '加速度', + type: 'line', + showSymbol: false, + yAxisIndex: 1, + data: km_accelerationList, + unit: 'm/s', + }, + { + name: '牵引力', + type: 'line', + showSymbol: false, + data: km_tractionForceList, + unit: 'kn', + }, + { + name: '制动力', + type: 'line', + showSymbol: false, + data: brakeForceList, + unit: 'kn', + }, ]; function trainKilometerFormat(v: number) { @@ -295,7 +335,7 @@ function initEcharts() { }, }, legend: { - data: ['速度'], + data: ['速度', '加速度', '牵引力', '制动力'], }, xAxis: { type: 'value', @@ -308,13 +348,26 @@ function initEcharts() { yAxis: [ { type: 'value', - max: 100, + // max: 100, axisLine: { show: false, }, axisTick: { show: false, }, + boundaryGap: [0, 0.1], + }, + { + type: 'value', + scale: true, + name: '加速度 m/s', + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + boundaryGap: [0, 0.4], }, ], series: km_series, @@ -349,6 +402,15 @@ watch( { data: km_speedList, }, + { + data: km_accelerationList, + }, + { + data: km_tractionForceList, + }, + { + data: km_brakeForceList, + }, ], }; } From c9c2478fcd754f4a6c9d8b8c2332bc8d9fd5fc23 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Mon, 23 Oct 2023 16:15:51 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/LineLayout.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index d09ceb8..36be66b 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -174,6 +174,11 @@ onMounted(async () => { } lineStore.addAllScene(projectInfo.mapInfoLinks || []); } + lineStore.setSceneName(sceneName); + scene = lineApp.getScene(sceneName); + scene.bindDom(dom); + scene.reload(); + onResize(); } catch (e) { const error = e as ApiError; $q.notify({ @@ -181,11 +186,6 @@ onMounted(async () => { message: error.title, }); } - lineStore.setSceneName(sceneName); - scene = lineApp.getScene(sceneName); - scene.bindDom(dom); - scene.reload(); - onResize(); } else { lineStore.setMapId(null); lineStore.setSimulationId(null); From 7587264a116166b87fe130b4f24050f8f4d35e69 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 23 Oct 2023 16:33:13 +0800 Subject: [PATCH 22/22] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E6=9C=BA=E6=95=85=E9=9A=9C=E6=8A=A5=E8=AD=A6=E4=BB=AA=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=EF=BC=8C=E7=BB=84=E5=90=88=E9=87=8C=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=B7=BB=E5=8A=A0=E4=BF=A1=E5=8F=B7=E6=9C=BA?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E6=8A=A5=E8=AD=A6=E4=BB=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draw-app/DrawRelayCabinetProperties.vue | 7 ++ .../dialogs/DeviceRelateRelayList.vue | 1 + .../draw-app/properties/RelateRelayConfig.vue | 4 + .../properties/SignalFaultAlarmProperty.vue | 25 ++++ .../SignalFaultAlarmInteraction.ts | 46 +++++++ src/drawApp/relayCabinetLayoutApp.ts | 19 +++ .../signalFaultAlarm/SignalFaultAlarm.ts | 80 ++++++++++++ .../SignalFaultAlarmDrawAssistant.ts | 104 +++++++++++++++ .../signalFaultAlarmSprites.png | Bin 0 -> 6249 bytes src/layouts/RelayCabinetLayout.vue | 2 + src/protos/relayCabinetLayoutGraphics.ts | 118 +++++++++++++++++- src/protos/stationLayoutGraphics.ts | 3 +- 12 files changed, 407 insertions(+), 2 deletions(-) create mode 100644 src/components/draw-app/properties/SignalFaultAlarmProperty.vue create mode 100644 src/drawApp/relayCabinetGraphics/SignalFaultAlarmInteraction.ts create mode 100644 src/graphics/signalFaultAlarm/SignalFaultAlarm.ts create mode 100644 src/graphics/signalFaultAlarm/SignalFaultAlarmDrawAssistant.ts create mode 100644 src/graphics/signalFaultAlarm/signalFaultAlarmSprites.png diff --git a/src/components/draw-app/DrawRelayCabinetProperties.vue b/src/components/draw-app/DrawRelayCabinetProperties.vue index 678f791..8316497 100644 --- a/src/components/draw-app/DrawRelayCabinetProperties.vue +++ b/src/components/draw-app/DrawRelayCabinetProperties.vue @@ -27,6 +27,11 @@ PhaseFailureProtector.Type " > + @@ -41,6 +46,8 @@ import RelayProperty from './properties/RelayProperty.vue'; import { Relay } from 'src/graphics/relay/Relay'; import PhaseFailureProtectorProperty from './properties/PhaseFailureProtectorProperty.vue'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; +import SignalFaultAlarmProperty from './properties/SignalFaultAlarmProperty.vue'; +import { SignalFaultAlarm } from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; import { useRelayCabinetStore } from 'src/stores/relayCabinet-store'; const relayCabinetStore = useRelayCabinetStore(); diff --git a/src/components/draw-app/dialogs/DeviceRelateRelayList.vue b/src/components/draw-app/dialogs/DeviceRelateRelayList.vue index f5ccdc2..c6d787b 100644 --- a/src/components/draw-app/dialogs/DeviceRelateRelayList.vue +++ b/src/components/draw-app/dialogs/DeviceRelateRelayList.vue @@ -63,6 +63,7 @@ const deviceTypeMap = { 5: '信号机', 6: '车站', 7: '屏蔽门', + 8: '信号机故障报警仪', }; const columns: QTable['columns'] = [ { diff --git a/src/components/draw-app/properties/RelateRelayConfig.vue b/src/components/draw-app/properties/RelateRelayConfig.vue index a1ac778..d43992b 100644 --- a/src/components/draw-app/properties/RelateRelayConfig.vue +++ b/src/components/draw-app/properties/RelateRelayConfig.vue @@ -133,6 +133,10 @@ const optionsType = [ { label: '信号机', value: graphicData.RelatedRef.DeviceType.signal }, { label: '车站', value: graphicData.RelatedRef.DeviceType.station }, { label: '屏蔽门', value: graphicData.RelatedRef.DeviceType.ScreenDoor }, + { + label: '信号机故障报警仪', + value: graphicData.RelatedRef.DeviceType.SignalFaultAlarm, + }, ]; let selectGraphic: JlGraphic[] = []; diff --git a/src/components/draw-app/properties/SignalFaultAlarmProperty.vue b/src/components/draw-app/properties/SignalFaultAlarmProperty.vue new file mode 100644 index 0000000..c152078 --- /dev/null +++ b/src/components/draw-app/properties/SignalFaultAlarmProperty.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/drawApp/relayCabinetGraphics/SignalFaultAlarmInteraction.ts b/src/drawApp/relayCabinetGraphics/SignalFaultAlarmInteraction.ts new file mode 100644 index 0000000..2878442 --- /dev/null +++ b/src/drawApp/relayCabinetGraphics/SignalFaultAlarmInteraction.ts @@ -0,0 +1,46 @@ +import * as pb_1 from 'google-protobuf'; +import { + ISignalFaultAlarmData, + SignalFaultAlarm, +} from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; +import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; +import { GraphicDataBase } from '../graphics/GraphicDataBase'; + +export class SignalFaultAlarmData + extends GraphicDataBase + implements ISignalFaultAlarmData +{ + constructor(data?: relayCabinetGraphicData.SignalFaultAlarm) { + let signalFaultAlarm; + if (!data) { + signalFaultAlarm = new relayCabinetGraphicData.SignalFaultAlarm( + { + common: GraphicDataBase.defaultCommonInfo(SignalFaultAlarm.Type), + } + ); + } else { + signalFaultAlarm = data; + } + super(signalFaultAlarm); + } + + public get data(): relayCabinetGraphicData.SignalFaultAlarm { + return this.getData(); + } + + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + clone(): SignalFaultAlarmData { + return new SignalFaultAlarmData(this.data.cloneMessage()); + } + copyFrom(data: SignalFaultAlarmData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: SignalFaultAlarmData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/relayCabinetLayoutApp.ts b/src/drawApp/relayCabinetLayoutApp.ts index d423185..4a9bd00 100644 --- a/src/drawApp/relayCabinetLayoutApp.ts +++ b/src/drawApp/relayCabinetLayoutApp.ts @@ -33,6 +33,12 @@ import { } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; import { PhaseFailureProtectorData } from './relayCabinetGraphics/PhaseFailureProtectorInteraction'; import { PhaseFailureProtectorDraw } from 'src/graphics/phaseFailureProtector/PhaseFailureProtectorDrawAssistant'; +import { + SignalFaultAlarm, + SignalFaultAlarmTemplate, +} from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; +import { SignalFaultAlarmData } from './relayCabinetGraphics/SignalFaultAlarmInteraction'; +import { SignalFaultAlarmDraw } from 'src/graphics/signalFaultAlarm/SignalFaultAlarmDrawAssistant'; const UndoOptions: MenuItemOptions = { name: '撤销', @@ -80,6 +86,10 @@ export function initDrawApp(): IDrawApp { app, new PhaseFailureProtectorTemplate(new PhaseFailureProtectorData()) ); + new SignalFaultAlarmDraw( + app, + new SignalFaultAlarmTemplate(new SignalFaultAlarmData()) + ); // 画布右键菜单 app.registerMenu(DefaultCanvasMenu); @@ -205,6 +215,12 @@ export function saveDrawDatas(app: IDrawApp) { (phaseFailureProtectorData as PhaseFailureProtectorData).data ); } + if (SignalFaultAlarm.Type === g.type) { + const signalFaultAlarmData = (g as SignalFaultAlarm).saveData(); + storage.signalFaultAlarms.push( + (signalFaultAlarmData as SignalFaultAlarmData).data + ); + } }); storage.deviceRelateRelayList = refRelaysList; storage.combinationtypeList = combinationTypeList; @@ -236,6 +252,9 @@ export async function loadDrawDatas(): Promise { storage.phaseFailureProtectors.forEach((phaseFailureProtector) => { datas.push(new PhaseFailureProtectorData(phaseFailureProtector)); }); + storage.signalFaultAlarms.forEach((signalFaultAlarm) => { + datas.push(new SignalFaultAlarmData(signalFaultAlarm)); + }); refRelaysList = storage.deviceRelateRelayList; combinationTypeList = storage.combinationtypeList; UniqueIdPrefix = storage.UniqueIdPrefix; diff --git a/src/graphics/signalFaultAlarm/SignalFaultAlarm.ts b/src/graphics/signalFaultAlarm/SignalFaultAlarm.ts new file mode 100644 index 0000000..239c8d7 --- /dev/null +++ b/src/graphics/signalFaultAlarm/SignalFaultAlarm.ts @@ -0,0 +1,80 @@ +import { Assets, Sprite, Texture } from 'pixi.js'; +import { + GraphicData, + JlGraphic, + JlGraphicTemplate, + VectorText, +} from 'src/jl-graphic'; +import signalFaultAlarmSprites from './signalFaultAlarmSprites.png'; + +export interface ISignalFaultAlarmData extends GraphicData { + get code(): string; // 编号 + set code(v: string); + clone(): ISignalFaultAlarmData; + copyFrom(data: ISignalFaultAlarmData): void; + eq(other: ISignalFaultAlarmData): boolean; +} + +export const signalFaultAlarmConsts = { + scaleX: 0.2, + scaleY: 0.2, +}; +export class SignalFaultAlarm extends JlGraphic { + static Type = 'SignalFaultAlarm'; + signalFaultAlarm: Sprite; + signalFaultAlarmTextures: Texture; + labelGraphic = new VectorText(); + + constructor(signalFaultAlarmTextures: Texture) { + super(SignalFaultAlarm.Type); + this.signalFaultAlarmTextures = signalFaultAlarmTextures; + this.signalFaultAlarm = new Sprite(); + this.signalFaultAlarm.texture = this.signalFaultAlarmTextures; + this.signalFaultAlarm.anchor.set(0.5, 0.5); + this.signalFaultAlarm.scale.set( + signalFaultAlarmConsts.scaleX, + signalFaultAlarmConsts.scaleY + ); + this.addChild(this.signalFaultAlarm); + this.setTextGraphic(this.labelGraphic, 'label'); + this.addChild(this.labelGraphic); + } + + get datas(): ISignalFaultAlarmData { + return this.getDatas(); + } + doRepaint(): void { + this.labelGraphic.text = this.datas.code; + this.labelGraphic.position.set(0, 25); + } + setTextGraphic(g: VectorText, name: string) { + g.setVectorFontSize(10); + g.anchor.set(0.5); + g.style.fill = '#0f0'; + g.transformSave = true; + g.name = name; + } +} + +export class SignalFaultAlarmTemplate extends JlGraphicTemplate { + signalFaultAlarmTextures?: Texture; + constructor(dataTemplate: ISignalFaultAlarmData) { + super(SignalFaultAlarm.Type, { + dataTemplate, + }); + } + new(): SignalFaultAlarm { + if (this.signalFaultAlarmTextures) { + const signalFaultAlarm = new SignalFaultAlarm( + this.signalFaultAlarmTextures + ); + signalFaultAlarm.loadData(this.datas); + return signalFaultAlarm; + } + throw new Error('资源未加载/加载失败'); + } + async loadAssets(): Promise { + this.signalFaultAlarmTextures = await Assets.load(signalFaultAlarmSprites); + return this.signalFaultAlarmTextures as Texture; + } +} diff --git a/src/graphics/signalFaultAlarm/SignalFaultAlarmDrawAssistant.ts b/src/graphics/signalFaultAlarm/SignalFaultAlarmDrawAssistant.ts new file mode 100644 index 0000000..9bcd783 --- /dev/null +++ b/src/graphics/signalFaultAlarm/SignalFaultAlarmDrawAssistant.ts @@ -0,0 +1,104 @@ +import { FederatedPointerEvent, Point } from 'pixi.js'; +import { + AbsorbableLine, + AbsorbablePosition, + GraphicDrawAssistant, + GraphicInteractionPlugin, + IDrawApp, + JlGraphic, +} from 'src/jl-graphic'; + +import { + ISignalFaultAlarmData, + SignalFaultAlarm, + SignalFaultAlarmTemplate, +} from './SignalFaultAlarm'; +import { Relay } from '../relay/Relay'; + +export interface ISignalFaultAlarmDrawOptions { + newData: () => ISignalFaultAlarmData; +} + +export class SignalFaultAlarmDraw extends GraphicDrawAssistant< + SignalFaultAlarmTemplate, + ISignalFaultAlarmData +> { + signalFaultAlarmGraphic: SignalFaultAlarm | null = null; + + constructor(app: IDrawApp, template: SignalFaultAlarmTemplate) { + super(app, template, 'notifications_active', '信号机故障报警仪'); + signalFaultAlarmInteraction.init(app); + } + bind(): void { + super.bind(); + if (!this.signalFaultAlarmGraphic) { + this.signalFaultAlarmGraphic = this.graphicTemplate.new(); + this.container.addChild(this.signalFaultAlarmGraphic); + } + } + + onLeftDown(e: FederatedPointerEvent): void { + this.container.position.copyFrom(this.toCanvasCoordinates(e.global)); + this.createAndStore(true); + } + + redraw(p: Point): void { + this.container.position.copyFrom(p); + } + prepareData(data: ISignalFaultAlarmData): boolean { + data.transform = this.container.saveTransform(); + return true; + } +} + +/** + * 构建吸附位置 + * @param polygon + * @returns + */ +function buildAbsorbablePositions( + signalFaultAlarmCabinet: SignalFaultAlarm +): AbsorbablePosition[] { + const aps: AbsorbablePosition[] = []; + const relays = signalFaultAlarmCabinet.queryStore.queryByType( + Relay.Type + ); + const { width, height } = signalFaultAlarmCabinet.getGraphicApp().canvas; + relays.forEach((relay) => { + const ps = relay.position; + const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y }); + const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height }); + aps.push(xs, ys); + }); + return aps; +} + +export class signalFaultAlarmInteraction extends GraphicInteractionPlugin { + static Name = 'signalFaultAlarm_transform'; + constructor(app: IDrawApp) { + super(signalFaultAlarmInteraction.Name, app); + } + static init(app: IDrawApp) { + return new signalFaultAlarmInteraction(app); + } + filter(...grahpics: JlGraphic[]): SignalFaultAlarm[] | undefined { + return grahpics + .filter((g) => g.type === SignalFaultAlarm.Type) + .map((g) => g as SignalFaultAlarm); + } + bind(g: SignalFaultAlarm): void { + g.eventMode = 'static'; + g.cursor = 'pointer'; + g.on('transformstart', this.move, this); + } + unbind(g: SignalFaultAlarm): void { + g.eventMode = 'none'; + g.off('transformstart', this.move, this); + } + move(): void { + const signalFaultAlarm = this.app.selectedGraphics[0] as SignalFaultAlarm; + this.app.setOptions({ + absorbablePositions: buildAbsorbablePositions(signalFaultAlarm), + }); + } +} diff --git a/src/graphics/signalFaultAlarm/signalFaultAlarmSprites.png b/src/graphics/signalFaultAlarm/signalFaultAlarmSprites.png new file mode 100644 index 0000000000000000000000000000000000000000..dd8830e8ee15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WfRS^R7DC{iEx|=XDS7rPJVj z1KwT}XkDG6R5wP$Ukxdyq^iY^5L$ai`l59?yhHIfy*k?aka@O`gdo#DB z)t$6Y5f3%eyz(}h0r0zN^I3YJ|2!p`&KqlPOdZ&~!@`od^}Wj^_u;|I=_c= z3Ru+pECm=c-0|%~gHS)Y=QSw`c+7#{m65&H-JBXXU1l94{|@6=e^2LstUA^NpQWOD^iabEE4_`B^)NW&`Hs z0KSwX#^f$s1ALeQnpI5EKzt_`0*?GT-U$$RsYty(@Tl z;rLLmDMHKXU-)#q?Ef3ky9j&B(L-FqW}N^ literal 0 HcmV?d00001 diff --git a/src/layouts/RelayCabinetLayout.vue b/src/layouts/RelayCabinetLayout.vue index fb0da20..507b222 100644 --- a/src/layouts/RelayCabinetLayout.vue +++ b/src/layouts/RelayCabinetLayout.vue @@ -198,6 +198,7 @@ import { DialogChainObject, useQuasar } from 'quasar'; import { Relay } from 'src/graphics/relay/Relay'; import { RelayCabinet } from 'src/graphics/relayCabinet/RelayCabinet'; import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector'; +import { SignalFaultAlarm } from 'src/graphics/signalFaultAlarm/SignalFaultAlarm'; import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics'; const $q = useQuasar(); @@ -291,6 +292,7 @@ onMounted(() => { RelayCabinet.Type, Relay.Type, PhaseFailureProtector.Type, + SignalFaultAlarm.Type, ]; drawAssistantsTypes.forEach((type) => { const drawAssistant = getDrawApp()?.getDrawAssistant(type); diff --git a/src/protos/relayCabinetLayoutGraphics.ts b/src/protos/relayCabinetLayoutGraphics.ts index b7b845f..5cd96d9 100644 --- a/src/protos/relayCabinetLayoutGraphics.ts +++ b/src/protos/relayCabinetLayoutGraphics.ts @@ -16,9 +16,10 @@ export namespace relayCabinetGraphicData { UniqueIdPrefix?: UniqueIdType; phaseFailureProtectors?: PhaseFailureProtector[]; combinationtypeList?: Combinationtype[]; + signalFaultAlarms?: SignalFaultAlarm[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8, 9], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -41,6 +42,9 @@ export namespace relayCabinetGraphicData { if ("combinationtypeList" in data && data.combinationtypeList != undefined) { this.combinationtypeList = data.combinationtypeList; } + if ("signalFaultAlarms" in data && data.signalFaultAlarms != undefined) { + this.signalFaultAlarms = data.signalFaultAlarms; + } } } get canvas() { @@ -91,6 +95,12 @@ export namespace relayCabinetGraphicData { set combinationtypeList(value: Combinationtype[]) { pb_1.Message.setRepeatedWrapperField(this, 8, value); } + get signalFaultAlarms() { + return pb_1.Message.getRepeatedWrapperField(this, SignalFaultAlarm, 9) as SignalFaultAlarm[]; + } + set signalFaultAlarms(value: SignalFaultAlarm[]) { + pb_1.Message.setRepeatedWrapperField(this, 9, value); + } static fromObject(data: { canvas?: ReturnType; relayCabinets?: ReturnType[]; @@ -99,6 +109,7 @@ export namespace relayCabinetGraphicData { UniqueIdPrefix?: ReturnType; phaseFailureProtectors?: ReturnType[]; combinationtypeList?: ReturnType[]; + signalFaultAlarms?: ReturnType[]; }): RelayCabinetGraphicStorage { const message = new RelayCabinetGraphicStorage({}); if (data.canvas != null) { @@ -122,6 +133,9 @@ export namespace relayCabinetGraphicData { if (data.combinationtypeList != null) { message.combinationtypeList = data.combinationtypeList.map(item => Combinationtype.fromObject(item)); } + if (data.signalFaultAlarms != null) { + message.signalFaultAlarms = data.signalFaultAlarms.map(item => SignalFaultAlarm.fromObject(item)); + } return message; } toObject() { @@ -133,6 +147,7 @@ export namespace relayCabinetGraphicData { UniqueIdPrefix?: ReturnType; phaseFailureProtectors?: ReturnType[]; combinationtypeList?: ReturnType[]; + signalFaultAlarms?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -155,6 +170,9 @@ export namespace relayCabinetGraphicData { if (this.combinationtypeList != null) { data.combinationtypeList = this.combinationtypeList.map((item: Combinationtype) => item.toObject()); } + if (this.signalFaultAlarms != null) { + data.signalFaultAlarms = this.signalFaultAlarms.map((item: SignalFaultAlarm) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -175,6 +193,8 @@ export namespace relayCabinetGraphicData { writer.writeRepeatedMessage(7, this.phaseFailureProtectors, (item: PhaseFailureProtector) => item.serialize(writer)); if (this.combinationtypeList.length) writer.writeRepeatedMessage(8, this.combinationtypeList, (item: Combinationtype) => item.serialize(writer)); + if (this.signalFaultAlarms.length) + writer.writeRepeatedMessage(9, this.signalFaultAlarms, (item: SignalFaultAlarm) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -205,6 +225,9 @@ export namespace relayCabinetGraphicData { case 8: reader.readMessage(message.combinationtypeList, () => pb_1.Message.addToRepeatedWrapperField(message, 8, Combinationtype.deserialize(reader), Combinationtype)); break; + case 9: + reader.readMessage(message.signalFaultAlarms, () => pb_1.Message.addToRepeatedWrapperField(message, 9, SignalFaultAlarm.deserialize(reader), SignalFaultAlarm)); + break; default: reader.skipField(); } } @@ -532,6 +555,99 @@ export namespace relayCabinetGraphicData { return PhaseFailureProtector.deserialize(bytes); } } + export class SignalFaultAlarm extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: dependency_1.graphicData.CommonInfo; + code?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo; + } + set common(value: dependency_1.graphicData.CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + }): SignalFaultAlarm { + const message = new SignalFaultAlarm({}); + if (data.common != null) { + message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SignalFaultAlarm { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SignalFaultAlarm(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): SignalFaultAlarm { + return SignalFaultAlarm.deserialize(bytes); + } + } export class DeviceRelateRelay extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index c701c22..5c081bf 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -3515,7 +3515,8 @@ export namespace graphicData { SectionLink = 4, signal = 5, station = 6, - ScreenDoor = 7 + ScreenDoor = 7, + SignalFaultAlarm = 8 } export enum DevicePort { A = 0,