ibp设备添加

This commit is contained in:
fan 2023-10-09 18:24:40 +08:00
parent c2e8f1c92f
commit 4f09b99366
9 changed files with 697 additions and 38 deletions

View File

@ -1,24 +1,24 @@
import * as pb_1 from 'google-protobuf'; import * as pb_1 from 'google-protobuf';
import { IArrowData, Arrow } from 'src/graphics/arrow/Arrow'; import { IArrowData, Arrow } from 'src/graphics/arrow/Arrow';
import { pslGraphicData } from 'src/protos/pslGraphics'; import { ibpGraphicData } from 'src/protos/ibpGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
import { IPointData } from 'pixi.js'; import { IPointData } from 'pixi.js';
export class ArrowData extends GraphicDataBase implements IArrowData { export class ArrowData extends GraphicDataBase implements IArrowData {
constructor(data?: pslGraphicData.PslKey) { constructor(data?: ibpGraphicData.IbpArrow) {
let arrow; let arrow;
if (data) { if (data) {
arrow = data; arrow = data;
} else { } else {
arrow = new pslGraphicData.PslKey({ arrow = new ibpGraphicData.IbpArrow({
common: GraphicDataBase.defaultCommonInfo(Arrow.Type), common: GraphicDataBase.defaultCommonInfo(Arrow.Type),
}); });
} }
super(arrow); super(arrow);
} }
public get data(): pslGraphicData.PslKey { public get data(): ibpGraphicData.IbpArrow {
return this.getData<pslGraphicData.PslKey>(); return this.getData<ibpGraphicData.IbpArrow>();
} }
get code(): string { get code(): string {
@ -32,7 +32,7 @@ export class ArrowData extends GraphicDataBase implements IArrowData {
} }
set points(points: IPointData[]) { set points(points: IPointData[]) {
this.data.points = points.map( this.data.points = points.map(
(p) => new pslGraphicData.Point({ x: p.x, y: p.y }) (p) => new ibpGraphicData.Point({ x: p.x, y: p.y })
); );
} }
clone(): ArrowData { clone(): ArrowData {

View File

@ -1,23 +1,23 @@
import * as pb_1 from 'google-protobuf'; import * as pb_1 from 'google-protobuf';
import { IIbpAlarmData, IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm'; import { IIbpAlarmData, IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm';
import { pslGraphicData } from 'src/protos/pslGraphics'; import { ibpGraphicData } from 'src/protos/ibpGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
export class IbpAlarmData extends GraphicDataBase implements IIbpAlarmData { export class IbpAlarmData extends GraphicDataBase implements IIbpAlarmData {
constructor(data?: pslGraphicData.PslKey) { constructor(data?: ibpGraphicData.IbpAlarm) {
let ibpAlram; let ibpAlram;
if (data) { if (data) {
ibpAlram = data; ibpAlram = data;
} else { } else {
ibpAlram = new pslGraphicData.PslKey({ ibpAlram = new ibpGraphicData.IbpAlarm({
common: GraphicDataBase.defaultCommonInfo(IbpAlarm.Type), common: GraphicDataBase.defaultCommonInfo(IbpAlarm.Type),
}); });
} }
super(ibpAlram); super(ibpAlram);
} }
public get data(): pslGraphicData.PslKey { public get data(): ibpGraphicData.IbpAlarm {
return this.getData<pslGraphicData.PslKey>(); return this.getData<ibpGraphicData.IbpAlarm>();
} }
get code(): string { get code(): string {

View File

@ -1,23 +1,23 @@
import * as pb_1 from 'google-protobuf'; import * as pb_1 from 'google-protobuf';
import { IIbpKeyData, IbpKey } from 'src/graphics/ibpKey/IbpKey'; import { IIbpKeyData, IbpKey } from 'src/graphics/ibpKey/IbpKey';
import { pslGraphicData } from 'src/protos/pslGraphics'; import { ibpGraphicData } from 'src/protos/ibpGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
export class IbpKeyData extends GraphicDataBase implements IIbpKeyData { export class IbpKeyData extends GraphicDataBase implements IIbpKeyData {
constructor(data?: pslGraphicData.PslKey) { constructor(data?: ibpGraphicData.IbpKey) {
let ibpKey; let ibpKey;
if (data) { if (data) {
ibpKey = data; ibpKey = data;
} else { } else {
ibpKey = new pslGraphicData.PslKey({ ibpKey = new ibpGraphicData.IbpKey({
common: GraphicDataBase.defaultCommonInfo(IbpKey.Type), common: GraphicDataBase.defaultCommonInfo(IbpKey.Type),
}); });
} }
super(ibpKey); super(ibpKey);
} }
public get data(): pslGraphicData.PslKey { public get data(): ibpGraphicData.IbpKey {
return this.getData<pslGraphicData.PslKey>(); return this.getData<ibpGraphicData.IbpKey>();
} }
get code(): string { get code(): string {

View File

@ -0,0 +1,59 @@
import * as pb_1 from 'google-protobuf';
import {
ITextContentData,
TextContent,
} from 'src/graphics/textContent/TextContent';
import { ibpGraphicData } from 'src/protos/ibpGraphics';
import { GraphicDataBase } from './GraphicDataBase';
export class IbpTextData extends GraphicDataBase implements ITextContentData {
constructor(data?: ibpGraphicData.IBPText) {
let pslText;
if (data) {
pslText = data;
} else {
pslText = new ibpGraphicData.IBPText({
common: GraphicDataBase.defaultCommonInfo(TextContent.Type),
});
}
super(pslText);
}
public get data(): ibpGraphicData.IBPText {
return this.getData<ibpGraphicData.IBPText>();
}
get code(): string {
return this.data.code;
}
set code(v: string) {
this.data.code = v;
}
get content(): string {
return this.data.content;
}
set content(v: string) {
this.data.content = v;
}
get color(): string {
return this.data.color;
}
set color(v: string) {
this.data.color = v;
}
get fontSize(): number {
return this.data.fontSize;
}
set fontSize(v: number) {
this.data.fontSize = v;
}
clone(): IbpTextData {
return new IbpTextData(this.data.cloneMessage());
}
copyFrom(data: IbpTextData): void {
pb_1.Message.copyInto(data.data, this.data);
}
eq(other: IbpTextData): boolean {
return pb_1.Message.equals(this.data, other.data);
}
}

View File

@ -12,7 +12,22 @@ import {
IBPButtonTemplate, IBPButtonTemplate,
IIBPButtonData, IIBPButtonData,
} from 'src/graphics/IBPButton/IBPButton'; } from 'src/graphics/IBPButton/IBPButton';
import { IbpAlarm, IbpAlarmTemplate } from 'src/graphics/ibpAlarm/IbpAlarm';
import { IbpKey, IbpKeyTemplate } from 'src/graphics/ibpKey/IbpKey';
import { Arrow, ArrowTemplate } from 'src/graphics/arrow/Arrow';
import { IBPButtonDrawAssistant } from 'src/graphics/IBPButton/IBPButtonDrawAssistant'; import { IBPButtonDrawAssistant } from 'src/graphics/IBPButton/IBPButtonDrawAssistant';
import {
TextContent,
TextContentTemplate,
} from 'src/graphics/textContent/TextContent';
import { IbpAlarmDraw } from 'src/graphics/ibpAlarm/IbpAlarmDrawAssistant';
import { IbpAlarmData } from './graphics/IbpAlarmInteraction';
import { IbpKeyDraw } from 'src/graphics/ibpKey/IbpKeyDrawAssistant';
import { IbpKeyData } from './graphics/IbpKeyInteraction';
import { ArrowDraw } from 'src/graphics/arrow/ArrowDrawAssistant';
import { ArrowData } from './graphics/ArrowInteraction';
import { TextContentDraw } from 'src/graphics/textContent/TextContentDrawAssistant';
import { IbpTextData } from './graphics/IbpTextInteraction';
let drawApp: IDrawApp | null = null; let drawApp: IDrawApp | null = null;
@ -29,6 +44,10 @@ export function initIBPDrawApp() {
drawApp, drawApp,
new IBPButtonTemplate(new IBPButtonData()) new IBPButtonTemplate(new IBPButtonData())
); );
new IbpAlarmDraw(drawApp, new IbpAlarmTemplate(new IbpAlarmData()));
new IbpKeyDraw(drawApp, new IbpKeyTemplate(new IbpKeyData()));
new ArrowDraw(drawApp, new ArrowTemplate(new ArrowData()));
new TextContentDraw(drawApp, new TextContentTemplate(new IbpTextData()));
return drawApp; return drawApp;
} }
@ -61,6 +80,14 @@ function saveIBPDrawDatas(app: IDrawApp) {
graphics.forEach((g) => { graphics.forEach((g) => {
if (g instanceof IBPButton) { if (g instanceof IBPButton) {
storage.ibpButtons.push(g.saveData<IBPButtonData>().data); storage.ibpButtons.push(g.saveData<IBPButtonData>().data);
} else if (g instanceof IbpAlarm) {
storage.ibpAlarms.push(g.saveData<IbpAlarmData>().data);
} else if (g instanceof IbpKey) {
storage.ibpKeys.push(g.saveData<IbpKeyData>().data);
} else if (g instanceof Arrow) {
storage.ibpArrows.push(g.saveData<ArrowData>().data);
} else if (g instanceof TextContent) {
storage.IBPTexts.push(g.saveData<IbpTextData>().data);
} }
}); });
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
@ -82,6 +109,18 @@ async function IBPDrawDataLoader() {
storage.ibpButtons.forEach((ibpButton) => { storage.ibpButtons.forEach((ibpButton) => {
datas.push(new IBPButtonData(ibpButton)); datas.push(new IBPButtonData(ibpButton));
}); });
storage.ibpAlarms.forEach((ibpAlarm) => {
datas.push(new IbpAlarmData(ibpAlarm));
});
storage.ibpKeys.forEach((ibpKey) => {
datas.push(new IbpKeyData(ibpKey));
});
storage.ibpArrows.forEach((ibpArrow) => {
datas.push(new ArrowData(ibpArrow));
});
storage.IBPTexts.forEach((ibpText) => {
datas.push(new IbpTextData(ibpText));
});
return { return {
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,

View File

@ -46,7 +46,7 @@ export class ArrowDraw extends GraphicDrawAssistant<ArrowTemplate, IArrowData> {
const p = new Point(x, y); const p = new Point(x, y);
this.points.push(p); this.points.push(p);
if (this.points.length === 2) { if (this.points.length === 2) {
this.createAndStore; this.createAndStore(true);
} }
} }

View File

@ -12,7 +12,7 @@
"frame": { "x": 378, "y": 0, "w": 377, "h": 1032 }, "frame": { "x": 378, "y": 0, "w": 377, "h": 1032 },
"rotated": false, "rotated": false,
"trimmed": false, "trimmed": false,
"spriteSourceSize": { "x": 378, "y": 0, "w": 377, "h": 1032 }, "spriteSourceSize": { "x": 0, "y": 0, "w": 377, "h": 1032 },
"sourceSize": { "w": 377, "h": 1032 }, "sourceSize": { "w": 377, "h": 1032 },
"anchor": { "x": 0.5, "y": 0.5 } "anchor": { "x": 0.5, "y": 0.5 }
} }
@ -23,7 +23,7 @@
"image": "ibp-key.png", "image": "ibp-key.png",
"format": "RGBA8888", "format": "RGBA8888",
"size": { "w": 755, "h": 1032 }, "size": { "w": 755, "h": 1032 },
"scale": "1", "scale": "10",
"smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$" "smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
} }
} }

View File

@ -3,6 +3,10 @@ import { onMounted, reactive, ref } from 'vue';
import { useIBPDrawStore } from '../stores/ibp-draw-store'; import { useIBPDrawStore } from '../stores/ibp-draw-store';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { IBPButton } from 'src/graphics/IBPButton/IBPButton'; import { IBPButton } from 'src/graphics/IBPButton/IBPButton';
import { IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm';
import { IbpKey } from 'src/graphics/ibpKey/IbpKey';
import { Arrow } from 'src/graphics/arrow/Arrow';
import { TextContent } from 'src/graphics/textContent/TextContent';
import { getIBPDrawApp } from 'src/drawApp/ibpDrawApp'; import { getIBPDrawApp } from 'src/drawApp/ibpDrawApp';
import IbpDrawProperties from 'src/components/draw-app/IbpDrawProperties.vue'; import IbpDrawProperties from 'src/components/draw-app/IbpDrawProperties.vue';
@ -64,7 +68,13 @@ onMounted(() => {
} else { } else {
ibpDrawStore.setDraftId(null); ibpDrawStore.setDraftId(null);
} }
const drawAssistantsTypes = [IBPButton.Type]; const drawAssistantsTypes = [
IBPButton.Type,
IbpAlarm.Type,
IbpKey.Type,
Arrow.Type,
TextContent.Type,
];
drawAssistantsTypes.forEach((type) => { drawAssistantsTypes.forEach((type) => {
const drawAssistant = getIBPDrawApp()?.getDrawAssistant(type); const drawAssistant = getIBPDrawApp()?.getDrawAssistant(type);
if (drawAssistant) { if (drawAssistant) {
@ -89,8 +99,6 @@ function onResize() {
canvasHeight.value = clientHeight - headerHeight.value; canvasHeight.value = clientHeight - headerHeight.value;
const dom = document.getElementById('draw-app-container'); const dom = document.getElementById('draw-app-container');
// console.log(dom); // console.log(dom);
console.log(canvasWidth.value);
console.log(canvasHeight.value);
if (dom) { if (dom) {
dom.style.width = canvasWidth.value + 'px'; dom.style.width = canvasWidth.value + 'px';
dom.style.height = canvasHeight.value + 'px'; dom.style.height = canvasHeight.value + 'px';

View File

@ -11,9 +11,13 @@ export namespace ibpGraphicData {
constructor(data?: any[] | { constructor(data?: any[] | {
canvas?: dependency_1.graphicData.Canvas; canvas?: dependency_1.graphicData.Canvas;
ibpButtons?: IBPButton[]; ibpButtons?: IBPButton[];
ibpAlarms?: IbpAlarm[];
ibpKeys?: IbpKey[];
ibpArrows?: IbpArrow[];
IBPTexts?: IBPText[];
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") { if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) { if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas; this.canvas = data.canvas;
@ -21,6 +25,18 @@ export namespace ibpGraphicData {
if ("ibpButtons" in data && data.ibpButtons != undefined) { if ("ibpButtons" in data && data.ibpButtons != undefined) {
this.ibpButtons = data.ibpButtons; this.ibpButtons = data.ibpButtons;
} }
if ("ibpAlarms" in data && data.ibpAlarms != undefined) {
this.ibpAlarms = data.ibpAlarms;
}
if ("ibpKeys" in data && data.ibpKeys != undefined) {
this.ibpKeys = data.ibpKeys;
}
if ("ibpArrows" in data && data.ibpArrows != undefined) {
this.ibpArrows = data.ibpArrows;
}
if ("IBPTexts" in data && data.IBPTexts != undefined) {
this.IBPTexts = data.IBPTexts;
}
} }
} }
get canvas() { get canvas() {
@ -38,9 +54,37 @@ export namespace ibpGraphicData {
set ibpButtons(value: IBPButton[]) { set ibpButtons(value: IBPButton[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value); pb_1.Message.setRepeatedWrapperField(this, 2, value);
} }
get ibpAlarms() {
return pb_1.Message.getRepeatedWrapperField(this, IbpAlarm, 3) as IbpAlarm[];
}
set ibpAlarms(value: IbpAlarm[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
get ibpKeys() {
return pb_1.Message.getRepeatedWrapperField(this, IbpKey, 4) as IbpKey[];
}
set ibpKeys(value: IbpKey[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
get ibpArrows() {
return pb_1.Message.getRepeatedWrapperField(this, IbpArrow, 5) as IbpArrow[];
}
set ibpArrows(value: IbpArrow[]) {
pb_1.Message.setRepeatedWrapperField(this, 5, value);
}
get IBPTexts() {
return pb_1.Message.getRepeatedWrapperField(this, IBPText, 6) as IBPText[];
}
set IBPTexts(value: IBPText[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
static fromObject(data: { static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>; canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
ibpButtons?: ReturnType<typeof IBPButton.prototype.toObject>[]; ibpButtons?: ReturnType<typeof IBPButton.prototype.toObject>[];
ibpAlarms?: ReturnType<typeof IbpAlarm.prototype.toObject>[];
ibpKeys?: ReturnType<typeof IbpKey.prototype.toObject>[];
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
}): IBPGraphicStorage { }): IBPGraphicStorage {
const message = new IBPGraphicStorage({}); const message = new IBPGraphicStorage({});
if (data.canvas != null) { if (data.canvas != null) {
@ -49,12 +93,28 @@ export namespace ibpGraphicData {
if (data.ibpButtons != null) { if (data.ibpButtons != null) {
message.ibpButtons = data.ibpButtons.map(item => IBPButton.fromObject(item)); message.ibpButtons = data.ibpButtons.map(item => IBPButton.fromObject(item));
} }
if (data.ibpAlarms != null) {
message.ibpAlarms = data.ibpAlarms.map(item => IbpAlarm.fromObject(item));
}
if (data.ibpKeys != null) {
message.ibpKeys = data.ibpKeys.map(item => IbpKey.fromObject(item));
}
if (data.ibpArrows != null) {
message.ibpArrows = data.ibpArrows.map(item => IbpArrow.fromObject(item));
}
if (data.IBPTexts != null) {
message.IBPTexts = data.IBPTexts.map(item => IBPText.fromObject(item));
}
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>; canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
ibpButtons?: ReturnType<typeof IBPButton.prototype.toObject>[]; ibpButtons?: ReturnType<typeof IBPButton.prototype.toObject>[];
ibpAlarms?: ReturnType<typeof IbpAlarm.prototype.toObject>[];
ibpKeys?: ReturnType<typeof IbpKey.prototype.toObject>[];
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
} = {}; } = {};
if (this.canvas != null) { if (this.canvas != null) {
data.canvas = this.canvas.toObject(); data.canvas = this.canvas.toObject();
@ -62,6 +122,18 @@ export namespace ibpGraphicData {
if (this.ibpButtons != null) { if (this.ibpButtons != null) {
data.ibpButtons = this.ibpButtons.map((item: IBPButton) => item.toObject()); data.ibpButtons = this.ibpButtons.map((item: IBPButton) => item.toObject());
} }
if (this.ibpAlarms != null) {
data.ibpAlarms = this.ibpAlarms.map((item: IbpAlarm) => item.toObject());
}
if (this.ibpKeys != null) {
data.ibpKeys = this.ibpKeys.map((item: IbpKey) => item.toObject());
}
if (this.ibpArrows != null) {
data.ibpArrows = this.ibpArrows.map((item: IbpArrow) => item.toObject());
}
if (this.IBPTexts != null) {
data.IBPTexts = this.IBPTexts.map((item: IBPText) => item.toObject());
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -72,6 +144,14 @@ export namespace ibpGraphicData {
writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer)); writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer));
if (this.ibpButtons.length) if (this.ibpButtons.length)
writer.writeRepeatedMessage(2, this.ibpButtons, (item: IBPButton) => item.serialize(writer)); writer.writeRepeatedMessage(2, this.ibpButtons, (item: IBPButton) => item.serialize(writer));
if (this.ibpAlarms.length)
writer.writeRepeatedMessage(3, this.ibpAlarms, (item: IbpAlarm) => item.serialize(writer));
if (this.ibpKeys.length)
writer.writeRepeatedMessage(4, this.ibpKeys, (item: IbpKey) => item.serialize(writer));
if (this.ibpArrows.length)
writer.writeRepeatedMessage(5, this.ibpArrows, (item: IbpArrow) => item.serialize(writer));
if (this.IBPTexts.length)
writer.writeRepeatedMessage(6, this.IBPTexts, (item: IBPText) => item.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -87,6 +167,18 @@ export namespace ibpGraphicData {
case 2: case 2:
reader.readMessage(message.ibpButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 2, IBPButton.deserialize(reader), IBPButton)); reader.readMessage(message.ibpButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 2, IBPButton.deserialize(reader), IBPButton));
break; break;
case 3:
reader.readMessage(message.ibpAlarms, () => pb_1.Message.addToRepeatedWrapperField(message, 3, IbpAlarm.deserialize(reader), IbpAlarm));
break;
case 4:
reader.readMessage(message.ibpKeys, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IbpKey.deserialize(reader), IbpKey));
break;
case 5:
reader.readMessage(message.ibpArrows, () => pb_1.Message.addToRepeatedWrapperField(message, 5, IbpArrow.deserialize(reader), IbpArrow));
break;
case 6:
reader.readMessage(message.IBPTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 6, IBPText.deserialize(reader), IBPText));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -251,7 +343,10 @@ export namespace ibpGraphicData {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor(data?: any[] | { constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo; common?: dependency_1.graphicData.CommonInfo;
size?: number; code?: string;
content?: string;
color?: string;
fontSize?: number;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -259,8 +354,17 @@ export namespace ibpGraphicData {
if ("common" in data && data.common != undefined) { if ("common" in data && data.common != undefined) {
this.common = data.common; this.common = data.common;
} }
if ("size" in data && data.size != undefined) { if ("code" in data && data.code != undefined) {
this.size = data.size; this.code = data.code;
}
if ("content" in data && data.content != undefined) {
this.content = data.content;
}
if ("color" in data && data.color != undefined) {
this.color = data.color;
}
if ("fontSize" in data && data.fontSize != undefined) {
this.fontSize = data.fontSize;
} }
} }
} }
@ -273,35 +377,77 @@ export namespace ibpGraphicData {
get has_common() { get has_common() {
return pb_1.Message.getField(this, 1) != null; return pb_1.Message.getField(this, 1) != null;
} }
get size() { get code() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
} }
set size(value: number) { set code(value: string) {
pb_1.Message.setField(this, 2, value); pb_1.Message.setField(this, 2, value);
} }
get content() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set content(value: string) {
pb_1.Message.setField(this, 3, value);
}
get color() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set color(value: string) {
pb_1.Message.setField(this, 4, value);
}
get fontSize() {
return pb_1.Message.getFieldWithDefault(this, 5, 0) as number;
}
set fontSize(value: number) {
pb_1.Message.setField(this, 5, value);
}
static fromObject(data: { static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>; common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
size?: number; code?: string;
content?: string;
color?: string;
fontSize?: number;
}): IBPText { }): IBPText {
const message = new IBPText({}); const message = new IBPText({});
if (data.common != null) { if (data.common != null) {
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common); message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
} }
if (data.size != null) { if (data.code != null) {
message.size = data.size; message.code = data.code;
}
if (data.content != null) {
message.content = data.content;
}
if (data.color != null) {
message.color = data.color;
}
if (data.fontSize != null) {
message.fontSize = data.fontSize;
} }
return message; return message;
} }
toObject() { toObject() {
const data: { const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>; common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
size?: number; code?: string;
content?: string;
color?: string;
fontSize?: number;
} = {}; } = {};
if (this.common != null) { if (this.common != null) {
data.common = this.common.toObject(); data.common = this.common.toObject();
} }
if (this.size != null) { if (this.code != null) {
data.size = this.size; data.code = this.code;
}
if (this.content != null) {
data.content = this.content;
}
if (this.color != null) {
data.color = this.color;
}
if (this.fontSize != null) {
data.fontSize = this.fontSize;
} }
return data; return data;
} }
@ -311,8 +457,14 @@ export namespace ibpGraphicData {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.has_common) if (this.has_common)
writer.writeMessage(1, this.common, () => this.common.serialize(writer)); writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.size != 0) if (this.code.length)
writer.writeInt32(2, this.size); writer.writeString(2, this.code);
if (this.content.length)
writer.writeString(3, this.content);
if (this.color.length)
writer.writeString(4, this.color);
if (this.fontSize != 0)
writer.writeInt32(5, this.fontSize);
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -326,7 +478,16 @@ export namespace ibpGraphicData {
reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader)); reader.readMessage(message.common, () => message.common = dependency_1.graphicData.CommonInfo.deserialize(reader));
break; break;
case 2: case 2:
message.size = reader.readInt32(); message.code = reader.readString();
break;
case 3:
message.content = reader.readString();
break;
case 4:
message.color = reader.readString();
break;
case 5:
message.fontSize = reader.readInt32();
break; break;
default: reader.skipField(); default: reader.skipField();
} }
@ -340,4 +501,396 @@ export namespace ibpGraphicData {
return IBPText.deserialize(bytes); return IBPText.deserialize(bytes);
} }
} }
export class IbpAlarm extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
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 ("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 code() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
}): IbpAlarm {
const message = new IbpAlarm({});
if (data.common != null) {
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
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.code.length)
writer.writeString(2, this.code);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpAlarm {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpAlarm();
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.code = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): IbpAlarm {
return IbpAlarm.deserialize(bytes);
}
}
export class IbpKey extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
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 ("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 code() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
}): IbpKey {
const message = new IbpKey({});
if (data.common != null) {
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
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.code.length)
writer.writeString(2, this.code);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpKey {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpKey();
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.code = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): IbpKey {
return IbpKey.deserialize(bytes);
}
}
export class Point extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
x?: number;
y?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("x" in data && data.x != undefined) {
this.x = data.x;
}
if ("y" in data && data.y != undefined) {
this.y = data.y;
}
}
}
get x() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set x(value: number) {
pb_1.Message.setField(this, 1, value);
}
get y() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set y(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
x?: number;
y?: number;
}): Point {
const message = new Point({});
if (data.x != null) {
message.x = data.x;
}
if (data.y != null) {
message.y = data.y;
}
return message;
}
toObject() {
const data: {
x?: number;
y?: number;
} = {};
if (this.x != null) {
data.x = this.x;
}
if (this.y != null) {
data.y = this.y;
}
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.x != 0)
writer.writeFloat(1, this.x);
if (this.y != 0)
writer.writeFloat(2, this.y);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Point {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Point();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.x = reader.readFloat();
break;
case 2:
message.y = reader.readFloat();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Point {
return Point.deserialize(bytes);
}
}
export class IbpArrow extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
common?: dependency_1.graphicData.CommonInfo;
code?: string;
points?: Point[];
}) {
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 ("common" in data && data.common != undefined) {
this.common = data.common;
}
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("points" in data && data.points != undefined) {
this.points = data.points;
}
}
}
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 code() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 2, value);
}
get points() {
return pb_1.Message.getRepeatedWrapperField(this, Point, 3) as Point[];
}
set points(value: Point[]) {
pb_1.Message.setRepeatedWrapperField(this, 3, value);
}
static fromObject(data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
}): IbpArrow {
const message = new IbpArrow({});
if (data.common != null) {
message.common = dependency_1.graphicData.CommonInfo.fromObject(data.common);
}
if (data.code != null) {
message.code = data.code;
}
if (data.points != null) {
message.points = data.points.map(item => Point.fromObject(item));
}
return message;
}
toObject() {
const data: {
common?: ReturnType<typeof dependency_1.graphicData.CommonInfo.prototype.toObject>;
code?: string;
points?: ReturnType<typeof Point.prototype.toObject>[];
} = {};
if (this.common != null) {
data.common = this.common.toObject();
}
if (this.code != null) {
data.code = this.code;
}
if (this.points != null) {
data.points = this.points.map((item: Point) => 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.has_common)
writer.writeMessage(1, this.common, () => this.common.serialize(writer));
if (this.code.length)
writer.writeString(2, this.code);
if (this.points.length)
writer.writeRepeatedMessage(3, this.points, (item: Point) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpArrow {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpArrow();
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.code = reader.readString();
break;
case 3:
reader.readMessage(message.points, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Point.deserialize(reader), Point));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): IbpArrow {
return IbpArrow.deserialize(bytes);
}
}
} }