信号机添加数据

This commit is contained in:
fan 2023-10-20 13:19:34 +08:00
parent ae8bb593d4
commit 78f7aa1faa
5 changed files with 144 additions and 4 deletions

@ -1 +1 @@
Subproject commit 8e5d8faf7b16ddbc8cfdeb19f5a102cfdbac404b Subproject commit 9b1c6d78012eff4f9d300412ad41c8175751767d

View File

@ -15,6 +15,16 @@
@blur="onUpdate" @blur="onUpdate"
label="索引" label="索引"
/> />
<q-select
outlined
class="q-mt-sm"
v-model="signalModel.mt"
:options="SignalTypeOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="信号机类型:"
></q-select>
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column"> <q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div> <div>公里标配置</div>
@ -48,7 +58,7 @@
<q-select <q-select
outlined outlined
class="q-mt-sm" class="q-mt-sm"
:model-value="refDevData.deviceType" v-model="refDevData.deviceType"
:options="DeviceTypeOptions" :options="DeviceTypeOptions"
readonly readonly
map-options map-options
@ -58,7 +68,7 @@
<q-input <q-input
outlined outlined
class="q-mt-sm" class="q-mt-sm"
:model-value="refDevData.code" v-model="refDevData.code"
:readonly="true" :readonly="true"
label="关联设备:" label="关联设备:"
></q-input> ></q-input>
@ -128,6 +138,14 @@ const DeviceTypeOptions = [
{ label: '区段', value: graphicData.RelatedRef.DeviceType.Section }, { label: '区段', value: graphicData.RelatedRef.DeviceType.Section },
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout }, { label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
]; ];
const SignalTypeOptions = [
{ label: '红绿黄', value: graphicData.Signal.Model.HLU },
{ label: '红绿', value: graphicData.Signal.Model.HL },
{ label: '红绿黄,封黄灯', value: graphicData.Signal.Model.HLU_FU },
{ label: '红绿黄,封绿灯', value: graphicData.Signal.Model.HLU_FL },
{ label: '蓝白', value: graphicData.Signal.Model.AB },
{ label: '红白黄', value: graphicData.Signal.Model.HBU },
];
const DevicePortOptions = [ const DevicePortOptions = [
{ label: 'A端', value: graphicData.RelatedRef.DevicePort.A }, { label: 'A端', value: graphicData.RelatedRef.DevicePort.A },
{ label: 'B端', value: graphicData.RelatedRef.DevicePort.B }, { label: 'B端', value: graphicData.RelatedRef.DevicePort.B },

View File

@ -76,6 +76,12 @@ export class SignalData extends GraphicDataBase implements ISignalData {
set centralizedStations(v: string[]) { set centralizedStations(v: string[]) {
this.data.centralizedStations = v; this.data.centralizedStations = v;
} }
get mt(): graphicData.Signal.Model {
return this.data.mt;
}
set mt(v: graphicData.Signal.Model) {
this.data.mt = v;
}
clone(): SignalData { clone(): SignalData {
return new SignalData(this.data.cloneMessage()); return new SignalData(this.data.cloneMessage());
} }

View File

@ -18,6 +18,7 @@ import {
import { SignalCode } from './SignalCode'; import { SignalCode } from './SignalCode';
import { Section, SectionPort, SectionType } from '../section/Section'; import { Section, SectionPort, SectionType } from '../section/Section';
import { Turnout, TurnoutPort } from '../turnout/Turnout'; import { Turnout, TurnoutPort } from '../turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export enum Direction { export enum Direction {
LEFT = 0, LEFT = 0,
@ -46,6 +47,8 @@ export interface ISignalData extends GraphicData {
set refDev(v: IRelatedRefData); set refDev(v: IRelatedRefData);
get centralizedStations(): string[]; get centralizedStations(): string[];
set centralizedStations(v: string[]); set centralizedStations(v: string[]);
get mt(): graphicData.Signal.Model;
set mt(v: graphicData.Signal.Model);
clone(): ISignalData; clone(): ISignalData;
copyFrom(data: ISignalData): void; copyFrom(data: ISignalData): void;
eq(other: ISignalData): boolean; eq(other: ISignalData): boolean;

View File

@ -2709,6 +2709,96 @@ export namespace state {
return PsdState.deserialize(bytes); return PsdState.deserialize(bytes);
} }
} }
export class KeyState extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
id?: string;
gear?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("id" in data && data.id != undefined) {
this.id = data.id;
}
if ("gear" in data && data.gear != undefined) {
this.gear = data.gear;
}
}
}
get id() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set id(value: string) {
pb_1.Message.setField(this, 1, value);
}
get gear() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set gear(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
id?: string;
gear?: number;
}): KeyState {
const message = new KeyState({});
if (data.id != null) {
message.id = data.id;
}
if (data.gear != null) {
message.gear = data.gear;
}
return message;
}
toObject() {
const data: {
id?: string;
gear?: number;
} = {};
if (this.id != null) {
data.id = this.id;
}
if (this.gear != null) {
data.gear = this.gear;
}
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.id.length)
writer.writeString(1, this.id);
if (this.gear != 0)
writer.writeInt32(2, this.gear);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): KeyState {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new KeyState();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.id = reader.readString();
break;
case 2:
message.gear = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): KeyState {
return KeyState.deserialize(bytes);
}
}
export class VariationStatus extends pb_1.Message { export class VariationStatus extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
@ -2880,9 +2970,10 @@ export namespace state {
AlarmState?: AlarmState[]; AlarmState?: AlarmState[];
LightState?: LightState[]; LightState?: LightState[];
psdState?: PsdState[]; psdState?: PsdState[];
KeyState?: KeyState[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("trainState" in data && data.trainState != undefined) { if ("trainState" in data && data.trainState != undefined) {
this.trainState = data.trainState; this.trainState = data.trainState;
@ -2911,6 +3002,9 @@ export namespace state {
if ("psdState" in data && data.psdState != undefined) { if ("psdState" in data && data.psdState != undefined) {
this.psdState = data.psdState; this.psdState = data.psdState;
} }
if ("KeyState" in data && data.KeyState != undefined) {
this.KeyState = data.KeyState;
}
} }
} }
get trainState() { get trainState() {
@ -2967,6 +3061,12 @@ export namespace state {
set psdState(value: PsdState[]) { set psdState(value: PsdState[]) {
pb_1.Message.setRepeatedWrapperField(this, 9, value); pb_1.Message.setRepeatedWrapperField(this, 9, value);
} }
get KeyState() {
return pb_1.Message.getRepeatedWrapperField(this, KeyState, 10) as KeyState[];
}
set KeyState(value: KeyState[]) {
pb_1.Message.setRepeatedWrapperField(this, 10, value);
}
static fromObject(data: { static fromObject(data: {
trainState?: ReturnType<typeof TrainState.prototype.toObject>[]; trainState?: ReturnType<typeof TrainState.prototype.toObject>[];
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[]; switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
@ -2977,6 +3077,7 @@ export namespace state {
AlarmState?: ReturnType<typeof AlarmState.prototype.toObject>[]; AlarmState?: ReturnType<typeof AlarmState.prototype.toObject>[];
LightState?: ReturnType<typeof LightState.prototype.toObject>[]; LightState?: ReturnType<typeof LightState.prototype.toObject>[];
psdState?: ReturnType<typeof PsdState.prototype.toObject>[]; psdState?: ReturnType<typeof PsdState.prototype.toObject>[];
KeyState?: ReturnType<typeof KeyState.prototype.toObject>[];
}): AllDevicesStatus { }): AllDevicesStatus {
const message = new AllDevicesStatus({}); const message = new AllDevicesStatus({});
if (data.trainState != null) { if (data.trainState != null) {
@ -3006,6 +3107,9 @@ export namespace state {
if (data.psdState != null) { if (data.psdState != null) {
message.psdState = data.psdState.map(item => PsdState.fromObject(item)); message.psdState = data.psdState.map(item => PsdState.fromObject(item));
} }
if (data.KeyState != null) {
message.KeyState = data.KeyState.map(item => KeyState.fromObject(item));
}
return message; return message;
} }
toObject() { toObject() {
@ -3019,6 +3123,7 @@ export namespace state {
AlarmState?: ReturnType<typeof AlarmState.prototype.toObject>[]; AlarmState?: ReturnType<typeof AlarmState.prototype.toObject>[];
LightState?: ReturnType<typeof LightState.prototype.toObject>[]; LightState?: ReturnType<typeof LightState.prototype.toObject>[];
psdState?: ReturnType<typeof PsdState.prototype.toObject>[]; psdState?: ReturnType<typeof PsdState.prototype.toObject>[];
KeyState?: ReturnType<typeof KeyState.prototype.toObject>[];
} = {}; } = {};
if (this.trainState != null) { if (this.trainState != null) {
data.trainState = this.trainState.map((item: TrainState) => item.toObject()); data.trainState = this.trainState.map((item: TrainState) => item.toObject());
@ -3047,6 +3152,9 @@ export namespace state {
if (this.psdState != null) { if (this.psdState != null) {
data.psdState = this.psdState.map((item: PsdState) => item.toObject()); data.psdState = this.psdState.map((item: PsdState) => item.toObject());
} }
if (this.KeyState != null) {
data.KeyState = this.KeyState.map((item: KeyState) => item.toObject());
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -3071,6 +3179,8 @@ export namespace state {
writer.writeRepeatedMessage(8, this.LightState, (item: LightState) => item.serialize(writer)); writer.writeRepeatedMessage(8, this.LightState, (item: LightState) => item.serialize(writer));
if (this.psdState.length) if (this.psdState.length)
writer.writeRepeatedMessage(9, this.psdState, (item: PsdState) => item.serialize(writer)); writer.writeRepeatedMessage(9, this.psdState, (item: PsdState) => item.serialize(writer));
if (this.KeyState.length)
writer.writeRepeatedMessage(10, this.KeyState, (item: KeyState) => item.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -3107,6 +3217,9 @@ export namespace state {
case 9: case 9:
reader.readMessage(message.psdState, () => pb_1.Message.addToRepeatedWrapperField(message, 9, PsdState.deserialize(reader), PsdState)); reader.readMessage(message.psdState, () => pb_1.Message.addToRepeatedWrapperField(message, 9, PsdState.deserialize(reader), PsdState));
break; break;
case 10:
reader.readMessage(message.KeyState, () => pb_1.Message.addToRepeatedWrapperField(message, 10, KeyState.deserialize(reader), KeyState));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }