From 8de70bf5976b5cf09267329e249c0448bdd4623d Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Sat, 14 Sep 2024 14:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8C=89=E9=92=AE+commonAPP(?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=A1=A8app=E5=85=B1=E7=94=A8=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E5=8A=9F=E8=83=BD=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draw-app/CCTVDrawProperties.vue | 8 +- src/components/draw-app/DrawProperties.vue | 1 + .../properties/CCTV/CCTVButtonProperty.vue | 1 + .../draw-app/properties/IscsTextProperty.vue | 6 +- src/drawApp/cctvApp.ts | 94 ++++++------------ src/drawApp/commonApp.ts | 14 +-- src/drawApp/drawApp.ts | 15 +-- src/graphics/CCTV/cctvButton/CCTVButton.ts | 25 +++-- .../CCTV/cctvButton/cctv-button-data.json | 16 +++ .../cctvButton/cctv-button-spritesheet.png | Bin 2599 -> 4453 bytes src/layouts/CCTVDrawLayout.vue | 4 +- src/protos/cctv_graphic_data.ts | 51 +++++++++- 12 files changed, 141 insertions(+), 94 deletions(-) diff --git a/src/components/draw-app/CCTVDrawProperties.vue b/src/components/draw-app/CCTVDrawProperties.vue index 9bf712f..b055ff0 100644 --- a/src/components/draw-app/CCTVDrawProperties.vue +++ b/src/components/draw-app/CCTVDrawProperties.vue @@ -23,8 +23,12 @@ @@ -38,6 +42,8 @@ diff --git a/src/components/draw-app/properties/IscsTextProperty.vue b/src/components/draw-app/properties/IscsTextProperty.vue index 9055c4d..2c6ffeb 100644 --- a/src/components/draw-app/properties/IscsTextProperty.vue +++ b/src/components/draw-app/properties/IscsTextProperty.vue @@ -38,13 +38,13 @@ diff --git a/src/drawApp/cctvApp.ts b/src/drawApp/cctvApp.ts index 2aa9e80..7e7a2ad 100644 --- a/src/drawApp/cctvApp.ts +++ b/src/drawApp/cctvApp.ts @@ -1,45 +1,25 @@ import { CombinationKey, - ContextMenu, IDrawApp, IGraphicStorage, JlGraphic, KeyListener, - MenuItemOptions, newDrawApp, } from 'jl-graphic'; -import { useCCTVDrawStore } from 'src/stores/cctv-draw-store'; -import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; -import { toStorageTransform } from './graphics/GraphicDataBase'; +import { useDrawStore } from 'src/stores/draw-store'; +import { CCTVGraphicData } from 'src/protos/cctv_graphic_data'; import { fromUint8Array } from 'js-base64'; +import { + initCommonDrawApp, + saveCommonDrawDatas, + saveDrawToServer, +} from './commonApp'; +import { CCTVButtonData } from './graphics/CCTV/CCTVButtonInteraction'; import { CCTVButtonDraw } from 'src/graphics/CCTV/cctvButton/CCTVButtonDrawAssistant'; import { CCTVButtonTemplate } from 'src/graphics/CCTV/cctvButton/CCTVButton'; -import { CCTVButtonData } from './graphics/CCTV/CCTVButtonInteraction'; let drawApp: IDrawApp | null = null; -const UndoOptions: MenuItemOptions = { - name: '撤销', -}; -const RedoOptions: MenuItemOptions = { - name: '重做', -}; -const SelectAllOptions: MenuItemOptions = { - name: '全选', -}; - -export const DefaultCanvasMenu = new ContextMenu({ - name: '绘制-画布菜单', - groups: [ - { - items: [UndoOptions, RedoOptions], - }, - { - items: [SelectAllOptions], - }, - ], -}); - export function getDrawApp(): IDrawApp | null { return drawApp; } @@ -60,26 +40,13 @@ export function initDrawApp(): IDrawApp { dataLoader: loadDrawDatas, isSupportDeletion: isSupportDeletion, }); - const app = drawApp; - new CCTVButtonDraw(drawApp, new CCTVButtonTemplate(new CCTVButtonData())); - app.canvas.on('_rightclick', (e) => { - if (app.drawing) return; - UndoOptions.disabled = !app.opRecord.hasUndo; - RedoOptions.disabled = !app.opRecord.hasRedo; + initCommonDrawApp(app); + new CCTVButtonDraw( + app, + new CCTVButtonTemplate(new CCTVButtonData()) + ); - UndoOptions.handler = () => { - app.opRecord.undo(); - }; - RedoOptions.handler = () => { - app.opRecord.redo(); - }; - SelectAllOptions.handler = () => { - app.selectAllGraphics(); - }; - DefaultCanvasMenu.open(e.global); - }); - app.on('destroy', async () => {}); app.addKeyboardListener( new KeyListener({ value: 'KeyS', @@ -94,36 +61,35 @@ export function initDrawApp(): IDrawApp { } export async function loadDrawDatas(): Promise { - const drawStore = useCCTVDrawStore(); + 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) { - const storage = new iscsGraphicData.IscsGraphicStorage(); - const canvasData = app.canvas.saveData(); - storage.canvas = new iscsGraphicData.Canvas({ - width: canvasData.width, - height: canvasData.height, - backgroundColor: canvasData.backgroundColor, - viewportTransform: toStorageTransform(canvasData.viewportTransform), - }); + let storage = new CCTVGraphicData.CCTVGraphicStorage(); + storage = saveCommonDrawDatas( + app, + storage + ) as CCTVGraphicData.CCTVGraphicStorage; 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; } - -export function saveDrawToServer(base64: string) { - const drawStore = useCCTVDrawStore(); - const id = drawStore.draftId; - if (!id) { - return; - } - console.log('save' + base64); -} diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts index 5fa1431..78fe8cf 100644 --- a/src/drawApp/commonApp.ts +++ b/src/drawApp/commonApp.ts @@ -5,7 +5,6 @@ import { MenuItemOptions, } from 'jl-graphic'; import { useDrawStore } from 'src/stores/draw-store'; -import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; import { toStorageTransform } from './graphics/GraphicDataBase'; import { Arrow, ArrowTemplate } from 'src/graphics/arrow/Arrow'; import { ArrowData } from './graphics/ArrowInteraction'; @@ -16,6 +15,7 @@ import { } from 'src/graphics/textContent/TextContent'; import { TextContentDraw } from 'src/graphics/textContent/TextContentDrawAssistant'; import { IscsTextData } from './graphics/IscsTextContentInteraction'; +import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; const UndoOptions: MenuItemOptions = { name: '撤销', @@ -64,9 +64,12 @@ export function initCommonDrawApp(app: IDrawApp) { app.on('destroy', async () => {}); } -export function loadCommonDrawDatas( - storage: iscsGraphicData.IscsGraphicStorage -): GraphicData[] { +interface ICommonStorage { + arrows: iscsGraphicData.Arrow[]; + iscsTexts: iscsGraphicData.IscsText[]; + canvas: iscsGraphicData.Canvas; +} +export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] { const datas: GraphicData[] = []; console.log(storage, 'storage'); storage.arrows.forEach((arrow) => { @@ -78,8 +81,7 @@ export function loadCommonDrawDatas( return datas; } -export function saveCommonDrawDatas(app: IDrawApp) { - const storage = new iscsGraphicData.IscsGraphicStorage(); +export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) { const canvasData = app.canvas.saveData(); storage.canvas = new iscsGraphicData.Canvas({ width: canvasData.width, diff --git a/src/drawApp/drawApp.ts b/src/drawApp/drawApp.ts index f952af4..ba8e5ea 100644 --- a/src/drawApp/drawApp.ts +++ b/src/drawApp/drawApp.ts @@ -1,4 +1,3 @@ -// import { fromUint8Array } from 'js-base64'; import { CombinationKey, IDrawApp, @@ -9,7 +8,6 @@ import { } from 'jl-graphic'; import { useDrawStore } from 'src/stores/draw-store'; import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; -import { toStorageTransform } from './graphics/GraphicDataBase'; import { fromUint8Array } from 'js-base64'; import { initCommonDrawApp, @@ -73,14 +71,11 @@ export async function loadDrawDatas(): Promise { } export function saveDrawDatas(app: IDrawApp) { - const storage = saveCommonDrawDatas(app); - const canvasData = app.canvas.saveData(); - storage.canvas = new iscsGraphicData.Canvas({ - width: canvasData.width, - height: canvasData.height, - backgroundColor: canvasData.backgroundColor, - viewportTransform: toStorageTransform(canvasData.viewportTransform), - }); + let storage = new iscsGraphicData.IscsGraphicStorage(); + storage = saveCommonDrawDatas( + app, + storage + ) as iscsGraphicData.IscsGraphicStorage; const graphics = app.queryStore.getAllGraphics(); /* graphics.forEach((g) => { if (TrackSection.Type === g.type) { diff --git a/src/graphics/CCTV/cctvButton/CCTVButton.ts b/src/graphics/CCTV/cctvButton/CCTVButton.ts index 7566bca..7ae3f2f 100644 --- a/src/graphics/CCTV/cctvButton/CCTVButton.ts +++ b/src/graphics/CCTV/cctvButton/CCTVButton.ts @@ -5,8 +5,10 @@ import { CCTVGraphicData } from 'src/protos/cctv_graphic_data'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; interface CCTVButtonTextures { - redBtn: Texture; - greenBtn: Texture; + rectPressBtn: Texture; + rectBtn: Texture; + monitorBtn: Texture; + semicircleBtn: Texture; } export interface ICCTVButtonData extends GraphicData { @@ -26,7 +28,7 @@ export class CCTVButton extends JlGraphic { super(CCTVButton.Type); this.cctvButtonTextures = cctvButtonTextures; this._cctvButton = new Sprite(); - this._cctvButton.texture = this.cctvButtonTextures.redBtn; + this._cctvButton.texture = this.cctvButtonTextures.rectBtn; this._cctvButton.anchor.set(0.5); this.addChild(this._cctvButton); } @@ -38,8 +40,15 @@ export class CCTVButton extends JlGraphic { } doRepaint(): void { - this._cctvButton.rotation = 0; - this._cctvButton.texture = this.cctvButtonTextures.redBtn; + if (this.datas.buttonType == CCTVGraphicData.CCTVButton.ButtonType.rect) { + this._cctvButton.texture = this.cctvButtonTextures.rectBtn; + } else if ( + this.datas.buttonType == CCTVGraphicData.CCTVButton.ButtonType.monitor + ) { + this._cctvButton.texture = this.cctvButtonTextures.monitorBtn; + } else { + this._cctvButton.texture = this.cctvButtonTextures.semicircleBtn; + } } } @@ -62,8 +71,10 @@ export class CCTVButtonTemplate extends JlGraphicTemplate { const cctvButtonSheet = new Spritesheet(texture, CCTV_Button_JSON); const result = await cctvButtonSheet.parse(); this.cctvButtonTextures = { - redBtn: result['rect-press-btn.png'], - greenBtn: result['rect-btn.png'], + rectPressBtn: result['rect-press-btn.png'], + rectBtn: result['rect-btn.png'], + monitorBtn: result['monitor-btn.png'], + semicircleBtn: result['semicircle-btn.png'], }; return this.cctvButtonTextures as CCTVButtonTextures; } diff --git a/src/graphics/CCTV/cctvButton/cctv-button-data.json b/src/graphics/CCTV/cctvButton/cctv-button-data.json index dd6250c..e3c17dd 100644 --- a/src/graphics/CCTV/cctvButton/cctv-button-data.json +++ b/src/graphics/CCTV/cctvButton/cctv-button-data.json @@ -15,6 +15,22 @@ "spriteSourceSize": { "x": 0, "y": 0, "w": 74, "h": 66 }, "sourceSize": { "w": 74, "h": 66 }, "anchor": { "x": 0.5, "y": 0.5 } + }, + "monitor-btn.png": { + "frame": { "x": 148, "y": 0, "w": 74, "h": 66 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 74, "h": 66 }, + "sourceSize": { "w": 74, "h": 66 }, + "anchor": { "x": 0.5, "y": 0.5 } + }, + "semicircle-btn.png": { + "frame": { "x": 230, "y": 0, "w": 66, "h": 66 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 66, "h": 66 }, + "sourceSize": { "w": 66, "h": 66 }, + "anchor": { "x": 0.5, "y": 0.5 } } }, "meta": { diff --git a/src/graphics/CCTV/cctvButton/cctv-button-spritesheet.png b/src/graphics/CCTV/cctvButton/cctv-button-spritesheet.png index 769409dd1f5a4c61b988e00fb711c8acaa2b616b..b1c9720f991a9e98d5b293d94843cafe0c38e370 100644 GIT binary patch delta 3119 zcma)9c{p2X7uPC^Qd=z5)-slet&v2Ct&E+Js32o&qX|k)jit3UQ>|K})i#NeiWadn z&CoD|5Y*SSM%qw}C8JbnLrRsQrP^t~JKy)r{5{X}KKD8IJ?H+;a?g3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ioq!>5`zCi8#%T&Eg0zrU&e z=@0qHvo_3om&%*}i}GBfWyY<2-cQI^{nu0ZzS`s3s;|s?^L?3%_Ad2JJ(rNoIrIKS zv!I+VNtN3cUmWH|Z^^G`Kd&kg!SW_K`Q+nxUtQ_!8nszdZ(jSe^6G*~dm|sT9lg78 z;htKp-8YLlb2iF{ZVvyGG2z$rD-V$Hv#*_5CAwje&tEgU gyt%Qv{@80de>6LFz-%$F*kbT>^>bP0l)%^o0Pid)#Q*>R diff --git a/src/layouts/CCTVDrawLayout.vue b/src/layouts/CCTVDrawLayout.vue index 1bde02b..5166bec 100644 --- a/src/layouts/CCTVDrawLayout.vue +++ b/src/layouts/CCTVDrawLayout.vue @@ -112,6 +112,8 @@ import { successNotify } from 'src/utils/CommonNotify'; import { useQuasar } from 'quasar'; import { useCCTVDrawStore } from 'src/stores/cctv-draw-store'; import { CCTVButton } from 'src/graphics/CCTV/cctvButton/CCTVButton'; +import { Arrow } from 'src/graphics/arrow/Arrow'; +import { TextContent } from 'src/graphics/textContent/TextContent'; const $q = useQuasar(); @@ -197,7 +199,7 @@ onMounted(() => { } else { drawStore.setDraftId(null); } - const drawAssistantsTypes = [CCTVButton.Type]; + const drawAssistantsTypes = [Arrow.Type,TextContent.Type,CCTVButton.Type]; drawAssistantsTypes.forEach((type) => { const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type); if (drawAssistant) { diff --git a/src/protos/cctv_graphic_data.ts b/src/protos/cctv_graphic_data.ts index 700fb76..35147fe 100644 --- a/src/protos/cctv_graphic_data.ts +++ b/src/protos/cctv_graphic_data.ts @@ -11,9 +11,11 @@ export namespace CCTVGraphicData { constructor(data?: any[] | { canvas?: dependency_1.iscsGraphicData.Canvas; cctvButtons?: CCTVButton[]; + arrows?: dependency_1.iscsGraphicData.Arrow[]; + iscsTexts?: dependency_1.iscsGraphicData.IscsText[]; }) { 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], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("canvas" in data && data.canvas != undefined) { this.canvas = data.canvas; @@ -21,6 +23,12 @@ export namespace CCTVGraphicData { if ("cctvButtons" in data && data.cctvButtons != undefined) { this.cctvButtons = data.cctvButtons; } + if ("arrows" in data && data.arrows != undefined) { + this.arrows = data.arrows; + } + if ("iscsTexts" in data && data.iscsTexts != undefined) { + this.iscsTexts = data.iscsTexts; + } } } get canvas() { @@ -38,9 +46,23 @@ export namespace CCTVGraphicData { set cctvButtons(value: CCTVButton[]) { pb_1.Message.setRepeatedWrapperField(this, 2, value); } + get arrows() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.iscsGraphicData.Arrow, 3) as dependency_1.iscsGraphicData.Arrow[]; + } + set arrows(value: dependency_1.iscsGraphicData.Arrow[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value); + } + get iscsTexts() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.iscsGraphicData.IscsText, 4) as dependency_1.iscsGraphicData.IscsText[]; + } + set iscsTexts(value: dependency_1.iscsGraphicData.IscsText[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value); + } static fromObject(data: { canvas?: ReturnType; cctvButtons?: ReturnType[]; + arrows?: ReturnType[]; + iscsTexts?: ReturnType[]; }): CCTVGraphicStorage { const message = new CCTVGraphicStorage({}); if (data.canvas != null) { @@ -49,12 +71,20 @@ export namespace CCTVGraphicData { if (data.cctvButtons != null) { message.cctvButtons = data.cctvButtons.map(item => CCTVButton.fromObject(item)); } + 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)); + } return message; } toObject() { const data: { canvas?: ReturnType; cctvButtons?: ReturnType[]; + arrows?: ReturnType[]; + iscsTexts?: ReturnType[]; } = {}; if (this.canvas != null) { data.canvas = this.canvas.toObject(); @@ -62,6 +92,12 @@ export namespace CCTVGraphicData { if (this.cctvButtons != null) { data.cctvButtons = this.cctvButtons.map((item: CCTVButton) => item.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()); + } return data; } serialize(): Uint8Array; @@ -72,6 +108,10 @@ export namespace CCTVGraphicData { writer.writeMessage(1, this.canvas, () => this.canvas.serialize(writer)); if (this.cctvButtons.length) writer.writeRepeatedMessage(2, this.cctvButtons, (item: CCTVButton) => item.serialize(writer)); + if (this.arrows.length) + writer.writeRepeatedMessage(3, this.arrows, (item: dependency_1.iscsGraphicData.Arrow) => item.serialize(writer)); + if (this.iscsTexts.length) + writer.writeRepeatedMessage(4, this.iscsTexts, (item: dependency_1.iscsGraphicData.IscsText) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -87,6 +127,12 @@ export namespace CCTVGraphicData { case 2: reader.readMessage(message.cctvButtons, () => pb_1.Message.addToRepeatedWrapperField(message, 2, CCTVButton.deserialize(reader), CCTVButton)); break; + case 3: + reader.readMessage(message.arrows, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.iscsGraphicData.Arrow.deserialize(reader), dependency_1.iscsGraphicData.Arrow)); + break; + case 4: + reader.readMessage(message.iscsTexts, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.iscsGraphicData.IscsText.deserialize(reader), dependency_1.iscsGraphicData.IscsText)); + break; default: reader.skipField(); } } @@ -218,7 +264,8 @@ export namespace CCTVGraphicData { export namespace CCTVButton { export enum ButtonType { rect = 0, - monitor = 1 + monitor = 1, + semicircle = 2 } } }