diff --git a/src/components/draw-app/FireAlarmDrawProperties.vue b/src/components/draw-app/FireAlarmDrawProperties.vue deleted file mode 100644 index 9ca8103..0000000 --- a/src/components/draw-app/FireAlarmDrawProperties.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - {{ drawStore.drawGraphicName + ' 模板' }} - - - - - - - - - - {{ drawStore.selectedObjName + ' 属性' }} - - - - - - - - - - - - - - - - - - - - - diff --git a/src/drawApp/fasApp.ts b/src/drawApp/fasApp.ts deleted file mode 100644 index 4bbd13a..0000000 --- a/src/drawApp/fasApp.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { - CombinationKey, - IDrawApp, - IGraphicStorage, - JlGraphic, - KeyListener, - newDrawApp, -} from 'jl-graphic'; -import { FASGraphicData } from 'src/protos/fas_graphic_data'; -import { fromUint8Array } from 'js-base64'; -import { - initCommonDrawApp, - saveCommonDrawDatas, - saveDrawToServer, -} from './commonApp'; -import { useDrawStore } from 'src/stores/draw-store'; - -let drawApp: IDrawApp | null = null; - -export function getFASDrawApp(): IDrawApp | null { - return drawApp; -} - -export function destroyFASDrawApp(): void { - if (drawApp) { - drawApp.destroy(); - drawApp = null; - } -} - -export function initFASDrawApp(): IDrawApp { - const isSupportDeletion = (g: JlGraphic) => { - console.log(g); - return true; - }; - drawApp = newDrawApp({ - dataLoader: loadDrawDatas, - isSupportDeletion: isSupportDeletion, - }); - const app = drawApp; - initCommonDrawApp(app); - // new CCTVButtonDraw(app, new CCTVButtonTemplate(new CCTVButtonData())); - - app.addKeyboardListener( - new KeyListener({ - value: 'KeyS', - global: true, - combinations: [CombinationKey.Ctrl], - onPress: () => { - saveDrawToServer(saveDrawDatas(app)); - }, - }) - ); - return drawApp; -} - -export async function loadDrawDatas(): Promise { - const drawStore = useDrawStore(); - const id = drawStore.draftId; - if (!id) { - throw new Error('获取数据异常:为获取到草稿地图ID'); - } - /* const { proto: base64 } = await getDraft(id); - if (base64) { - const storage = iscsGraphicData.IscsGraphicStorage.deserialize( - toUint8Array(base64) - ); - const datas = loadCommonDrawDatas(storage);} */ - return Promise.resolve({ - datas: [], - }); -} - -export function saveDrawDatas(app: IDrawApp) { - let storage = new FASGraphicData.FASGraphicStorage(); - storage = saveCommonDrawDatas( - app, - storage - ) as FASGraphicData.FASGraphicStorage; - const graphics = app.queryStore.getAllGraphics(); - /* graphics.forEach((g) => { - if (TrackSection.Type === g.type) { - const trackSectionData = (g as TrackSection).saveData(); - storage.trackSections.push((trackSectionData as TrackSectionData).data); - } }) */ - console.log(storage, '保存数据', graphics); - const base64 = fromUint8Array(storage.serialize()); - return base64; -} diff --git a/src/layouts/FASDrawLayout.vue b/src/layouts/FASDrawLayout.vue deleted file mode 100644 index 2f6907e..0000000 --- a/src/layouts/FASDrawLayout.vue +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - {{ item.label }} - - - - - - - {{ ctl.tip }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 另存为 - - - - - - - - - - - - - - - - - diff --git a/src/protos/fas_graphic_data.ts b/src/protos/fas_graphic_data.ts deleted file mode 100644 index a1c4181..0000000 --- a/src/protos/fas_graphic_data.ts +++ /dev/null @@ -1,682 +0,0 @@ -/** - * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 5.27.4 - * source: fas_graphic_data.proto - * git: https://github.com/thesayyn/protoc-gen-ts */ -import * as dependency_1 from "./iscs_graphic_data"; -import * as pb_1 from "google-protobuf"; -export namespace FASGraphicData { - export class FASGraphicStorage extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - canvas?: dependency_1.iscsGraphicData.Canvas; - arrows?: dependency_1.iscsGraphicData.Arrow[]; - iscsTexts?: dependency_1.iscsGraphicData.IscsText[]; - rects?: dependency_1.iscsGraphicData.Rect[]; - manualAlarmButtons?: ManualAlarmButton[]; - hydrantAlarmButtons?: HydrantAlarmButton[]; - gasExtinguishings?: GasExtinguishing[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 7], this.#one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("canvas" in data && data.canvas != undefined) { - this.canvas = data.canvas; - } - if ("arrows" in data && data.arrows != undefined) { - this.arrows = data.arrows; - } - if ("iscsTexts" in data && data.iscsTexts != undefined) { - this.iscsTexts = data.iscsTexts; - } - if ("rects" in data && data.rects != undefined) { - this.rects = data.rects; - } - if ("manualAlarmButtons" in data && data.manualAlarmButtons != undefined) { - this.manualAlarmButtons = data.manualAlarmButtons; - } - if ("hydrantAlarmButtons" in data && data.hydrantAlarmButtons != undefined) { - this.hydrantAlarmButtons = data.hydrantAlarmButtons; - } - if ("gasExtinguishings" in data && data.gasExtinguishings != undefined) { - this.gasExtinguishings = data.gasExtinguishings; - } - } - } - get canvas() { - return pb_1.Message.getWrapperField(this, dependency_1.iscsGraphicData.Canvas, 1) as dependency_1.iscsGraphicData.Canvas; - } - set canvas(value: dependency_1.iscsGraphicData.Canvas) { - pb_1.Message.setWrapperField(this, 1, value); - } - get has_canvas() { - return pb_1.Message.getField(this, 1) != null; - } - get arrows() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.iscsGraphicData.Arrow, 2) as dependency_1.iscsGraphicData.Arrow[]; - } - set arrows(value: dependency_1.iscsGraphicData.Arrow[]) { - pb_1.Message.setRepeatedWrapperField(this, 2, value); - } - get iscsTexts() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.iscsGraphicData.IscsText, 3) as dependency_1.iscsGraphicData.IscsText[]; - } - set iscsTexts(value: dependency_1.iscsGraphicData.IscsText[]) { - pb_1.Message.setRepeatedWrapperField(this, 3, value); - } - get rects() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.iscsGraphicData.Rect, 4) as dependency_1.iscsGraphicData.Rect[]; - } - set rects(value: dependency_1.iscsGraphicData.Rect[]) { - pb_1.Message.setRepeatedWrapperField(this, 4, value); - } - get manualAlarmButtons() { - return pb_1.Message.getRepeatedWrapperField(this, ManualAlarmButton, 5) as ManualAlarmButton[]; - } - set manualAlarmButtons(value: ManualAlarmButton[]) { - pb_1.Message.setRepeatedWrapperField(this, 5, value); - } - get hydrantAlarmButtons() { - return pb_1.Message.getRepeatedWrapperField(this, HydrantAlarmButton, 6) as HydrantAlarmButton[]; - } - set hydrantAlarmButtons(value: HydrantAlarmButton[]) { - pb_1.Message.setRepeatedWrapperField(this, 6, value); - } - get gasExtinguishings() { - return pb_1.Message.getRepeatedWrapperField(this, GasExtinguishing, 7) as GasExtinguishing[]; - } - set gasExtinguishings(value: GasExtinguishing[]) { - pb_1.Message.setRepeatedWrapperField(this, 7, value); - } - static fromObject(data: { - canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; - manualAlarmButtons?: ReturnType[]; - hydrantAlarmButtons?: ReturnType[]; - gasExtinguishings?: ReturnType[]; - }): FASGraphicStorage { - const message = new FASGraphicStorage({}); - if (data.canvas != null) { - message.canvas = dependency_1.iscsGraphicData.Canvas.fromObject(data.canvas); - } - if (data.arrows != null) { - message.arrows = data.arrows.map(item => dependency_1.iscsGraphicData.Arrow.fromObject(item)); - } - if (data.iscsTexts != null) { - message.iscsTexts = data.iscsTexts.map(item => dependency_1.iscsGraphicData.IscsText.fromObject(item)); - } - if (data.rects != null) { - message.rects = data.rects.map(item => dependency_1.iscsGraphicData.Rect.fromObject(item)); - } - if (data.manualAlarmButtons != null) { - message.manualAlarmButtons = data.manualAlarmButtons.map(item => ManualAlarmButton.fromObject(item)); - } - if (data.hydrantAlarmButtons != null) { - message.hydrantAlarmButtons = data.hydrantAlarmButtons.map(item => HydrantAlarmButton.fromObject(item)); - } - if (data.gasExtinguishings != null) { - message.gasExtinguishings = data.gasExtinguishings.map(item => GasExtinguishing.fromObject(item)); - } - return message; - } - toObject() { - const data: { - canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; - manualAlarmButtons?: ReturnType[]; - hydrantAlarmButtons?: ReturnType[]; - gasExtinguishings?: ReturnType[]; - } = {}; - if (this.canvas != null) { - data.canvas = this.canvas.toObject(); - } - if (this.arrows != null) { - data.arrows = this.arrows.map((item: dependency_1.iscsGraphicData.Arrow) => item.toObject()); - } - if (this.iscsTexts != null) { - data.iscsTexts = this.iscsTexts.map((item: dependency_1.iscsGraphicData.IscsText) => item.toObject()); - } - if (this.rects != null) { - data.rects = this.rects.map((item: dependency_1.iscsGraphicData.Rect) => item.toObject()); - } - if (this.manualAlarmButtons != null) { - data.manualAlarmButtons = this.manualAlarmButtons.map((item: ManualAlarmButton) => item.toObject()); - } - if (this.hydrantAlarmButtons != null) { - data.hydrantAlarmButtons = this.hydrantAlarmButtons.map((item: HydrantAlarmButton) => item.toObject()); - } - if (this.gasExtinguishings != null) { - data.gasExtinguishings = this.gasExtinguishings.map((item: GasExtinguishing) => 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_canvas) - writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer)); - if (this.arrows.length) - writer.writeRepeatedMessage(2, this.arrows, (item: dependency_1.iscsGraphicData.Arrow) => item.serialize(writer)); - if (this.iscsTexts.length) - writer.writeRepeatedMessage(3, this.iscsTexts, (item: dependency_1.iscsGraphicData.IscsText) => item.serialize(writer)); - if (this.rects.length) - writer.writeRepeatedMessage(4, this.rects, (item: dependency_1.iscsGraphicData.Rect) => item.serialize(writer)); - if (this.manualAlarmButtons.length) - writer.writeRepeatedMessage(5, this.manualAlarmButtons, (item: ManualAlarmButton) => item.serialize(writer)); - if (this.hydrantAlarmButtons.length) - writer.writeRepeatedMessage(6, this.hydrantAlarmButtons, (item: HydrantAlarmButton) => item.serialize(writer)); - if (this.gasExtinguishings.length) - writer.writeRepeatedMessage(7, this.gasExtinguishings, (item: GasExtinguishing) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FASGraphicStorage { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FASGraphicStorage(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.canvas, () => message.canvas = dependency_1.iscsGraphicData.Canvas.deserialize(reader)); - break; - case 2: - reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.iscsGraphicData.Arrow.deserialize(reader), dependency_1.iscsGraphicData.Arrow)); - break; - case 3: - reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.iscsGraphicData.IscsText.deserialize(reader), dependency_1.iscsGraphicData.IscsText)); - break; - case 4: - reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.iscsGraphicData.Rect.deserialize(reader), dependency_1.iscsGraphicData.Rect)); - break; - case 5: - reader.readMessage(message.manualAlarmButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 5, ManualAlarmButton.deserialize(reader), ManualAlarmButton)); - break; - case 6: - reader.readMessage(message.hydrantAlarmButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 6, HydrantAlarmButton.deserialize(reader), HydrantAlarmButton)); - break; - case 7: - reader.readMessage(message.gasExtinguishings, () => pb_1.Message.addToRepeatedWrapperField(message, 7, GasExtinguishing.deserialize(reader), GasExtinguishing)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): FASGraphicStorage { - return FASGraphicStorage.deserialize(bytes); - } - } - export class ManualAlarmButton extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: dependency_1.iscsGraphicData.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.iscsGraphicData.CommonInfo, 1) as dependency_1.iscsGraphicData.CommonInfo; - } - set common(value: dependency_1.iscsGraphicData.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; - code?: string; - }): ManualAlarmButton { - const message = new ManualAlarmButton({}); - if (data.common != null) { - message.common = dependency_1.iscsGraphicData.CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - 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): ManualAlarmButton { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ManualAlarmButton(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = dependency_1.iscsGraphicData.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): ManualAlarmButton { - return ManualAlarmButton.deserialize(bytes); - } - } - export class HydrantAlarmButton extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: dependency_1.iscsGraphicData.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.iscsGraphicData.CommonInfo, 1) as dependency_1.iscsGraphicData.CommonInfo; - } - set common(value: dependency_1.iscsGraphicData.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; - code?: string; - }): HydrantAlarmButton { - const message = new HydrantAlarmButton({}); - if (data.common != null) { - message.common = dependency_1.iscsGraphicData.CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - 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): HydrantAlarmButton { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new HydrantAlarmButton(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = dependency_1.iscsGraphicData.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): HydrantAlarmButton { - return HydrantAlarmButton.deserialize(bytes); - } - } - export class GasExtinguishing extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: dependency_1.iscsGraphicData.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.iscsGraphicData.CommonInfo, 1) as dependency_1.iscsGraphicData.CommonInfo; - } - set common(value: dependency_1.iscsGraphicData.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; - code?: string; - }): GasExtinguishing { - const message = new GasExtinguishing({}); - if (data.common != null) { - message.common = dependency_1.iscsGraphicData.CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - 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): GasExtinguishing { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GasExtinguishing(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = dependency_1.iscsGraphicData.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): GasExtinguishing { - return GasExtinguishing.deserialize(bytes); - } - } - export class SmokeDetector extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: dependency_1.iscsGraphicData.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.iscsGraphicData.CommonInfo, 1) as dependency_1.iscsGraphicData.CommonInfo; - } - set common(value: dependency_1.iscsGraphicData.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; - code?: string; - }): SmokeDetector { - const message = new SmokeDetector({}); - if (data.common != null) { - message.common = dependency_1.iscsGraphicData.CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - 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): SmokeDetector { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SmokeDetector(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = dependency_1.iscsGraphicData.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): SmokeDetector { - return SmokeDetector.deserialize(bytes); - } - } - export class TemperatureDetector extends pb_1.Message { - #one_of_decls: number[][] = []; - constructor(data?: any[] | { - common?: dependency_1.iscsGraphicData.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.iscsGraphicData.CommonInfo, 1) as dependency_1.iscsGraphicData.CommonInfo; - } - set common(value: dependency_1.iscsGraphicData.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; - code?: string; - }): TemperatureDetector { - const message = new TemperatureDetector({}); - if (data.common != null) { - message.common = dependency_1.iscsGraphicData.CommonInfo.fromObject(data.common); - } - if (data.code != null) { - message.code = data.code; - } - return message; - } - toObject() { - const data: { - common?: ReturnType; - 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): TemperatureDetector { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TemperatureDetector(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.common, () => message.common = dependency_1.iscsGraphicData.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): TemperatureDetector { - return TemperatureDetector.deserialize(bytes); - } - } -}