diff --git a/src/components/draw-app/properties/StationProperty.vue b/src/components/draw-app/properties/StationProperty.vue
index d131b70..454d2ed 100644
--- a/src/components/draw-app/properties/StationProperty.vue
+++ b/src/components/draw-app/properties/StationProperty.vue
@@ -3,13 +3,22 @@
+
();
+ }
+ clone(): ScreenDoorState {
+ return new ScreenDoorState(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);
+ }
+}
diff --git a/src/drawApp/graphics/StationInteraction.ts b/src/drawApp/graphics/StationInteraction.ts
index 422fca7..b799381 100644
--- a/src/drawApp/graphics/StationInteraction.ts
+++ b/src/drawApp/graphics/StationInteraction.ts
@@ -43,6 +43,12 @@ export class StationData extends GraphicDataBase implements IStationData {
set code(v: string) {
this.data.code = v;
}
+ get stationName(): string {
+ return this.data.stationName;
+ }
+ set stationName(v: string) {
+ this.data.stationName = v;
+ }
get kilometerSystem(): KilometerSystem {
if (!this.data.kilometerSystem) {
this.data.kilometerSystem = new graphicData.KilometerSystem();
diff --git a/src/drawApp/lineScene.ts b/src/drawApp/lineScene.ts
index 8254e22..613a315 100644
--- a/src/drawApp/lineScene.ts
+++ b/src/drawApp/lineScene.ts
@@ -21,7 +21,10 @@ import {
PlatformState,
} from './graphics/PlatformInteraction';
import { PlatformTemplate, Platform } from 'src/graphics/platform/Platform';
-import { ScreenDoorData } from './graphics/ScreenDoorInteraction';
+import {
+ ScreenDoorData,
+ ScreenDoorState,
+} from './graphics/ScreenDoorInteraction';
import {
ScreenDoor,
ScreenDoorTemplate,
@@ -209,7 +212,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
getTypeConsts(Signal.Type)
),
new PlatformTemplate(new PlatformData(), new PlatformState()),
- new ScreenDoorTemplate(new ScreenDoorData()),
+ new ScreenDoorTemplate(new ScreenDoorData(), new ScreenDoorState()),
new StationTemplate(new StationData(), new StationState()),
new TurnoutTemplate(new TurnoutData(), new TurnoutStates()),
new SectionTemplate(new SectionData()),
@@ -284,6 +287,11 @@ function handleSubscribe(lineScene: IGraphicScene) {
// states.push(new SectionState(item));
}
});
+ storage.allStatus.psdState.forEach((item) => {
+ if (item.id) {
+ states.push(new ScreenDoorState(item));
+ }
+ });
storage.allStatus.switchState.forEach((item) => {
// 道岔
if (item.id) {
diff --git a/src/graphics/screenDoor/ScreenDoor.ts b/src/graphics/screenDoor/ScreenDoor.ts
index 494089e..a5d3a99 100644
--- a/src/graphics/screenDoor/ScreenDoor.ts
+++ b/src/graphics/screenDoor/ScreenDoor.ts
@@ -1,6 +1,7 @@
import { Color, Container, Graphics } from 'pixi.js';
import {
GraphicData,
+ GraphicState,
JlGraphic,
JlGraphicTemplate,
VectorText,
@@ -23,11 +24,15 @@ export interface IScreenDoorData extends GraphicData {
eq(other: IScreenDoorData): boolean;
}
+export interface IScreenDoorState extends GraphicState {
+ get openDoorCodes(): number[]; //打开的屏蔽门的编号
+}
+
const screenDoorConsts = {
lineWidth: 3,
smallDoorWidth: 10,
- doorGreen: '0x00FF00', //屏蔽门的颜色
- doorRed: '0xff0000',
+ doorClose: '0x00FF00', //屏蔽门的颜色
+ doorOpen: '0xff0000',
};
class smallDoorGraphic extends Container {
@@ -42,12 +47,14 @@ class smallDoorGraphic extends Container {
this.addChild(this.smallDoorGraphic);
this.addChild(this.labelGraphic);
}
- draw(data: IScreenDoorData, i: number): void {
+ draw(data: IScreenDoorData, i: number, open: boolean): void {
const start =
(-screenDoorConsts.smallDoorWidth * data.sonDoorAmount) / 2 +
screenDoorConsts.smallDoorWidth * i;
const smallDoorGraphic = this.smallDoorGraphic;
- const lineColor = screenDoorConsts.doorGreen;
+ const lineColor = open
+ ? screenDoorConsts.doorOpen
+ : screenDoorConsts.doorClose;
const direction = 'up';
smallDoorGraphic
.lineStyle(screenDoorConsts.lineWidth, new Color(lineColor))
@@ -79,6 +86,10 @@ export class ScreenDoor extends JlGraphic {
return this.getDatas();
}
+ get states(): IScreenDoorState {
+ return this.getStates();
+ }
+
doRepaint(): void {
const doorGraphic = this.doorGraphic;
doorGraphic.children.forEach((g) => {
@@ -88,7 +99,7 @@ export class ScreenDoor extends JlGraphic {
this.datas.sonDoorAmount = this.datas?.sonDoorAmount || 30;
for (let i = 0; i < this.datas.sonDoorAmount; i++) {
const smallDoor = new smallDoorGraphic();
- smallDoor.draw(this.datas, i);
+ smallDoor.draw(this.datas, i, this.states.openDoorCodes.includes(i));
doorGraphic.addChild(smallDoor);
}
}
@@ -130,14 +141,16 @@ export class ScreenDoor extends JlGraphic {
}
export class ScreenDoorTemplate extends JlGraphicTemplate {
- constructor(dataTemplate: IScreenDoorData) {
+ constructor(dataTemplate: IScreenDoorData, stateTemplate?: IScreenDoorState) {
super(ScreenDoor.Type, {
dataTemplate,
+ stateTemplate,
});
}
new(): ScreenDoor {
const screenDoor = new ScreenDoor();
screenDoor.loadData(this.datas);
+ screenDoor.loadState(this.states);
return screenDoor;
}
}
diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts
index a5bd6fc..b5c979d 100644
--- a/src/graphics/station/Station.ts
+++ b/src/graphics/station/Station.ts
@@ -8,8 +8,10 @@ import {
import { KilometerSystem } from '../signal/Signal';
export interface IStationData extends GraphicData {
- get code(): string; // 编号
+ get code(): string; // 车站站名
set code(v: string);
+ get stationName(): string; // 车站名
+ set stationName(v: string);
get kilometerSystem(): KilometerSystem;
set kilometerSystem(v: KilometerSystem);
get concentrationStations(): boolean; //是否集中站
@@ -36,7 +38,7 @@ const stationConsts = {
};
export class Station extends JlGraphic {
static Type = 'station';
- codeGraph: VectorText = new VectorText(''); //车站名
+ codeGraph: VectorText = new VectorText(''); //车站站名
kilometerGraph: VectorText = new VectorText(''); //公里标
constructor() {
super(Station.Type);
diff --git a/src/protos/stationLayoutGraphics.ts b/src/protos/stationLayoutGraphics.ts
index ba613a1..c701c22 100644
--- a/src/protos/stationLayoutGraphics.ts
+++ b/src/protos/stationLayoutGraphics.ts
@@ -1755,6 +1755,7 @@ export namespace graphicData {
kilometerSystem?: KilometerSystem;
index?: number;
refIbpMapCode?: string;
+ stationName?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@@ -1777,6 +1778,9 @@ export namespace graphicData {
if ("refIbpMapCode" in data && data.refIbpMapCode != undefined) {
this.refIbpMapCode = data.refIbpMapCode;
}
+ if ("stationName" in data && data.stationName != undefined) {
+ this.stationName = data.stationName;
+ }
}
}
get common() {
@@ -1821,6 +1825,12 @@ export namespace graphicData {
set refIbpMapCode(value: string) {
pb_1.Message.setField(this, 8, value);
}
+ get stationName() {
+ return pb_1.Message.getFieldWithDefault(this, 9, "") as string;
+ }
+ set stationName(value: string) {
+ pb_1.Message.setField(this, 9, value);
+ }
static fromObject(data: {
common?: ReturnType;
code?: string;
@@ -1828,6 +1838,7 @@ export namespace graphicData {
kilometerSystem?: ReturnType;
index?: number;
refIbpMapCode?: string;
+ stationName?: string;
}): Station {
const message = new Station({});
if (data.common != null) {
@@ -1848,6 +1859,9 @@ export namespace graphicData {
if (data.refIbpMapCode != null) {
message.refIbpMapCode = data.refIbpMapCode;
}
+ if (data.stationName != null) {
+ message.stationName = data.stationName;
+ }
return message;
}
toObject() {
@@ -1858,6 +1872,7 @@ export namespace graphicData {
kilometerSystem?: ReturnType;
index?: number;
refIbpMapCode?: string;
+ stationName?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@@ -1877,6 +1892,9 @@ export namespace graphicData {
if (this.refIbpMapCode != null) {
data.refIbpMapCode = this.refIbpMapCode;
}
+ if (this.stationName != null) {
+ data.stationName = this.stationName;
+ }
return data;
}
serialize(): Uint8Array;
@@ -1895,6 +1913,8 @@ export namespace graphicData {
writer.writeInt32(7, this.index);
if (this.refIbpMapCode.length)
writer.writeString(8, this.refIbpMapCode);
+ if (this.stationName.length)
+ writer.writeString(9, this.stationName);
if (!w)
return writer.getResultBuffer();
}
@@ -1922,6 +1942,9 @@ export namespace graphicData {
case 8:
message.refIbpMapCode = reader.readString();
break;
+ case 9:
+ message.stationName = reader.readString();
+ break;
default: reader.skipField();
}
}