Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
daab07ed90
@ -11,6 +11,8 @@ import { TextContent } from 'src/graphics/textContent/TextContent';
|
||||
import IbpTextProperty from './properties/IbpTextProperty.vue';
|
||||
import { Arrow } from 'src/graphics/arrow/Arrow';
|
||||
import IbpArrowProperty from './properties/IbpArrowPropery.vue';
|
||||
import IbpLightProperty from './properties/IbpLightProperty.vue';
|
||||
import { IbpLight } from 'src/graphics/ibpLight/IbpLight';
|
||||
|
||||
const ibpDrawStore = useIBPDrawStore();
|
||||
</script>
|
||||
@ -44,6 +46,9 @@ const ibpDrawStore = useIBPDrawStore();
|
||||
<ibp-text-property
|
||||
v-else-if="ibpDrawStore.selectedGraphicType === TextContent.Type"
|
||||
/>
|
||||
<IbpLightProperty
|
||||
v-else-if="ibpDrawStore.selectedGraphicType === IbpLight.Type"
|
||||
/>
|
||||
</QCardSection>
|
||||
</template>
|
||||
</QCard>
|
||||
|
50
src/components/draw-app/properties/IbpLightProperty.vue
Normal file
50
src/components/draw-app/properties/IbpLightProperty.vue
Normal file
@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
||||
import { IbpLightData } from 'src/drawApp/graphics/IbpLightInteraction';
|
||||
import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
import { useIBPDrawStore } from 'src/stores/ibp-draw-store';
|
||||
|
||||
const { data: ibpLightModel, onUpdate } = useFormData(
|
||||
new IbpLightData(),
|
||||
useIBPDrawStore().getDrawApp()
|
||||
);
|
||||
|
||||
const { IbpLightColor } = ibpGraphicData.IbpLight;
|
||||
const colorOptions = [
|
||||
{ label: '白色', value: IbpLightColor.white },
|
||||
{ label: '红色', value: IbpLightColor.red },
|
||||
{ label: '蓝色', value: IbpLightColor.blue },
|
||||
{ label: '绿色', value: IbpLightColor.green },
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Qform>
|
||||
<QInput
|
||||
outlined
|
||||
readonly
|
||||
v-model="ibpLightModel.id"
|
||||
label="id"
|
||||
@blur="onUpdate"
|
||||
/>
|
||||
<QInput
|
||||
class="q-mt-sm"
|
||||
outlined
|
||||
v-model="ibpLightModel.code"
|
||||
@blur="onUpdate"
|
||||
label="名称"
|
||||
/>
|
||||
<QSelect
|
||||
class="q-mt-sm"
|
||||
emitValue
|
||||
mapOptions
|
||||
outlined
|
||||
v-model="ibpLightModel.color"
|
||||
label="颜色"
|
||||
:options="colorOptions"
|
||||
@popupHide="onUpdate"
|
||||
/>
|
||||
</Qform>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
@ -118,7 +118,7 @@ const list2: DynamicKeyType[] = [
|
||||
{ label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat },
|
||||
{ label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat },
|
||||
{ label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat },
|
||||
{ label: '加速', key: 'acceleration', formatFn: accelerationFormat },
|
||||
{ label: '加速度', key: 'acceleration', formatFn: accelerationFormat },
|
||||
];
|
||||
const list3: VobcStateType[] = [
|
||||
// 动力学信息
|
||||
@ -192,7 +192,7 @@ function slopeFormat(v: number) {
|
||||
}
|
||||
function resistanceFormat(v: number) {
|
||||
const n = floatDecimal(v);
|
||||
return `${n} KN`;
|
||||
return `${n} kn`;
|
||||
}
|
||||
function speedFormat(v: number) {
|
||||
let n: string | number = '';
|
||||
@ -218,7 +218,7 @@ function floatDecimal(v: number, x = 2) {
|
||||
|
||||
function tractionForceFormat(v: number) {
|
||||
const n = floatDecimal(v / 100);
|
||||
return `${n} KN`;
|
||||
return `${n} kn`;
|
||||
}
|
||||
function trainLoadFormat(v: number) {
|
||||
const n = floatDecimal(v / 100);
|
||||
|
@ -59,6 +59,37 @@ function getDataList() {
|
||||
});
|
||||
}
|
||||
|
||||
let series = [
|
||||
{
|
||||
name: '速度',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: speedList,
|
||||
unit: 'km/h',
|
||||
},
|
||||
{
|
||||
name: '加速度',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: accelerationList,
|
||||
unit: 'm/s',
|
||||
},
|
||||
{
|
||||
name: '牵引力',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: tractionForceList,
|
||||
unit: 'kn',
|
||||
},
|
||||
{
|
||||
name: '制动力',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: brakeForceList,
|
||||
unit: 'kn',
|
||||
},
|
||||
];
|
||||
|
||||
let myChart: echarts.EChartsType;
|
||||
function initEcharts() {
|
||||
const dom = document.getElementById('train-echarts');
|
||||
@ -73,7 +104,53 @@ function initEcharts() {
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
valueFormatter: (value: number) => value.toFixed(2),
|
||||
formatter: function (params: any) {
|
||||
let title = params[0].axisValueLabel;
|
||||
let result = `<div
|
||||
style="height:100%;
|
||||
min-height:${30 + 28 * params.length}px;
|
||||
width: 200px;
|
||||
background: rgba(255, 255, 255, 0.27);
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="width: 100%;
|
||||
height: 30px;
|
||||
padding-left:10px;
|
||||
font-size: 14px;
|
||||
line-height: 30px;
|
||||
"
|
||||
>
|
||||
${title}
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
height: 100%;
|
||||
padding-left:10px;
|
||||
width: 100%;
|
||||
border-radius: 3px;
|
||||
"
|
||||
>
|
||||
`;
|
||||
params.forEach((item: any, index: number) => {
|
||||
result +=
|
||||
"<div style='height: 28px;line-height:28px'>" +
|
||||
'<span style="display:inline-block;margin-right:5px;border-radius:20px;width:10px;height:10px;background-color:' +
|
||||
item.color +
|
||||
'"></span>' +
|
||||
item.seriesName +
|
||||
' : ' +
|
||||
'<span style="float:right;margin-left:20px;font-size:14px;color:#666;font-weight:bold">' +
|
||||
item.value[1].toFixed(2) +
|
||||
' ' +
|
||||
series[index].unit +
|
||||
'</span>' +
|
||||
'<div style="clear:both"></div>' +
|
||||
'</div>';
|
||||
});
|
||||
result += '</div>';
|
||||
return result;
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: ['速度', '加速度', '牵引力', '制动力'],
|
||||
@ -90,32 +167,7 @@ function initEcharts() {
|
||||
type: 'value',
|
||||
boundaryGap: [0, '100%'],
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '速度',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: speedList,
|
||||
},
|
||||
{
|
||||
name: '加速度',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: accelerationList,
|
||||
},
|
||||
{
|
||||
name: '牵引力',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: tractionForceList,
|
||||
},
|
||||
{
|
||||
name: '制动力',
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
data: brakeForceList,
|
||||
},
|
||||
],
|
||||
series: series,
|
||||
};
|
||||
|
||||
myChart.setOption(option);
|
||||
|
42
src/drawApp/graphics/IbpLightInteraction.ts
Normal file
42
src/drawApp/graphics/IbpLightInteraction.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import * as pb_1 from 'google-protobuf';
|
||||
import { IIbpLightData, IbpLight } from 'src/graphics/ibpLight/IbpLight';
|
||||
import { GraphicDataBase } from './GraphicDataBase';
|
||||
import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
|
||||
export class IbpLightData extends GraphicDataBase implements IIbpLightData {
|
||||
constructor(data?: ibpGraphicData.IbpLight) {
|
||||
let ibpLight;
|
||||
if (data) {
|
||||
ibpLight = data;
|
||||
} else {
|
||||
ibpLight = new ibpGraphicData.IbpLight({
|
||||
common: GraphicDataBase.defaultCommonInfo(IbpLight.Type),
|
||||
});
|
||||
}
|
||||
super(ibpLight);
|
||||
}
|
||||
get data(): ibpGraphicData.IbpLight {
|
||||
return this.getData<ibpGraphicData.IbpLight>();
|
||||
}
|
||||
get code(): string {
|
||||
return this.data.code;
|
||||
}
|
||||
set code(v: string) {
|
||||
this.data.code = v;
|
||||
}
|
||||
get color(): ibpGraphicData.IbpLight.IbpLightColor {
|
||||
return this.data.color;
|
||||
}
|
||||
set color(v: ibpGraphicData.IbpLight.IbpLightColor) {
|
||||
this.data.color = v;
|
||||
}
|
||||
clone(): IbpLightData {
|
||||
return new IbpLightData(this.data.cloneMessage());
|
||||
}
|
||||
copyFrom(data: IbpLightData): void {
|
||||
pb_1.Message.copyInto(data.data, this.data);
|
||||
}
|
||||
eq(other: IbpLightData): boolean {
|
||||
return pb_1.Message.equals(this.data, other.data);
|
||||
}
|
||||
}
|
@ -32,6 +32,9 @@ import { TextContentDraw } from 'src/graphics/textContent/TextContentDrawAssista
|
||||
import { IbpTextData } from './graphics/IbpTextInteraction';
|
||||
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
|
||||
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
|
||||
import { IbpLightDraw } from 'src/graphics/ibpLight/IbpLightDrawAssistant';
|
||||
import { IbpLightTempalte } from 'src/graphics/ibpLight/IbpLight';
|
||||
import { IbpLightData } from './graphics/IbpLightInteraction';
|
||||
|
||||
let drawApp: IDrawApp | null = null;
|
||||
const UndoOptions: MenuItemOptions = {
|
||||
@ -73,6 +76,7 @@ export function initIBPDrawApp() {
|
||||
new IbpAlarmDraw(drawApp, new IbpAlarmTemplate(new IbpAlarmData()));
|
||||
new IbpKeyDraw(drawApp, new IbpKeyTemplate(new IbpKeyData()));
|
||||
new ArrowDraw(drawApp, new ArrowTemplate(new ArrowData()));
|
||||
new IbpLightDraw(drawApp, new IbpLightTempalte(new IbpLightData()));
|
||||
new TextContentDraw(drawApp, new TextContentTemplate(new IbpTextData()));
|
||||
// 画布右键菜单
|
||||
drawApp.registerMenu(DefaultCanvasMenu);
|
||||
@ -142,6 +146,8 @@ export function saveIBPDrawDatas(app: IDrawApp) {
|
||||
storage.ibpArrows.push(g.saveData<ArrowData>().data);
|
||||
} else if (g instanceof TextContent) {
|
||||
storage.IBPTexts.push(g.saveData<IbpTextData>().data);
|
||||
} else {
|
||||
storage.ibpLights.push(g.saveData<IbpLightData>().data);
|
||||
}
|
||||
});
|
||||
const base64 = fromUint8Array(storage.serialize());
|
||||
@ -175,6 +181,9 @@ async function IBPDrawDataLoader() {
|
||||
storage.IBPTexts.forEach((ibpText) => {
|
||||
datas.push(new IbpTextData(ibpText));
|
||||
});
|
||||
storage.ibpLights.forEach((ibpLight) => {
|
||||
datas.push(new IbpLightData(ibpLight));
|
||||
});
|
||||
return {
|
||||
canvasProperty: storage.canvas,
|
||||
datas: datas,
|
||||
|
54
src/graphics/ibpLight/IbpLight.ts
Normal file
54
src/graphics/ibpLight/IbpLight.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { Graphics } from 'pixi.js';
|
||||
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'src/jl-graphic';
|
||||
import { ibpGraphicData } from 'src/protos/ibpGraphics';
|
||||
|
||||
export interface IIbpLightData extends GraphicData {
|
||||
get code(): string;
|
||||
set code(v: string);
|
||||
get color(): ibpGraphicData.IbpLight.IbpLightColor;
|
||||
set color(v: ibpGraphicData.IbpLight.IbpLightColor);
|
||||
}
|
||||
|
||||
const ibpLightColorMap = {
|
||||
[ibpGraphicData.IbpLight.IbpLightColor.white]: 0xffffff,
|
||||
[ibpGraphicData.IbpLight.IbpLightColor.red]: 0xff0000,
|
||||
[ibpGraphicData.IbpLight.IbpLightColor.green]: 0x00ff00,
|
||||
[ibpGraphicData.IbpLight.IbpLightColor.blue]: 0x0000ff,
|
||||
};
|
||||
|
||||
const ibpLightConsts = {
|
||||
radius: 20,
|
||||
offAlpha: 0.6,
|
||||
onAlpha: 1,
|
||||
};
|
||||
|
||||
export class IbpLight extends JlGraphic {
|
||||
static Type = 'IbpLight';
|
||||
graphic = new Graphics();
|
||||
|
||||
constructor() {
|
||||
super(IbpLight.Type);
|
||||
this.addChild(this.graphic);
|
||||
}
|
||||
get datas(): IIbpLightData {
|
||||
return this.getDatas<IIbpLightData>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
this.graphic.clear();
|
||||
this.graphic
|
||||
.beginFill(ibpLightColorMap[this.datas.color ?? 0], 0.5)
|
||||
.drawCircle(0, 0, ibpLightConsts.radius)
|
||||
.endFill();
|
||||
}
|
||||
}
|
||||
|
||||
export class IbpLightTempalte extends JlGraphicTemplate<IbpLight> {
|
||||
constructor(dataTemplate: IIbpLightData) {
|
||||
super(IbpLight.Type, { dataTemplate });
|
||||
}
|
||||
new(): IbpLight {
|
||||
const g = new IbpLight();
|
||||
g.loadData(this.datas);
|
||||
return g;
|
||||
}
|
||||
}
|
98
src/graphics/ibpLight/IbpLightDrawAssistant.ts
Normal file
98
src/graphics/ibpLight/IbpLightDrawAssistant.ts
Normal file
@ -0,0 +1,98 @@
|
||||
import {
|
||||
AbsorbableLine,
|
||||
AbsorbablePosition,
|
||||
GraphicDrawAssistant,
|
||||
GraphicInteractionPlugin,
|
||||
GraphicTransformEvent,
|
||||
IDrawApp,
|
||||
JlGraphic,
|
||||
} from 'src/jl-graphic';
|
||||
import { IIbpLightData, IbpLight, IbpLightTempalte } from './IbpLight';
|
||||
import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
|
||||
|
||||
export class IbpLightDraw extends GraphicDrawAssistant<
|
||||
IbpLightTempalte,
|
||||
IIbpLightData
|
||||
> {
|
||||
_g: IbpLight | null = null;
|
||||
constructor(app: IDrawApp, template: IbpLightTempalte) {
|
||||
super(app, template, 'sym_o_lightbulb', 'IbpLight');
|
||||
IbpLightInteraction.init(app);
|
||||
}
|
||||
get g(): IbpLight {
|
||||
if (!this._g) {
|
||||
this._g = this.graphicTemplate.new();
|
||||
this._g.loadData(this.graphicTemplate.datas);
|
||||
this.container.addChild(this._g);
|
||||
}
|
||||
return this._g;
|
||||
}
|
||||
onLeftUp(e: FederatedMouseEvent): void {
|
||||
this.container.position.copyFrom(this.toCanvasCoordinates(e.global));
|
||||
this.createAndStore(true);
|
||||
}
|
||||
redraw(cp: Point): void {
|
||||
this.g.repaint();
|
||||
this.container.position.set(cp.x, cp.y);
|
||||
}
|
||||
prepareData(data: IIbpLightData): boolean {
|
||||
data.transform = this.container.saveTransform();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function buildAbsorbablePositions(ibpLight: IbpLight): AbsorbablePosition[] {
|
||||
const aps: AbsorbablePosition[] = [];
|
||||
const ibpLights = ibpLight.queryStore.queryByType<IbpLight>(IbpLight.Type);
|
||||
|
||||
const canvas = ibpLight.getCanvas();
|
||||
ibpLights.forEach((item) => {
|
||||
if (item.id === ibpLight.id) {
|
||||
return;
|
||||
}
|
||||
const ala = new AbsorbableLine(
|
||||
new Point(item.x, 0),
|
||||
new Point(item.x, canvas.height)
|
||||
);
|
||||
const alb = new AbsorbableLine(
|
||||
new Point(0, item.y),
|
||||
new Point(canvas.width, item.y)
|
||||
);
|
||||
aps.push(ala);
|
||||
aps.push(alb);
|
||||
});
|
||||
return aps;
|
||||
}
|
||||
|
||||
export class IbpLightInteraction extends GraphicInteractionPlugin<IbpLight> {
|
||||
static Name = 'ibp_light_transform';
|
||||
constructor(app: IDrawApp) {
|
||||
super(IbpLightInteraction.Name, app);
|
||||
}
|
||||
static init(app: IDrawApp) {
|
||||
return new IbpLightInteraction(app);
|
||||
}
|
||||
filter(...grahpics: JlGraphic[]): IbpLight[] | undefined {
|
||||
return grahpics.filter((g): g is IbpLight => g instanceof IbpLight);
|
||||
}
|
||||
bind(g: IbpLight): void {
|
||||
g.eventMode = 'static';
|
||||
g.cursor = 'pointer';
|
||||
g.scalable = true;
|
||||
g.rotatable = true;
|
||||
g.on('transformstart', this.transformstart, this);
|
||||
}
|
||||
unbind(g: IbpLight): void {
|
||||
g.eventMode = 'none';
|
||||
g.scalable = false;
|
||||
g.rotatable = false;
|
||||
g.off('transformstart', this.transformstart, this);
|
||||
}
|
||||
transformstart(e: GraphicTransformEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
const ibpKey = target.getGraphic() as IbpLight;
|
||||
ibpKey.getGraphicApp().setOptions({
|
||||
absorbablePositions: buildAbsorbablePositions(ibpKey),
|
||||
});
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import {
|
||||
Point,
|
||||
} from 'pixi.js';
|
||||
import {
|
||||
GraphicEditPlugin,
|
||||
IEditPointOptions,
|
||||
ILineGraphic,
|
||||
PolylineEditPlugin,
|
||||
|
@ -16,6 +16,7 @@ import IbpDrawProperties from 'src/components/draw-app/IbpDrawProperties.vue';
|
||||
import { DialogChainObject, useQuasar } from 'quasar';
|
||||
import IBpRelatedDeviceList from 'src/components/draw-app/dialogs/IBpRelatedDeviceList.vue';
|
||||
import RelateIbpConfig from 'src/components/draw-app/properties/RelateIbpConfig.vue';
|
||||
import { IbpLight } from 'src/graphics/ibpLight/IbpLight';
|
||||
|
||||
const ibpDrawStore = useIBPDrawStore();
|
||||
const route = useRoute();
|
||||
@ -85,6 +86,7 @@ onMounted(() => {
|
||||
}
|
||||
const drawAssistantsTypes = [
|
||||
IBPButton.Type,
|
||||
IbpLight.Type,
|
||||
IbpAlarm.Type,
|
||||
IbpKey.Type,
|
||||
Arrow.Type,
|
||||
|
@ -377,6 +377,7 @@ export namespace state {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
id?: string;
|
||||
aspect?: Signal.Aspect;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -384,6 +385,9 @@ export namespace state {
|
||||
if ("id" in data && data.id != undefined) {
|
||||
this.id = data.id;
|
||||
}
|
||||
if ("aspect" in data && data.aspect != undefined) {
|
||||
this.aspect = data.aspect;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -392,22 +396,36 @@ export namespace state {
|
||||
set id(value: string) {
|
||||
pb_1.Message.setField(this, 1, value);
|
||||
}
|
||||
get aspect() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, Signal.Aspect.OFF) as Signal.Aspect;
|
||||
}
|
||||
set aspect(value: Signal.Aspect) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
aspect?: Signal.Aspect;
|
||||
}): SignalState {
|
||||
const message = new SignalState({});
|
||||
if (data.id != null) {
|
||||
message.id = data.id;
|
||||
}
|
||||
if (data.aspect != null) {
|
||||
message.aspect = data.aspect;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
id?: string;
|
||||
aspect?: Signal.Aspect;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
}
|
||||
if (this.aspect != null) {
|
||||
data.aspect = this.aspect;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -416,6 +434,8 @@ export namespace state {
|
||||
const writer = w || new pb_1.BinaryWriter();
|
||||
if (this.id.length)
|
||||
writer.writeString(1, this.id);
|
||||
if (this.aspect != Signal.Aspect.OFF)
|
||||
writer.writeEnum(2, this.aspect);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -428,6 +448,9 @@ export namespace state {
|
||||
case 1:
|
||||
message.id = reader.readString();
|
||||
break;
|
||||
case 2:
|
||||
message.aspect = reader.readEnum();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -2423,9 +2446,10 @@ export namespace state {
|
||||
switchState?: SwitchState[];
|
||||
sectionState?: SectionState[];
|
||||
replyState?: ReplyState[];
|
||||
signalState?: SignalState[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("trainState" in data && data.trainState != undefined) {
|
||||
this.trainState = data.trainState;
|
||||
@ -2439,6 +2463,9 @@ export namespace state {
|
||||
if ("replyState" in data && data.replyState != undefined) {
|
||||
this.replyState = data.replyState;
|
||||
}
|
||||
if ("signalState" in data && data.signalState != undefined) {
|
||||
this.signalState = data.signalState;
|
||||
}
|
||||
}
|
||||
}
|
||||
get trainState() {
|
||||
@ -2465,11 +2492,18 @@ export namespace state {
|
||||
set replyState(value: ReplyState[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 4, value);
|
||||
}
|
||||
get signalState() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, SignalState, 5) as SignalState[];
|
||||
}
|
||||
set signalState(value: SignalState[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 5, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
trainState?: ReturnType<typeof TrainState.prototype.toObject>[];
|
||||
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
|
||||
sectionState?: ReturnType<typeof SectionState.prototype.toObject>[];
|
||||
replyState?: ReturnType<typeof ReplyState.prototype.toObject>[];
|
||||
signalState?: ReturnType<typeof SignalState.prototype.toObject>[];
|
||||
}): AllDevicesStatus {
|
||||
const message = new AllDevicesStatus({});
|
||||
if (data.trainState != null) {
|
||||
@ -2484,6 +2518,9 @@ export namespace state {
|
||||
if (data.replyState != null) {
|
||||
message.replyState = data.replyState.map(item => ReplyState.fromObject(item));
|
||||
}
|
||||
if (data.signalState != null) {
|
||||
message.signalState = data.signalState.map(item => SignalState.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -2492,6 +2529,7 @@ export namespace state {
|
||||
switchState?: ReturnType<typeof SwitchState.prototype.toObject>[];
|
||||
sectionState?: ReturnType<typeof SectionState.prototype.toObject>[];
|
||||
replyState?: ReturnType<typeof ReplyState.prototype.toObject>[];
|
||||
signalState?: ReturnType<typeof SignalState.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.trainState != null) {
|
||||
data.trainState = this.trainState.map((item: TrainState) => item.toObject());
|
||||
@ -2505,6 +2543,9 @@ export namespace state {
|
||||
if (this.replyState != null) {
|
||||
data.replyState = this.replyState.map((item: ReplyState) => item.toObject());
|
||||
}
|
||||
if (this.signalState != null) {
|
||||
data.signalState = this.signalState.map((item: SignalState) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -2519,6 +2560,8 @@ export namespace state {
|
||||
writer.writeRepeatedMessage(3, this.sectionState, (item: SectionState) => item.serialize(writer));
|
||||
if (this.replyState.length)
|
||||
writer.writeRepeatedMessage(4, this.replyState, (item: ReplyState) => item.serialize(writer));
|
||||
if (this.signalState.length)
|
||||
writer.writeRepeatedMessage(5, this.signalState, (item: SignalState) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -2540,6 +2583,9 @@ export namespace state {
|
||||
case 4:
|
||||
reader.readMessage(message.replyState, () => pb_1.Message.addToRepeatedWrapperField(message, 4, ReplyState.deserialize(reader), ReplyState));
|
||||
break;
|
||||
case 5:
|
||||
reader.readMessage(message.signalState, () => pb_1.Message.addToRepeatedWrapperField(message, 5, SignalState.deserialize(reader), SignalState));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,10 @@ export namespace ibpGraphicData {
|
||||
ibpArrows?: IbpArrow[];
|
||||
IBPTexts?: IBPText[];
|
||||
ibpRelatedDevices?: IbpRelatedDevice[];
|
||||
ibpLights?: IbpLight[];
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 8], this.#one_of_decls);
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 8, 9], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("canvas" in data && data.canvas != undefined) {
|
||||
this.canvas = data.canvas;
|
||||
@ -41,6 +42,9 @@ export namespace ibpGraphicData {
|
||||
if ("ibpRelatedDevices" in data && data.ibpRelatedDevices != undefined) {
|
||||
this.ibpRelatedDevices = data.ibpRelatedDevices;
|
||||
}
|
||||
if ("ibpLights" in data && data.ibpLights != undefined) {
|
||||
this.ibpLights = data.ibpLights;
|
||||
}
|
||||
}
|
||||
}
|
||||
get canvas() {
|
||||
@ -88,6 +92,12 @@ export namespace ibpGraphicData {
|
||||
set ibpRelatedDevices(value: IbpRelatedDevice[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 8, value);
|
||||
}
|
||||
get ibpLights() {
|
||||
return pb_1.Message.getRepeatedWrapperField(this, IbpLight, 9) as IbpLight[];
|
||||
}
|
||||
set ibpLights(value: IbpLight[]) {
|
||||
pb_1.Message.setRepeatedWrapperField(this, 9, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
|
||||
ibpButtons?: ReturnType<typeof IBPButton.prototype.toObject>[];
|
||||
@ -96,6 +106,7 @@ export namespace ibpGraphicData {
|
||||
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
|
||||
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
|
||||
ibpRelatedDevices?: ReturnType<typeof IbpRelatedDevice.prototype.toObject>[];
|
||||
ibpLights?: ReturnType<typeof IbpLight.prototype.toObject>[];
|
||||
}): IBPGraphicStorage {
|
||||
const message = new IBPGraphicStorage({});
|
||||
if (data.canvas != null) {
|
||||
@ -119,6 +130,9 @@ export namespace ibpGraphicData {
|
||||
if (data.ibpRelatedDevices != null) {
|
||||
message.ibpRelatedDevices = data.ibpRelatedDevices.map(item => IbpRelatedDevice.fromObject(item));
|
||||
}
|
||||
if (data.ibpLights != null) {
|
||||
message.ibpLights = data.ibpLights.map(item => IbpLight.fromObject(item));
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -130,6 +144,7 @@ export namespace ibpGraphicData {
|
||||
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
|
||||
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
|
||||
ibpRelatedDevices?: ReturnType<typeof IbpRelatedDevice.prototype.toObject>[];
|
||||
ibpLights?: ReturnType<typeof IbpLight.prototype.toObject>[];
|
||||
} = {};
|
||||
if (this.canvas != null) {
|
||||
data.canvas = this.canvas.toObject();
|
||||
@ -152,6 +167,9 @@ export namespace ibpGraphicData {
|
||||
if (this.ibpRelatedDevices != null) {
|
||||
data.ibpRelatedDevices = this.ibpRelatedDevices.map((item: IbpRelatedDevice) => item.toObject());
|
||||
}
|
||||
if (this.ibpLights != null) {
|
||||
data.ibpLights = this.ibpLights.map((item: IbpLight) => item.toObject());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -172,6 +190,8 @@ export namespace ibpGraphicData {
|
||||
writer.writeRepeatedMessage(6, this.IBPTexts, (item: IBPText) => item.serialize(writer));
|
||||
if (this.ibpRelatedDevices.length)
|
||||
writer.writeRepeatedMessage(8, this.ibpRelatedDevices, (item: IbpRelatedDevice) => item.serialize(writer));
|
||||
if (this.ibpLights.length)
|
||||
writer.writeRepeatedMessage(9, this.ibpLights, (item: IbpLight) => item.serialize(writer));
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -202,6 +222,9 @@ export namespace ibpGraphicData {
|
||||
case 8:
|
||||
reader.readMessage(message.ibpRelatedDevices, () => pb_1.Message.addToRepeatedWrapperField(message, 8, IbpRelatedDevice.deserialize(reader), IbpRelatedDevice));
|
||||
break;
|
||||
case 9:
|
||||
reader.readMessage(message.ibpLights, () => pb_1.Message.addToRepeatedWrapperField(message, 9, IbpLight.deserialize(reader), IbpLight));
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
@ -826,6 +849,130 @@ export namespace ibpGraphicData {
|
||||
return IbpArrow.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export class IbpLight extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
common?: dependency_1.graphicData.CommonInfo;
|
||||
color?: IbpLight.IbpLightColor;
|
||||
code?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
if (!Array.isArray(data) && typeof data == "object") {
|
||||
if ("common" in data && data.common != undefined) {
|
||||
this.common = data.common;
|
||||
}
|
||||
if ("color" in data && data.color != undefined) {
|
||||
this.color = data.color;
|
||||
}
|
||||
if ("code" in data && data.code != undefined) {
|
||||
this.code = data.code;
|
||||
}
|
||||
}
|
||||
}
|
||||
get common() {
|
||||
return pb_1.Message.getWrapperField(this, dependency_1.graphicData.CommonInfo, 1) as dependency_1.graphicData.CommonInfo;
|
||||
}
|
||||
set common(value: dependency_1.graphicData.CommonInfo) {
|
||||
pb_1.Message.setWrapperField(this, 1, value);
|
||||
}
|
||||
get has_common() {
|
||||
return pb_1.Message.getField(this, 1) != null;
|
||||
}
|
||||
get color() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 2, IbpLight.IbpLightColor.white) as IbpLight.IbpLightColor;
|
||||
}
|
||||
set color(value: IbpLight.IbpLightColor) {
|
||||
pb_1.Message.setField(this, 2, value);
|
||||
}
|
||||
get code() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
|
||||
}
|
||||
set code(value: string) {
|
||||
pb_1.Message.setField(this, 3, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
||||
color?: IbpLight.IbpLightColor;
|
||||
code?: string;
|
||||
}): IbpLight {
|
||||
const message = new IbpLight({});
|
||||
if (data.common != null) {
|
||||
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
|
||||
}
|
||||
if (data.color != null) {
|
||||
message.color = data.color;
|
||||
}
|
||||
if (data.code != null) {
|
||||
message.code = data.code;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
const data: {
|
||||
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
|
||||
color?: IbpLight.IbpLightColor;
|
||||
code?: string;
|
||||
} = {};
|
||||
if (this.common != null) {
|
||||
data.common = this.common.toObject();
|
||||
}
|
||||
if (this.color != null) {
|
||||
data.color = this.color;
|
||||
}
|
||||
if (this.code != null) {
|
||||
data.code = this.code;
|
||||
}
|
||||
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.has_common)
|
||||
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
|
||||
if (this.color != IbpLight.IbpLightColor.white)
|
||||
writer.writeEnum(2, this.color);
|
||||
if (this.code.length)
|
||||
writer.writeString(3, this.code);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpLight {
|
||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpLight();
|
||||
while (reader.nextField()) {
|
||||
if (reader.isEndGroup())
|
||||
break;
|
||||
switch (reader.getFieldNumber()) {
|
||||
case 1:
|
||||
reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader));
|
||||
break;
|
||||
case 2:
|
||||
message.color = reader.readEnum();
|
||||
break;
|
||||
case 3:
|
||||
message.code = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
serializeBinary(): Uint8Array {
|
||||
return this.serialize();
|
||||
}
|
||||
static deserializeBinary(bytes: Uint8Array): IbpLight {
|
||||
return IbpLight.deserialize(bytes);
|
||||
}
|
||||
}
|
||||
export namespace IbpLight {
|
||||
export enum IbpLightColor {
|
||||
white = 0,
|
||||
red = 1,
|
||||
green = 2,
|
||||
blue = 3
|
||||
}
|
||||
}
|
||||
export class IbpRelatedDevice extends pb_1.Message {
|
||||
#one_of_decls: number[][] = [];
|
||||
constructor(data?: any[] | {
|
||||
|
Loading…
Reference in New Issue
Block a user