From c0cc5fac147c04b2c6c195f6775a23cda05a2fbb Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 10 Oct 2024 15:11:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9protoc=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtss-proto-msg | 2 +- src/api/DraftApi.ts | 2 +- .../draw-app/properties/RectProperty.vue | 36 +- src/drawApp/commonApp.ts | 44 +- .../graphics/IscsTextContentInteraction.ts | 8 +- src/drawApp/graphics/RectInteraction.ts | 12 + src/drawApp/iscsApp.ts | 40 +- src/graphics/rect/Rect.ts | 12 + src/graphics/rect/RectDrawAssistant.ts | 21 +- src/protos/iscs_graphic_data.ts | 456 ++++++++++-------- yarn.lock | 6 +- 11 files changed, 369 insertions(+), 270 deletions(-) diff --git a/rtss-proto-msg b/rtss-proto-msg index 49c235a..ea8b911 160000 --- a/rtss-proto-msg +++ b/rtss-proto-msg @@ -1 +1 @@ -Subproject commit 49c235a66f0f6a89c68039bd904eadd9497f8219 +Subproject commit ea8b911846b63f649a254250ba81c7a804da332a diff --git a/src/api/DraftApi.ts b/src/api/DraftApi.ts index 238a2b2..3e27519 100644 --- a/src/api/DraftApi.ts +++ b/src/api/DraftApi.ts @@ -93,7 +93,7 @@ export async function sharedDraftPageQuery( sharedDraftIscsDataPaging(paging: $paging, query: $query) { total items { - draftData {id name dataType userName defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} + draftData {id name dataType userName userId defaultReleaseDataId createdAt updatedAt isShared defaultReleaseDataName} options {style} } } diff --git a/src/components/draw-app/properties/RectProperty.vue b/src/components/draw-app/properties/RectProperty.vue index a86742e..1c19de2 100644 --- a/src/components/draw-app/properties/RectProperty.vue +++ b/src/components/draw-app/properties/RectProperty.vue @@ -8,7 +8,7 @@ @blur="onUpdate" label="线宽" lazy-rules - :rules="[(val) => (val && val > 0) || '画布宽必须大于0']" + :rules="[(val) => (val && val > 0) || '线宽必须大于0']" /> + + + + { + storage.commonGraphicStorage.arrows.forEach((arrow) => { datas.push(new ArrowData(arrow)); }); - storage.iscsTexts.forEach((iscsText) => { + storage.commonGraphicStorage.texts.forEach((iscsText) => { datas.push(new IscsTextData(iscsText)); }); - storage.rects.forEach((rect) => { + storage.commonGraphicStorage.rects.forEach((rect) => { datas.push(new RectData(rect)); }); - storage.lines.forEach((line) => { + storage.commonGraphicStorage.lines.forEach((line) => { datas.push(new LineData(line)); }); return datas; @@ -113,16 +115,16 @@ export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) { graphics.forEach((g) => { if (g instanceof Arrow) { const arrowData = g.saveData(); - storage.arrows.push((arrowData as ArrowData).data); + storage.commonGraphicStorage.arrows.push((arrowData as ArrowData).data); } else if (g instanceof TextContent) { const textContentData = g.saveData(); - storage.iscsTexts.push((textContentData as IscsTextData).data); + storage.commonGraphicStorage.texts.push((textContentData as IscsTextData).data); } else if (g instanceof Rect) { const rectData = g.saveData(); - storage.rects.push((rectData as RectData).data); + storage.commonGraphicStorage.rects.push((rectData as RectData).data); } else if (g instanceof Line) { const lineData = g.saveData(); - storage.lines.push((lineData as LineData).data); + storage.commonGraphicStorage.lines.push((lineData as LineData).data); } }); @@ -162,7 +164,7 @@ export function handlerCommonTypeData(data: sync_data_message.UpdataData) { case Arrow.Type: return new ArrowData(iscsGraphicData.Arrow.deserialize(data.data)); case TextContent.Type: - return new IscsTextData(iscsGraphicData.IscsText.deserialize(data.data)); + return new IscsTextData(iscsGraphicData.Text.deserialize(data.data)); } } @@ -176,27 +178,27 @@ export function handlerNoEditCommonData( const rectData = iscsGraphicData.Rect.deserialize(data.data); // syncNoEditData(operationType, rectData, storage.rects); if (operationType === 'graphic-create') { - storage.rects.push(rectData); + storage.commonGraphicStorage.rects.push(rectData); } else if (operationType === 'graphic-delete') { - const index = storage.rects.findIndex( + const index = storage.commonGraphicStorage.rects.findIndex( (ele) => ele.common.id === rectData.common.id ); - storage.rects.splice(index, 1); + storage.commonGraphicStorage.rects.splice(index, 1); } else if (operationType === 'graphic-drag') { - const index = storage.rects.findIndex( + const index = storage.commonGraphicStorage.rects.findIndex( (ele) => ele.common.id === rectData.common.id ); - storage.rects[index] = rectData; + storage.commonGraphicStorage.rects[index] = rectData; } console.log(rectData, storage); break; case Arrow.Type: const arrowData = iscsGraphicData.Arrow.deserialize(data.data); - syncNoEditData(operationType, arrowData, storage.arrows); + syncNoEditData(operationType, arrowData, storage.commonGraphicStorage.arrows); break; case TextContent.Type: - const iscsTextData = iscsGraphicData.IscsText.deserialize(data.data); - syncNoEditData(operationType, iscsTextData, storage.iscsTexts); + const iscsTextData = iscsGraphicData.Text.deserialize(data.data); + syncNoEditData(operationType, iscsTextData, storage.commonGraphicStorage.texts); break; } } diff --git a/src/drawApp/graphics/IscsTextContentInteraction.ts b/src/drawApp/graphics/IscsTextContentInteraction.ts index f5f8874..83872c6 100644 --- a/src/drawApp/graphics/IscsTextContentInteraction.ts +++ b/src/drawApp/graphics/IscsTextContentInteraction.ts @@ -7,20 +7,20 @@ import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; import { GraphicDataBase } from './GraphicDataBase'; export class IscsTextData extends GraphicDataBase implements ITextContentData { - constructor(data?: iscsGraphicData.IscsText) { + constructor(data?: iscsGraphicData.Text) { let pslText; if (data) { pslText = data; } else { - pslText = new iscsGraphicData.IscsText({ + pslText = new iscsGraphicData.Text({ common: GraphicDataBase.defaultCommonInfo(TextContent.Type), }); } super(pslText); } - public get data(): iscsGraphicData.IscsText { - return this.getData(); + public get data(): iscsGraphicData.Text { + return this.getData(); } get code(): string { diff --git a/src/drawApp/graphics/RectInteraction.ts b/src/drawApp/graphics/RectInteraction.ts index 1e14626..3af5f68 100644 --- a/src/drawApp/graphics/RectInteraction.ts +++ b/src/drawApp/graphics/RectInteraction.ts @@ -64,6 +64,18 @@ export class RectData extends GraphicDataBase implements IRectData { set radius(v: number) { this.data.radius = v; } + get fillColor(): string { + return this.data.fillColor; + } + set fillColor(v: string) { + this.data.fillColor = v; + } + get alpha(): number { + return this.data.alpha; + } + set alpha(v: number) { + this.data.alpha = v; + } clone(): RectData { return new RectData(this.data.cloneMessage()); } diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts index 6a781ce..042de0d 100644 --- a/src/drawApp/iscsApp.ts +++ b/src/drawApp/iscsApp.ts @@ -125,8 +125,8 @@ function handleSubscribe(app: IDrawApp) { toUint8Array(base64) ); if (syncData.submenu === '火灾报警平面图') { - for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) { - const fasPlatformAlarm = storage.fasPlatformAlarmStorages[i]; + for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { + const fasPlatformAlarm = storage.fasOfPlatformAlarmStorages[i]; if (fasPlatformAlarm.stationName == syncData.station) { // canvasProperty = fasPlatformAlarm.canvas; // datas = loadCommonDrawDatas(fasPlatformAlarm); @@ -138,7 +138,7 @@ function handleSubscribe(app: IDrawApp) { syncData.operationType ); }); - storage.fasPlatformAlarmStorages[i] = fasPlatformAlarm; + storage.fasOfPlatformAlarmStorages[i] = fasPlatformAlarm; console.log(fasPlatformAlarm, 'fasPlatformAlarm'); } } @@ -216,14 +216,14 @@ export async function loadDrawDatas(): Promise { switch (drawStore.selectSubmenuAndStation.submenu) { case '火灾报警平面图': - for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) { - const fasPlatformAlarm = storage.fasPlatformAlarmStorages[i]; + for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { + const fasOfPlatformAlarm = storage.fasOfPlatformAlarmStorages[i]; if ( - fasPlatformAlarm.stationName == + fasOfPlatformAlarm.stationName == drawStore.selectSubmenuAndStation.station ) { - canvasProperty = fasPlatformAlarm.canvas; - datas = loadCommonDrawDatas(fasPlatformAlarm); + canvasProperty = fasOfPlatformAlarm.canvas; + datas = loadCommonDrawDatas(fasOfPlatformAlarm); break; } } @@ -266,11 +266,12 @@ export function saveDrawDatas(app: IDrawApp) { if (!storage) { storage = new iscsGraphicData.IscsGraphicStorage(); } - if (!storage?.fasPlatformAlarmStorages.length) { + if (!storage?.fasOfPlatformAlarmStorages.length) { stationOption.forEach((station) => - storage?.fasPlatformAlarmStorages.push( - new iscsGraphicData.FASPlatformAlarmStorage({ + storage?.fasOfPlatformAlarmStorages.push( + new iscsGraphicData.FASOfPlatformAlarmStorage({ stationName: station, + commonGraphicStorage: new iscsGraphicData.CommonGraphicStorage(), }) ) ); @@ -280,26 +281,28 @@ export function saveDrawDatas(app: IDrawApp) { storage?.cctvOfStationControlStorages.push( new iscsGraphicData.CCTVOfStationControlStorage({ stationName: station, + commonGraphicStorage: new iscsGraphicData.CommonGraphicStorage(), }) ) ); } switch (drawStore.selectSubmenuAndStation.submenu) { case '火灾报警平面图': - for (let i = 0; i < storage.fasPlatformAlarmStorages.length; i++) { - let fasPlatformAlarm = storage.fasPlatformAlarmStorages[i]; + for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { + let fasOfPlatformAlarm = storage.fasOfPlatformAlarmStorages[i]; if ( - fasPlatformAlarm.stationName == + fasOfPlatformAlarm.stationName == drawStore.selectSubmenuAndStation.station ) { - fasPlatformAlarm = new iscsGraphicData.FASPlatformAlarmStorage({ + fasOfPlatformAlarm = new iscsGraphicData.FASOfPlatformAlarmStorage({ stationName: drawStore.selectSubmenuAndStation.station, + commonGraphicStorage: new iscsGraphicData.CommonGraphicStorage(), }); const fasStorage = saveCommonDrawDatas( app, - fasPlatformAlarm - ) as iscsGraphicData.FASPlatformAlarmStorage; - storage.fasPlatformAlarmStorages[i] = fasStorage; + fasOfPlatformAlarm + ) as iscsGraphicData.FASOfPlatformAlarmStorage; + storage.fasOfPlatformAlarmStorages[i] = fasStorage; break; } } @@ -314,6 +317,7 @@ export function saveDrawDatas(app: IDrawApp) { cctvOfStationControl = new iscsGraphicData.CCTVOfStationControlStorage({ stationName: drawStore.selectSubmenuAndStation.station, + commonGraphicStorage: new iscsGraphicData.CommonGraphicStorage(), }); const cctvStorage = saveCommonDrawDatas( app, diff --git a/src/graphics/rect/Rect.ts b/src/graphics/rect/Rect.ts index c9704ef..dfa1c9e 100644 --- a/src/graphics/rect/Rect.ts +++ b/src/graphics/rect/Rect.ts @@ -21,6 +21,10 @@ export interface IRectData extends GraphicData { set height(v: number); get radius(): number; // 圆角半径 set radius(v: number); + get fillColor(): string; // 填充色 + set fillColor(v: string); + get alpha(): number; // 透明度 + set alpha(v: number); clone(): IRectData; copyFrom(data: IRectData): void; eq(other: IRectData): boolean; @@ -29,6 +33,8 @@ export interface IRectData extends GraphicData { const rectConsts = { lineWidth: 2, lineColor: '0xff0000', + fillColor: '0xff0000', + alpha: 0.001, }; export class Rect extends JlGraphic { @@ -50,6 +56,7 @@ export class Rect extends JlGraphic { new Color(this.datas.lineColor) ); const radius = this.datas?.radius || 0; + rectGraphic.beginFill(this.datas.fillColor, this.datas.alpha); rectGraphic.drawRoundedRect( 0, 0, @@ -57,6 +64,7 @@ export class Rect extends JlGraphic { this.datas.height, radius ); + rectGraphic.endFill; rectGraphic.pivot = getRectangleCenter( new Rectangle(0, 0, this.datas.width, this.datas.height) ); @@ -86,12 +94,16 @@ export class Rect extends JlGraphic { export class RectTemplate extends JlGraphicTemplate { lineWidth: number; lineColor: string; + fillColor: string; + alpha: number; constructor(dataTemplate: IRectData) { super(Rect.Type, { dataTemplate, }); this.lineWidth = rectConsts.lineWidth; this.lineColor = rectConsts.lineColor; + this.fillColor = rectConsts.fillColor; + this.alpha = rectConsts.alpha; } new(): Rect { return new Rect(); diff --git a/src/graphics/rect/RectDrawAssistant.ts b/src/graphics/rect/RectDrawAssistant.ts index fff9f55..4faf128 100644 --- a/src/graphics/rect/RectDrawAssistant.ts +++ b/src/graphics/rect/RectDrawAssistant.ts @@ -1,10 +1,9 @@ -import { FederatedPointerEvent, Graphics, Point, IHitArea } from 'pixi.js'; +import { FederatedPointerEvent, Graphics, Point } from 'pixi.js'; import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic, - pointBox, } from 'jl-graphic'; import { IRectData, Rect, RectTemplate } from './Rect'; @@ -65,27 +64,14 @@ export class RectDraw extends GraphicDrawAssistant { data.point = new Point(x, y); data.lineWidth = template.lineWidth; data.lineColor = template.lineColor; + data.fillColor = template.fillColor; + data.alpha = template.alpha; data.width = width; data.height = height; return true; } } -//碰撞检测 -export class RectGraphicHitArea implements IHitArea { - rect: Rect; - constructor(rect: Rect) { - this.rect = rect; - } - contains(x: number, y: number): boolean { - const boxRect = this.rect.getLocalBounds(); - let contains = false; - const p = new Point(x, y); - contains = contains || pointBox(p, boxRect); - return contains; - } -} - export class rectInteraction extends GraphicInteractionPlugin { static Name = 'platform_transform'; constructor(app: IDrawApp) { @@ -102,7 +88,6 @@ export class rectInteraction extends GraphicInteractionPlugin { g.cursor = 'pointer'; g.scalable = true; g.rotatable = true; - g.rectGraphic.hitArea = new RectGraphicHitArea(g); } unbind(g: Rect): void { g.eventMode = 'none'; diff --git a/src/protos/iscs_graphic_data.ts b/src/protos/iscs_graphic_data.ts index 0606f14..cd45fc6 100644 --- a/src/protos/iscs_graphic_data.ts +++ b/src/protos/iscs_graphic_data.ts @@ -10,7 +10,7 @@ export namespace iscsGraphicData { #one_of_decls: number[][] = []; constructor(data?: any[] | { cctvOfStationControlStorages?: CCTVOfStationControlStorage[]; - fasPlatformAlarmStorages?: FASPlatformAlarmStorage[]; + fasOfPlatformAlarmStorages?: FASOfPlatformAlarmStorage[]; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls); @@ -18,8 +18,8 @@ export namespace iscsGraphicData { if ("cctvOfStationControlStorages" in data && data.cctvOfStationControlStorages != undefined) { this.cctvOfStationControlStorages = data.cctvOfStationControlStorages; } - if ("fasPlatformAlarmStorages" in data && data.fasPlatformAlarmStorages != undefined) { - this.fasPlatformAlarmStorages = data.fasPlatformAlarmStorages; + if ("fasOfPlatformAlarmStorages" in data && data.fasOfPlatformAlarmStorages != undefined) { + this.fasOfPlatformAlarmStorages = data.fasOfPlatformAlarmStorages; } } } @@ -29,35 +29,35 @@ export namespace iscsGraphicData { set cctvOfStationControlStorages(value: CCTVOfStationControlStorage[]) { pb_1.Message.setRepeatedWrapperField(this, 1, value); } - get fasPlatformAlarmStorages() { - return pb_1.Message.getRepeatedWrapperField(this, FASPlatformAlarmStorage, 2) as FASPlatformAlarmStorage[]; + get fasOfPlatformAlarmStorages() { + return pb_1.Message.getRepeatedWrapperField(this, FASOfPlatformAlarmStorage, 2) as FASOfPlatformAlarmStorage[]; } - set fasPlatformAlarmStorages(value: FASPlatformAlarmStorage[]) { + set fasOfPlatformAlarmStorages(value: FASOfPlatformAlarmStorage[]) { pb_1.Message.setRepeatedWrapperField(this, 2, value); } static fromObject(data: { cctvOfStationControlStorages?: ReturnType[]; - fasPlatformAlarmStorages?: ReturnType[]; + fasOfPlatformAlarmStorages?: ReturnType[]; }): IscsGraphicStorage { const message = new IscsGraphicStorage({}); if (data.cctvOfStationControlStorages != null) { message.cctvOfStationControlStorages = data.cctvOfStationControlStorages.map(item => CCTVOfStationControlStorage.fromObject(item)); } - if (data.fasPlatformAlarmStorages != null) { - message.fasPlatformAlarmStorages = data.fasPlatformAlarmStorages.map(item => FASPlatformAlarmStorage.fromObject(item)); + if (data.fasOfPlatformAlarmStorages != null) { + message.fasOfPlatformAlarmStorages = data.fasOfPlatformAlarmStorages.map(item => FASOfPlatformAlarmStorage.fromObject(item)); } return message; } toObject() { const data: { cctvOfStationControlStorages?: ReturnType[]; - fasPlatformAlarmStorages?: ReturnType[]; + fasOfPlatformAlarmStorages?: ReturnType[]; } = {}; if (this.cctvOfStationControlStorages != null) { data.cctvOfStationControlStorages = this.cctvOfStationControlStorages.map((item: CCTVOfStationControlStorage) => item.toObject()); } - if (this.fasPlatformAlarmStorages != null) { - data.fasPlatformAlarmStorages = this.fasPlatformAlarmStorages.map((item: FASPlatformAlarmStorage) => item.toObject()); + if (this.fasOfPlatformAlarmStorages != null) { + data.fasOfPlatformAlarmStorages = this.fasOfPlatformAlarmStorages.map((item: FASOfPlatformAlarmStorage) => item.toObject()); } return data; } @@ -67,8 +67,8 @@ export namespace iscsGraphicData { const writer = w || new pb_1.BinaryWriter(); if (this.cctvOfStationControlStorages.length) writer.writeRepeatedMessage(1, this.cctvOfStationControlStorages, (item: CCTVOfStationControlStorage) => item.serialize(writer)); - if (this.fasPlatformAlarmStorages.length) - writer.writeRepeatedMessage(2, this.fasPlatformAlarmStorages, (item: FASPlatformAlarmStorage) => item.serialize(writer)); + if (this.fasOfPlatformAlarmStorages.length) + writer.writeRepeatedMessage(2, this.fasOfPlatformAlarmStorages, (item: FASOfPlatformAlarmStorage) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -82,7 +82,7 @@ export namespace iscsGraphicData { reader.readMessage(message.cctvOfStationControlStorages, () => pb_1.Message.addToRepeatedWrapperField(message, 1, CCTVOfStationControlStorage.deserialize(reader), CCTVOfStationControlStorage)); break; case 2: - reader.readMessage(message.fasPlatformAlarmStorages, () => pb_1.Message.addToRepeatedWrapperField(message, 2, FASPlatformAlarmStorage.deserialize(reader), FASPlatformAlarmStorage)); + reader.readMessage(message.fasOfPlatformAlarmStorages, () => pb_1.Message.addToRepeatedWrapperField(message, 2, FASOfPlatformAlarmStorage.deserialize(reader), FASOfPlatformAlarmStorage)); break; default: reader.skipField(); } @@ -209,6 +209,142 @@ export namespace iscsGraphicData { return UniqueIdOfStationLayout.deserialize(bytes); } } + export class CommonGraphicStorage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + arrows?: Arrow[]; + texts?: Text[]; + rects?: Rect[]; + lines?: Line[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("arrows" in data && data.arrows != undefined) { + this.arrows = data.arrows; + } + if ("texts" in data && data.texts != undefined) { + this.texts = data.texts; + } + if ("rects" in data && data.rects != undefined) { + this.rects = data.rects; + } + if ("lines" in data && data.lines != undefined) { + this.lines = data.lines; + } + } + } + get arrows() { + return pb_1.Message.getRepeatedWrapperField(this, Arrow, 1) as Arrow[]; + } + set arrows(value: Arrow[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + get texts() { + return pb_1.Message.getRepeatedWrapperField(this, Text, 2) as Text[]; + } + set texts(value: Text[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + get rects() { + return pb_1.Message.getRepeatedWrapperField(this, Rect, 3) as Rect[]; + } + set rects(value: Rect[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get lines() { + return pb_1.Message.getRepeatedWrapperField(this, Line, 4) as Line[]; + } + set lines(value: Line[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value); + } + static fromObject(data: { + arrows?: ReturnType[]; + texts?: ReturnType[]; + rects?: ReturnType[]; + lines?: ReturnType[]; + }): CommonGraphicStorage { + const message = new CommonGraphicStorage({}); + if (data.arrows != null) { + message.arrows = data.arrows.map(item => Arrow.fromObject(item)); + } + if (data.texts != null) { + message.texts = data.texts.map(item => Text.fromObject(item)); + } + if (data.rects != null) { + message.rects = data.rects.map(item => Rect.fromObject(item)); + } + if (data.lines != null) { + message.lines = data.lines.map(item => Line.fromObject(item)); + } + return message; + } + toObject() { + const data: { + arrows?: ReturnType[]; + texts?: ReturnType[]; + rects?: ReturnType[]; + lines?: ReturnType[]; + } = {}; + if (this.arrows != null) { + data.arrows = this.arrows.map((item: Arrow) => item.toObject()); + } + if (this.texts != null) { + data.texts = this.texts.map((item: Text) => item.toObject()); + } + if (this.rects != null) { + data.rects = this.rects.map((item: Rect) => item.toObject()); + } + if (this.lines != null) { + data.lines = this.lines.map((item: Line) => 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.arrows.length) + writer.writeRepeatedMessage(1, this.arrows, (item: Arrow) => item.serialize(writer)); + if (this.texts.length) + writer.writeRepeatedMessage(2, this.texts, (item: Text) => item.serialize(writer)); + if (this.rects.length) + writer.writeRepeatedMessage(3, this.rects, (item: Rect) => item.serialize(writer)); + if (this.lines.length) + writer.writeRepeatedMessage(4, this.lines, (item: Line) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CommonGraphicStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CommonGraphicStorage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 1, Arrow.deserialize(reader), Arrow)); + break; + case 2: + reader.readMessage(message.texts, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Text.deserialize(reader), Text)); + break; + case 3: + reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Rect.deserialize(reader), Rect)); + break; + case 4: + reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Line.deserialize(reader), Line)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): CommonGraphicStorage { + return CommonGraphicStorage.deserialize(bytes); + } + } export class Arrow extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { @@ -325,7 +461,7 @@ export namespace iscsGraphicData { return Arrow.deserialize(bytes); } } - export class IscsText extends pb_1.Message { + export class Text extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { common?: dependency_1.common.CommonInfo; @@ -393,8 +529,8 @@ export namespace iscsGraphicData { content?: string; color?: string; fontSize?: number; - }): IscsText { - const message = new IscsText({}); + }): Text { + const message = new Text({}); if (data.common != null) { message.common = dependency_1.common.CommonInfo.fromObject(data.common); } @@ -454,8 +590,8 @@ export namespace iscsGraphicData { if (!w) return writer.getResultBuffer(); } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IscsText { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IscsText(); + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Text { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Text(); while (reader.nextField()) { if (reader.isEndGroup()) break; @@ -483,8 +619,8 @@ export namespace iscsGraphicData { serializeBinary(): Uint8Array { return this.serialize(); } - static deserializeBinary(bytes: Uint8Array): IscsText { - return IscsText.deserialize(bytes); + static deserializeBinary(bytes: Uint8Array): Text { + return Text.deserialize(bytes); } } export class Rect extends pb_1.Message { @@ -498,6 +634,8 @@ export namespace iscsGraphicData { height?: number; radius?: number; point?: dependency_1.common.Point; + fillColor?: string; + alpha?: number; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -526,6 +664,12 @@ export namespace iscsGraphicData { if ("point" in data && data.point != undefined) { this.point = data.point; } + if ("fillColor" in data && data.fillColor != undefined) { + this.fillColor = data.fillColor; + } + if ("alpha" in data && data.alpha != undefined) { + this.alpha = data.alpha; + } } } get common() { @@ -582,6 +726,18 @@ export namespace iscsGraphicData { get has_point() { return pb_1.Message.getField(this, 8) != null; } + get fillColor() { + return pb_1.Message.getFieldWithDefault(this, 9, "") as string; + } + set fillColor(value: string) { + pb_1.Message.setField(this, 9, value); + } + get alpha() { + return pb_1.Message.getFieldWithDefault(this, 10, 0) as number; + } + set alpha(value: number) { + pb_1.Message.setField(this, 10, value); + } static fromObject(data: { common?: ReturnType; code?: string; @@ -591,6 +747,8 @@ export namespace iscsGraphicData { height?: number; radius?: number; point?: ReturnType; + fillColor?: string; + alpha?: number; }): Rect { const message = new Rect({}); if (data.common != null) { @@ -617,6 +775,12 @@ export namespace iscsGraphicData { if (data.point != null) { message.point = dependency_1.common.Point.fromObject(data.point); } + if (data.fillColor != null) { + message.fillColor = data.fillColor; + } + if (data.alpha != null) { + message.alpha = data.alpha; + } return message; } toObject() { @@ -629,6 +793,8 @@ export namespace iscsGraphicData { height?: number; radius?: number; point?: ReturnType; + fillColor?: string; + alpha?: number; } = {}; if (this.common != null) { data.common = this.common.toObject(); @@ -654,6 +820,12 @@ export namespace iscsGraphicData { if (this.point != null) { data.point = this.point.toObject(); } + if (this.fillColor != null) { + data.fillColor = this.fillColor; + } + if (this.alpha != null) { + data.alpha = this.alpha; + } return data; } serialize(): Uint8Array; @@ -676,6 +848,10 @@ export namespace iscsGraphicData { writer.writeInt32(7, this.radius); if (this.has_point) writer.writeMessage(8, this.point, () => this.point.serialize(writer)); + if (this.fillColor.length) + writer.writeString(9, this.fillColor); + if (this.alpha != 0) + writer.writeFloat(10, this.alpha); if (!w) return writer.getResultBuffer(); } @@ -709,6 +885,12 @@ export namespace iscsGraphicData { case 8: reader.readMessage(message.point, () => message.point = dependency_1.common.Point.deserialize(reader)); break; + case 9: + message.fillColor = reader.readString(); + break; + case 10: + message.alpha = reader.readFloat(); + break; default: reader.skipField(); } } @@ -1522,14 +1704,11 @@ export namespace iscsGraphicData { constructor(data?: any[] | { stationName?: string; canvas?: dependency_1.common.Canvas; - arrows?: Arrow[]; - iscsTexts?: IscsText[]; - rects?: Rect[]; + commonGraphicStorage?: CommonGraphicStorage; cctvButtons?: CCTVButton[]; - lines?: Line[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5, 6, 7], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("stationName" in data && data.stationName != undefined) { this.stationName = data.stationName; @@ -1537,21 +1716,12 @@ export namespace iscsGraphicData { 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 ("commonGraphicStorage" in data && data.commonGraphicStorage != undefined) { + this.commonGraphicStorage = data.commonGraphicStorage; } if ("cctvButtons" in data && data.cctvButtons != undefined) { this.cctvButtons = data.cctvButtons; } - if ("lines" in data && data.lines != undefined) { - this.lines = data.lines; - } } } get stationName() { @@ -1569,44 +1739,26 @@ export namespace iscsGraphicData { get has_canvas() { return pb_1.Message.getField(this, 2) != null; } - get arrows() { - return pb_1.Message.getRepeatedWrapperField(this, Arrow, 3) as Arrow[]; + get commonGraphicStorage() { + return pb_1.Message.getWrapperField(this, CommonGraphicStorage, 3) as CommonGraphicStorage; } - set arrows(value: Arrow[]) { - pb_1.Message.setRepeatedWrapperField(this, 3, value); + set commonGraphicStorage(value: CommonGraphicStorage) { + pb_1.Message.setWrapperField(this, 3, value); } - get iscsTexts() { - return pb_1.Message.getRepeatedWrapperField(this, IscsText, 4) as IscsText[]; - } - set iscsTexts(value: IscsText[]) { - pb_1.Message.setRepeatedWrapperField(this, 4, value); - } - get rects() { - return pb_1.Message.getRepeatedWrapperField(this, Rect, 5) as Rect[]; - } - set rects(value: Rect[]) { - pb_1.Message.setRepeatedWrapperField(this, 5, value); + get has_commonGraphicStorage() { + return pb_1.Message.getField(this, 3) != null; } get cctvButtons() { - return pb_1.Message.getRepeatedWrapperField(this, CCTVButton, 6) as CCTVButton[]; + return pb_1.Message.getRepeatedWrapperField(this, CCTVButton, 4) as CCTVButton[]; } set cctvButtons(value: CCTVButton[]) { - pb_1.Message.setRepeatedWrapperField(this, 6, value); - } - get lines() { - return pb_1.Message.getRepeatedWrapperField(this, Line, 7) as Line[]; - } - set lines(value: Line[]) { - pb_1.Message.setRepeatedWrapperField(this, 7, value); + pb_1.Message.setRepeatedWrapperField(this, 4, value); } static fromObject(data: { stationName?: string; canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; + commonGraphicStorage?: ReturnType; cctvButtons?: ReturnType[]; - lines?: ReturnType[]; }): CCTVOfStationControlStorage { const message = new CCTVOfStationControlStorage({}); if (data.stationName != null) { @@ -1615,32 +1767,20 @@ export namespace iscsGraphicData { if (data.canvas != null) { message.canvas = dependency_1.common.Canvas.fromObject(data.canvas); } - if (data.arrows != null) { - message.arrows = data.arrows.map(item => Arrow.fromObject(item)); - } - if (data.iscsTexts != null) { - message.iscsTexts = data.iscsTexts.map(item => IscsText.fromObject(item)); - } - if (data.rects != null) { - message.rects = data.rects.map(item => Rect.fromObject(item)); + if (data.commonGraphicStorage != null) { + message.commonGraphicStorage = CommonGraphicStorage.fromObject(data.commonGraphicStorage); } if (data.cctvButtons != null) { message.cctvButtons = data.cctvButtons.map(item => CCTVButton.fromObject(item)); } - if (data.lines != null) { - message.lines = data.lines.map(item => Line.fromObject(item)); - } return message; } toObject() { const data: { stationName?: string; canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; + commonGraphicStorage?: ReturnType; cctvButtons?: ReturnType[]; - lines?: ReturnType[]; } = {}; if (this.stationName != null) { data.stationName = this.stationName; @@ -1648,21 +1788,12 @@ export namespace iscsGraphicData { if (this.canvas != null) { data.canvas = this.canvas.toObject(); } - if (this.arrows != null) { - data.arrows = this.arrows.map((item: Arrow) => item.toObject()); - } - if (this.iscsTexts != null) { - data.iscsTexts = this.iscsTexts.map((item: IscsText) => item.toObject()); - } - if (this.rects != null) { - data.rects = this.rects.map((item: Rect) => item.toObject()); + if (this.commonGraphicStorage != null) { + data.commonGraphicStorage = this.commonGraphicStorage.toObject(); } if (this.cctvButtons != null) { data.cctvButtons = this.cctvButtons.map((item: CCTVButton) => item.toObject()); } - if (this.lines != null) { - data.lines = this.lines.map((item: Line) => item.toObject()); - } return data; } serialize(): Uint8Array; @@ -1673,16 +1804,10 @@ export namespace iscsGraphicData { writer.writeString(1, this.stationName); if (this.has_canvas) writer.writeMessage(2, this.canvas, () => this.canvas.serialize(writer)); - if (this.arrows.length) - writer.writeRepeatedMessage(3, this.arrows, (item: Arrow) => item.serialize(writer)); - if (this.iscsTexts.length) - writer.writeRepeatedMessage(4, this.iscsTexts, (item: IscsText) => item.serialize(writer)); - if (this.rects.length) - writer.writeRepeatedMessage(5, this.rects, (item: Rect) => item.serialize(writer)); + if (this.has_commonGraphicStorage) + writer.writeMessage(3, this.commonGraphicStorage, () => this.commonGraphicStorage.serialize(writer)); if (this.cctvButtons.length) - writer.writeRepeatedMessage(6, this.cctvButtons, (item: CCTVButton) => item.serialize(writer)); - if (this.lines.length) - writer.writeRepeatedMessage(7, this.lines, (item: Line) => item.serialize(writer)); + writer.writeRepeatedMessage(4, this.cctvButtons, (item: CCTVButton) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -1699,19 +1824,10 @@ export namespace iscsGraphicData { reader.readMessage(message.canvas, () => message.canvas = dependency_1.common.Canvas.deserialize(reader)); break; case 3: - reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Arrow.deserialize(reader), Arrow)); + reader.readMessage(message.commonGraphicStorage, () => message.commonGraphicStorage = CommonGraphicStorage.deserialize(reader)); break; case 4: - reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IscsText.deserialize(reader), IscsText)); - break; - case 5: - reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Rect.deserialize(reader), Rect)); - break; - case 6: - reader.readMessage(message.cctvButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 6, CCTVButton.deserialize(reader), CCTVButton)); - break; - case 7: - reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 7, Line.deserialize(reader), Line)); + reader.readMessage(message.cctvButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 4, CCTVButton.deserialize(reader), CCTVButton)); break; default: reader.skipField(); } @@ -1725,18 +1841,15 @@ export namespace iscsGraphicData { return CCTVOfStationControlStorage.deserialize(bytes); } } - export class FASPlatformAlarmStorage extends pb_1.Message { + export class FASOfPlatformAlarmStorage extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { stationName?: string; canvas?: dependency_1.common.Canvas; - arrows?: Arrow[]; - iscsTexts?: IscsText[]; - rects?: Rect[]; - lines?: Line[]; + commonGraphicStorage?: CommonGraphicStorage; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3, 4, 5, 6], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("stationName" in data && data.stationName != undefined) { this.stationName = data.stationName; @@ -1744,17 +1857,8 @@ export namespace iscsGraphicData { 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 ("lines" in data && data.lines != undefined) { - this.lines = data.lines; + if ("commonGraphicStorage" in data && data.commonGraphicStorage != undefined) { + this.commonGraphicStorage = data.commonGraphicStorage; } } } @@ -1773,56 +1877,29 @@ export namespace iscsGraphicData { get has_canvas() { return pb_1.Message.getField(this, 2) != null; } - get arrows() { - return pb_1.Message.getRepeatedWrapperField(this, Arrow, 3) as Arrow[]; + get commonGraphicStorage() { + return pb_1.Message.getWrapperField(this, CommonGraphicStorage, 3) as CommonGraphicStorage; } - set arrows(value: Arrow[]) { - pb_1.Message.setRepeatedWrapperField(this, 3, value); + set commonGraphicStorage(value: CommonGraphicStorage) { + pb_1.Message.setWrapperField(this, 3, value); } - get iscsTexts() { - return pb_1.Message.getRepeatedWrapperField(this, IscsText, 4) as IscsText[]; - } - set iscsTexts(value: IscsText[]) { - pb_1.Message.setRepeatedWrapperField(this, 4, value); - } - get rects() { - return pb_1.Message.getRepeatedWrapperField(this, Rect, 5) as Rect[]; - } - set rects(value: Rect[]) { - pb_1.Message.setRepeatedWrapperField(this, 5, value); - } - get lines() { - return pb_1.Message.getRepeatedWrapperField(this, Line, 6) as Line[]; - } - set lines(value: Line[]) { - pb_1.Message.setRepeatedWrapperField(this, 6, value); + get has_commonGraphicStorage() { + return pb_1.Message.getField(this, 3) != null; } static fromObject(data: { stationName?: string; canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; - lines?: ReturnType[]; - }): FASPlatformAlarmStorage { - const message = new FASPlatformAlarmStorage({}); + commonGraphicStorage?: ReturnType; + }): FASOfPlatformAlarmStorage { + const message = new FASOfPlatformAlarmStorage({}); if (data.stationName != null) { message.stationName = data.stationName; } if (data.canvas != null) { message.canvas = dependency_1.common.Canvas.fromObject(data.canvas); } - if (data.arrows != null) { - message.arrows = data.arrows.map(item => Arrow.fromObject(item)); - } - if (data.iscsTexts != null) { - message.iscsTexts = data.iscsTexts.map(item => IscsText.fromObject(item)); - } - if (data.rects != null) { - message.rects = data.rects.map(item => Rect.fromObject(item)); - } - if (data.lines != null) { - message.lines = data.lines.map(item => Line.fromObject(item)); + if (data.commonGraphicStorage != null) { + message.commonGraphicStorage = CommonGraphicStorage.fromObject(data.commonGraphicStorage); } return message; } @@ -1830,10 +1907,7 @@ export namespace iscsGraphicData { const data: { stationName?: string; canvas?: ReturnType; - arrows?: ReturnType[]; - iscsTexts?: ReturnType[]; - rects?: ReturnType[]; - lines?: ReturnType[]; + commonGraphicStorage?: ReturnType; } = {}; if (this.stationName != null) { data.stationName = this.stationName; @@ -1841,17 +1915,8 @@ export namespace iscsGraphicData { if (this.canvas != null) { data.canvas = this.canvas.toObject(); } - if (this.arrows != null) { - data.arrows = this.arrows.map((item: Arrow) => item.toObject()); - } - if (this.iscsTexts != null) { - data.iscsTexts = this.iscsTexts.map((item: IscsText) => item.toObject()); - } - if (this.rects != null) { - data.rects = this.rects.map((item: Rect) => item.toObject()); - } - if (this.lines != null) { - data.lines = this.lines.map((item: Line) => item.toObject()); + if (this.commonGraphicStorage != null) { + data.commonGraphicStorage = this.commonGraphicStorage.toObject(); } return data; } @@ -1863,19 +1928,13 @@ export namespace iscsGraphicData { writer.writeString(1, this.stationName); if (this.has_canvas) writer.writeMessage(2, this.canvas, () => this.canvas.serialize(writer)); - if (this.arrows.length) - writer.writeRepeatedMessage(3, this.arrows, (item: Arrow) => item.serialize(writer)); - if (this.iscsTexts.length) - writer.writeRepeatedMessage(4, this.iscsTexts, (item: IscsText) => item.serialize(writer)); - if (this.rects.length) - writer.writeRepeatedMessage(5, this.rects, (item: Rect) => item.serialize(writer)); - if (this.lines.length) - writer.writeRepeatedMessage(6, this.lines, (item: Line) => item.serialize(writer)); + if (this.has_commonGraphicStorage) + writer.writeMessage(3, this.commonGraphicStorage, () => this.commonGraphicStorage.serialize(writer)); if (!w) return writer.getResultBuffer(); } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FASPlatformAlarmStorage { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FASPlatformAlarmStorage(); + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FASOfPlatformAlarmStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FASOfPlatformAlarmStorage(); while (reader.nextField()) { if (reader.isEndGroup()) break; @@ -1887,16 +1946,7 @@ export namespace iscsGraphicData { reader.readMessage(message.canvas, () => message.canvas = dependency_1.common.Canvas.deserialize(reader)); break; case 3: - reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, Arrow.deserialize(reader), Arrow)); - break; - case 4: - reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 4, IscsText.deserialize(reader), IscsText)); - break; - case 5: - reader.readMessage(message.rects, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Rect.deserialize(reader), Rect)); - break; - case 6: - reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 6, Line.deserialize(reader), Line)); + reader.readMessage(message.commonGraphicStorage, () => message.commonGraphicStorage = CommonGraphicStorage.deserialize(reader)); break; default: reader.skipField(); } @@ -1906,8 +1956,8 @@ export namespace iscsGraphicData { serializeBinary(): Uint8Array { return this.serialize(); } - static deserializeBinary(bytes: Uint8Array): FASPlatformAlarmStorage { - return FASPlatformAlarmStorage.deserialize(bytes); + static deserializeBinary(bytes: Uint8Array): FASOfPlatformAlarmStorage { + return FASOfPlatformAlarmStorage.deserialize(bytes); } } } diff --git a/yarn.lock b/yarn.lock index 7bbefa9..0444ae5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2528,9 +2528,9 @@ isobject@^3.0.1: resolved "https://mirrors.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== -"jl-graphic@git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.15": - version "0.1.14" - resolved "git+https://gitea.joylink.club/joylink/graphic-pixi.git#8b0ad14f7324a5eaba58239645a1fa0452e87ab4" +"jl-graphic@git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.18": + version "0.1.16" + resolved "git+https://gitea.joylink.club/joylink/graphic-pixi.git#38045a10271f81b65820db402051fefc62b0a2cd" dependencies: "@pixi/graphics-extras" "^7.3.2" "@pixi/utils" "^7.3.2" From f6e078563328c30b3a8dd83a8eb52e07df572b57 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Thu, 10 Oct 2024 16:04:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/iscsApp.ts | 23 +++++------------------ src/layouts/IscsDrawLayout.vue | 32 +++++++++++++++++--------------- src/pages/IscsDraftManage.vue | 5 ++++- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts index 042de0d..0fd32d0 100644 --- a/src/drawApp/iscsApp.ts +++ b/src/drawApp/iscsApp.ts @@ -121,16 +121,10 @@ function handleSubscribe(app: IDrawApp) { app.deleteGraphics(...graphics); } } else { - storage = iscsGraphicData.IscsGraphicStorage.deserialize( - toUint8Array(base64) - ); if (syncData.submenu === '火灾报警平面图') { for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { const fasPlatformAlarm = storage.fasOfPlatformAlarmStorages[i]; if (fasPlatformAlarm.stationName == syncData.station) { - // canvasProperty = fasPlatformAlarm.canvas; - // datas = loadCommonDrawDatas(fasPlatformAlarm); - // break; syncData.datas.forEach((data) => { handlerNoEditCommonData( data, @@ -150,12 +144,6 @@ function handleSubscribe(app: IDrawApp) { ) { const ctvOfStationControl = storage.cctvOfStationControlStorages[i]; if (ctvOfStationControl.stationName == syncData.station) { - // canvasProperty = ctvOfStationControl.canvas; - // datas = loadCommonDrawDatas(ctvOfStationControl); - // ctvOfStationControl.cctvButtons.forEach((cctvButton) => { - // datas.push(new CCTVButtonData(cctvButton)); - // }); - // break; syncData.datas.forEach((data) => { handlerNoEditCommonData( data, @@ -202,18 +190,17 @@ export async function loadDrawDatas(): Promise { if (!hasLoadData) { base64 = (await getDraft(id)).data; - hasLoadData = true; - } - if (base64) { - if (!hasLoadData) { + if (base64) { storage = iscsGraphicData.IscsGraphicStorage.deserialize( toUint8Array(base64) ); } - + hasLoadData = true; + } + if (hasLoadData) { let datas = []; let canvasProperty; - + console.log(storage); switch (drawStore.selectSubmenuAndStation.submenu) { case '火灾报警平面图': for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { diff --git a/src/layouts/IscsDrawLayout.vue b/src/layouts/IscsDrawLayout.vue index bcea97a..e56578e 100644 --- a/src/layouts/IscsDrawLayout.vue +++ b/src/layouts/IscsDrawLayout.vue @@ -343,21 +343,23 @@ onMounted(() => { const drawApp = drawStore.initDrawApp(); drawApp.bindDom(dom); drawApp.reload(); - const _record = drawApp.opRecord.record; - drawApp.opRecord.record = function (op) { - handleRecordData(op); - _record.call(drawApp.opRecord, op); - }; - const _undo = drawApp.opRecord.undo; - drawApp.opRecord.undo = function () { - _undo.call(drawApp.opRecord); - console.log('undo'); - }; - const _redo = drawApp.opRecord.redo; - drawApp.opRecord.redo = function () { - _redo.call(drawApp.opRecord); - console.log('redo'); - }; + if (route.query.isShared == '1') { + const _record = drawApp.opRecord.record; + drawApp.opRecord.record = function (op) { + handleRecordData(op); + _record.call(drawApp.opRecord, op); + }; + const _undo = drawApp.opRecord.undo; + drawApp.opRecord.undo = function () { + _undo.call(drawApp.opRecord); + console.log('undo'); + }; + const _redo = drawApp.opRecord.redo; + drawApp.opRecord.redo = function () { + _redo.call(drawApp.opRecord); + console.log('redo'); + }; + } onResize(); } else { drawStore.setDraftId(null); diff --git a/src/pages/IscsDraftManage.vue b/src/pages/IscsDraftManage.vue index b1c191e..a5ee606 100644 --- a/src/pages/IscsDraftManage.vue +++ b/src/pages/IscsDraftManage.vue @@ -486,7 +486,10 @@ function goToPath(row: DraftItem) { let path = `/iscsPainting/${row.id}`; const iscsStyle = allRequestData.find((item) => item.draftData.id == row.id) .options.style; - router.push({ path: path, query: { iscsStyle } }); + router.push({ + path: path, + query: { iscsStyle, isShared: row.isShared ? 1 : 2 }, + }); } //发布相关