diff --git a/src/components/draw-app/IbpDrawProperties.vue b/src/components/draw-app/IbpDrawProperties.vue index 7fbebe9..f16469a 100644 --- a/src/components/draw-app/IbpDrawProperties.vue +++ b/src/components/draw-app/IbpDrawProperties.vue @@ -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(); @@ -44,6 +46,9 @@ const ibpDrawStore = useIBPDrawStore(); + diff --git a/src/components/draw-app/properties/IbpLightProperty.vue b/src/components/draw-app/properties/IbpLightProperty.vue new file mode 100644 index 0000000..9b5e7b1 --- /dev/null +++ b/src/components/draw-app/properties/IbpLightProperty.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/components/line-app/infos/TrainInfo.vue b/src/components/line-app/infos/TrainInfo.vue index f1fcaaf..0403fb8 100644 --- a/src/components/line-app/infos/TrainInfo.vue +++ b/src/components/line-app/infos/TrainInfo.vue @@ -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); diff --git a/src/components/line-app/infos/TrainInfoEcharts.vue b/src/components/line-app/infos/TrainInfoEcharts.vue index f7a5f46..b76f83b 100644 --- a/src/components/line-app/infos/TrainInfoEcharts.vue +++ b/src/components/line-app/infos/TrainInfoEcharts.vue @@ -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 = `
+
+ ${title} +
+
+ `; + params.forEach((item: any, index: number) => { + result += + "
" + + '' + + item.seriesName + + ' : ' + + '' + + item.value[1].toFixed(2) + + ' ' + + series[index].unit + + '' + + '
' + + '
'; + }); + result += '
'; + 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); diff --git a/src/drawApp/graphics/IbpLightInteraction.ts b/src/drawApp/graphics/IbpLightInteraction.ts new file mode 100644 index 0000000..9f90f96 --- /dev/null +++ b/src/drawApp/graphics/IbpLightInteraction.ts @@ -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(); + } + 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); + } +} diff --git a/src/drawApp/ibpDrawApp.ts b/src/drawApp/ibpDrawApp.ts index f7cd79f..9c7e760 100644 --- a/src/drawApp/ibpDrawApp.ts +++ b/src/drawApp/ibpDrawApp.ts @@ -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().data); } else if (g instanceof TextContent) { storage.IBPTexts.push(g.saveData().data); + } else { + storage.ibpLights.push(g.saveData().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, diff --git a/src/graphics/ibpLight/IbpLight.ts b/src/graphics/ibpLight/IbpLight.ts new file mode 100644 index 0000000..0061231 --- /dev/null +++ b/src/graphics/ibpLight/IbpLight.ts @@ -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(); + } + 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 { + constructor(dataTemplate: IIbpLightData) { + super(IbpLight.Type, { dataTemplate }); + } + new(): IbpLight { + const g = new IbpLight(); + g.loadData(this.datas); + return g; + } +} diff --git a/src/graphics/ibpLight/IbpLightDrawAssistant.ts b/src/graphics/ibpLight/IbpLightDrawAssistant.ts new file mode 100644 index 0000000..44644f9 --- /dev/null +++ b/src/graphics/ibpLight/IbpLightDrawAssistant.ts @@ -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.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 { + 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), + }); + } +} diff --git a/src/graphics/section/SectionDrawAssistant.ts b/src/graphics/section/SectionDrawAssistant.ts index 34579cf..298a79a 100644 --- a/src/graphics/section/SectionDrawAssistant.ts +++ b/src/graphics/section/SectionDrawAssistant.ts @@ -32,7 +32,6 @@ import { Point, } from 'pixi.js'; import { - GraphicEditPlugin, IEditPointOptions, ILineGraphic, PolylineEditPlugin, diff --git a/src/layouts/IBPDrawLayout.vue b/src/layouts/IBPDrawLayout.vue index 805e4ff..82def24 100644 --- a/src/layouts/IBPDrawLayout.vue +++ b/src/layouts/IBPDrawLayout.vue @@ -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, diff --git a/src/protos/device_state.ts b/src/protos/device_state.ts index 1f37479..3f16d7b 100644 --- a/src/protos/device_state.ts +++ b/src/protos/device_state.ts @@ -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[]; switchState?: ReturnType[]; sectionState?: ReturnType[]; replyState?: ReturnType[]; + signalState?: ReturnType[]; }): 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[]; sectionState?: ReturnType[]; replyState?: ReturnType[]; + signalState?: ReturnType[]; } = {}; 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(); } } diff --git a/src/protos/ibpGraphics.ts b/src/protos/ibpGraphics.ts index 2748105..7550ab3 100644 --- a/src/protos/ibpGraphics.ts +++ b/src/protos/ibpGraphics.ts @@ -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; ibpButtons?: ReturnType[]; @@ -96,6 +106,7 @@ export namespace ibpGraphicData { ibpArrows?: ReturnType[]; IBPTexts?: ReturnType[]; ibpRelatedDevices?: ReturnType[]; + ibpLights?: ReturnType[]; }): 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[]; IBPTexts?: ReturnType[]; ibpRelatedDevices?: ReturnType[]; + ibpLights?: ReturnType[]; } = {}; 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; + 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; + 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[] | {