道岔增加转辙机型号字段

This commit is contained in:
Yuan 2023-09-13 15:33:44 +08:00
parent 8c9f548342
commit 879897d4a8
7 changed files with 94 additions and 7 deletions

@ -1 +1 @@
Subproject commit 53175169cb3bea1a41474e9664dd20836470afeb Subproject commit fad24da7d969b733f54a0a4b8c97fa7cec80d38d

View File

@ -70,6 +70,16 @@
@update:model-value="onUpdate" @update:model-value="onUpdate"
label="方向" label="方向"
></q-select> ></q-select>
<q-select
outlined
class="q-mt-md"
map-options
emit-value
label="转辙机型号"
@update:model-value="onUpdate"
v-model="turnoutModel.data.switchMachineType"
:options="switchMachineTypeOptions"
></q-select>
<q-field class="q-mt-lg" outlined label="关联区段" readonly stack-label> <q-field class="q-mt-lg" outlined label="关联区段" readonly stack-label>
<template #control> <template #control>
<q-chip <q-chip
@ -102,6 +112,7 @@ import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction';
import { Section } from 'src/graphics/section/Section'; import { Section } from 'src/graphics/section/Section';
import { Direction } from 'src/graphics/signal/Signal'; import { Direction } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout'; import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { computed, reactive, shallowRef, watchEffect } from 'vue'; import { computed, reactive, shallowRef, watchEffect } from 'vue';
@ -121,6 +132,20 @@ const directionOptions = [
{ label: '左行', value: 0 }, { label: '左行', value: 0 },
{ label: '右行', value: 1 }, { label: '右行', value: 1 },
]; ];
const switchMachineTypeOptions = [
{
label: '请选择',
value: graphicData.Turnout.SwitchMachineType.Unknown,
},
{
label: 'ZDJ6(单机牵引)',
value: graphicData.Turnout.SwitchMachineType.ZDJ9_Single,
},
{
label: 'ZDJ6(双机牵引)',
value: graphicData.Turnout.SwitchMachineType.ZDJ9_Double,
},
];
const sectionRelations = computed(() => { const sectionRelations = computed(() => {
const turnout = drawStore.selectedGraphic as Turnout; const turnout = drawStore.selectedGraphic as Turnout;

View File

@ -2,7 +2,7 @@ import * as pb_1 from 'google-protobuf';
import { DisplayObject, FederatedMouseEvent } from 'pixi.js'; import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
import { ISpksSwitch, SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch'; import { ISpksSwitch, SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -82,11 +82,11 @@ const SpksSwitchEditMenu: ContextMenu = ContextMenu.init({
}); });
export class DrawSpksSwitchInteraction extends GraphicInteractionPlugin<SpksSwitch> { export class DrawSpksSwitchInteraction extends GraphicInteractionPlugin<SpksSwitch> {
static Name = 'spks_switch_draw_right_menu'; static Name = 'spks_switch_draw_right_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(DrawSpksSwitchInteraction.Name, app); super(DrawSpksSwitchInteraction.Name, app);
app.registerMenu(SpksSwitchEditMenu); app.registerMenu(SpksSwitchEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new DrawSpksSwitchInteraction(app); return new DrawSpksSwitchInteraction(app);
} }
filter(...grahpics: JlGraphic[]): SpksSwitch[] | undefined { filter(...grahpics: JlGraphic[]): SpksSwitch[] | undefined {

View File

@ -11,7 +11,7 @@ import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
import { KilometerSystem } from 'src/graphics/signal/Signal'; import { KilometerSystem } from 'src/graphics/signal/Signal';
import { state } from 'src/protos/device_state'; import { state } from 'src/protos/device_state';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -51,11 +51,11 @@ const TurnoutOperationMenu: ContextMenu = ContextMenu.init({
export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> { export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
static Name = 'turnout_operate_menu'; static Name = 'turnout_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(TurnoutOperationPlugin.Name, app); super(TurnoutOperationPlugin.Name, app);
app.registerMenu(TurnoutOperationMenu); app.registerMenu(TurnoutOperationMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new TurnoutOperationPlugin(app); return new TurnoutOperationPlugin(app);
} }
filter(...grahpics: JlGraphic[]): Turnout[] | undefined { filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
@ -259,6 +259,12 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
set pcTrackSectionId(v: string) { set pcTrackSectionId(v: string) {
this.data.pcTrackSectionId = v; this.data.pcTrackSectionId = v;
} }
get switchMachineType(): graphicData.Turnout.SwitchMachineType {
return this.data.switchMachineType;
}
set switchMachineType(v: graphicData.Turnout.SwitchMachineType) {
this.data.switchMachineType = v;
}
clone(): TurnoutData { clone(): TurnoutData {
return new TurnoutData(this.data.cloneMessage()); return new TurnoutData(this.data.cloneMessage());
} }

View File

@ -18,6 +18,7 @@ import {
} from '../CommonGraphics'; } from '../CommonGraphics';
import { KilometerSystem } from '../signal/Signal'; import { KilometerSystem } from '../signal/Signal';
import { TrackSection } from '../trackSection/TrackSection'; import { TrackSection } from '../trackSection/TrackSection';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export interface ITurnoutData extends GraphicData { export interface ITurnoutData extends GraphicData {
get code(): string; get code(): string;
@ -44,6 +45,8 @@ export interface ITurnoutData extends GraphicData {
set pbTrackSectionId(v: string); set pbTrackSectionId(v: string);
get pcTrackSectionId(): string; get pcTrackSectionId(): string;
set pcTrackSectionId(v: string); set pcTrackSectionId(v: string);
get switchMachineType(): graphicData.Turnout.SwitchMachineType;
set switchMachineType(v: graphicData.Turnout.SwitchMachineType);
clone(): ITurnoutData; clone(): ITurnoutData;
copyFrom(data: ITurnoutData): void; copyFrom(data: ITurnoutData): void;
eq(other: ITurnoutData): boolean; eq(other: ITurnoutData): boolean;

View File

@ -544,6 +544,7 @@ export namespace state {
headDirection?: boolean; headDirection?: boolean;
dynamicState?: TrainDynamicState; dynamicState?: TrainDynamicState;
vobcState?: TrainVobcState; vobcState?: TrainVobcState;
trainKilometer?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -587,6 +588,9 @@ export namespace state {
if ("vobcState" in data && data.vobcState != undefined) { if ("vobcState" in data && data.vobcState != undefined) {
this.vobcState = data.vobcState; this.vobcState = data.vobcState;
} }
if ("trainKilometer" in data && data.trainKilometer != undefined) {
this.trainKilometer = data.trainKilometer;
}
} }
} }
get id() { get id() {
@ -673,6 +677,12 @@ export namespace state {
get has_vobcState() { get has_vobcState() {
return pb_1.Message.getField(this, 13) != null; return pb_1.Message.getField(this, 13) != null;
} }
get trainKilometer() {
return pb_1.Message.getFieldWithDefault(this, 14, 0) as number;
}
set trainKilometer(value: number) {
pb_1.Message.setField(this, 14, value);
}
static fromObject(data: { static fromObject(data: {
id?: string; id?: string;
up?: boolean; up?: boolean;
@ -687,6 +697,7 @@ export namespace state {
headDirection?: boolean; headDirection?: boolean;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>; dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>; vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
}): TrainState { }): TrainState {
const message = new TrainState({}); const message = new TrainState({});
if (data.id != null) { if (data.id != null) {
@ -728,6 +739,9 @@ export namespace state {
if (data.vobcState != null) { if (data.vobcState != null) {
message.vobcState = TrainVobcState.fromObject(data.vobcState); message.vobcState = TrainVobcState.fromObject(data.vobcState);
} }
if (data.trainKilometer != null) {
message.trainKilometer = data.trainKilometer;
}
return message; return message;
} }
toObject() { toObject() {
@ -745,6 +759,7 @@ export namespace state {
headDirection?: boolean; headDirection?: boolean;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>; dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>; vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
} = {}; } = {};
if (this.id != null) { if (this.id != null) {
data.id = this.id; data.id = this.id;
@ -785,6 +800,9 @@ export namespace state {
if (this.vobcState != null) { if (this.vobcState != null) {
data.vobcState = this.vobcState.toObject(); data.vobcState = this.vobcState.toObject();
} }
if (this.trainKilometer != null) {
data.trainKilometer = this.trainKilometer;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -817,6 +835,8 @@ export namespace state {
writer.writeMessage(12, this.dynamicState, () => this.dynamicState.serialize(writer)); writer.writeMessage(12, this.dynamicState, () => this.dynamicState.serialize(writer));
if (this.has_vobcState) if (this.has_vobcState)
writer.writeMessage(13, this.vobcState, () => this.vobcState.serialize(writer)); writer.writeMessage(13, this.vobcState, () => this.vobcState.serialize(writer));
if (this.trainKilometer != 0)
writer.writeInt64(14, this.trainKilometer);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -865,6 +885,9 @@ export namespace state {
case 13: case 13:
reader.readMessage(message.vobcState, () => message.vobcState = TrainVobcState.deserialize(reader)); reader.readMessage(message.vobcState, () => message.vobcState = TrainVobcState.deserialize(reader));
break; break;
case 14:
message.trainKilometer = reader.readInt64();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }

View File

@ -1913,6 +1913,7 @@ export namespace graphicData {
paTrackSectionId?: string; paTrackSectionId?: string;
pbTrackSectionId?: string; pbTrackSectionId?: string;
pcTrackSectionId?: string; pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6, 7, 8, 13], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [6, 7, 8, 13], this.#one_of_decls);
@ -1956,6 +1957,9 @@ export namespace graphicData {
if ("pcTrackSectionId" in data && data.pcTrackSectionId != undefined) { if ("pcTrackSectionId" in data && data.pcTrackSectionId != undefined) {
this.pcTrackSectionId = data.pcTrackSectionId; this.pcTrackSectionId = data.pcTrackSectionId;
} }
if ("switchMachineType" in data && data.switchMachineType != undefined) {
this.switchMachineType = data.switchMachineType;
}
} }
} }
get common() { get common() {
@ -2048,6 +2052,12 @@ export namespace graphicData {
set pcTrackSectionId(value: string) { set pcTrackSectionId(value: string) {
pb_1.Message.setField(this, 17, value); pb_1.Message.setField(this, 17, value);
} }
get switchMachineType() {
return pb_1.Message.getFieldWithDefault(this, 18, Turnout.SwitchMachineType.Unknown) as Turnout.SwitchMachineType;
}
set switchMachineType(value: Turnout.SwitchMachineType) {
pb_1.Message.setField(this, 18, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>; common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string; code?: string;
@ -2062,6 +2072,7 @@ export namespace graphicData {
paTrackSectionId?: string; paTrackSectionId?: string;
pbTrackSectionId?: string; pbTrackSectionId?: string;
pcTrackSectionId?: string; pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
}): Turnout { }): Turnout {
const message = new Turnout({}); const message = new Turnout({});
if (data.common != null) { if (data.common != null) {
@ -2103,6 +2114,9 @@ export namespace graphicData {
if (data.pcTrackSectionId != null) { if (data.pcTrackSectionId != null) {
message.pcTrackSectionId = data.pcTrackSectionId; message.pcTrackSectionId = data.pcTrackSectionId;
} }
if (data.switchMachineType != null) {
message.switchMachineType = data.switchMachineType;
}
return message; return message;
} }
toObject() { toObject() {
@ -2120,6 +2134,7 @@ export namespace graphicData {
paTrackSectionId?: string; paTrackSectionId?: string;
pbTrackSectionId?: string; pbTrackSectionId?: string;
pcTrackSectionId?: string; pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
@ -2160,6 +2175,9 @@ export namespace graphicData {
if (this.pcTrackSectionId != null) { if (this.pcTrackSectionId != null) {
data.pcTrackSectionId = this.pcTrackSectionId; data.pcTrackSectionId = this.pcTrackSectionId;
} }
if (this.switchMachineType != null) {
data.switchMachineType = this.switchMachineType;
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -2192,6 +2210,8 @@ export namespace graphicData {
writer.writeString(16, this.pbTrackSectionId); writer.writeString(16, this.pbTrackSectionId);
if (this.pcTrackSectionId.length) if (this.pcTrackSectionId.length)
writer.writeString(17, this.pcTrackSectionId); writer.writeString(17, this.pcTrackSectionId);
if (this.switchMachineType != Turnout.SwitchMachineType.Unknown)
writer.writeEnum(18, this.switchMachineType);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -2240,6 +2260,9 @@ export namespace graphicData {
case 17: case 17:
message.pcTrackSectionId = reader.readString(); message.pcTrackSectionId = reader.readString();
break; break;
case 18:
message.switchMachineType = reader.readEnum();
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -2252,6 +2275,13 @@ export namespace graphicData {
return Turnout.deserialize(bytes); return Turnout.deserialize(bytes);
} }
} }
export namespace Turnout {
export enum SwitchMachineType {
Unknown = 0,
ZDJ9_Single = 1,
ZDJ9_Double = 2
}
}
export class KilometerSystem extends pb_1.Message { export class KilometerSystem extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {