屏蔽门状态和车站名
This commit is contained in:
parent
0451397be2
commit
83a3a369b4
@ -3,13 +3,22 @@
|
||||
<q-input outlined readonly v-model="stationModel.id" label="id" />
|
||||
<q-input
|
||||
outlined
|
||||
label="车站名称"
|
||||
label="车站站名"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="stationModel.code"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
label="车站名"
|
||||
type="textarea"
|
||||
@blur="onUpdate"
|
||||
v-model="stationModel.stationName"
|
||||
lazy-rules
|
||||
autogrow
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model.number="stationModel.index"
|
||||
|
@ -17,7 +17,10 @@ import {
|
||||
ScreenDoor,
|
||||
ScreenDoorTemplate,
|
||||
} from 'src/graphics/screenDoor/ScreenDoor';
|
||||
import { ScreenDoorData } from './graphics/ScreenDoorInteraction';
|
||||
import {
|
||||
ScreenDoorData,
|
||||
ScreenDoorState,
|
||||
} from './graphics/ScreenDoorInteraction';
|
||||
import { ScreenDoorDraw } from 'src/graphics/screenDoor/ScreenDoorDrawAssistant';
|
||||
import { Station, StationTemplate } from 'src/graphics/station/Station';
|
||||
import { StationDraw } from 'src/graphics/station/StationDrawAssistant';
|
||||
@ -168,7 +171,10 @@ export function initCommonDrawApp(app: IDrawApp) {
|
||||
app,
|
||||
new PlatformTemplate(new PlatformData(), new PlatformState())
|
||||
);
|
||||
new ScreenDoorDraw(app, new ScreenDoorTemplate(new ScreenDoorData()));
|
||||
new ScreenDoorDraw(
|
||||
app,
|
||||
new ScreenDoorTemplate(new ScreenDoorData(), new ScreenDoorState())
|
||||
);
|
||||
new StationDraw(
|
||||
app,
|
||||
new StationTemplate(new StationData(), new StationState())
|
||||
|
@ -1,10 +1,12 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import {
|
||||
IScreenDoorData,
|
||||
IScreenDoorState,
|
||||
ScreenDoor,
|
||||
} from 'src/graphics/screenDoor/ScreenDoor';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { state } from 'src/protos/device_state';
|
||||
|
||||
export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
|
||||
constructor(data?: graphicData.ScreenDoor) {
|
||||
@ -59,3 +61,36 @@ export class ScreenDoorData extends GraphicDataBase implements IScreenDoorData {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
||||
|
||||
export class ScreenDoorState
|
||||
extends GraphicStateBase
|
||||
implements IScreenDoorState
|
||||
{
|
||||
constructor(proto?: state.PsdState) {
|
||||
let states;
|
||||
if (proto) {
|
||||
states = proto;
|
||||
} else {
|
||||
states = new state.PsdState();
|
||||
}
|
||||
super(states, ScreenDoor.Type);
|
||||
}
|
||||
get code(): string {
|
||||
return this.states.id;
|
||||
}
|
||||
get openDoorCodes() {
|
||||
return this.states.openDoorCodes;
|
||||
}
|
||||
get states(): state.PsdState {
|
||||
return this.getState<state.PsdState>();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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<IScreenDoorData>();
|
||||
}
|
||||
|
||||
get states(): IScreenDoorState {
|
||||
return this.getStates<IScreenDoorState>();
|
||||
}
|
||||
|
||||
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<ScreenDoor> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<typeof CommonInfo.prototype.toObject>;
|
||||
code?: string;
|
||||
@ -1828,6 +1838,7 @@ export namespace graphicData {
|
||||
kilometerSystem?: ReturnType<typeof KilometerSystem.prototype.toObject>;
|
||||
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<typeof KilometerSystem.prototype.toObject>;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user