Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
018c8eb66f
@ -7,6 +7,14 @@ import {
|
|||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||||
import { state } from 'src/protos/device_status';
|
import { state } from 'src/protos/device_status';
|
||||||
|
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||||
|
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||||
|
import {
|
||||||
|
GraphicApp,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
|
JlGraphic,
|
||||||
|
} from 'src/jl-graphic';
|
||||||
|
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||||
|
|
||||||
export class PlatformData extends GraphicDataBase implements IPlatformData {
|
export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||||
constructor(data?: graphicData.Platform) {
|
constructor(data?: graphicData.Platform) {
|
||||||
@ -81,7 +89,7 @@ export class PlatformState extends GraphicStateBase implements IPlatformState {
|
|||||||
get close(): boolean {
|
get close(): boolean {
|
||||||
return this.states.close;
|
return this.states.close;
|
||||||
}
|
}
|
||||||
set greencloseOpen(v: boolean) {
|
set close(v: boolean) {
|
||||||
this.states.close = v;
|
this.states.close = v;
|
||||||
}
|
}
|
||||||
get upHold(): boolean {
|
get upHold(): boolean {
|
||||||
@ -170,3 +178,127 @@ export class PlatformState extends GraphicStateBase implements IPlatformState {
|
|||||||
return new PlatformState(this.states.cloneMessage());
|
return new PlatformState(this.states.cloneMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const arrestCarConfig: MenuItemOptions = {
|
||||||
|
name: '扣车',
|
||||||
|
};
|
||||||
|
const removeArrestCarConfig: MenuItemOptions = {
|
||||||
|
name: '取消扣车',
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
|
const batchArrestCarConfig: MenuItemOptions = {
|
||||||
|
name: '批量扣车',
|
||||||
|
};
|
||||||
|
const removeBatchArrestCarConfig: MenuItemOptions = {
|
||||||
|
name: '批量取消扣车',
|
||||||
|
};
|
||||||
|
const earlyDepartureConfig: MenuItemOptions = {
|
||||||
|
name: '提前发车',
|
||||||
|
};
|
||||||
|
const jumpStopConfig: MenuItemOptions = {
|
||||||
|
name: '设置跳停',
|
||||||
|
};
|
||||||
|
const removeJumpStopConfig: MenuItemOptions = {
|
||||||
|
name: '设置跳停',
|
||||||
|
};
|
||||||
|
const dockTimeConfig: MenuItemOptions = {
|
||||||
|
name: '设置停站时间',
|
||||||
|
};
|
||||||
|
const operatingLevelConfig: MenuItemOptions = {
|
||||||
|
name: '设置运行等级',
|
||||||
|
};
|
||||||
|
const numberOfRegionalTrainsConfig: MenuItemOptions = {
|
||||||
|
name: '区间列车数量限制',
|
||||||
|
};
|
||||||
|
const removeNumberOfRegionalTrainsConfig: MenuItemOptions = {
|
||||||
|
name: '取消区间列车数量限制',
|
||||||
|
};
|
||||||
|
const platformMessadeConfig: MenuItemOptions = {
|
||||||
|
name: '站台详细信息',
|
||||||
|
};
|
||||||
|
|
||||||
|
const PlatformOperateMenu: ContextMenu = ContextMenu.init({
|
||||||
|
name: '站台操作菜单',
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
items: [
|
||||||
|
arrestCarConfig,
|
||||||
|
removeArrestCarConfig,
|
||||||
|
earlyDepartureConfig,
|
||||||
|
platformMessadeConfig,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const dispatchPlatformOperateMenu: ContextMenu = ContextMenu.init({
|
||||||
|
name: '调度仿真站台操作菜单',
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
items: [
|
||||||
|
arrestCarConfig,
|
||||||
|
removeArrestCarConfig,
|
||||||
|
batchArrestCarConfig,
|
||||||
|
removeBatchArrestCarConfig,
|
||||||
|
earlyDepartureConfig,
|
||||||
|
jumpStopConfig,
|
||||||
|
removeJumpStopConfig,
|
||||||
|
dockTimeConfig,
|
||||||
|
operatingLevelConfig,
|
||||||
|
numberOfRegionalTrainsConfig,
|
||||||
|
removeNumberOfRegionalTrainsConfig,
|
||||||
|
platformMessadeConfig,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platform> {
|
||||||
|
static Name = 'signal_operate_menu';
|
||||||
|
constructor(app: GraphicApp) {
|
||||||
|
super(PlatformOperateInteraction.Name, app);
|
||||||
|
app.registerMenu(PlatformOperateMenu);
|
||||||
|
}
|
||||||
|
static init(app: GraphicApp) {
|
||||||
|
return new PlatformOperateInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): Platform[] | undefined {
|
||||||
|
return grahpics
|
||||||
|
.filter((g) => g.type === Platform.Type)
|
||||||
|
.map((g) => g as Platform);
|
||||||
|
}
|
||||||
|
bind(g: Platform): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.selectable = true;
|
||||||
|
g.on('_rightclick', this.onContextMenu, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
unbind(g: Platform): void {
|
||||||
|
g.selectable = false;
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.off('_rightclick', this.onContextMenu, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
onContextMenu(e: FederatedMouseEvent) {
|
||||||
|
const target = e.target as DisplayObject;
|
||||||
|
const platform = target.getGraphic() as Platform;
|
||||||
|
this.app.updateSelected(platform);
|
||||||
|
arrestCarConfig.handler = () => {
|
||||||
|
platform.states.close = true;
|
||||||
|
platform.changeState();
|
||||||
|
};
|
||||||
|
removeArrestCarConfig.handler = () => {
|
||||||
|
platform.states.close = false;
|
||||||
|
platform.changeState();
|
||||||
|
};
|
||||||
|
earlyDepartureConfig.handler = () => {
|
||||||
|
console.log(2222);
|
||||||
|
};
|
||||||
|
platformMessadeConfig.handler = () => {
|
||||||
|
console.log(2222);
|
||||||
|
};
|
||||||
|
|
||||||
|
PlatformOperateMenu.open(e.global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,14 @@ import {
|
|||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||||
import { state } from 'src/protos/device_status';
|
import { state } from 'src/protos/device_status';
|
||||||
|
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||||
|
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||||
|
import {
|
||||||
|
GraphicApp,
|
||||||
|
GraphicInteractionPlugin,
|
||||||
|
JlGraphic,
|
||||||
|
} from 'src/jl-graphic';
|
||||||
|
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||||
|
|
||||||
export class StationData extends GraphicDataBase implements IStationData {
|
export class StationData extends GraphicDataBase implements IStationData {
|
||||||
constructor(data?: graphicData.Station) {
|
constructor(data?: graphicData.Station) {
|
||||||
@ -223,3 +231,59 @@ export class StationState extends GraphicStateBase implements IStationState {
|
|||||||
return new StationState(this.states.cloneMessage());
|
return new StationState(this.states.cloneMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const chainConfig: MenuItemOptions = {
|
||||||
|
name: '全站设置连锁自动触发',
|
||||||
|
};
|
||||||
|
const removeChainConfig: MenuItemOptions = {
|
||||||
|
name: '全站取消连锁自动触发',
|
||||||
|
};
|
||||||
|
const StationOperateMenu: ContextMenu = ContextMenu.init({
|
||||||
|
name: '车站操作菜单',
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
items: [chainConfig, removeChainConfig],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
export class StationOperateInteraction extends GraphicInteractionPlugin<Station> {
|
||||||
|
static Name = 'signal_operate_menu';
|
||||||
|
constructor(app: GraphicApp) {
|
||||||
|
super(StationOperateInteraction.Name, app);
|
||||||
|
app.registerMenu(StationOperateMenu);
|
||||||
|
}
|
||||||
|
static init(app: GraphicApp) {
|
||||||
|
return new StationOperateInteraction(app);
|
||||||
|
}
|
||||||
|
filter(...grahpics: JlGraphic[]): Station[] | undefined {
|
||||||
|
return grahpics
|
||||||
|
.filter((g) => g.type === Station.Type)
|
||||||
|
.map((g) => g as Station);
|
||||||
|
}
|
||||||
|
bind(g: Station): void {
|
||||||
|
g.eventMode = 'static';
|
||||||
|
g.cursor = 'pointer';
|
||||||
|
g.selectable = true;
|
||||||
|
g.on('_rightclick', this.onContextMenu, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
unbind(g: Station): void {
|
||||||
|
g.selectable = false;
|
||||||
|
g.eventMode = 'none';
|
||||||
|
g.off('_rightclick', this.onContextMenu, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
onContextMenu(e: FederatedMouseEvent) {
|
||||||
|
const target = e.target as DisplayObject;
|
||||||
|
const station = target.getGraphic() as Station;
|
||||||
|
this.app.updateSelected(station);
|
||||||
|
chainConfig.handler = () => {
|
||||||
|
console.log(2222);
|
||||||
|
};
|
||||||
|
removeChainConfig.handler = () => {
|
||||||
|
console.log(2222);
|
||||||
|
};
|
||||||
|
StationOperateMenu.open(e.global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user