道岔增加转辙机型号字段

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"
label="方向"
></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>
<template #control>
<q-chip
@ -102,6 +112,7 @@ import { TurnoutData } from 'src/drawApp/graphics/TurnoutInteraction';
import { Section } from 'src/graphics/section/Section';
import { Direction } from 'src/graphics/signal/Signal';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { useDrawStore } from 'src/stores/draw-store';
import { computed, reactive, shallowRef, watchEffect } from 'vue';
@ -121,6 +132,20 @@ const directionOptions = [
{ label: '左行', value: 0 },
{ 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 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 { ISpksSwitch, SpksSwitch } from 'src/graphics/spksSwitch/SpksSwitch';
import {
GraphicApp,
IGraphicApp,
GraphicInteractionPlugin,
JlGraphic,
} from 'src/jl-graphic';
@ -82,11 +82,11 @@ const SpksSwitchEditMenu: ContextMenu = ContextMenu.init({
});
export class DrawSpksSwitchInteraction extends GraphicInteractionPlugin<SpksSwitch> {
static Name = 'spks_switch_draw_right_menu';
constructor(app: GraphicApp) {
constructor(app: IGraphicApp) {
super(DrawSpksSwitchInteraction.Name, app);
app.registerMenu(SpksSwitchEditMenu);
}
static init(app: GraphicApp) {
static init(app: IGraphicApp) {
return new DrawSpksSwitchInteraction(app);
}
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 { state } from 'src/protos/device_state';
import {
GraphicApp,
IGraphicApp,
GraphicInteractionPlugin,
JlGraphic,
} from 'src/jl-graphic';
@ -51,11 +51,11 @@ const TurnoutOperationMenu: ContextMenu = ContextMenu.init({
export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
static Name = 'turnout_operate_menu';
constructor(app: GraphicApp) {
constructor(app: IGraphicApp) {
super(TurnoutOperationPlugin.Name, app);
app.registerMenu(TurnoutOperationMenu);
}
static init(app: GraphicApp) {
static init(app: IGraphicApp) {
return new TurnoutOperationPlugin(app);
}
filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
@ -259,6 +259,12 @@ export class TurnoutData extends GraphicDataBase implements ITurnoutData {
set pcTrackSectionId(v: string) {
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 {
return new TurnoutData(this.data.cloneMessage());
}

View File

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

View File

@ -544,6 +544,7 @@ export namespace state {
headDirection?: boolean;
dynamicState?: TrainDynamicState;
vobcState?: TrainVobcState;
trainKilometer?: number;
}) {
super();
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) {
this.vobcState = data.vobcState;
}
if ("trainKilometer" in data && data.trainKilometer != undefined) {
this.trainKilometer = data.trainKilometer;
}
}
}
get id() {
@ -673,6 +677,12 @@ export namespace state {
get has_vobcState() {
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: {
id?: string;
up?: boolean;
@ -687,6 +697,7 @@ export namespace state {
headDirection?: boolean;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
}): TrainState {
const message = new TrainState({});
if (data.id != null) {
@ -728,6 +739,9 @@ export namespace state {
if (data.vobcState != null) {
message.vobcState = TrainVobcState.fromObject(data.vobcState);
}
if (data.trainKilometer != null) {
message.trainKilometer = data.trainKilometer;
}
return message;
}
toObject() {
@ -745,6 +759,7 @@ export namespace state {
headDirection?: boolean;
dynamicState?: ReturnType<typeof TrainDynamicState.prototype.toObject>;
vobcState?: ReturnType<typeof TrainVobcState.prototype.toObject>;
trainKilometer?: number;
} = {};
if (this.id != null) {
data.id = this.id;
@ -785,6 +800,9 @@ export namespace state {
if (this.vobcState != null) {
data.vobcState = this.vobcState.toObject();
}
if (this.trainKilometer != null) {
data.trainKilometer = this.trainKilometer;
}
return data;
}
serialize(): Uint8Array;
@ -817,6 +835,8 @@ export namespace state {
writer.writeMessage(12, this.dynamicState, () => this.dynamicState.serialize(writer));
if (this.has_vobcState)
writer.writeMessage(13, this.vobcState, () => this.vobcState.serialize(writer));
if (this.trainKilometer != 0)
writer.writeInt64(14, this.trainKilometer);
if (!w)
return writer.getResultBuffer();
}
@ -865,6 +885,9 @@ export namespace state {
case 13:
reader.readMessage(message.vobcState, () => message.vobcState = TrainVobcState.deserialize(reader));
break;
case 14:
message.trainKilometer = reader.readInt64();
break;
default: reader.skipField();
}
}

View File

@ -1913,6 +1913,7 @@ export namespace graphicData {
paTrackSectionId?: string;
pbTrackSectionId?: string;
pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
}) {
super();
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) {
this.pcTrackSectionId = data.pcTrackSectionId;
}
if ("switchMachineType" in data && data.switchMachineType != undefined) {
this.switchMachineType = data.switchMachineType;
}
}
}
get common() {
@ -2048,6 +2052,12 @@ export namespace graphicData {
set pcTrackSectionId(value: string) {
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: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
@ -2062,6 +2072,7 @@ export namespace graphicData {
paTrackSectionId?: string;
pbTrackSectionId?: string;
pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
}): Turnout {
const message = new Turnout({});
if (data.common != null) {
@ -2103,6 +2114,9 @@ export namespace graphicData {
if (data.pcTrackSectionId != null) {
message.pcTrackSectionId = data.pcTrackSectionId;
}
if (data.switchMachineType != null) {
message.switchMachineType = data.switchMachineType;
}
return message;
}
toObject() {
@ -2120,6 +2134,7 @@ export namespace graphicData {
paTrackSectionId?: string;
pbTrackSectionId?: string;
pcTrackSectionId?: string;
switchMachineType?: Turnout.SwitchMachineType;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -2160,6 +2175,9 @@ export namespace graphicData {
if (this.pcTrackSectionId != null) {
data.pcTrackSectionId = this.pcTrackSectionId;
}
if (this.switchMachineType != null) {
data.switchMachineType = this.switchMachineType;
}
return data;
}
serialize(): Uint8Array;
@ -2192,6 +2210,8 @@ export namespace graphicData {
writer.writeString(16, this.pbTrackSectionId);
if (this.pcTrackSectionId.length)
writer.writeString(17, this.pcTrackSectionId);
if (this.switchMachineType != Turnout.SwitchMachineType.Unknown)
writer.writeEnum(18, this.switchMachineType);
if (!w)
return writer.getResultBuffer();
}
@ -2240,6 +2260,9 @@ export namespace graphicData {
case 17:
message.pcTrackSectionId = reader.readString();
break;
case 18:
message.switchMachineType = reader.readEnum();
break;
default: reader.skipField();
}
}
@ -2252,6 +2275,13 @@ export namespace graphicData {
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 {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {