列车信息调整

This commit is contained in:
dong 2023-09-05 15:29:30 +08:00
parent 6103863d70
commit 5ad860befe

View File

@ -5,7 +5,7 @@ import { state } from 'src/protos/device_state';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -99,13 +99,13 @@ export class TrainState extends GraphicStateBase implements ITrainState {
this.states.headDirection = v; this.states.headDirection = v;
} }
get dynamicState(): state.TrainDynamicState { get dynamicState(): state.TrainDynamicState {
return this.states.dynamicState; return this.states.dynamicState || new state.TrainDynamicState();
} }
set dynamicState(v: state.TrainDynamicState) { set dynamicState(v: state.TrainDynamicState) {
this.states.dynamicState = new state.TrainDynamicState(v); this.states.dynamicState = new state.TrainDynamicState(v);
} }
get vobcState(): state.TrainVobcState { get vobcState(): state.TrainVobcState {
return this.states.vobcState; return this.states.vobcState || new state.TrainVobcState();
} }
set vobcState(v: state.TrainVobcState) { set vobcState(v: state.TrainVobcState) {
this.states.vobcState = new state.TrainVobcState(v); this.states.vobcState = new state.TrainVobcState(v);
@ -135,11 +135,11 @@ const TrainOperateMenu: ContextMenu = ContextMenu.init({
export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> { export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
static Name = 'train_operate_menu'; static Name = 'train_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(TrainOperateInteraction.Name, app); super(TrainOperateInteraction.Name, app);
app.registerMenu(TrainOperateMenu); app.registerMenu(TrainOperateMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new TrainOperateInteraction(app); return new TrainOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Train[] | undefined { filter(...grahpics: JlGraphic[]): Train[] | undefined {