From 99978dc23dd659d26a68ad4656ca94a60e168796 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 18 Jul 2023 18:10:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E7=AB=99=E5=8E=BB=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draw-app/properties/StationProperty.vue | 13 - src/drawApp/graphics/StationInteraction.ts | 6 - src/graphics/station/Station.ts | 232 ------------------ src/graphics/station/StationDrawAssistant.ts | 10 - src/protos/stationLayoutGraphics.ts | 23 -- 5 files changed, 284 deletions(-) diff --git a/src/components/draw-app/properties/StationProperty.vue b/src/components/draw-app/properties/StationProperty.vue index 09bab81..e33ffa2 100644 --- a/src/components/draw-app/properties/StationProperty.vue +++ b/src/components/draw-app/properties/StationProperty.vue @@ -35,13 +35,6 @@ @blur="onUpdate" label="公里标(mm):" /> - { if (val && val.type == Station.Type) { stationModel.copyFrom(val.saveData() as StationData); - hasControl.value = (showSelectData as never)[ - stationModel.hasControl + '' - ]; concentrationStations.value = (showSelectData as never)[ stationModel.concentrationStations + '' ]; @@ -105,7 +94,6 @@ onMounted(() => { const station = drawStore.selectedGraphic as Station; if (station) { stationModel.copyFrom(station.saveData()); - hasControl.value = (showSelectData as never)[stationModel.hasControl + '']; concentrationStations.value = (showSelectData as never)[ stationModel.concentrationStations + '' ]; @@ -118,7 +106,6 @@ onMounted(() => { }); function onUpdate() { - stationModel.hasControl = JSON.parse((showSelect as never)[hasControl.value]); stationModel.concentrationStations = JSON.parse( (showSelect as never)[concentrationStations.value] ); diff --git a/src/drawApp/graphics/StationInteraction.ts b/src/drawApp/graphics/StationInteraction.ts index 92efb61..66ca006 100644 --- a/src/drawApp/graphics/StationInteraction.ts +++ b/src/drawApp/graphics/StationInteraction.ts @@ -45,12 +45,6 @@ export class StationData extends GraphicDataBase implements IStationData { set kilometerSystem(v: KilometerSystem) { this.data.kilometerSystem = new graphicData.KilometerSystem(v); } - get hasControl(): boolean { - return this.data.hasControl; - } - set hasControl(v: boolean) { - this.data.hasControl = v; - } get concentrationStations(): boolean { return this.data.concentrationStations; } diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts index 1d8625a..5c97309 100644 --- a/src/graphics/station/Station.ts +++ b/src/graphics/station/Station.ts @@ -1,4 +1,3 @@ -import { Color, Container, Graphics, Point } from 'pixi.js'; import { GraphicData, GraphicState, @@ -13,8 +12,6 @@ export interface IStationData extends GraphicData { set code(v: string); get kilometerSystem(): KilometerSystem; set kilometerSystem(v: KilometerSystem); - get hasControl(): boolean; /// 是否有控制 - set hasControl(v: boolean); get concentrationStations(): boolean; ////是否集中站 set concentrationStations(v: boolean); get index(): number; @@ -56,239 +53,15 @@ const stationConsts = { kilometerCodeFontSize: 8, kilometerCodeOffsetY: -25, }; -class constrolGraphic extends Container { - circleA: Graphics = new Graphics(); - codeGraphA: VectorText = new VectorText(''); //控制名--紧急站控 - circleB: Graphics = new Graphics(); - codeGraphB: VectorText = new VectorText(''); //控制名--中控 - circleC: Graphics = new Graphics(); - codeGraphC: VectorText = new VectorText(''); //控制名--站控 - circleD: Graphics = new Graphics(); - codeGraphD: VectorText = new VectorText(''); //控制名--联锁控 - circleE: Graphics = new Graphics(); - codeGraphE: VectorText = new VectorText(''); //控制名--按图折返 - constructor() { - super(); - this.addChild(this.circleA); - this.addChild(this.codeGraphA); - this.addChild(this.circleB); - this.addChild(this.codeGraphB); - this.addChild(this.circleC); - this.addChild(this.codeGraphC); - this.addChild(this.circleD); - this.addChild(this.codeGraphD); - this.addChild(this.circleE); - this.addChild(this.codeGraphE); - this.codeGraphA.setVectorFontSize(stationConsts.codeFontSize); - this.codeGraphB.setVectorFontSize(stationConsts.codeFontSize); - this.codeGraphC.setVectorFontSize(stationConsts.codeFontSize); - this.codeGraphD.setVectorFontSize(stationConsts.codeFontSize); - this.codeGraphE.setVectorFontSize(stationConsts.codeFontSize); - } - draw(states: IStationState): void { - const graphics = [ - { - circle: this.circleA, - codeGraph: this.codeGraphA, - codeText: '紧急站控', - circleFillColor: stationConsts.circleColorGrey, - codeGraphFillColor: stationConsts.circleColorWhite, - }, - { - circle: this.circleB, - codeGraph: this.codeGraphB, - codeText: '中控', - circleFillColor: stationConsts.circleColorBlue, - codeGraphFillColor: stationConsts.circleColorBlue, - }, - { - circle: this.circleC, - codeGraph: this.codeGraphC, - codeText: '站控', - circleFillColor: stationConsts.circleColorGrey, - codeGraphFillColor: stationConsts.circleColorWhite, - circlePs: new Point(0, stationConsts.circleOffsetY), - codeGraphPs: new Point(0, stationConsts.codeOffsetY), - }, - { - circle: this.circleD, - codeGraph: this.codeGraphD, - codeText: '联锁控', - circleFillColor: stationConsts.circleColorGrey, - codeGraphFillColor: stationConsts.circleColorWhite, - }, - { - circle: this.circleE, - codeGraph: this.codeGraphE, - codeText: '按图折返', - circleFillColor: stationConsts.circleColorYellow, - codeGraphFillColor: stationConsts.circleColorYellow, - }, - ]; - if ( - states.ipRtuStusInEmergencyCtrl || - states.ipRtuStusInLocalCtrl || - states.ipRtuStusInCentralCtrl - ) { - graphics[1].circleFillColor = stationConsts.circleColorGrey; - graphics[1].codeGraphFillColor = stationConsts.circleColorWhite; - if (states.ipRtuStusInEmergencyCtrl) { - graphics[0].circleFillColor = stationConsts.emergencyStationControl; - graphics[0].codeGraphFillColor = stationConsts.emergencyStationControl; - } else if (states.ipRtuStusInCentralCtrl) { - graphics[1].circleFillColor = stationConsts.centralControl; - graphics[1].codeGraphFillColor = stationConsts.centralControl; - } else if (states.ipRtuStusInLocalCtrl) { - graphics[2].circleFillColor = stationConsts.stationControl; - graphics[2].codeGraphFillColor = stationConsts.stationControl; - } - } - - const graphicsPs = [ - { - circlePs: new Point( - -stationConsts.circleBetweenOffset * 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - -stationConsts.circleBetweenOffset * 2, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point( - -stationConsts.circleBetweenOffset, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - -stationConsts.circleBetweenOffset, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point(0, stationConsts.circleOffsetY), - codeGraphPs: new Point(0, stationConsts.codeOffsetY), - }, - { - circlePs: new Point( - stationConsts.circleBetweenOffset, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - stationConsts.circleBetweenOffset, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point( - stationConsts.circleBetweenOffset * 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - stationConsts.circleBetweenOffset * 2, - stationConsts.codeOffsetY - ), - }, - ]; - const graphicsPsChange = [ - { - circlePs: new Point( - (-stationConsts.circleBetweenOffset * 3) / 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - (-stationConsts.circleBetweenOffset * 3) / 2, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point( - -stationConsts.circleBetweenOffset / 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - -stationConsts.circleBetweenOffset / 2, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point( - stationConsts.circleBetweenOffset / 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - stationConsts.circleBetweenOffset / 2, - stationConsts.codeOffsetY - ), - }, - { - circlePs: new Point( - (stationConsts.circleBetweenOffset * 3) / 2, - stationConsts.circleOffsetY - ), - codeGraphPs: new Point( - (stationConsts.circleBetweenOffset * 3) / 2, - stationConsts.codeOffsetY - ), - }, - ]; - //graphics.pop(); - graphics.forEach((g, i) => { - Object.assign(g, graphicsPs[i]); - //Object.assign(g, graphicsPsChange[i]); - this.drawCircleCode( - g.circle, - g.codeGraph, - g.codeText, - g.circleFillColor, - g.codeGraphFillColor - ); - g.circle.position.copyFrom(g.circlePs as Point); - g.codeGraph.position.copyFrom(g.codeGraphPs as Point); - }); - } - drawCircleCode( - circle: Graphics, - codeGraph: VectorText, - code: string, - circleFillColor: string, - codeGraphFillColor: string - ): void { - circle.clear(); - circle.lineStyle(stationConsts.borderWidth, new Color(circleFillColor)); - circle.beginFill(circleFillColor, 1); - circle.drawCircle(0, 0, stationConsts.radius); - circle.endFill; - codeGraph.text = code; - codeGraph.style.fill = codeGraphFillColor; - codeGraph.setVectorFontSize(stationConsts.codeControlFontSize); - codeGraph.anchor.set(0.5); - } - clear(): void { - this.circleA.clear(); - this.circleB.clear(); - this.circleC.clear(); - this.circleD.clear(); - this.circleE.clear(); - this.codeGraphA.text = ''; - this.codeGraphB.text = ''; - this.codeGraphC.text = ''; - this.codeGraphD.text = ''; - this.codeGraphE.text = ''; - } -} export class Station extends JlGraphic { static Type = 'station'; codeGraph: VectorText = new VectorText(''); //车站名 kilometerGraph: VectorText = new VectorText(''); //公里标 - controlGraphic: constrolGraphic = new constrolGraphic(); constructor() { super(Station.Type); this.addChild(this.codeGraph); this.addChild(this.kilometerGraph); - this.addChild(this.controlGraphic); this.kilometerGraph.name = 'kilometer'; - this.controlGraphic.name = 'trainControl'; } get datas(): IStationData { @@ -303,8 +76,6 @@ export class Station extends JlGraphic { doRepaint(): void { const codeGraph = this.codeGraph; const kilometerGraph = this.kilometerGraph; - const controlGraphic = this.controlGraphic; - controlGraphic.clear(); codeGraph.text = this.datas?.code || '车站Station'; codeGraph.style.fill = stationConsts.codeColor; codeGraph.setVectorFontSize(stationConsts.codeFontSize); @@ -334,9 +105,6 @@ export class Station extends JlGraphic { } }); } - if (this.datas.hasControl) { - controlGraphic.draw(this.states); - } } } diff --git a/src/graphics/station/StationDrawAssistant.ts b/src/graphics/station/StationDrawAssistant.ts index 15266cf..81b628e 100644 --- a/src/graphics/station/StationDrawAssistant.ts +++ b/src/graphics/station/StationDrawAssistant.ts @@ -50,7 +50,6 @@ export class StationDraw extends GraphicDrawAssistant< } prepareData(data: IStationData): boolean { data.transform = this.container.saveTransform(); - data.hasControl = this.graphicTemplate.hasControl; return true; } } @@ -88,11 +87,6 @@ export class stationInteraction extends GraphicInteractionPlugin { g.cursor = 'pointer'; g.scalable = true; g.rotatable = true; - g.controlGraphic.eventMode = 'static'; - g.controlGraphic.cursor = 'pointer'; - g.controlGraphic.draggable = true; - g.controlGraphic.selectable = true; - g.controlGraphic.transformSave = true; g.kilometerGraph.eventMode = 'static'; g.kilometerGraph.cursor = 'pointer'; g.kilometerGraph.draggable = true; @@ -104,10 +98,6 @@ export class stationInteraction extends GraphicInteractionPlugin { g.eventMode = 'none'; g.scalable = false; g.rotatable = false; - g.controlGraphic.eventMode = 'none'; - g.controlGraphic.draggable = false; - g.controlGraphic.selectable = false; - g.controlGraphic.transformSave = false; g.kilometerGraph.eventMode = 'none'; g.kilometerGraph.draggable = false; g.kilometerGraph.selectable = false; diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts index eba1a38..fbe0739 100644 --- a/src/protos/stationLayoutGraphics.ts +++ b/src/protos/stationLayoutGraphics.ts @@ -1124,7 +1124,6 @@ export namespace graphicData { constructor(data?: any[] | { common?: CommonInfo; code?: string; - hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: KilometerSystem; index?: number; @@ -1138,9 +1137,6 @@ export namespace graphicData { if ("code" in data && data.code != undefined) { this.code = data.code; } - if ("hasControl" in data && data.hasControl != undefined) { - this.hasControl = data.hasControl; - } if ("concentrationStations" in data && data.concentrationStations != undefined) { this.concentrationStations = data.concentrationStations; } @@ -1167,12 +1163,6 @@ export namespace graphicData { set code(value: string) { pb_1.Message.setField(this, 2, value); } - get hasControl() { - return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean; - } - set hasControl(value: boolean) { - pb_1.Message.setField(this, 3, value); - } get concentrationStations() { return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean; } @@ -1197,7 +1187,6 @@ export namespace graphicData { static fromObject(data: { common?: ReturnType; code?: string; - hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: ReturnType; index?: number; @@ -1209,9 +1198,6 @@ export namespace graphicData { if (data.code != null) { message.code = data.code; } - if (data.hasControl != null) { - message.hasControl = data.hasControl; - } if (data.concentrationStations != null) { message.concentrationStations = data.concentrationStations; } @@ -1227,7 +1213,6 @@ export namespace graphicData { const data: { common?: ReturnType; code?: string; - hasControl?: boolean; concentrationStations?: boolean; kilometerSystem?: ReturnType; index?: number; @@ -1238,9 +1223,6 @@ export namespace graphicData { if (this.code != null) { data.code = this.code; } - if (this.hasControl != null) { - data.hasControl = this.hasControl; - } if (this.concentrationStations != null) { data.concentrationStations = this.concentrationStations; } @@ -1260,8 +1242,6 @@ export namespace graphicData { writer.writeMessage(1, this.common, () => this.common.serialize(writer)); if (this.code.length) writer.writeString(2, this.code); - if (this.hasControl != false) - writer.writeBool(3, this.hasControl); if (this.concentrationStations != false) writer.writeBool(4, this.concentrationStations); if (this.has_kilometerSystem) @@ -1283,9 +1263,6 @@ export namespace graphicData { case 2: message.code = reader.readString(); break; - case 3: - message.hasControl = reader.readBool(); - break; case 4: message.concentrationStations = reader.readBool(); break;