道岔状态显示
This commit is contained in:
parent
773010b73e
commit
fdadeb7237
47
src/api/TurnoutApi.ts
Normal file
47
src/api/TurnoutApi.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { api } from 'src/boot/axios';
|
||||
import { ITurnoutState } from 'src/graphics/turnout/Turnout';
|
||||
|
||||
const base = '/mock/train';
|
||||
|
||||
interface State {
|
||||
id: string;
|
||||
ipSingleSwitchStusCiOccupied?: boolean; // 连锁报告道岔占用
|
||||
ipSingleSwitchStusCbtcOccupied?: boolean; // CBTC报告道岔占用
|
||||
ipSingleSwitchStusLocked?: boolean; // 道岔锁闭
|
||||
ipSingleSwitchStusFailLocked?: boolean; // 道岔故障锁闭
|
||||
ipSingleSwitchStusNormal?: boolean; // 定位
|
||||
ipSingleSwitchStusReverse?: boolean; // 反位
|
||||
ipSingleSwitchStusBlocked1?: boolean; // 单锁
|
||||
ipSingleSwitchStusJammed?: boolean; // 挤岔
|
||||
ipSingleSwitchStusExpectLock?: boolean; // 期望锁闭
|
||||
ipSingleSwitchStusExpectUnlock?: boolean; // 期望锁闭解除
|
||||
ipSingleSwitchStusExpectNormal?: boolean; // 期望道岔定位
|
||||
ipSingleSwitchStusExpectReverse?: boolean; // 期望道岔反位
|
||||
ipSingleSwitchStusExpectBlock?: boolean; // 期望道岔单锁
|
||||
ipSingleSwitchStusExpectUnblock?: boolean; // 期望道岔解除单锁
|
||||
ipSingleSwitchStusInRoute?: boolean; // 是否在进路中锁闭
|
||||
ipSingleSwitchStusManualMode?: boolean; // 道岔为手动操作模式
|
||||
ipSingleSwitchStusCut?: boolean; // 道岔切除
|
||||
ipSingleSwitchStusAtcInvalid?: boolean; // 道岔区段被ATC报告失效
|
||||
ipSingleSwitchStusOverlap?: boolean; // OVERLAP
|
||||
ipSingleSwitchStusTsrCbtcMain?: boolean; // CBTC岔前限速
|
||||
ipSingleSwitchStusTsrCbtcNormal?: boolean; // CBTC定位限速
|
||||
ipSingleSwitchStusTsrCbtcReverse?: boolean; // CBTC反位限速
|
||||
ipSingleSwitchStusTsrBmMain?: boolean; // BM岔前限速
|
||||
ipSingleSwitchStusTsrBmNormal?: boolean; // BM定位限速
|
||||
ipSingleSwitchStusTsrBmReverse?: boolean; // BM反位限速
|
||||
ipSingleSwitchStusBlocked2?: boolean; // 道岔封锁
|
||||
ipSingleSwitchStusLostIndication?: boolean; // 道岔失表示
|
||||
speedLimit?: number;
|
||||
}
|
||||
|
||||
export async function setSwitchStatus(lineId: string, state: State) {
|
||||
try {
|
||||
delete state._state;
|
||||
delete state._graphicType;
|
||||
state.speedLimit = 0;
|
||||
return await api.post(`/mock/switch/status/${lineId}`, state);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
@ -6,9 +6,230 @@ import {
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { IPointData } from 'pixi.js';
|
||||
import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
|
||||
import { KilometerSystem } from 'src/graphics/signal/Signal';
|
||||
import { state } from 'src/protos/device_status';
|
||||
import {
|
||||
GraphicApp,
|
||||
GraphicInteractionPlugin,
|
||||
JlGraphic,
|
||||
} from 'src/jl-graphic';
|
||||
import {
|
||||
ForkHitArea,
|
||||
TurnoutSectionHitArea,
|
||||
} from 'src/graphics/turnout/TurnoutDrawAssistant';
|
||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||
import { setSwitchStatus } from 'src/api/TurnoutApi';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
|
||||
let menuItemHandler: (propName: string) => void;
|
||||
|
||||
const ipSingleSwitchStusCiOccupied: MenuItemOptions = {
|
||||
name: '连锁报告道岔占用-ipSingleSwitchStusCiOccupied',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusCiOccupied'),
|
||||
};
|
||||
const ipSingleSwitchStusCbtcOccupied: MenuItemOptions = {
|
||||
name: 'CBTC报告道岔占用-ipSingleSwitchStusCbtcOccupied',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusCbtcOccupied'),
|
||||
};
|
||||
const ipSingleSwitchStusLocked: MenuItemOptions = {
|
||||
name: '道岔锁闭-ipSingleSwitchStusLocked',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusLocked'),
|
||||
};
|
||||
const ipSingleSwitchStusFailLocked: MenuItemOptions = {
|
||||
name: '道岔故障锁闭-ipSingleSwitchStusFailLocked',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusFailLocked'),
|
||||
};
|
||||
const ipSingleSwitchStusNormal: MenuItemOptions = {
|
||||
name: '定位-ipSingleSwitchStusNormal',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusNormal'),
|
||||
};
|
||||
const ipSingleSwitchStusReverse: MenuItemOptions = {
|
||||
name: '反位-ipSingleSwitchStusReverse',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusReverse'),
|
||||
};
|
||||
const ipSingleSwitchStusBlocked1: MenuItemOptions = {
|
||||
name: '单锁-ipSingleSwitchStusBlocked1',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusBlocked1'),
|
||||
};
|
||||
const ipSingleSwitchStusJammed: MenuItemOptions = {
|
||||
name: '挤岔-ipSingleSwitchStusJammed',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusJammed'),
|
||||
};
|
||||
|
||||
const ipSingleSwitchStusCut: MenuItemOptions = {
|
||||
name: '道岔切除-ipSingleSwitchStusCut',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusCut'),
|
||||
};
|
||||
const ipSingleSwitchStusAtcInvalid: MenuItemOptions = {
|
||||
name: '道岔区段被ATC报告失效-ipSingleSwitchStusAtcInvalid',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusAtcInvalid'),
|
||||
};
|
||||
const ipSingleSwitchStusOverlap: MenuItemOptions = {
|
||||
name: 'OVERLAP-ipSingleSwitchStusOverlap',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusOverlap'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrCbtcMain: MenuItemOptions = {
|
||||
name: 'CBTC岔前限速-ipSingleSwitchStusTsrCbtcMain',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrCbtcMain'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrCbtcNormal: MenuItemOptions = {
|
||||
name: 'CBTC定位限速-ipSingleSwitchStusTsrCbtcNormal',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrCbtcNormal'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrCbtcReverse: MenuItemOptions = {
|
||||
name: 'CBTC反位限速-ipSingleSwitchStusTsrCbtcReverse',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrCbtcReverse'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrBmMain: MenuItemOptions = {
|
||||
name: 'BM岔前限速-ipSingleSwitchStusTsrBmMain',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrBmMain'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrBmNormal: MenuItemOptions = {
|
||||
name: 'BM定位限速-ipSingleSwitchStusTsrBmNormal',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrBmNormal'),
|
||||
};
|
||||
const ipSingleSwitchStusTsrBmReverse: MenuItemOptions = {
|
||||
name: 'BM反位限速-ipSingleSwitchStusTsrBmReverse',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusTsrBmReverse'),
|
||||
};
|
||||
const ipSingleSwitchStusBlocked2: MenuItemOptions = {
|
||||
name: '道岔封锁-ipSingleSwitchStusBlocked2',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusBlocked2'),
|
||||
};
|
||||
const ipSingleSwitchStusLostIndication: MenuItemOptions = {
|
||||
name: '道岔失表示-ipSingleSwitchStusLostIndication',
|
||||
handler: () => menuItemHandler('ipSingleSwitchStusLostIndication'),
|
||||
};
|
||||
|
||||
const TurnoutOperateMenu = ContextMenu.init({
|
||||
name: 'Turnout操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [
|
||||
ipSingleSwitchStusCiOccupied,
|
||||
ipSingleSwitchStusCbtcOccupied,
|
||||
ipSingleSwitchStusLocked,
|
||||
ipSingleSwitchStusFailLocked,
|
||||
ipSingleSwitchStusNormal,
|
||||
ipSingleSwitchStusReverse,
|
||||
ipSingleSwitchStusBlocked1,
|
||||
ipSingleSwitchStusJammed,
|
||||
ipSingleSwitchStusCut,
|
||||
ipSingleSwitchStusAtcInvalid,
|
||||
ipSingleSwitchStusOverlap,
|
||||
ipSingleSwitchStusTsrCbtcMain,
|
||||
ipSingleSwitchStusTsrCbtcNormal,
|
||||
ipSingleSwitchStusTsrCbtcReverse,
|
||||
ipSingleSwitchStusTsrBmMain,
|
||||
ipSingleSwitchStusTsrBmNormal,
|
||||
ipSingleSwitchStusTsrBmReverse,
|
||||
ipSingleSwitchStusBlocked2,
|
||||
ipSingleSwitchStusLostIndication,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
|
||||
static Name = 'turnout_operate_menu';
|
||||
constructor(app: GraphicApp) {
|
||||
super(TurnoutOperationPlugin.Name, app);
|
||||
app.registerMenu(TurnoutOperateMenu);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
|
||||
return grahpics.filter((g): g is Turnout => g instanceof Turnout);
|
||||
}
|
||||
static init(app: GraphicApp) {
|
||||
return new TurnoutOperationPlugin(app);
|
||||
}
|
||||
bind(g: Turnout): void {
|
||||
g.graphics.fork.eventMode = 'static';
|
||||
g.graphics.fork.cursor = 'pointer';
|
||||
g.graphics.fork.hitArea = new ForkHitArea(g);
|
||||
g.graphics.sections.forEach((sectionGraphic) => {
|
||||
sectionGraphic.eventMode = 'static';
|
||||
sectionGraphic.cursor = 'pointer';
|
||||
sectionGraphic.hitArea = new TurnoutSectionHitArea(sectionGraphic);
|
||||
});
|
||||
g.on('rightclick', this.onContextMenu, this);
|
||||
}
|
||||
unbind(g: Turnout): void {
|
||||
g.graphics.fork.eventMode = 'none';
|
||||
g.graphics.sections.forEach((sectionGraphic) => {
|
||||
sectionGraphic.eventMode = 'none';
|
||||
});
|
||||
g.on('rightclick', this.onContextMenu, this);
|
||||
}
|
||||
onContextMenu(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const turnout = target.getGraphic() as Turnout;
|
||||
this.app.updateSelected(turnout);
|
||||
const state = {
|
||||
ipSingleSwitchStusCiOccupied: turnout.states.ipSingleSwitchStusCiOccupied, // 连锁报告道岔占用
|
||||
ipSingleSwitchStusCbtcOccupied:
|
||||
turnout.states.ipSingleSwitchStusCbtcOccupied, // CBTC报告道岔占用
|
||||
ipSingleSwitchStusLocked: turnout.states.ipSingleSwitchStusLocked, // 道岔锁闭
|
||||
ipSingleSwitchStusFailLocked: turnout.states.ipSingleSwitchStusFailLocked, // 道岔故障锁闭
|
||||
ipSingleSwitchStusNormal: turnout.states.ipSingleSwitchStusNormal, // 定位
|
||||
ipSingleSwitchStusReverse: turnout.states.ipSingleSwitchStusReverse, // 反位
|
||||
ipSingleSwitchStusBlocked1: turnout.states.ipSingleSwitchStusBlocked1, // 单锁
|
||||
ipSingleSwitchStusJammed: turnout.states.ipSingleSwitchStusJammed, // 挤岔
|
||||
ipSingleSwitchStusCut: turnout.states.ipSingleSwitchStusCut, // 道岔切除
|
||||
ipSingleSwitchStusAtcInvalid: turnout.states.ipSingleSwitchStusAtcInvalid, // 道岔区段被ATC报告失效
|
||||
ipSingleSwitchStusOverlap: turnout.states.ipSingleSwitchStusOverlap, // OVERLAP
|
||||
ipSingleSwitchStusTsrCbtcMain:
|
||||
turnout.states.ipSingleSwitchStusTsrCbtcMain, // CBTC岔前限速
|
||||
ipSingleSwitchStusTsrCbtcNormal:
|
||||
turnout.states.ipSingleSwitchStusTsrCbtcNormal, // CBTC定位限速
|
||||
ipSingleSwitchStusTsrCbtcReverse:
|
||||
turnout.states.ipSingleSwitchStusTsrCbtcReverse, // CBTC反位限速
|
||||
ipSingleSwitchStusTsrBmMain: turnout.states.ipSingleSwitchStusTsrBmMain, // BM岔前限速
|
||||
ipSingleSwitchStusTsrBmNormal:
|
||||
turnout.states.ipSingleSwitchStusTsrBmNormal, // BM定位限速
|
||||
ipSingleSwitchStusTsrBmReverse:
|
||||
turnout.states.ipSingleSwitchStusTsrBmReverse, // BM反位限速
|
||||
ipSingleSwitchStusBlocked2: turnout.states.ipSingleSwitchStusBlocked2, // 道岔封锁
|
||||
ipSingleSwitchStusLostIndication:
|
||||
turnout.states.ipSingleSwitchStusLostIndication, // 道岔失表示
|
||||
};
|
||||
(Object.keys(state) as unknown as (keyof ITurnoutState)[]).forEach(
|
||||
(key: keyof ITurnoutState) => {
|
||||
if (!key.startsWith('ipSingle')) return;
|
||||
const item = TurnoutOperateMenu.groups[0].items.find((item) =>
|
||||
item.config.name.includes(key)
|
||||
);
|
||||
if (
|
||||
turnout.states[key] === true &&
|
||||
!item?.config?.name?.endsWith('✔️')
|
||||
) {
|
||||
if (item?.config?.name) item.config.name += '✔️';
|
||||
}
|
||||
if (
|
||||
turnout.states[key] !== true &&
|
||||
item?.config?.name?.endsWith('✔️')
|
||||
) {
|
||||
item.config.name = item?.config?.name.slice(
|
||||
0,
|
||||
item.config.name.length - 2
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
menuItemHandler = (propName: string) => {
|
||||
const lineId = useLineStore().lineId?.toString();
|
||||
if (!lineId) return;
|
||||
console.log({ ...turnout.states });
|
||||
setSwitchStatus(lineId, {
|
||||
...state,
|
||||
id: turnout.datas.code,
|
||||
[propName]: !turnout.states[propName],
|
||||
});
|
||||
};
|
||||
TurnoutOperateMenu.open(e.global);
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultEndPoint() {
|
||||
return {
|
||||
@ -20,13 +241,15 @@ function getDefaultEndPoint() {
|
||||
|
||||
export class TurnoutData extends GraphicDataBase implements ITurnoutData {
|
||||
constructor(data?: graphicData.Turnout) {
|
||||
let turnout = new graphicData.Turnout();
|
||||
let turnout;
|
||||
if (!data) {
|
||||
turnout.common = GraphicDataBase.defaultCommonInfo(Turnout.Type);
|
||||
const p = getDefaultEndPoint();
|
||||
turnout.pointA = p.pointA;
|
||||
turnout.pointB = p.pointB;
|
||||
turnout.pointC = p.pointC;
|
||||
turnout = new graphicData.Turnout({
|
||||
common: GraphicDataBase.defaultCommonInfo(Turnout.Type),
|
||||
pointA: p.pointA,
|
||||
pointB: p.pointB,
|
||||
pointC: p.pointC,
|
||||
});
|
||||
} else {
|
||||
turnout = data;
|
||||
}
|
||||
@ -110,25 +333,120 @@ export class TurnoutStates extends GraphicStateBase implements ITurnoutState {
|
||||
get code(): string {
|
||||
return this.states.id;
|
||||
}
|
||||
ipSingleSwitchStusCiOccupied?: boolean;
|
||||
ipSingleSwitchStusCbtcOccupied?: boolean;
|
||||
ipSingleSwitchStusLocked?: boolean;
|
||||
ipSingleSwitchStusFailLocked?: boolean;
|
||||
ipSingleSwitchStusNormal?: boolean;
|
||||
ipSingleSwitchStusReverse?: boolean;
|
||||
ipSingleSwitchStusBlocked1?: boolean;
|
||||
ipSingleSwitchStusJammed?: boolean;
|
||||
ipSingleSwitchStusCut?: boolean;
|
||||
ipSingleSwitchStusAtcInvalid?: boolean;
|
||||
ipSingleSwitchStusOverlap?: boolean;
|
||||
ipSingleSwitchStusTsrCbtcMain?: boolean;
|
||||
ipSingleSwitchStusTsrCbtcNormal?: boolean;
|
||||
ipSingleSwitchStusTsrCbtcReverse?: boolean;
|
||||
ipSingleSwitchStusTsrBmMain?: boolean;
|
||||
ipSingleSwitchStusTsrBmNormal?: boolean;
|
||||
ipSingleSwitchStusTsrBmReverse?: boolean;
|
||||
ipSingleSwitchStusBlocked2?: boolean;
|
||||
ipSingleSwitchStusLostIndication?: boolean;
|
||||
public get ipSingleSwitchStusCiOccupied(): boolean {
|
||||
return this.states.ipSingleSwitchStusCiOccupied ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusCiOccupied(value: boolean) {
|
||||
this.states.ipSingleSwitchStusCiOccupied = value;
|
||||
}
|
||||
public get ipSingleSwitchStusCbtcOccupied(): boolean {
|
||||
return this.states.ipSingleSwitchStusCbtcOccupied ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusCbtcOccupied(value: boolean) {
|
||||
this.states.ipSingleSwitchStusCbtcOccupied = value;
|
||||
}
|
||||
public get ipSingleSwitchStusLocked(): boolean {
|
||||
return this.states.ipSingleSwitchStusLocked ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusLocked(value: boolean) {
|
||||
this.states.ipSingleSwitchStusLocked = value;
|
||||
}
|
||||
public get ipSingleSwitchStusFailLocked(): boolean {
|
||||
return this.states.ipSingleSwitchStusFailLocked ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusFailLocked(value: boolean) {
|
||||
this.states.ipSingleSwitchStusFailLocked = value;
|
||||
}
|
||||
public get ipSingleSwitchStusNormal(): boolean {
|
||||
return this.states.ipSingleSwitchStusNormal ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusNormal(value: boolean) {
|
||||
this.states.ipSingleSwitchStusNormal = value;
|
||||
}
|
||||
public get ipSingleSwitchStusReverse(): boolean {
|
||||
return this.states.ipSingleSwitchStusReverse ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusReverse(value: boolean) {
|
||||
this.states.ipSingleSwitchStusReverse = value;
|
||||
}
|
||||
public get ipSingleSwitchStusBlocked1(): boolean {
|
||||
return this.states.ipSingleSwitchStusBlocked1 ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusBlocked1(value: boolean) {
|
||||
this.states.ipSingleSwitchStusBlocked1 = value;
|
||||
}
|
||||
public get ipSingleSwitchStusJammed(): boolean {
|
||||
return this.states.ipSingleSwitchStusJammed ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusJammed(value: boolean) {
|
||||
this.states.ipSingleSwitchStusJammed = value;
|
||||
}
|
||||
public get ipSingleSwitchStusCut(): boolean {
|
||||
return this.states.ipSingleSwitchStusCut ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusCut(value: boolean) {
|
||||
this.states.ipSingleSwitchStusCut = value;
|
||||
}
|
||||
public get ipSingleSwitchStusAtcInvalid(): boolean {
|
||||
return this.states.ipSingleSwitchStusAtcInvalid ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusAtcInvalid(value: boolean) {
|
||||
this.states.ipSingleSwitchStusAtcInvalid = value;
|
||||
}
|
||||
public get ipSingleSwitchStusOverlap(): boolean {
|
||||
return this.states.ipSingleSwitchStusOverlap ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusOverlap(value: boolean) {
|
||||
this.states.ipSingleSwitchStusOverlap = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrCbtcMain(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrCbtcMain ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrCbtcMain(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrCbtcMain = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrCbtcNormal(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrCbtcNormal ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrCbtcNormal(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrCbtcNormal = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrCbtcReverse(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrCbtcReverse ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrCbtcReverse(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrCbtcReverse = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrBmMain(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrBmMain ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrBmMain(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrBmMain = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrBmNormal(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrBmNormal ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrBmNormal(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrBmNormal = value;
|
||||
}
|
||||
public get ipSingleSwitchStusTsrBmReverse(): boolean {
|
||||
return this.states.ipSingleSwitchStusTsrBmReverse ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusTsrBmReverse(value: boolean) {
|
||||
this.states.ipSingleSwitchStusTsrBmReverse = value;
|
||||
}
|
||||
public get ipSingleSwitchStusBlocked2(): boolean {
|
||||
return this.states.ipSingleSwitchStusBlocked2 ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusBlocked2(value: boolean) {
|
||||
this.states.ipSingleSwitchStusBlocked2 = value;
|
||||
}
|
||||
public get ipSingleSwitchStusLostIndication(): boolean {
|
||||
return this.states.ipSingleSwitchStusLostIndication ?? false;
|
||||
}
|
||||
public set ipSingleSwitchStusLostIndication(value: boolean) {
|
||||
this.states.ipSingleSwitchStusLostIndication = value;
|
||||
}
|
||||
id?: string;
|
||||
speedLimit?: number;
|
||||
get states(): state.Switch {
|
||||
@ -137,10 +455,10 @@ export class TurnoutStates extends GraphicStateBase implements ITurnoutState {
|
||||
clone(): TurnoutStates {
|
||||
return new TurnoutStates(this.states.cloneMessage());
|
||||
}
|
||||
copyFrom(data: GraphicStateBase): void {
|
||||
copyFrom(data: TurnoutStates): void {
|
||||
pb_1.Message.copyInto(data._state, this._state);
|
||||
}
|
||||
eq(data: GraphicStateBase): boolean {
|
||||
eq(data: TurnoutStates): boolean {
|
||||
return pb_1.Message.equals(this._state, data._state);
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,12 @@ import {
|
||||
StationState,
|
||||
} from './graphics/StationInteraction';
|
||||
import { Station, StationTemplate } from 'src/graphics/station/Station';
|
||||
import { TurnoutData, TurnoutStates } from './graphics/TurnoutInteraction';
|
||||
import { TurnoutTemplate } from 'src/graphics/turnout/Turnout';
|
||||
import {
|
||||
TurnoutData,
|
||||
TurnoutOperationPlugin,
|
||||
TurnoutStates,
|
||||
} from './graphics/TurnoutInteraction';
|
||||
import { Turnout, TurnoutTemplate } from 'src/graphics/turnout/Turnout';
|
||||
import { SectionData } from './graphics/SectionInteraction';
|
||||
import { SectionTemplate } from 'src/graphics/section/Section';
|
||||
import { getPublishMapInfoByLineId } from 'src/api/PublishApi';
|
||||
@ -59,7 +63,10 @@ let msgBroker: AppWsMsgBroker | null = null;
|
||||
|
||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||
import { LogicSectionTemplate } from 'src/graphics/logicSection/LogicSection';
|
||||
import {
|
||||
LogicSection,
|
||||
LogicSectionTemplate,
|
||||
} from 'src/graphics/logicSection/LogicSection';
|
||||
import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
||||
|
||||
// const QuickJumpMenu = new ContextMenu({
|
||||
@ -113,6 +120,8 @@ export function initLineApp(dom: HTMLElement): GraphicApp {
|
||||
Platform.Type,
|
||||
Station.Type,
|
||||
Train.Type,
|
||||
LogicSection.Type,
|
||||
Turnout.Type,
|
||||
],
|
||||
},
|
||||
});
|
||||
@ -120,6 +129,7 @@ export function initLineApp(dom: HTMLElement): GraphicApp {
|
||||
PlatformOperateInteraction.init(lineApp);
|
||||
StationOperateInteraction.init(lineApp);
|
||||
TrainOperateInteraction.init(lineApp);
|
||||
TurnoutOperationPlugin.init(lineApp);
|
||||
return lineApp;
|
||||
}
|
||||
|
||||
@ -230,6 +240,9 @@ export async function loadLineDatas(app: GraphicApp) {
|
||||
storage.rtu.forEach((item) => {
|
||||
states.push(new StationState(item));
|
||||
});
|
||||
storage.switch.forEach((item) => {
|
||||
states.push(new TurnoutStates(item));
|
||||
});
|
||||
return states;
|
||||
},
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Graphics, IPoint, IPointData, Point } from 'pixi.js';
|
||||
import {
|
||||
GraphicAnimation,
|
||||
GraphicData,
|
||||
GraphicRelationParam,
|
||||
GraphicState,
|
||||
@ -53,6 +54,7 @@ const TurnoutLabelColor = {
|
||||
GREEN: '#0f0',
|
||||
YELLOW: '#ff0',
|
||||
RED: '#f00',
|
||||
WHITE: '#fff',
|
||||
};
|
||||
|
||||
export enum TurnoutPosition {
|
||||
@ -133,29 +135,88 @@ export class TurnoutSection extends Graphics {
|
||||
|
||||
class ForkGraphic extends Graphics {
|
||||
turnout: Turnout;
|
||||
dt = 0;
|
||||
lostIndicationSquare: Graphics = new Graphics();
|
||||
constructor(turnout: Turnout) {
|
||||
super();
|
||||
this.turnout = turnout;
|
||||
this.addChild(this.lostIndicationSquare);
|
||||
}
|
||||
|
||||
paint() {
|
||||
this.clear()
|
||||
.lineStyle(TurnoutConsts.lineWidth, TurnoutConsts.lineColor)
|
||||
.moveTo(0, 0);
|
||||
// if (this.turnout.states.ipSingleSwitchStusJammed) {
|
||||
// this.lineStyle(TurnoutConsts.lineWidth);
|
||||
// }
|
||||
let p: IPointData;
|
||||
this.clear();
|
||||
this.lostIndicationSquare.clear();
|
||||
if (this.turnout.states.ipSingleSwitchStusLostIndication) {
|
||||
let x: number, y: number;
|
||||
const w = 24,
|
||||
h = 24;
|
||||
if (this.turnout.datas.pointA[0].x > this.turnout.datas.pointB[0].x) {
|
||||
x = -22;
|
||||
} else {
|
||||
x = -2;
|
||||
}
|
||||
if (this.turnout.datas.pointC[0].y > 0) {
|
||||
y = -2;
|
||||
} else {
|
||||
y = -20;
|
||||
}
|
||||
this.lostIndicationSquare.lineStyle(2, '#f00').drawRect(x, y, w, h);
|
||||
const flashAnimation = this.bindFlashAnimation(this.lostIndicationSquare);
|
||||
flashAnimation.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.turnout.states.ipSingleSwitchStusNormal) {
|
||||
p = this.turnout.datas.pointB[0];
|
||||
this.paintForkLine('B');
|
||||
this.turnout.removeAllAnimation();
|
||||
} else if (this.turnout.states.ipSingleSwitchStusReverse) {
|
||||
p = this.turnout.datas.pointC[0];
|
||||
} else return;
|
||||
const target = getForkPoint(
|
||||
this.paintForkLine('C');
|
||||
this.turnout.removeAllAnimation();
|
||||
} else {
|
||||
this.paintForkLine('BOTH');
|
||||
const flashAnimation = this.bindFlashAnimation(this);
|
||||
flashAnimation.resume();
|
||||
}
|
||||
}
|
||||
|
||||
paintForkLine(position: 'B' | 'C' | 'BOTH') {
|
||||
this.clear().lineStyle(TurnoutConsts.lineWidth, TurnoutConsts.lineColor);
|
||||
|
||||
const targetB = getForkPoint(
|
||||
TurnoutConsts.forkLenth,
|
||||
getForkPoint(TurnoutConsts.forkLenth, p)
|
||||
this.turnout.datas.pointB[0]
|
||||
);
|
||||
this.lineTo(target.x, target.y);
|
||||
const targetC = getForkPoint(
|
||||
TurnoutConsts.forkLenth,
|
||||
this.turnout.datas.pointC[0]
|
||||
);
|
||||
if (position === 'B') {
|
||||
this.moveTo(0, 0).lineTo(targetB.x, targetB.y);
|
||||
} else if (position === 'C') {
|
||||
console.log('reverse paint');
|
||||
this.moveTo(0, 0).lineTo(targetC.x, targetC.y);
|
||||
} else if (position === 'BOTH') {
|
||||
this.moveTo(targetB.x, targetB.y)
|
||||
.lineTo(0, 0)
|
||||
.lineTo(targetC.x, targetC.y);
|
||||
}
|
||||
}
|
||||
|
||||
bindFlashAnimation(g: Graphics) {
|
||||
const flashAnimation = GraphicAnimation.init({
|
||||
name: 'lostIndicationFlash',
|
||||
run: (dt: number) => {
|
||||
this.dt += dt;
|
||||
if (this.dt > 60) {
|
||||
this.dt = 0;
|
||||
g.visible = true;
|
||||
} else if (this.dt > 30) {
|
||||
g.visible = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
this.turnout.addAnimation(flashAnimation);
|
||||
return flashAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,6 +226,7 @@ export class Turnout extends JlGraphic {
|
||||
fork: ForkGraphic;
|
||||
sections: [TurnoutSection, TurnoutSection, TurnoutSection];
|
||||
label: VectorText;
|
||||
labelRect: Graphics;
|
||||
};
|
||||
|
||||
constructor() {
|
||||
@ -178,11 +240,12 @@ export class Turnout extends JlGraphic {
|
||||
new TurnoutSection(this, TurnoutPort.C),
|
||||
],
|
||||
label: new VectorText(),
|
||||
labelRect: new Graphics(),
|
||||
};
|
||||
this.addChild(this.graphics.fork);
|
||||
this.addChild(this.graphics.sections[0]);
|
||||
this.addChild(this.graphics.sections[1]);
|
||||
this.addChild(this.graphics.sections[2]);
|
||||
this.addChild(this.graphics.fork);
|
||||
this.graphics.label.anchor.set(0.5);
|
||||
this.graphics.label.style.fill = '#0f0';
|
||||
this.graphics.label.setVectorFontSize(TurnoutConsts.labelFontSize);
|
||||
@ -192,6 +255,14 @@ export class Turnout extends JlGraphic {
|
||||
this.addChild(this.graphics.label);
|
||||
}
|
||||
|
||||
get code(): string {
|
||||
return this.datas.code;
|
||||
}
|
||||
|
||||
set code(code: string) {
|
||||
this.datas.code = code;
|
||||
}
|
||||
|
||||
get datas(): ITurnoutData {
|
||||
return this.getDatas<ITurnoutData>();
|
||||
}
|
||||
@ -205,17 +276,27 @@ export class Turnout extends JlGraphic {
|
||||
}
|
||||
|
||||
doRepaint(): void {
|
||||
this.graphics.fork.paint();
|
||||
|
||||
this.graphics.sections.forEach((sectionGraphic) => sectionGraphic.paint());
|
||||
|
||||
this.graphics.fork.paint();
|
||||
|
||||
this.graphics.label.text = this.datas.code;
|
||||
if (this.states.ipSingleSwitchStusJammed) {
|
||||
if (
|
||||
this.states.ipSingleSwitchStusJammed ||
|
||||
this.states.ipSingleSwitchStusBlocked1
|
||||
) {
|
||||
this.graphics.label.style.fill = TurnoutLabelColor.RED;
|
||||
} else if (this.states.ipSingleSwitchStusNormal) {
|
||||
this.graphics.label.style.fill = TurnoutLabelColor.GREEN;
|
||||
} else if (this.states.ipSingleSwitchStusReverse) {
|
||||
this.graphics.label.style.fill = TurnoutLabelColor.YELLOW;
|
||||
} else if (this.states.ipSingleSwitchStusLostIndication) {
|
||||
this.graphics.label.style.fill = TurnoutLabelColor.WHITE;
|
||||
}
|
||||
if (this.states.ipSingleSwitchStusBlocked2) {
|
||||
this.graphics.labelRect.clear().lineStyle(1, '#f00');
|
||||
const { x, y, width, height } = this.graphics.label.getLocalBounds();
|
||||
this.graphics.labelRect.drawRect(x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,34 +69,7 @@ export class TurnoutDraw extends GraphicDrawAssistant<
|
||||
}
|
||||
}
|
||||
|
||||
export class TurnoutHitArea implements IHitArea {
|
||||
turnout: Turnout;
|
||||
constructor(turnout: Turnout) {
|
||||
this.turnout = turnout;
|
||||
}
|
||||
contains(x: number, y: number): boolean {
|
||||
const { pointA, pointB, pointC } = this.turnout.datas;
|
||||
return (
|
||||
polylinePoint(
|
||||
[...pointA, { x: 0, y: 0 }],
|
||||
{ x, y },
|
||||
TurnoutConsts.lineWidth
|
||||
) ||
|
||||
polylinePoint(
|
||||
[...pointB, { x: 0, y: 0 }],
|
||||
{ x, y },
|
||||
TurnoutConsts.lineWidth
|
||||
) ||
|
||||
polylinePoint(
|
||||
[...pointC, { x: 0, y: 0 }],
|
||||
{ x, y },
|
||||
TurnoutConsts.lineWidth
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ForkHitArea implements IHitArea {
|
||||
export class ForkHitArea implements IHitArea {
|
||||
turnout: Turnout;
|
||||
constructor(turnout: Turnout) {
|
||||
this.turnout = turnout;
|
||||
@ -128,7 +101,7 @@ class ForkHitArea implements IHitArea {
|
||||
}
|
||||
}
|
||||
|
||||
class TurnoutSectionHitArea implements IHitArea {
|
||||
export class TurnoutSectionHitArea implements IHitArea {
|
||||
section: TurnoutSection;
|
||||
constructor(section: TurnoutSection) {
|
||||
this.section = section;
|
||||
|
25
src/protos/alertConst.ts
Normal file
25
src/protos/alertConst.ts
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Generated by the protoc-gen-ts. DO NOT EDIT!
|
||||
* compiler version: 4.23.1
|
||||
* source: alertConst.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace alert {
|
||||
export enum AlertLocation {
|
||||
ALERT_LOCATION_UNKNOWN = 0,
|
||||
QX = 1,
|
||||
YHZ_LSQ = 2,
|
||||
HJM_LSQ = 3,
|
||||
BCT_LSQ = 4,
|
||||
BSQ_LSQ = 5
|
||||
}
|
||||
export enum AlertType {
|
||||
ALERT_TYPE_UNKNOWN = 0,
|
||||
BLUE_DISPLAY = 1,
|
||||
TRAIN_DELAY_2 = 2,
|
||||
TRAIN_DELAY_10 = 3,
|
||||
PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL = 4,
|
||||
PLATFORM_DOOR_CANNOT_OPEN = 5,
|
||||
PLATFORM_DOOR_CANNOT_CLOSE = 6
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
* compiler version: 4.23.1
|
||||
* source: alertInfo.proto
|
||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||
import * as dependency_1 from "./alertConst";
|
||||
import * as pb_1 from "google-protobuf";
|
||||
export namespace alert {
|
||||
export class NccAlertInfoMessage extends pb_1.Message {
|
||||
@ -79,10 +80,12 @@ export namespace alert {
|
||||
id?: string;
|
||||
level?: string;
|
||||
alert_time?: string;
|
||||
info?: string;
|
||||
alert_tip_id?: number;
|
||||
device_info?: string;
|
||||
reason?: string;
|
||||
line_id?: number;
|
||||
alert_object?: string;
|
||||
alert_type?: dependency_1.alert.AlertType;
|
||||
locator_device_id?: string;
|
||||
mock?: boolean;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -96,17 +99,23 @@ export namespace alert {
|
||||
if ("alert_time" in data && data.alert_time != undefined) {
|
||||
this.alert_time = data.alert_time;
|
||||
}
|
||||
if ("info" in data && data.info != undefined) {
|
||||
this.info = data.info;
|
||||
}
|
||||
if ("alert_tip_id" in data && data.alert_tip_id != undefined) {
|
||||
this.alert_tip_id = data.alert_tip_id;
|
||||
}
|
||||
if ("device_info" in data && data.device_info != undefined) {
|
||||
this.device_info = data.device_info;
|
||||
if ("line_id" in data && data.line_id != undefined) {
|
||||
this.line_id = data.line_id;
|
||||
}
|
||||
if ("reason" in data && data.reason != undefined) {
|
||||
this.reason = data.reason;
|
||||
if ("alert_object" in data && data.alert_object != undefined) {
|
||||
this.alert_object = data.alert_object;
|
||||
}
|
||||
if ("alert_type" in data && data.alert_type != undefined) {
|
||||
this.alert_type = data.alert_type;
|
||||
}
|
||||
if ("locator_device_id" in data && data.locator_device_id != undefined) {
|
||||
this.locator_device_id = data.locator_device_id;
|
||||
}
|
||||
if ("mock" in data && data.mock != undefined) {
|
||||
this.mock = data.mock;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,38 +137,52 @@ export namespace alert {
|
||||
set alert_time(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get info() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
||||
}
|
||||
set info(value: string) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get alert_tip_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, 0) as number;
|
||||
}
|
||||
set alert_tip_id(value: number) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get line_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
|
||||
}
|
||||
set line_id(value: number) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get device_info() {
|
||||
get alert_object() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
}
|
||||
set device_info(value: string) {
|
||||
set alert_object(value: string) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
}
|
||||
get reason() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
|
||||
get alert_type() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, dependency_1.alert.AlertType.ALERT_TYPE_UNKNOWN) as dependency_1.alert.AlertType;
|
||||
}
|
||||
set reason(value: string) {
|
||||
set alert_type(value: dependency_1.alert.AlertType) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
}
|
||||
get locator_device_id() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
|
||||
}
|
||||
set locator_device_id(value: string) {
|
||||
pb_1.Message.setField(this, 8, value);
|
||||
}
|
||||
get mock() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
|
||||
}
|
||||
set mock(value: boolean) {
|
||||
pb_1.Message.setField(this, 9, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
level?: string;
|
||||
alert_time?: string;
|
||||
info?: string;
|
||||
alert_tip_id?: number;
|
||||
device_info?: string;
|
||||
reason?: string;
|
||||
line_id?: number;
|
||||
alert_object?: string;
|
||||
alert_type?: dependency_1.alert.AlertType;
|
||||
locator_device_id?: string;
|
||||
mock?: boolean;
|
||||
}): Message {
|
||||
const message = new Message({});
|
||||
if (data.id != null) {
|
||||
@ -171,17 +194,23 @@ export namespace alert {
|
||||
if (data.alert_time != null) {
|
||||
message.alert_time = data.alert_time;
|
||||
}
|
||||
if (data.info != null) {
|
||||
message.info = data.info;
|
||||
}
|
||||
if (data.alert_tip_id != null) {
|
||||
message.alert_tip_id = data.alert_tip_id;
|
||||
}
|
||||
if (data.device_info != null) {
|
||||
message.device_info = data.device_info;
|
||||
if (data.line_id != null) {
|
||||
message.line_id = data.line_id;
|
||||
}
|
||||
if (data.reason != null) {
|
||||
message.reason = data.reason;
|
||||
if (data.alert_object != null) {
|
||||
message.alert_object = data.alert_object;
|
||||
}
|
||||
if (data.alert_type != null) {
|
||||
message.alert_type = data.alert_type;
|
||||
}
|
||||
if (data.locator_device_id != null) {
|
||||
message.locator_device_id = data.locator_device_id;
|
||||
}
|
||||
if (data.mock != null) {
|
||||
message.mock = data.mock;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -190,10 +219,12 @@ export namespace alert {
|
||||
id?: string;
|
||||
level?: string;
|
||||
alert_time?: string;
|
||||
info?: string;
|
||||
alert_tip_id?: number;
|
||||
device_info?: string;
|
||||
reason?: string;
|
||||
line_id?: number;
|
||||
alert_object?: string;
|
||||
alert_type?: dependency_1.alert.AlertType;
|
||||
locator_device_id?: string;
|
||||
mock?: boolean;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -204,17 +235,23 @@ export namespace alert {
|
||||
if (this.alert_time != null) {
|
||||
data.alert_time = this.alert_time;
|
||||
}
|
||||
if (this.info != null) {
|
||||
data.info = this.info;
|
||||
}
|
||||
if (this.alert_tip_id != null) {
|
||||
data.alert_tip_id = this.alert_tip_id;
|
||||
}
|
||||
if (this.device_info != null) {
|
||||
data.device_info = this.device_info;
|
||||
if (this.line_id != null) {
|
||||
data.line_id = this.line_id;
|
||||
}
|
||||
if (this.reason != null) {
|
||||
data.reason = this.reason;
|
||||
if (this.alert_object != null) {
|
||||
data.alert_object = this.alert_object;
|
||||
}
|
||||
if (this.alert_type != null) {
|
||||
data.alert_type = this.alert_type;
|
||||
}
|
||||
if (this.locator_device_id != null) {
|
||||
data.locator_device_id = this.locator_device_id;
|
||||
}
|
||||
if (this.mock != null) {
|
||||
data.mock = this.mock;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -228,14 +265,18 @@ export namespace alert {
|
||||
writer.writeString(2, this.level);
|
||||
if (this.alert_time.length)
|
||||
writer.writeString(3, this.alert_time);
|
||||
if (this.info.length)
|
||||
writer.writeString(4, this.info);
|
||||
if (this.alert_tip_id != 0)
|
||||
writer.writeInt32(5, this.alert_tip_id);
|
||||
if (this.device_info.length)
|
||||
writer.writeString(6, this.device_info);
|
||||
if (this.reason.length)
|
||||
writer.writeString(7, this.reason);
|
||||
writer.writeInt32(4, this.alert_tip_id);
|
||||
if (this.line_id != 0)
|
||||
writer.writeInt32(5, this.line_id);
|
||||
if (this.alert_object.length)
|
||||
writer.writeString(6, this.alert_object);
|
||||
if (this.alert_type != dependency_1.alert.AlertType.ALERT_TYPE_UNKNOWN)
|
||||
writer.writeEnum(7, this.alert_type);
|
||||
if (this.locator_device_id.length)
|
||||
writer.writeString(8, this.locator_device_id);
|
||||
if (this.mock != false)
|
||||
writer.writeBool(9, this.mock);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -255,16 +296,22 @@ export namespace alert {
|
||||
message.alert_time = reader.readString();
|
||||
break;
|
||||
case 4:
|
||||
message.info = reader.readString();
|
||||
break;
|
||||
case 5:
|
||||
message.alert_tip_id = reader.readInt32();
|
||||
break;
|
||||
case 5:
|
||||
message.line_id = reader.readInt32();
|
||||
break;
|
||||
case 6:
|
||||
message.device_info = reader.readString();
|
||||
message.alert_object = reader.readString();
|
||||
break;
|
||||
case 7:
|
||||
message.reason = reader.readString();
|
||||
message.alert_type = reader.readEnum();
|
||||
break;
|
||||
case 8:
|
||||
message.locator_device_id = reader.readString();
|
||||
break;
|
||||
case 9:
|
||||
message.mock = reader.readBool();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
|
@ -12,13 +12,12 @@ export namespace state {
|
||||
id?: string;
|
||||
code?: string;
|
||||
childrenId?: string[];
|
||||
kilometerSystem?: dependency_1.graphicData.KilometerSystem[];
|
||||
convertKilometer?: number[];
|
||||
physicalSectionId?: string;
|
||||
destinationCode?: string;
|
||||
kilometer?: DeviceKilometer;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
@ -29,18 +28,15 @@ export namespace state {
|
||||
if ("childrenId" in data && data.childrenId != undefined) {
|
||||
this.childrenId = data.childrenId;
|
||||
}
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
if ("convertKilometer" in data && data.convertKilometer != undefined) {
|
||||
this.convertKilometer = data.convertKilometer;
|
||||
}
|
||||
if ("physicalSectionId" in data && data.physicalSectionId != undefined) {
|
||||
this.physicalSectionId = data.physicalSectionId;
|
||||
}
|
||||
if ("destinationCode" in data && data.destinationCode != undefined) {
|
||||
this.destinationCode = data.destinationCode;
|
||||
}
|
||||
if ("kilometer" in data && data.kilometer != undefined) {
|
||||
this.kilometer = data.kilometer;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -61,38 +57,34 @@ export namespace state {
|
||||
set childrenId(value: string[]) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
get kilometerSystem() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.graphicData.KilometerSystem, 4) as dependency_1.graphicData.KilometerSystem[];
|
||||
}
|
||||
set kilometerSystem(value: dependency_1.graphicData.KilometerSystem[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 4, value);
|
||||
}
|
||||
get convertKilometer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, []) as number[];
|
||||
}
|
||||
set convertKilometer(value: number[]) {
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get physicalSectionId() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
|
||||
}
|
||||
set physicalSectionId(value: string) {
|
||||
pb_1.Message.setField(this, 6, value);
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
}
|
||||
get destinationCode() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 7, "") as string;
|
||||
return pb_1.Message.getFieldWithDefault(this, 5, "") as string;
|
||||
}
|
||||
set destinationCode(value: string) {
|
||||
pb_1.Message.setField(this, 7, value);
|
||||
pb_1.Message.setField(this, 5, value);
|
||||
}
|
||||
get kilometer() {
|
||||
return pb_1.Message.getWrapperField(this, DeviceKilometer, 6) as DeviceKilometer;
|
||||
}
|
||||
set kilometer(value: DeviceKilometer) {
|
||||
pb_1.Message.setWrapperField(this, 6, value);
|
||||
}
|
||||
get has_kilometer() {
|
||||
return pb_1.Message.getField(this, 6) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
code?: string;
|
||||
childrenId?: string[];
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
convertKilometer?: number[];
|
||||
physicalSectionId?: string;
|
||||
destinationCode?: string;
|
||||
kilometer?: ReturnType<typeof DeviceKilometer.prototype.toObject>;
|
||||
}): Section {
|
||||
const message = new Section({});
|
||||
if (data.id != null) {
|
||||
@ -104,18 +96,15 @@ export namespace state {
|
||||
if (data.childrenId != null) {
|
||||
message.childrenId = data.childrenId;
|
||||
}
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = data.kilometerSystem.map(item => dependency_1.graphicData.KilometerSystem.fromObject(item));
|
||||
}
|
||||
if (data.convertKilometer != null) {
|
||||
message.convertKilometer = data.convertKilometer;
|
||||
}
|
||||
if (data.physicalSectionId != null) {
|
||||
message.physicalSectionId = data.physicalSectionId;
|
||||
}
|
||||
if (data.destinationCode != null) {
|
||||
message.destinationCode = data.destinationCode;
|
||||
}
|
||||
if (data.kilometer != null) {
|
||||
message.kilometer = DeviceKilometer.fromObject(data.kilometer);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -123,10 +112,9 @@ export namespace state {
|
||||
id?: string;
|
||||
code?: string;
|
||||
childrenId?: string[];
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
convertKilometer?: number[];
|
||||
physicalSectionId?: string;
|
||||
destinationCode?: string;
|
||||
kilometer?: ReturnType<typeof DeviceKilometer.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -137,18 +125,15 @@ export namespace state {
|
||||
if (this.childrenId != null) {
|
||||
data.childrenId = this.childrenId;
|
||||
}
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.map((item: dependency_1.graphicData.KilometerSystem) => item.toObject());
|
||||
}
|
||||
if (this.convertKilometer != null) {
|
||||
data.convertKilometer = this.convertKilometer;
|
||||
}
|
||||
if (this.physicalSectionId != null) {
|
||||
data.physicalSectionId = this.physicalSectionId;
|
||||
}
|
||||
if (this.destinationCode != null) {
|
||||
data.destinationCode = this.destinationCode;
|
||||
}
|
||||
if (this.kilometer != null) {
|
||||
data.kilometer = this.kilometer.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -161,14 +146,12 @@ export namespace state {
|
||||
writer.writeString(2, this.code);
|
||||
if (this.childrenId.length)
|
||||
writer.writeRepeatedString(3, this.childrenId);
|
||||
if (this.kilometerSystem.length)
|
||||
writer.writeRepeatedMessage(4, this.kilometerSystem, (item: dependency_1.graphicData.KilometerSystem) => item.serialize(writer));
|
||||
if (this.convertKilometer.length)
|
||||
writer.writePackedInt64(5, this.convertKilometer);
|
||||
if (this.physicalSectionId.length)
|
||||
writer.writeString(6, this.physicalSectionId);
|
||||
writer.writeString(4, this.physicalSectionId);
|
||||
if (this.destinationCode.length)
|
||||
writer.writeString(7, this.destinationCode);
|
||||
writer.writeString(5, this.destinationCode);
|
||||
if (this.has_kilometer)
|
||||
writer.writeMessage(6, this.kilometer, () => this.kilometer.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -188,17 +171,14 @@ export namespace state {
|
||||
pb_1.Message.addToRepeatedField(message, 3, reader.readString());
|
||||
break;
|
||||
case 4:
|
||||
reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.graphicData.KilometerSystem.deserialize(reader), dependency_1.graphicData.KilometerSystem));
|
||||
break;
|
||||
case 5:
|
||||
message.convertKilometer = reader.readPackedInt64();
|
||||
break;
|
||||
case 6:
|
||||
message.physicalSectionId = reader.readString();
|
||||
break;
|
||||
case 7:
|
||||
case 5:
|
||||
message.destinationCode = reader.readString();
|
||||
break;
|
||||
case 6:
|
||||
reader.readMessage(message.kilometer, () => message.kilometer = DeviceKilometer.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -216,11 +196,10 @@ export namespace state {
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
code?: string;
|
||||
kilometerSystem?: dependency_1.graphicData.KilometerSystem[];
|
||||
convertKilometer?: number[];
|
||||
kilometer?: DeviceKilometer;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
@ -228,11 +207,8 @@ export namespace state {
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
if ("convertKilometer" in data && data.convertKilometer != undefined) {
|
||||
this.convertKilometer = data.convertKilometer;
|
||||
if ("kilometer" in data && data.kilometer != undefined) {
|
||||
this.kilometer = data.kilometer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,23 +224,19 @@ export namespace state {
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get kilometerSystem() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.graphicData.KilometerSystem, 3) as dependency_1.graphicData.KilometerSystem[];
|
||||
get kilometer() {
|
||||
return pb_1.Message.getWrapperField(this, DeviceKilometer, 3) as DeviceKilometer;
|
||||
}
|
||||
set kilometerSystem(value: dependency_1.graphicData.KilometerSystem[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
set kilometer(value: DeviceKilometer) {
|
||||
pb_1.Message.setWrapperField(this, 3, value);
|
||||
}
|
||||
get convertKilometer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 4, []) as number[];
|
||||
}
|
||||
set convertKilometer(value: number[]) {
|
||||
pb_1.Message.setField(this, 4, value);
|
||||
get has_kilometer() {
|
||||
return pb_1.Message.getField(this, 3) != null;
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
code?: string;
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
convertKilometer?: number[];
|
||||
kilometer?: ReturnType<typeof DeviceKilometer.prototype.toObject>;
|
||||
}): Turnout {
|
||||
const message = new Turnout({});
|
||||
if (data.id != null) {
|
||||
@ -273,11 +245,8 @@ export namespace state {
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = data.kilometerSystem.map(item => dependency_1.graphicData.KilometerSystem.fromObject(item));
|
||||
}
|
||||
if (data.convertKilometer != null) {
|
||||
message.convertKilometer = data.convertKilometer;
|
||||
if (data.kilometer != null) {
|
||||
message.kilometer = DeviceKilometer.fromObject(data.kilometer);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -285,8 +254,7 @@ export namespace state {
|
||||
const data: {
|
||||
id?: string;
|
||||
code?: string;
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
convertKilometer?: number[];
|
||||
kilometer?: ReturnType<typeof DeviceKilometer.prototype.toObject>;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -294,11 +262,8 @@ export namespace state {
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.map((item: dependency_1.graphicData.KilometerSystem) => item.toObject());
|
||||
}
|
||||
if (this.convertKilometer != null) {
|
||||
data.convertKilometer = this.convertKilometer;
|
||||
if (this.kilometer != null) {
|
||||
data.kilometer = this.kilometer.toObject();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -310,10 +275,8 @@ export namespace state {
|
||||
writer.writeString(1, this.id);
|
||||
if (this.code.length)
|
||||
writer.writeString(2, this.code);
|
||||
if (this.kilometerSystem.length)
|
||||
writer.writeRepeatedMessage(3, this.kilometerSystem, (item: dependency_1.graphicData.KilometerSystem) => item.serialize(writer));
|
||||
if (this.convertKilometer.length)
|
||||
writer.writePackedInt64(4, this.convertKilometer);
|
||||
if (this.has_kilometer)
|
||||
writer.writeMessage(3, this.kilometer, () => this.kilometer.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -330,10 +293,7 @@ export namespace state {
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.graphicData.KilometerSystem.deserialize(reader), dependency_1.graphicData.KilometerSystem));
|
||||
break;
|
||||
case 4:
|
||||
message.convertKilometer = reader.readPackedInt64();
|
||||
reader.readMessage(message.kilometer, () => message.kilometer = DeviceKilometer.deserialize(reader));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
@ -347,4 +307,117 @@ export namespace state {
|
||||
return Turnout.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class DeviceKilometer extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
minKilometer?: number;
|
||||
maxKilometer?: number;
|
||||
kilometerSystem?: dependency_1.graphicData.KilometerSystem[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("minKilometer" in data && data.minKilometer != undefined) {
|
||||
this.minKilometer = data.minKilometer;
|
||||
}
|
||||
if ("maxKilometer" in data && data.maxKilometer != undefined) {
|
||||
this.maxKilometer = data.maxKilometer;
|
||||
}
|
||||
if ("kilometerSystem" in data && data.kilometerSystem != undefined) {
|
||||
this.kilometerSystem = data.kilometerSystem;
|
||||
}
|
||||
}
|
||||
}
|
||||
get minKilometer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
|
||||
}
|
||||
set minKilometer(value: number) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get maxKilometer() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
|
||||
}
|
||||
set maxKilometer(value: number) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get kilometerSystem() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, dependency_1.graphicData.KilometerSystem, 3) as dependency_1.graphicData.KilometerSystem[];
|
||||
}
|
||||
set kilometerSystem(value: dependency_1.graphicData.KilometerSystem[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
minKilometer?: number;
|
||||
maxKilometer?: number;
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
}): DeviceKilometer {
|
||||
const message = new DeviceKilometer({});
|
||||
if (data.minKilometer != null) {
|
||||
message.minKilometer = data.minKilometer;
|
||||
}
|
||||
if (data.maxKilometer != null) {
|
||||
message.maxKilometer = data.maxKilometer;
|
||||
}
|
||||
if (data.kilometerSystem != null) {
|
||||
message.kilometerSystem = data.kilometerSystem.map(item => dependency_1.graphicData.KilometerSystem.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
minKilometer?: number;
|
||||
maxKilometer?: number;
|
||||
kilometerSystem?: ReturnType<typeof dependency_1.graphicData.KilometerSystem.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.minKilometer != null) {
|
||||
data.minKilometer = this.minKilometer;
|
||||
}
|
||||
if (this.maxKilometer != null) {
|
||||
data.maxKilometer = this.maxKilometer;
|
||||
}
|
||||
if (this.kilometerSystem != null) {
|
||||
data.kilometerSystem = this.kilometerSystem.map((item: dependency_1.graphicData.KilometerSystem) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
serialize(w: pb_1.BinaryWriter): void;
|
||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.minKilometer != 0)
|
||||
writer.writeInt64(1, this.minKilometer);
|
||||
if (this.maxKilometer != 0)
|
||||
writer.writeInt64(2, this.maxKilometer);
|
||||
if (this.kilometerSystem.length)
|
||||
writer.writeRepeatedMessage(3, this.kilometerSystem, (item: dependency_1.graphicData.KilometerSystem) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DeviceKilometer {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DeviceKilometer();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
message.minKilometer = reader.readInt64();
|
||||
break;
|
||||
case 2:
|
||||
message.maxKilometer = reader.readInt64();
|
||||
break;
|
||||
case 3:
|
||||
reader.readMessage(message.kilometerSystem, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.graphicData.KilometerSystem.deserialize(reader), dependency_1.graphicData.KilometerSystem));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): DeviceKilometer {
|
||||
return DeviceKilometer.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4f27cc3670bcb4071706bb0e66d6fdfd817e27a4
|
||||
Subproject commit ec5889fd030d15bc93efdaf8f73d62039bde31a9
|
Loading…
Reference in New Issue
Block a user