diff --git a/src/drawApp/graphics/StationInteraction.ts b/src/drawApp/graphics/StationInteraction.ts index fb5f93f..df32f2d 100644 --- a/src/drawApp/graphics/StationInteraction.ts +++ b/src/drawApp/graphics/StationInteraction.ts @@ -68,7 +68,7 @@ export class StationData extends GraphicDataBase implements IStationData { } export class StationState extends GraphicStateBase implements IStationState { - constructor(proto?: state.Station) { + constructor(proto?: state.Rtu) { let states; if (proto) { states = proto; @@ -78,153 +78,32 @@ export class StationState extends GraphicStateBase implements IStationState { super(states, Station.Type); } - get ipStaStusTermMode1(): boolean { - return this.states.ipStaStusTermMode1; + get ipRtuStusDown(): boolean { + return this.states.ipRtuStusDown; } - set ipStaStusTermMode1(v: boolean) { - this.states.ipStaStusTermMode1 = v; + set ipRtuStusDown(v: boolean) { + this.states.ipRtuStusDown = v; } - get ipStaStusTermMode2(): boolean { - return this.states.ipStaStusTermMode2; + get ipRtuStusInLocalCtrl(): boolean { + return this.states.ipRtuStusInLocalCtrl; } - set ipStaStusTermMode2(v: boolean) { - this.states.ipStaStusTermMode2 = v; + set ipRtuStusInLocalCtrl(v: boolean) { + this.states.ipRtuStusInLocalCtrl = v; } - get ipStaStusTermMode3(): boolean { - return this.states.ipStaStusTermMode3; + get ipRtuStusInCentralCtrl(): boolean { + return this.states.ipRtuStusInCentralCtrl; } - set ipStaStusTermMode3(v: boolean) { - this.states.ipStaStusTermMode3 = v; + set ipRtuStusInCentralCtrl(v: boolean) { + this.states.ipRtuStusInCentralCtrl = v; } - get ipStaStusTermMode4(): boolean { - return this.states.ipStaStusTermMode4; + get ipRtuStusInEmergencyCtrl(): boolean { + return this.states.ipRtuStusInEmergencyCtrl; } - set ipStaStusTermMode4(v: boolean) { - this.states.ipStaStusTermMode4 = v; + set ipRtuStusInEmergencyCtrl(v: boolean) { + this.states.ipRtuStusInEmergencyCtrl = v; } - get ipStaStusTermMode5(): boolean { - return this.states.ipStaStusTermMode5; - } - set ipStaStusTermMode5(v: boolean) { - this.states.ipStaStusTermMode5 = v; - } - get ipStaStusTermMode6(): boolean { - return this.states.ipStaStusTermMode6; - } - set ipStaStusTermMode6(v: boolean) { - this.states.ipStaStusTermMode6 = v; - } - get ipStaStusExpectTermMode1(): boolean { - return this.states.ipStaStusExpectTermMode1; - } - set ipStaStusExpectTermMode1(v: boolean) { - this.states.ipStaStusExpectTermMode1 = v; - } - get ipStaStusExpectTermMode2(): boolean { - return this.states.ipStaStusExpectTermMode2; - } - set ipStaStusExpectTermMode2(v: boolean) { - this.states.ipStaStusExpectTermMode2 = v; - } - get ipStaStusExpectTermMode3(): boolean { - return this.states.ipStaStusExpectTermMode3; - } - set ipStaStusExpectTermMode3(v: boolean) { - this.states.ipStaStusExpectTermMode3 = v; - } - - get ipStaStusExpectTermMode4(): boolean { - return this.states.ipStaStusExpectTermMode4; - } - set ipStaStusExpectTermMode4(v: boolean) { - this.states.ipStaStusExpectTermMode4 = v; - } - get ipStaStusExpectTermMode5(): boolean { - return this.states.ipStaStusExpectTermMode5; - } - set ipStaStusExpectTermMode5(v: boolean) { - this.states.ipStaStusExpectTermMode5 = v; - } - get ipStaStusExpectTermMode6(): boolean { - return this.states.ipStaStusExpectTermMode6; - } - set ipStaStusExpectTermMode6(v: boolean) { - this.states.ipStaStusExpectTermMode6 = v; - } - get ipStaStusInCycle1(): boolean { - return this.states.ipStaStusInCycle1; - } - set ipStaStusInCycle1(v: boolean) { - this.states.ipStaStusInCycle1 = v; - } - get ipStaStusInCycle2(): boolean { - return this.states.ipStaStusInCycle2; - } - set ipStaStusInCycle2(v: boolean) { - this.states.ipStaStusInCycle2 = v; - } - get ipStaStusInCycle3(): boolean { - return this.states.ipStaStusInCycle3; - } - set ipStaStusInCycle3(v: boolean) { - this.states.ipStaStusInCycle3 = v; - } - get ipStaStusInCycle4(): boolean { - return this.states.ipStaStusInCycle4; - } - set ipStaStusInCycle4(v: boolean) { - this.states.ipStaStusInCycle4 = v; - } - get ipStaStusInCycle5(): boolean { - return this.states.ipStaStusInCycle5; - } - set ipStaStusInCycle5(v: boolean) { - this.states.ipStaStusInCycle5 = v; - } - get ipStaStusInCycle6(): boolean { - return this.states.ipStaStusInCycle6; - } - set ipStaStusInCycle6(v: boolean) { - this.states.ipStaStusInCycle6 = v; - } - get ipStaStusExpectCycle1(): boolean { - return this.states.ipStaStusExpectCycle1; - } - set ipStaStusExpectCycle1(v: boolean) { - this.states.ipStaStusExpectCycle1 = v; - } - get ipStaStusExpectCycle2(): boolean { - return this.states.ipStaStusExpectCycle2; - } - set ipStaStusExpectCycle2(v: boolean) { - this.states.ipStaStusExpectCycle2 = v; - } - get ipStaStusExpectCycle3(): boolean { - return this.states.ipStaStusExpectCycle3; - } - set ipStaStusExpectCycle3(v: boolean) { - this.states.ipStaStusExpectCycle3 = v; - } - get ipStaStusExpectCycle4(): boolean { - return this.states.ipStaStusExpectCycle4; - } - set ipStaStusExpectCycle4(v: boolean) { - this.states.ipStaStusExpectCycle4 = v; - } - get ipStaStusExpectCycle5(): boolean { - return this.states.ipStaStusExpectCycle5; - } - set ipStaStusExpectCycle5(v: boolean) { - this.states.ipStaStusExpectCycle5 = v; - } - get ipStaStusExpectCycle6(): boolean { - return this.states.ipStaStusExpectCycle6; - } - set ipStaStusExpectCycle6(v: boolean) { - this.states.ipStaStusExpectCycle6 = v; - } - get states(): state.Station { - return this.getState(); + get states(): state.Rtu { + return this.getState(); } clone(): StationState { @@ -232,6 +111,10 @@ export class StationState extends GraphicStateBase implements IStationState { } } +const powerUnlockConfig: MenuItemOptions = { + name: '上电解锁', +}; + const chainConfig: MenuItemOptions = { name: '全站设置连锁自动触发', }; @@ -242,7 +125,7 @@ const StationOperateMenu: ContextMenu = ContextMenu.init({ name: '车站操作菜单', groups: [ { - items: [chainConfig, removeChainConfig], + items: [powerUnlockConfig, chainConfig, removeChainConfig], }, ], }); @@ -278,7 +161,14 @@ export class StationOperateInteraction extends GraphicInteractionPlugin const target = e.target as DisplayObject; const station = target.getGraphic() as Station; this.app.updateSelected(station); + powerUnlockConfig.handler = () => { + station.states.ipRtuStusInLocalCtrl = true; + station.doRepaint(); + console.log(2222); + }; chainConfig.handler = () => { + station.states.ipRtuStusDown = true; + station.doRepaint(); console.log(2222); }; removeChainConfig.handler = () => { diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts index 58d58df..d9ffe72 100644 --- a/src/graphics/station/Station.ts +++ b/src/graphics/station/Station.ts @@ -22,126 +22,109 @@ export interface IStationData extends GraphicData { } export interface IStationState extends GraphicState { - get ipStaStusTermMode1(): boolean; - set ipStaStusTermMode1(v: boolean); - get ipStaStusTermMode2(): boolean; - set ipStaStusTermMode2(v: boolean); - get ipStaStusTermMode3(): boolean; - set ipStaStusTermMode3(v: boolean); - get ipStaStusTermMode4(): boolean; - set ipStaStusTermMode4(v: boolean); - get ipStaStusTermMode5(): boolean; - set ipStaStusTermMode5(v: boolean); - get ipStaStusTermMode6(): boolean; - set ipStaStusTermMode6(v: boolean); - get ipStaStusExpectTermMode1(): boolean; - set ipStaStusExpectTermMode1(v: boolean); - get ipStaStusExpectTermMode2(): boolean; - set ipStaStusExpectTermMode2(v: boolean); - get ipStaStusExpectTermMode3(): boolean; - set ipStaStusExpectTermMode3(v: boolean); - get ipStaStusExpectTermMode4(): boolean; - set ipStaStusExpectTermMode4(v: boolean); - get ipStaStusExpectTermMode5(): boolean; - set ipStaStusExpectTermMode5(v: boolean); - get ipStaStusExpectTermMode6(): boolean; - set ipStaStusExpectTermMode6(v: boolean); - get ipStaStusInCycle1(): boolean; - set ipStaStusInCycle1(v: boolean); - get ipStaStusInCycle2(): boolean; - set ipStaStusInCycle2(v: boolean); - get ipStaStusInCycle3(): boolean; - set ipStaStusInCycle3(v: boolean); - get ipStaStusInCycle4(): boolean; - set ipStaStusInCycle4(v: boolean); - get ipStaStusInCycle5(): boolean; - set ipStaStusInCycle5(v: boolean); - get ipStaStusInCycle6(): boolean; - set ipStaStusInCycle6(v: boolean); - get ipStaStusExpectCycle1(): boolean; - set ipStaStusExpectCycle1(v: boolean); - get ipStaStusExpectCycle2(): boolean; - set ipStaStusExpectCycle2(v: boolean); - get ipStaStusExpectCycle3(): boolean; - set ipStaStusExpectCycle3(v: boolean); - get ipStaStusExpectCycle4(): boolean; - set ipStaStusExpectCycle4(v: boolean); - get ipStaStusExpectCycle5(): boolean; - set ipStaStusExpectCycle5(v: boolean); - get ipStaStusExpectCycle6(): boolean; - set ipStaStusExpectCycle6(v: boolean); + get ipRtuStusDown(): boolean; + set ipRtuStusDown(v: boolean); + get ipRtuStusInLocalCtrl(): boolean; + set ipRtuStusInLocalCtrl(v: boolean); + get ipRtuStusInCentralCtrl(): boolean; + set ipRtuStusInCentralCtrl(v: boolean); + get ipRtuStusInEmergencyCtrl(): boolean; + set ipRtuStusInEmergencyCtrl(v: boolean); } const stationConsts = { - radius: 5, + radius: 3, borderWidth: 1, - borderColor: '0xff0000', - fillColor: '0xff0000', - transferRadius: 3.5, - transferWidth: 0.2, - transferColor: '0x0fe81f', + circleColorGrey: '0x808080', + circleColorBlue: '0x08F80D', + circleColorYellow: '0xFFFA0C', codeColor: '0xF48815', codeFontSize: 22, - codeControlFontSize: 18, - codeOffsetX: -60, - codeOffsetY: -25, - circleOffsetY: -50, - circleBetweenOffset: 60, - kilometerCodeColor: '0x0fe81f', - kilometerCodeFontSize: 11, + codeControlFontSize: 12, + codeOffsetY: 30, + circleOffsetY: 20, + circleBetweenOffset: 40, + kilometerCodeColor: '0xFFFFFF', + kilometerCodeFontSize: 8, kilometerCodeOffsetY: -25, }; class constrolGraphic extends Container { circleA: Graphics = new Graphics(); - codeGraphA: VectorText = new VectorText(''); //控制名--紧急站控 + codeGraphA: VectorText = new VectorText(''); //控制名--站控 circleB: Graphics = new Graphics(); - codeGraphB: VectorText = new VectorText(''); //控制名--遥控 - circleC: Graphics = new Graphics(); - codeGraphC: VectorText = new VectorText(''); //控制名--站控 + codeGraphB: VectorText = new VectorText(''); //控制名--中控 + arrow: Graphics = new Graphics(); + inArrow: Graphics = new Graphics(); 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.arrow); + this.addChild(this.inArrow); this.codeGraphA.setVectorFontSize(stationConsts.codeFontSize); + this.codeGraphB.setVectorFontSize(stationConsts.codeFontSize); } - draw(): void { - this.drawCircleCode(this.circleA, this.codeGraphA, '站控'); + draw(states: IStationState): void { + let StationControlFillColor = stationConsts.circleColorGrey; + let centralControlFillColor = stationConsts.circleColorBlue; + let inArrowFillColor = stationConsts.circleColorGrey; + if (states.ipRtuStusInLocalCtrl) { + StationControlFillColor = stationConsts.circleColorYellow; + centralControlFillColor = stationConsts.circleColorGrey; + if (!states.ipRtuStusDown) { + inArrowFillColor = stationConsts.circleColorBlue; + } + } + this.drawCircleCode( + this.circleA, + this.codeGraphA, + '站控', + StationControlFillColor + ); this.circleA.position.set( - stationConsts.codeOffsetX, + stationConsts.circleBetweenOffset / 2, stationConsts.circleOffsetY ); this.codeGraphA.position.set( - stationConsts.codeOffsetX, + stationConsts.circleBetweenOffset / 2, stationConsts.codeOffsetY ); - this.drawCircleCode(this.circleB, this.codeGraphB, '遥控', '0x0fe81f'); + this.drawCircleCode( + this.circleB, + this.codeGraphB, + '中控', + centralControlFillColor + ); this.circleB.position.set( - stationConsts.codeOffsetX - stationConsts.circleBetweenOffset, + -stationConsts.circleBetweenOffset / 2, stationConsts.circleOffsetY ); this.codeGraphB.position.set( - stationConsts.codeOffsetX - stationConsts.circleBetweenOffset, - stationConsts.codeOffsetY - ); - this.drawCircleCode(this.circleC, this.codeGraphC, '紧急站控'); - this.circleC.position.set( - stationConsts.codeOffsetX - stationConsts.circleBetweenOffset * 2, - stationConsts.circleOffsetY - ); - this.codeGraphC.position.set( - stationConsts.codeOffsetX - stationConsts.circleBetweenOffset * 2, + -stationConsts.circleBetweenOffset / 2, stationConsts.codeOffsetY ); + const arrow = this.arrow; + arrow.clear(); + arrow.lineStyle(stationConsts.borderWidth, new Color('0xFFFFFF')); + const points = [0, 0, 2, 2, 2, 1, 14, 1, 14, -1, 2, -1, 2, -2]; + arrow.beginFill('0xFFFFFF'); + arrow.drawPolygon(points); + arrow.endFill(); + arrow.scale.set(1.1, 1.1); + arrow.position.set(-7, stationConsts.circleOffsetY); + const inArrow = this.inArrow; + inArrow.beginFill(inArrowFillColor); + inArrow.drawPolygon(points); + inArrow.endFill(); + inArrow.position.set(-6.5, stationConsts.circleOffsetY); } drawCircleCode( circle: Graphics, codeGraph: VectorText, code: string, - fillcolor = stationConsts.fillColor + fillcolor: string ): void { circle.clear(); circle.lineStyle(stationConsts.borderWidth, new Color(fillcolor)); @@ -149,17 +132,17 @@ class constrolGraphic extends Container { circle.drawCircle(0, 0, stationConsts.radius); circle.endFill; codeGraph.text = code; - codeGraph.style.fill = stationConsts.codeColor; + codeGraph.style.fill = fillcolor; codeGraph.setVectorFontSize(stationConsts.codeControlFontSize); codeGraph.anchor.set(0.5); } clear(): void { this.circleA.clear(); this.circleB.clear(); - this.circleC.clear(); this.codeGraphA.text = ''; this.codeGraphB.text = ''; - this.codeGraphC.text = ''; + this.arrow.clear(); + this.inArrow.clear(); } } export class Station extends JlGraphic { @@ -215,7 +198,7 @@ export class Station extends JlGraphic { }); } if (this.datas.hasControl) { - controlGraphic.draw(); + controlGraphic.draw(this.states); } } }