列车信息调整

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