火灾报警调整

This commit is contained in:
joylink_fanyuhong 2024-09-18 09:32:56 +08:00
parent 3fb5bd2df5
commit 8e01da8ed5
9 changed files with 16 additions and 164 deletions

View File

@ -6,7 +6,7 @@ import {
KeyListener, KeyListener,
newDrawApp, newDrawApp,
} from 'jl-graphic'; } from 'jl-graphic';
import { FireAlarmGraphicData } from 'src/protos/fire_alarm_graphic_data'; import { FASGraphicData } from 'src/protos/fas_graphic_data';
import { fromUint8Array } from 'js-base64'; import { fromUint8Array } from 'js-base64';
import { import {
initCommonDrawApp, initCommonDrawApp,
@ -17,18 +17,18 @@ import { useDrawStore } from 'src/stores/draw-store';
let drawApp: IDrawApp | null = null; let drawApp: IDrawApp | null = null;
export function getFireAlarmDrawApp(): IDrawApp | null { export function getFASDrawApp(): IDrawApp | null {
return drawApp; return drawApp;
} }
export function destroyFireAlarmDrawApp(): void { export function destroyFASDrawApp(): void {
if (drawApp) { if (drawApp) {
drawApp.destroy(); drawApp.destroy();
drawApp = null; drawApp = null;
} }
} }
export function initFireAlarmDrawApp(): IDrawApp { export function initFASDrawApp(): IDrawApp {
const isSupportDeletion = (g: JlGraphic) => { const isSupportDeletion = (g: JlGraphic) => {
console.log(g); console.log(g);
return true; return true;
@ -72,11 +72,11 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
} }
export function saveDrawDatas(app: IDrawApp) { export function saveDrawDatas(app: IDrawApp) {
let storage = new FireAlarmGraphicData.FireAlarmGraphicStorage(); let storage = new FASGraphicData.FASGraphicStorage();
storage = saveCommonDrawDatas( storage = saveCommonDrawDatas(
app, app,
storage storage
) as FireAlarmGraphicData.FireAlarmGraphicStorage; ) as FASGraphicData.FASGraphicStorage;
const graphics = app.queryStore.getAllGraphics(); const graphics = app.queryStore.getAllGraphics();
/* graphics.forEach((g) => { /* graphics.forEach((g) => {
if (TrackSection.Type === g.type) { if (TrackSection.Type === g.type) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,148 +0,0 @@
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 5.27.4
* source: fire_alarm_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 FireAlarmGraphicData {
export class FireAlarmGraphicStorage 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[];
}) {
super();
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;
}
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;
}
}
}
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);
}
static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.iscsGraphicData.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof dependency_1.iscsGraphicData.Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof dependency_1.iscsGraphicData.IscsText.prototype.toObject>[];
rects?: ReturnType<typeof dependency_1.iscsGraphicData.Rect.prototype.toObject>[];
}): FireAlarmGraphicStorage {
const message = new FireAlarmGraphicStorage({});
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));
}
return message;
}
toObject() {
const data: {
canvas?: ReturnType<typeof dependency_1.iscsGraphicData.Canvas.prototype.toObject>;
arrows?: ReturnType<typeof dependency_1.iscsGraphicData.Arrow.prototype.toObject>[];
iscsTexts?: ReturnType<typeof dependency_1.iscsGraphicData.IscsText.prototype.toObject>[];
rects?: ReturnType<typeof dependency_1.iscsGraphicData.Rect.prototype.toObject>[];
} = {};
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());
}
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 (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FireAlarmGraphicStorage {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new FireAlarmGraphicStorage();
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;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): FireAlarmGraphicStorage {
return FireAlarmGraphicStorage.deserialize(bytes);
}
}
}

View File

@ -35,12 +35,12 @@ const routes: RouteRecordRaw[] = [
component: () => import('layouts/CCTVDrawLayout.vue'), component: () => import('layouts/CCTVDrawLayout.vue'),
}, },
{ {
path: '/fireAlarmPaint', path: '/fasPaint',
name: 'fireAlarmPaint', name: 'fasPaint',
meta: { meta: {
label: '火灾报警绘制', label: '火灾报警绘制',
}, },
component: () => import('layouts/FireAlarmDrawLayout.vue'), component: () => import('layouts/FASDrawLayout.vue'),
}, },
]; ];

View File

@ -5,10 +5,10 @@ import {
getCCTVDrawApp, getCCTVDrawApp,
} from 'src/drawApp/cctvApp'; } from 'src/drawApp/cctvApp';
import { import {
initFireAlarmDrawApp, initFASDrawApp,
destroyFireAlarmDrawApp, destroyFASDrawApp,
getFireAlarmDrawApp, getFASDrawApp,
} from 'src/drawApp/fireAlarmApp'; } from 'src/drawApp/fasApp';
import { import {
DrawAssistant, DrawAssistant,
GraphicData, GraphicData,
@ -38,7 +38,7 @@ export const useDrawStore = defineStore('draw', {
app = getCCTVDrawApp(); app = getCCTVDrawApp();
break; break;
case PictureType.FireAlarm: case PictureType.FireAlarm:
app = getFireAlarmDrawApp(); app = getFASDrawApp();
break; break;
} }
return app; return app;
@ -99,7 +99,7 @@ export const useDrawStore = defineStore('draw', {
app = initCCTVDrawApp(); app = initCCTVDrawApp();
break; break;
case PictureType.FireAlarm: case PictureType.FireAlarm:
app = initFireAlarmDrawApp(); app = initFASDrawApp();
break; break;
} }
if (app == null) { if (app == null) {
@ -129,7 +129,7 @@ export const useDrawStore = defineStore('draw', {
destroyCCTVDrawApp(); destroyCCTVDrawApp();
break; break;
case PictureType.FireAlarm: case PictureType.FireAlarm:
destroyFireAlarmDrawApp(); destroyFASDrawApp();
break; break;
} }
}, },