diff --git a/package.json b/package.json index e89c56b..d5711f4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@quasar/extras": "^1.16.4", "axios": "^1.2.1", "google-protobuf": "^3.21.4", - "jl-graphic": "git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.18", + "jl-graphic": "git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.19", "js-base64": "^3.7.5", "pinia": "^2.0.11", "quasar": "^2.16.0", diff --git a/src/components/Iscs/IscsBottomAlarm.vue b/src/components/Iscs/IscsBottomAlarm.vue new file mode 100644 index 0000000..878be6a --- /dev/null +++ b/src/components/Iscs/IscsBottomAlarm.vue @@ -0,0 +1,246 @@ + + + + + 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 @@ - - - diff --git a/src/components/draw-app/IscsDrawProperties.vue b/src/components/draw-app/IscsDrawProperties.vue index 94d894a..fd95662 100644 --- a/src/components/draw-app/IscsDrawProperties.vue +++ b/src/components/draw-app/IscsDrawProperties.vue @@ -36,6 +36,9 @@ + @@ -50,7 +53,7 @@ diff --git a/src/components/draw-app/properties/CCTV/CanvasCCTVProperty.vue b/src/components/draw-app/properties/CanvasIscsProperty.vue similarity index 100% rename from src/components/draw-app/properties/CCTV/CanvasCCTVProperty.vue rename to src/components/draw-app/properties/CanvasIscsProperty.vue diff --git a/src/components/draw-app/properties/CircleProperty.vue b/src/components/draw-app/properties/CircleProperty.vue new file mode 100644 index 0000000..1353307 --- /dev/null +++ b/src/components/draw-app/properties/CircleProperty.vue @@ -0,0 +1,94 @@ + + + diff --git a/src/components/draw-app/properties/RectProperty.vue b/src/components/draw-app/properties/RectProperty.vue index 1c19de2..7c0833c 100644 --- a/src/components/draw-app/properties/RectProperty.vue +++ b/src/components/draw-app/properties/RectProperty.vue @@ -37,7 +37,7 @@ diff --git a/src/configs/iscsStyleConfig.ts b/src/configs/iscsStyleConfig.ts index 1ea6482..34b1d67 100644 --- a/src/configs/iscsStyleConfig.ts +++ b/src/configs/iscsStyleConfig.ts @@ -1,118 +1,182 @@ import { IscsStyle } from 'src/api/DraftApi'; +export interface I_DA_SHI_ZHI_NENG { + menuName: string; + icon: string; + activeIcon: string; + sunMenu: { + sunMenuName: string; + displayForm: DisplayForm; + heightPercent?: number; //绘制占的百分比 + }[]; +} + +export enum DisplayForm { + draw, + component, + drawAndComponent, +} + //达实智能(福州一号线) -const DA_SHI_ZHI_NENG = [ +const DA_SHI_ZHI_NENG: I_DA_SHI_ZHI_NENG[] = [ { menuName: 'Plan', icon: 'svguse:../iscsMenuIcon.svg#icon-Plan', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Plan-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '设备运行图', displayForm: DisplayForm.draw }, + { sunMenuName: '站厅布局图', displayForm: DisplayForm.draw }, + { sunMenuName: '站台布局图', displayForm: DisplayForm.draw }, + { sunMenuName: '出入口布局图', displayForm: DisplayForm.draw }, + ], }, { menuName: 'PSCADA', icon: 'svguse:../iscsMenuIcon.svg#icon-PSCADA', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PSCADA-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '一次图', displayForm: DisplayForm.draw }, + { sunMenuName: '自动化系统图', displayForm: DisplayForm.draw }, + { sunMenuName: '定值召唤', displayForm: DisplayForm.draw }, + { sunMenuName: '实时SOE', displayForm: DisplayForm.draw }, + { sunMenuName: '历史SOE', displayForm: DisplayForm.draw }, + { sunMenuName: '光字幕', displayForm: DisplayForm.draw }, + { sunMenuName: '交流直屏', displayForm: DisplayForm.draw }, + ], }, { menuName: 'BAS', icon: 'svguse:../iscsMenuIcon.svg#icon-BAS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-BAS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '大系统', displayForm: DisplayForm.draw }, + { sunMenuName: '小系统', displayForm: DisplayForm.draw }, + { sunMenuName: '隧道通风系统', displayForm: DisplayForm.draw }, + { sunMenuName: '水系统', displayForm: DisplayForm.draw }, + { sunMenuName: '给排水', displayForm: DisplayForm.draw }, + { sunMenuName: '电扶梯', displayForm: DisplayForm.draw }, + { sunMenuName: '照明系统', displayForm: DisplayForm.draw }, + { sunMenuName: '传感器', displayForm: DisplayForm.draw }, + { sunMenuName: '导向标识/广告', displayForm: DisplayForm.draw }, + { sunMenuName: '人防门', displayForm: DisplayForm.draw }, + { sunMenuName: 'BAS系统', displayForm: DisplayForm.draw }, + { sunMenuName: '模式控制', displayForm: DisplayForm.draw }, + { sunMenuName: '时间表', displayForm: DisplayForm.draw }, + { sunMenuName: '操作场所切换', displayForm: DisplayForm.draw }, + ], }, { menuName: 'FAS', icon: 'svguse:../iscsMenuIcon.svg#icon-FAS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-FAS-active', sunMenu: [ - { sunMenuName: '设备分区图' }, - { sunMenuName: '火灾报警平面图' }, - { sunMenuName: 'FAS气灭系统图' }, + { sunMenuName: '设备分区图', displayForm: DisplayForm.draw }, + { sunMenuName: '火灾报警平面图', displayForm: DisplayForm.draw }, + { sunMenuName: 'FAS气灭系统图', displayForm: DisplayForm.draw }, ], }, { menuName: 'TFDS', icon: 'svguse:../iscsMenuIcon.svg#icon-TFDS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-TFDS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '感温光纤状态监视图', displayForm: DisplayForm.draw }, + ], }, { menuName: 'AFC', icon: 'svguse:../iscsMenuIcon.svg#icon-AFC', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-AFC-active', - sunMenu: [{ sunMenuName: '屏蔽门' }], + sunMenu: [ + { sunMenuName: '自动售检票系统监视图', displayForm: DisplayForm.draw }, + ], }, { menuName: 'CCTV', icon: 'svguse:../iscsMenuIcon.svg#icon-CCTV', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-CCTV-active', - sunMenu: [{ sunMenuName: '监控布局图' }, { sunMenuName: 'CCTV设备布局图' }], + sunMenu: [ + { sunMenuName: '监控布局图', displayForm: DisplayForm.draw }, + { sunMenuName: 'CCTV设备布局图', displayForm: DisplayForm.draw }, + ], }, { menuName: 'PIS', icon: 'svguse:../iscsMenuIcon.svg#icon-PIS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PIS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: 'PIS监控', displayForm: DisplayForm.draw }], }, { menuName: 'PA', icon: 'svguse:../iscsMenuIcon.svg#icon-PA', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PA-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: 'PA监控', displayForm: DisplayForm.draw }], }, { menuName: 'SIG/RAD', icon: 'svguse:../iscsMenuIcon.svg#icon-SIG/RAD', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-SIG/RAD-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '子目录', displayForm: DisplayForm.component }], }, { menuName: 'ACS', icon: 'svguse:../iscsMenuIcon.svg#icon-ACS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-ACS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '门禁总览图', displayForm: DisplayForm.draw }, + { sunMenuName: '门禁监视布局图-站厅', displayForm: DisplayForm.draw }, + { sunMenuName: '门禁监视布局图-站台', displayForm: DisplayForm.draw }, + ], }, { menuName: 'PSD', icon: 'svguse:../iscsMenuIcon.svg#icon-PSD', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-PSD-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '屏蔽门系统图', displayForm: DisplayForm.draw }], }, { menuName: 'FG', icon: 'svguse:../iscsMenuIcon.svg#icon-FG', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-FG-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { sunMenuName: '防淹门状态监视图', displayForm: DisplayForm.draw }, + ], }, { menuName: 'ALM', icon: 'svguse:../iscsMenuIcon.svg#icon-ALM', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-ALM-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '子目录', displayForm: DisplayForm.component }], }, { menuName: 'NMS', icon: 'svguse:../iscsMenuIcon.svg#icon-NMS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-NMS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '网络状态监视图', displayForm: DisplayForm.draw }], }, { menuName: 'OPS', icon: 'svguse:../iscsMenuIcon.svg#icon-OPS', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-OPS-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '子目录', displayForm: DisplayForm.component }], }, { menuName: '数据', icon: 'svguse:../iscsMenuIcon.svg#icon-Data', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Data-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [{ sunMenuName: '子目录', displayForm: DisplayForm.component }], }, { menuName: '联动', icon: 'svguse:../iscsMenuIcon.svg#icon-Linkage', activeIcon: 'svguse:../iscsMenuIcon.svg#icon-Linkage-active', - sunMenu: [{ sunMenuName: '子目录' }], + sunMenu: [ + { + sunMenuName: '子目录', + displayForm: DisplayForm.drawAndComponent, + heightPercent: 50, + }, + ], }, ]; diff --git a/src/drawApp/commonApp.ts b/src/drawApp/commonApp.ts index 318ba86..b894a99 100644 --- a/src/drawApp/commonApp.ts +++ b/src/drawApp/commonApp.ts @@ -26,6 +26,9 @@ import { sync_data_message } from 'src/protos/sync_data_message'; import { LineDraw } from 'src/graphics/line/LineDrawAssistant'; import { Line, LineTemplate } from 'src/graphics/line/Line'; import { LineData } from './graphics/LineInteraction'; +import { CircleDraw } from 'src/graphics/circle/CircleDrawAssistant'; +import { Circle, CircleTemplate } from 'src/graphics/circle/Circle'; +import { CircleData } from './graphics/CircleInteraction'; const UndoOptions: MenuItemOptions = { name: '撤销', @@ -54,6 +57,7 @@ export function initCommonDrawApp(app: IDrawApp) { new TextContentDraw(app, new TextContentTemplate(new IscsTextData())); new RectDraw(app, new RectTemplate(new RectData())); new LineDraw(app, new LineTemplate(new LineData())); + new CircleDraw(app, new CircleTemplate(new CircleData())); // 画布右键菜单 app.registerMenu(DefaultCanvasMenu); @@ -83,6 +87,7 @@ interface ICommonStorage { texts: iscsGraphicData.Text[]; rects: iscsGraphicData.Rect[]; lines: iscsGraphicData.Line[]; + circles: iscsGraphicData.Circle[]; }; } export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] { @@ -100,6 +105,9 @@ export function loadCommonDrawDatas(storage: ICommonStorage): GraphicData[] { storage.commonGraphicStorage.lines.forEach((line) => { datas.push(new LineData(line)); }); + storage.commonGraphicStorage.circles.forEach((circle) => { + datas.push(new CircleData(circle)); + }); return datas; } @@ -118,13 +126,20 @@ export function saveCommonDrawDatas(app: IDrawApp, storage: ICommonStorage) { storage.commonGraphicStorage.arrows.push((arrowData as ArrowData).data); } else if (g instanceof TextContent) { const textContentData = g.saveData(); - storage.commonGraphicStorage.texts.push((textContentData as IscsTextData).data); + storage.commonGraphicStorage.texts.push( + (textContentData as IscsTextData).data + ); } else if (g instanceof Rect) { const rectData = g.saveData(); storage.commonGraphicStorage.rects.push((rectData as RectData).data); } else if (g instanceof Line) { const lineData = g.saveData(); storage.commonGraphicStorage.lines.push((lineData as LineData).data); + } else if (g instanceof Circle) { + const circleData = g.saveData(); + storage.commonGraphicStorage.circles.push( + (circleData as CircleData).data + ); } }); @@ -194,11 +209,19 @@ export function handlerNoEditCommonData( break; case Arrow.Type: const arrowData = iscsGraphicData.Arrow.deserialize(data.data); - syncNoEditData(operationType, arrowData, storage.commonGraphicStorage.arrows); + syncNoEditData( + operationType, + arrowData, + storage.commonGraphicStorage.arrows + ); break; case TextContent.Type: const iscsTextData = iscsGraphicData.Text.deserialize(data.data); - syncNoEditData(operationType, iscsTextData, storage.commonGraphicStorage.texts); + syncNoEditData( + operationType, + iscsTextData, + storage.commonGraphicStorage.texts + ); break; } } 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/drawApp/graphics/CircleInteraction.ts b/src/drawApp/graphics/CircleInteraction.ts new file mode 100644 index 0000000..db4e426 --- /dev/null +++ b/src/drawApp/graphics/CircleInteraction.ts @@ -0,0 +1,76 @@ +import * as pb_1 from 'google-protobuf'; +import { IPointData } from 'pixi.js'; +import { ICircleData, Circle } from 'src/graphics/circle/Circle'; +import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; +import { GraphicDataBase } from './GraphicDataBase'; +import { common } from 'src/protos/common'; + +export class CircleData extends GraphicDataBase implements ICircleData { + constructor(data?: iscsGraphicData.Circle) { + let circle; + if (!data) { + circle = new iscsGraphicData.Circle({ + common: GraphicDataBase.defaultCommonInfo(Circle.Type), + }); + } else { + circle = data; + } + super(circle); + } + + public get data(): iscsGraphicData.Circle { + return this.getData(); + } + + get code(): string { + return this.data.code; + } + set code(v: string) { + this.data.code = v; + } + get lineWidth(): number { + return this.data.lineWidth; + } + set lineWidth(v: number) { + this.data.lineWidth = v; + } + get lineColor(): string { + return this.data.lineColor; + } + set lineColor(v: string) { + this.data.lineColor = v; + } + get position(): IPointData { + return this.data.position; + } + set position(point: IPointData) { + this.data.position = new common.Point({ x: point.x, y: point.y }); + } + get radius(): number { + return this.data.radius; + } + 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(): CircleData { + return new CircleData(this.data.cloneMessage()); + } + copyFrom(data: CircleData): void { + pb_1.Message.copyInto(data.data, this.data); + } + eq(other: CircleData): boolean { + return pb_1.Message.equals(this.data, other.data); + } +} diff --git a/src/drawApp/iscsApp.ts b/src/drawApp/iscsApp.ts index 0fd32d0..11ff46e 100644 --- a/src/drawApp/iscsApp.ts +++ b/src/drawApp/iscsApp.ts @@ -6,6 +6,7 @@ import { KeyListener, newDrawApp, ClientEngine, + GraphicIdGenerator, } from 'jl-graphic'; import { @@ -18,7 +19,10 @@ import { } 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 { + CCTVButton, + CCTVButtonTemplate, +} from 'src/graphics/CCTV/cctvButton/CCTVButton'; import { useDrawStore } from 'src/stores/draw-store'; import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; import { getDraft } from 'src/api/DraftApi'; @@ -27,6 +31,7 @@ import { fromUint8Array, toUint8Array } from 'js-base64'; import { getWebsocketUrl } from 'src/configs/UrlManage'; import { sync_data_message } from 'src/protos/sync_data_message'; import { useAuthStore } from 'src/stores/auth-store'; +import { common } from 'src/protos/common'; // import { getOnlyToken } from 'src/configs/TokenManage'; let drawApp: IDrawApp | null = null; @@ -103,6 +108,10 @@ function handleSubscribe(app: IDrawApp) { const proto = handlerTypeData(data); const template = app.getGraphicTemplatesByType(proto.graphicType); const g = template.new(); + if (app.queryStore.checkIdExist(proto.id)) { + const newId = GraphicIdGenerator.next(); + proto.id = newId; + } g.loadData(proto); app.addGraphics(g); }); @@ -119,6 +128,11 @@ function handleSubscribe(app: IDrawApp) { graphics.push(g); }); app.deleteGraphics(...graphics); + } else if (syncData.operationType === 'update-canvas') { + // console.log(common.Canvas.deserialize(syncData.datas[0].data)); + // common.Canvas.deserialize(syncData.datas[0].data); + // app.updateCanvasAndRecord() + app.canvas.update(common.Canvas.deserialize(syncData.datas[0].data)); } } else { if (syncData.submenu === '火灾报警平面图') { @@ -273,6 +287,7 @@ export function saveDrawDatas(app: IDrawApp) { ) ); } + const graphics = app.queryStore.getAllGraphics(); switch (drawStore.selectSubmenuAndStation.submenu) { case '火灾报警平面图': for (let i = 0; i < storage.fasOfPlatformAlarmStorages.length; i++) { @@ -310,6 +325,15 @@ export function saveDrawDatas(app: IDrawApp) { app, cctvOfStationControl ) as iscsGraphicData.CCTVOfStationControlStorage; + + graphics.forEach((g) => { + if (g instanceof CCTVButton) { + const cctvButtonData = g.saveData(); + cctvStorage.cctvButtons.push( + (cctvButtonData as CCTVButtonData).data + ); + } + }); storage.cctvOfStationControlStorages[i] = cctvStorage; break; } @@ -319,12 +343,6 @@ export function saveDrawDatas(app: IDrawApp) { default: break; } - 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/graphics/circle/Circle.ts b/src/graphics/circle/Circle.ts new file mode 100644 index 0000000..0fe040f --- /dev/null +++ b/src/graphics/circle/Circle.ts @@ -0,0 +1,86 @@ +import { Color, Graphics, IPointData } from 'pixi.js'; +import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic'; + +export interface ICircleData extends GraphicData { + get code(): string; // 编号 + set code(v: string); + get position(): IPointData; // 位置坐标 + set position(point: IPointData); + get radius(): number; // 圆的半径 + set radius(v: number); + get lineWidth(): number; // 线宽 + set lineWidth(v: number); + get lineColor(): string; // 线色 + set lineColor(v: string); + get fillColor(): string; // 填充色 + set fillColor(v: string); + get alpha(): number; // 透明度 + set alpha(v: number); + clone(): ICircleData; + copyFrom(data: ICircleData): void; + eq(other: ICircleData): boolean; +} + +const circleConsts = { + lineWidth: 2, + lineColor: '0xff0000', + fillColor: '0xff0000', + alpha: 0.001, +}; + +export class Circle extends JlGraphic { + static Type = 'Circle'; + circleGraphic: Graphics = new Graphics(); + constructor() { + super(Circle.Type); + this.addChild(this.circleGraphic); + } + + get datas(): ICircleData { + return this.getDatas(); + } + doRepaint(): void { + const circleGraphic = this.circleGraphic; + circleGraphic.clear(); + circleGraphic.lineStyle( + this.datas.lineWidth, + new Color(this.datas.lineColor) + ); + circleGraphic.beginFill(this.datas.fillColor, this.datas.alpha); + circleGraphic.drawCircle( + this.datas.position.x, + this.datas.position.y, + this.datas.radius + ); + circleGraphic.endFill; + circleGraphic.pivot = this.datas.position; + const transformPos = this.datas.transform.position; + if (transformPos.x == 0 && transformPos.y == 0) { + this.position.set(this.datas.position.x, this.datas.position.y); + } else { + this.position.set( + this.datas.transform.position.x, + this.datas.transform.position.y + ); + } + } +} + +export class CircleTemplate extends JlGraphicTemplate { + lineWidth: number; + lineColor: string; + fillColor: string; + alpha: number; + constructor(dataTemplate: ICircleData) { + super(Circle.Type, { + dataTemplate, + }); + this.lineWidth = circleConsts.lineWidth; + this.lineColor = circleConsts.lineColor; + this.fillColor = circleConsts.fillColor; + this.alpha = circleConsts.alpha; + } + new(): Circle { + return new Circle(); + } +} diff --git a/src/graphics/circle/CircleDrawAssistant.ts b/src/graphics/circle/CircleDrawAssistant.ts new file mode 100644 index 0000000..902c0ed --- /dev/null +++ b/src/graphics/circle/CircleDrawAssistant.ts @@ -0,0 +1,117 @@ +import { FederatedPointerEvent, Graphics, IHitArea, Point } from 'pixi.js'; +import { + circlePoint2, + GraphicDrawAssistant, + GraphicInteractionPlugin, + IDrawApp, + JlGraphic, +} from 'jl-graphic'; + +import { ICircleData, Circle, CircleTemplate } from './Circle'; + +export class CircleDraw extends GraphicDrawAssistant< + CircleTemplate, + ICircleData +> { + point1: Point | null = null; + point2: Point | null = null; + circleGraphic: Graphics = new Graphics(); + + constructor(app: IDrawApp, template: CircleTemplate) { + super(app, template, 'sym_o_circle', '圆Circle'); + this.container.addChild(this.circleGraphic); + circleInteraction.init(app); + } + + clearCache(): void { + this.circleGraphic.clear(); + } + onLeftDown(e: FederatedPointerEvent): void { + const { x, y } = this.toCanvasCoordinates(e.global); + const p = new Point(x, y); + if (this.point1 === null) { + this.point1 = p; + } else { + this.point2 = p; + this.createAndStore(true); + this.point1 = null; + this.point2 = null; + } + } + + redraw(p: Point): void { + const template = this.graphicTemplate; + if (this.point1 === null) return; + const circleGraphic = this.circleGraphic; + circleGraphic.clear(); + circleGraphic.lineStyle(template.lineWidth, template.lineColor); + circleGraphic.drawCircle(...this.normalize(this.point1, p)); + } + private normalize(p1: Point, p2: Point): [number, number, number] { + const { abs } = Math; + const x = p1.x < p2.x ? p1.x : p2.x; + const y = p1.y < p2.y ? p1.y : p2.y; + const r = abs(p1.x - p2.x); + return [x, y, r]; + } + prepareData(data: ICircleData): boolean { + const p1 = this.point1 as Point; + const p2 = this.point2 as Point; + const [x, y, radius] = this.normalize(p1, p2); + const template = this.graphicTemplate; + data.position = new Point(x, y); + data.lineWidth = template.lineWidth; + data.lineColor = template.lineColor; + data.fillColor = template.fillColor; + data.alpha = template.alpha; + data.radius = radius; + return true; + } +} + +//碰撞检测 +export class CircleGraphicHitArea implements IHitArea { + circle: Circle; + constructor(circle: Circle) { + this.circle = circle; + } + contains(x: number, y: number): boolean { + const datas = this.circle.datas; + const tolerance = datas.lineWidth; + return circlePoint2( + datas.position.x, + datas.position.y, + Math.abs(datas.radius), + x, + y, + tolerance + ); + } +} + +export class circleInteraction extends GraphicInteractionPlugin { + static Name = 'circle_transform'; + constructor(app: IDrawApp) { + super(circleInteraction.Name, app); + } + static init(app: IDrawApp) { + return new circleInteraction(app); + } + filter(...grahpics: JlGraphic[]): Circle[] | undefined { + return grahpics + .filter((g) => g.type === Circle.Type) + .map((g) => g as Circle); + } + bind(g: Circle): void { + g.eventMode = 'static'; + g.cursor = 'pointer'; + g.scalable = true; + g.rotatable = true; + g.circleGraphic.hitArea = new CircleGraphicHitArea(g); + } + unbind(g: Circle): void { + g.eventMode = 'none'; + g.scalable = false; + g.rotatable = false; + } +} diff --git a/src/graphics/rect/RectDrawAssistant.ts b/src/graphics/rect/RectDrawAssistant.ts index 4faf128..ec179f0 100644 --- a/src/graphics/rect/RectDrawAssistant.ts +++ b/src/graphics/rect/RectDrawAssistant.ts @@ -1,17 +1,14 @@ -import { FederatedPointerEvent, Graphics, Point } from 'pixi.js'; +import { FederatedPointerEvent, Graphics, IHitArea, Point } from 'pixi.js'; import { GraphicDrawAssistant, GraphicInteractionPlugin, IDrawApp, JlGraphic, + linePoint, } from 'jl-graphic'; import { IRectData, Rect, RectTemplate } from './Rect'; -export interface IRectDrawOptions { - newData: () => IRectData; -} - export class RectDraw extends GraphicDrawAssistant { point1: Point | null = null; point2: Point | null = null; @@ -72,8 +69,30 @@ export class RectDraw extends GraphicDrawAssistant { } } +//碰撞检测 +export class RectGraphicHitArea implements IHitArea { + rect: Rect; + constructor(rect: Rect) { + this.rect = rect; + } + contains(x: number, y: number): boolean { + let contains = false; + const datas = this.rect.datas; + const tolerance = datas.lineWidth; + const p1 = new Point(0, 0); + const p2 = new Point(p1.x + datas.width, p1.y); + const p3 = new Point(p1.x + datas.width, p1.y + datas.height); + const p4 = new Point(p1.x, p1.y + datas.height); + const p = new Point(x, y); + contains = contains || linePoint(p1, p2, p, tolerance); + contains = contains || linePoint(p2, p3, p, tolerance); + contains = contains || linePoint(p3, p4, p, tolerance); + contains = contains || linePoint(p4, p1, p, tolerance); + return contains; + } +} export class rectInteraction extends GraphicInteractionPlugin { - static Name = 'platform_transform'; + static Name = 'rect_transform'; constructor(app: IDrawApp) { super(rectInteraction.Name, app); } @@ -88,6 +107,7 @@ 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/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 @@ - - - diff --git a/src/layouts/IscsDrawLayout.vue b/src/layouts/IscsDrawLayout.vue index e56578e..ee90b38 100644 --- a/src/layouts/IscsDrawLayout.vue +++ b/src/layouts/IscsDrawLayout.vue @@ -8,6 +8,14 @@ {{ currentTime }}
+ @@ -167,13 +175,26 @@ -
+
+ +
+ 组件展示 +
- - 状态栏 - + @@ -210,16 +231,8 @@ :height="drawDialogHeight" v-model="showDrawTool" canNotClose + position="left" > -
- - - @@ -250,7 +260,11 @@ import { CCTVButton } from 'src/graphics/CCTV/cctvButton/CCTVButton'; import { Arrow } from 'src/graphics/arrow/Arrow'; import { TextContent } from 'src/graphics/textContent/TextContent'; import { Rect } from 'src/graphics/rect/Rect'; -import { getIscsStyleConfig } from 'src/configs/iscsStyleConfig'; +import { + DisplayForm, + getIscsStyleConfig, + I_DA_SHI_ZHI_NENG, +} from 'src/configs/iscsStyleConfig'; import { IscsStyle, saveAsDraft } from 'src/api/DraftApi'; import DraggableDialog from 'src/components/common/DraggableDialog.vue'; import { successNotify } from 'src/utils/CommonNotify'; @@ -259,6 +273,11 @@ import { saveDrawToServer } from 'src/drawApp/commonApp'; import { sync_data_message } from 'src/protos/sync_data_message'; import { useAuthStore } from 'src/stores/auth-store'; import { Line } from 'src/graphics/line/Line'; +import { JlOperation } from 'jl-graphic'; +import { common } from 'src/protos/common'; +import { toStorageTransform } from 'src/drawApp/graphics/GraphicDataBase'; +import { Circle } from 'src/graphics/circle/Circle'; +import IscsBottomAlarm from 'src/components/Iscs/IscsBottomAlarm.vue'; const $q = useQuasar(); const route = useRoute(); @@ -305,7 +324,7 @@ function toggleRightDrawer() { //工具栏所用 const selectUtil = ref(); -const utilsOption: ControlItem[] = reactive([]); +let utilsOption: ControlItem[] = reactive([]); function drawSelect(item: string) { drawStore.getDrawApp().interactionPlugin(item).resume(); @@ -327,6 +346,36 @@ class ControlItem { } } } + +function handleUtilsOption() { + utilsOption = []; + const drawAssistantsTypes = [ + Arrow.Type, + TextContent.Type, + Circle.Type, + Rect.Type, + Line.Type, + ]; + switch (drawStore.selectSubmenuAndStation.submenu) { + case '监控布局图': + drawAssistantsTypes.push(CCTVButton.Type); + break; + } + drawAssistantsTypes.forEach((type) => { + const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type); + if (drawAssistant) { + utilsOption.push( + new ControlItem( + drawAssistant.name, + drawAssistant.icon, + drawAssistant.description || drawAssistant.name + ) + ); + } + }); + drawDialogHeight.value = 0; + drawDialogHeight.value = 44 * Math.ceil(utilsOption.length / 2); +} //左侧功能按钮 const leftMenuConfig = [ { label: '保存', click: saveAllDrawDatas }, @@ -346,46 +395,128 @@ onMounted(() => { if (route.query.isShared == '1') { const _record = drawApp.opRecord.record; drawApp.opRecord.record = function (op) { - handleRecordData(op); _record.call(drawApp.opRecord, op); + handleRecordData(op); + saveAllDrawDatas(); }; const _undo = drawApp.opRecord.undo; drawApp.opRecord.undo = function () { + const op = + drawApp.opRecord.undoStack[drawApp.opRecord.undoStack.length - 1]; _undo.call(drawApp.opRecord); - console.log('undo'); + console.log(op, 'undo'); + handleUnDoData(op); + saveAllDrawDatas(); + console.log('undo', drawApp); }; const _redo = drawApp.opRecord.redo; drawApp.opRecord.redo = function () { + const op = + drawApp.opRecord.redoStack[drawApp.opRecord.redoStack.length - 1]; _redo.call(drawApp.opRecord); - console.log('redo'); + console.log(op, 'redo'); + handleRecordData(op); + saveAllDrawDatas(); + console.log('redo', drawApp); }; } onResize(); } else { drawStore.setDraftId(null); } - const drawAssistantsTypes = [ - Arrow.Type, - TextContent.Type, - Rect.Type, - Line.Type, - CCTVButton.Type, - ]; - drawAssistantsTypes.forEach((type) => { - const drawAssistant = drawStore.getDrawApp().getDrawAssistant(type); - if (drawAssistant) { - utilsOption.push( - new ControlItem( - drawAssistant.name, - drawAssistant.icon, - drawAssistant.description || drawAssistant.name - ) - ); - } - }); - drawDialogHeight.value = 44 * Math.ceil(utilsOption.length / 2); + handleUtilsOption(); }); +function handleUnDoData(op: JlOperation) { + const drawApp = drawStore.getDrawApp(); + let operationType = op.type; + if (operationType == 'graphic-create') { + operationType = 'graphic-delete'; + } else if (operationType == 'graphic-delete') { + operationType = 'graphic-create'; + } + const syncData = { + operationType: operationType, + datas: [], + submenu: drawStore.selectSubmenuAndStation.submenu, + station: drawStore.selectSubmenuAndStation.station, + userId: useAuthStore().userId, + }; + if (op.type === 'update-canvas') { + const canvasData = op.obj.saveData(); + syncData.datas.push( + new sync_data_message.UpdataData({ + id: 0, + type: op.obj.type, + data: new common.Canvas({ + width: canvasData.width, + height: canvasData.height, + backgroundColor: canvasData.backgroundColor, + viewportTransform: toStorageTransform(canvasData.viewportTransform), + }).serialize(), + }) + ); + } else { + op.obj.forEach((g) => { + const gData = g.saveData(); + syncData.datas.push( + new sync_data_message.UpdataData({ + id: g.id, + type: g.type, + data: gData.data.serialize(), + }) + ); + }); + } + drawApp.publishMessage( + `/rtss_simulation/draft/iscs/${drawStore.draftId}`, + new sync_data_message.SyncData({ ...syncData }).serialize() + ); +} + +function handleRecordData(op: JlOperation) { + const drawApp = drawStore.getDrawApp(); + const syncData = { + operationType: op.type, + datas: [], + submenu: drawStore.selectSubmenuAndStation.submenu, + station: drawStore.selectSubmenuAndStation.station, + userId: useAuthStore().userId, + }; + if (op.type === 'update-canvas') { + const canvasData = op.obj.saveData(); + console.log(canvasData, 'canvasData'); + syncData.datas.push( + new sync_data_message.UpdataData({ + id: 0, + type: op.obj.type, + data: new common.Canvas({ + width: canvasData.width, + height: canvasData.height, + backgroundColor: canvasData.backgroundColor, + viewportTransform: toStorageTransform(canvasData.viewportTransform), + }).serialize(), + }) + ); + } else { + op.obj.forEach((g) => { + const gData = g.saveData(); + syncData.datas.push( + new sync_data_message.UpdataData({ + id: g.id, + type: g.type, + data: gData.data.serialize(), + }) + ); + }); + } + + drawApp.publishMessage( + `/rtss_simulation/draft/iscs/${drawStore.draftId}`, + new sync_data_message.SyncData({ ...syncData }).serialize() + ); +} + const canvasWidth = ref(0); const canvasHeight = ref(0); const headerHeight = ref(0); @@ -415,8 +546,16 @@ function onResize() { canvasHeight.value = clientHeight - headerHeight.value - footerHeight.value; const dom = document.getElementById('draw-app-container'); if (dom) { - dom.style.width = canvasWidth.value + 'px'; - dom.style.height = canvasHeight.value + 'px'; + if (subMenuDisplayForm.value == DisplayForm.draw) { + dom.style.width = canvasWidth.value + 'px'; + dom.style.height = canvasHeight.value + 'px'; + } else if (subMenuDisplayForm.value == DisplayForm.drawAndComponent) { + const heightPercent = subMenuOption.value.find( + (subMenu) => subMenu.value == selectSubMenuName.value + ).heightPercent; + dom.style.width = canvasWidth.value + 'px'; + dom.style.height = (heightPercent / 100) * canvasHeight.value + 'px'; + } } } @@ -459,6 +598,7 @@ const updateTime = () => { }; //目录车站切换 +const subMenuDisplayForm = ref(DisplayForm.draw); const selectMenuName = ref(''); let menuOption = []; function selectedMenu(menuName: string) { @@ -466,7 +606,12 @@ function selectedMenu(menuName: string) { for (let i = 0; i < iscsTypeConfig.length; i++) { if (iscsTypeConfig[i].menuName == menuName) { subMenuOption.value = iscsTypeConfig[i].sunMenu.map((sunMenu) => { - return { label: sunMenu.sunMenuName, value: sunMenu.sunMenuName }; + return { + label: sunMenu.sunMenuName, + value: sunMenu.sunMenuName, + displayForm: sunMenu.displayForm, + heightPercent: sunMenu?.heightPercent || 0, + }; }); selectSubMenuName.value = subMenuOption.value[0].value; selectedSubMenu(selectSubMenuName.value); @@ -476,18 +621,30 @@ function selectedMenu(menuName: string) { } const selectSubMenuName = ref(''); -const subMenuOption = ref([]); +const subMenuOption = ref< + { + label: string; + value: string; + displayForm: DisplayForm; + heightPercent?: number; + }[] +>([]); function selectedSubMenu(subName: string) { drawStore.selectSubmenuAndStation.submenu = subName; - forceReloadDate(); + subMenuDisplayForm.value = subMenuOption.value.find( + (subMenu) => subMenu.value == subName + ).displayForm; + if (subMenuDisplayForm.value !== DisplayForm.component) { + showDrawTool.value = true; + forceReloadDate(); + handleUtilsOption(); + } else { + showDrawTool.value = false; + } + onResize(); } -let iscsTypeConfig: { - menuName: string; - icon: string; - activeIcon: string; - sunMenu: { sunMenuName: string }[]; -}[] = []; +let iscsTypeConfig: I_DA_SHI_ZHI_NENG[] = []; function initMunuOption() { iscsTypeConfig = getIscsStyleConfig(route.query.iscsStyle as IscsStyle); menuOption = iscsTypeConfig.map((menu) => { @@ -500,9 +657,17 @@ function initMunuOption() { }); selectMenuName.value = menuOption[0].value; subMenuOption.value = iscsTypeConfig[0].sunMenu.map((sunMenu) => { - return { label: sunMenu.sunMenuName, value: sunMenu.sunMenuName }; + return { + label: sunMenu.sunMenuName, + value: sunMenu.sunMenuName, + displayForm: sunMenu.displayForm, + heightPercent: sunMenu?.heightPercent || 0, + }; }); selectSubMenuName.value = subMenuOption.value[0].value; + subMenuDisplayForm.value = subMenuOption.value[0].displayForm; + showDrawTool.value = + subMenuOption.value[0].displayForm !== DisplayForm.component; drawStore.selectSubmenuAndStation.submenu = selectSubMenuName.value; drawStore.selectSubmenuAndStation.station = stationOption[0].value; } @@ -531,30 +696,6 @@ function selectedStation(name: string) { forceReloadDate(); } -function handleRecordData(op) { - const drawApp = drawStore.getDrawApp(); - const syncData = { - operationType: op.type, - datas: [], - submenu: drawStore.selectSubmenuAndStation.submenu, - station: drawStore.selectSubmenuAndStation.station, - userId: useAuthStore().userId, - }; - op.obj.forEach((g) => { - const gData = g.saveData(); - syncData.datas.push( - new sync_data_message.UpdataData({ - id: g.id, - type: g.type, - data: gData.data.serialize(), - }) - ); - }); - drawApp.publishMessage( - `/rtss_simulation/draft/iscs/${drawStore.draftId}`, - new sync_data_message.SyncData({ ...syncData }).serialize() - ); -} function forceReloadDate() { const drawApp = drawStore.getDrawApp(); const graphics = drawApp.queryStore.getAllGraphics(); @@ -639,7 +780,7 @@ onUnmounted(() => { top: 10px; } .menu-nav-text { - width: 90px; + width: 4.8vw; margin-top: 28px; text-align: center; color: white; 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); - } - } -} diff --git a/src/protos/iscs_graphic_data.ts b/src/protos/iscs_graphic_data.ts index cd45fc6..3faa48c 100644 --- a/src/protos/iscs_graphic_data.ts +++ b/src/protos/iscs_graphic_data.ts @@ -216,9 +216,10 @@ export namespace iscsGraphicData { texts?: Text[]; rects?: Rect[]; lines?: Line[]; + circles?: Circle[]; }) { super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4], this.#one_of_decls); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2, 3, 4, 5], this.#one_of_decls); if (!Array.isArray(data) && typeof data == "object") { if ("arrows" in data && data.arrows != undefined) { this.arrows = data.arrows; @@ -232,6 +233,9 @@ export namespace iscsGraphicData { if ("lines" in data && data.lines != undefined) { this.lines = data.lines; } + if ("circles" in data && data.circles != undefined) { + this.circles = data.circles; + } } } get arrows() { @@ -258,11 +262,18 @@ export namespace iscsGraphicData { set lines(value: Line[]) { pb_1.Message.setRepeatedWrapperField(this, 4, value); } + get circles() { + return pb_1.Message.getRepeatedWrapperField(this, Circle, 5) as Circle[]; + } + set circles(value: Circle[]) { + pb_1.Message.setRepeatedWrapperField(this, 5, value); + } static fromObject(data: { arrows?: ReturnType[]; texts?: ReturnType[]; rects?: ReturnType[]; lines?: ReturnType[]; + circles?: ReturnType[]; }): CommonGraphicStorage { const message = new CommonGraphicStorage({}); if (data.arrows != null) { @@ -277,6 +288,9 @@ export namespace iscsGraphicData { if (data.lines != null) { message.lines = data.lines.map(item => Line.fromObject(item)); } + if (data.circles != null) { + message.circles = data.circles.map(item => Circle.fromObject(item)); + } return message; } toObject() { @@ -285,6 +299,7 @@ export namespace iscsGraphicData { texts?: ReturnType[]; rects?: ReturnType[]; lines?: ReturnType[]; + circles?: ReturnType[]; } = {}; if (this.arrows != null) { data.arrows = this.arrows.map((item: Arrow) => item.toObject()); @@ -298,6 +313,9 @@ export namespace iscsGraphicData { if (this.lines != null) { data.lines = this.lines.map((item: Line) => item.toObject()); } + if (this.circles != null) { + data.circles = this.circles.map((item: Circle) => item.toObject()); + } return data; } serialize(): Uint8Array; @@ -312,6 +330,8 @@ export namespace iscsGraphicData { 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 (this.circles.length) + writer.writeRepeatedMessage(5, this.circles, (item: Circle) => item.serialize(writer)); if (!w) return writer.getResultBuffer(); } @@ -333,6 +353,9 @@ export namespace iscsGraphicData { case 4: reader.readMessage(message.lines, () => pb_1.Message.addToRepeatedWrapperField(message, 4, Line.deserialize(reader), Line)); break; + case 5: + reader.readMessage(message.circles, () => pb_1.Message.addToRepeatedWrapperField(message, 5, Circle.deserialize(reader), Circle)); + break; default: reader.skipField(); } } @@ -1111,6 +1134,240 @@ export namespace iscsGraphicData { return Line.deserialize(bytes); } } + export class Circle extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + common?: dependency_1.common.CommonInfo; + code?: string; + position?: dependency_1.common.Point; + radius?: number; + lineWidth?: number; + lineColor?: string; + fillColor?: string; + alpha?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("common" in data && data.common != undefined) { + this.common = data.common; + } + if ("code" in data && data.code != undefined) { + this.code = data.code; + } + if ("position" in data && data.position != undefined) { + this.position = data.position; + } + if ("radius" in data && data.radius != undefined) { + this.radius = data.radius; + } + if ("lineWidth" in data && data.lineWidth != undefined) { + this.lineWidth = data.lineWidth; + } + if ("lineColor" in data && data.lineColor != undefined) { + this.lineColor = data.lineColor; + } + if ("fillColor" in data && data.fillColor != undefined) { + this.fillColor = data.fillColor; + } + if ("alpha" in data && data.alpha != undefined) { + this.alpha = data.alpha; + } + } + } + get common() { + return pb_1.Message.getWrapperField(this, dependency_1.common.CommonInfo, 1) as dependency_1.common.CommonInfo; + } + set common(value: dependency_1.common.CommonInfo) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_common() { + return pb_1.Message.getField(this, 1) != null; + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, "") as string; + } + set code(value: string) { + pb_1.Message.setField(this, 2, value); + } + get position() { + return pb_1.Message.getWrapperField(this, dependency_1.common.Point, 3) as dependency_1.common.Point; + } + set position(value: dependency_1.common.Point) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_position() { + return pb_1.Message.getField(this, 3) != null; + } + get radius() { + return pb_1.Message.getFieldWithDefault(this, 4, 0) as number; + } + set radius(value: number) { + pb_1.Message.setField(this, 4, value); + } + get lineWidth() { + return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; + } + set lineWidth(value: number) { + pb_1.Message.setField(this, 5, value); + } + get lineColor() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set lineColor(value: string) { + pb_1.Message.setField(this, 6, value); + } + get fillColor() { + return pb_1.Message.getFieldWithDefault(this, 7, "") as string; + } + set fillColor(value: string) { + pb_1.Message.setField(this, 7, value); + } + get alpha() { + return pb_1.Message.getFieldWithDefault(this, 8, 0) as number; + } + set alpha(value: number) { + pb_1.Message.setField(this, 8, value); + } + static fromObject(data: { + common?: ReturnType; + code?: string; + position?: ReturnType; + radius?: number; + lineWidth?: number; + lineColor?: string; + fillColor?: string; + alpha?: number; + }): Circle { + const message = new Circle({}); + if (data.common != null) { + message.common = dependency_1.common.CommonInfo.fromObject(data.common); + } + if (data.code != null) { + message.code = data.code; + } + if (data.position != null) { + message.position = dependency_1.common.Point.fromObject(data.position); + } + if (data.radius != null) { + message.radius = data.radius; + } + if (data.lineWidth != null) { + message.lineWidth = data.lineWidth; + } + if (data.lineColor != null) { + message.lineColor = data.lineColor; + } + if (data.fillColor != null) { + message.fillColor = data.fillColor; + } + if (data.alpha != null) { + message.alpha = data.alpha; + } + return message; + } + toObject() { + const data: { + common?: ReturnType; + code?: string; + position?: ReturnType; + radius?: number; + lineWidth?: number; + lineColor?: string; + fillColor?: string; + alpha?: number; + } = {}; + if (this.common != null) { + data.common = this.common.toObject(); + } + if (this.code != null) { + data.code = this.code; + } + if (this.position != null) { + data.position = this.position.toObject(); + } + if (this.radius != null) { + data.radius = this.radius; + } + if (this.lineWidth != null) { + data.lineWidth = this.lineWidth; + } + if (this.lineColor != null) { + data.lineColor = this.lineColor; + } + if (this.fillColor != null) { + data.fillColor = this.fillColor; + } + if (this.alpha != null) { + data.alpha = this.alpha; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_common) + writer.writeMessage(1, this.common, () => this.common.serialize(writer)); + if (this.code.length) + writer.writeString(2, this.code); + if (this.has_position) + writer.writeMessage(3, this.position, () => this.position.serialize(writer)); + if (this.radius != 0) + writer.writeFloat(4, this.radius); + if (this.lineWidth != 0) + writer.writeInt32(5, this.lineWidth); + if (this.lineColor.length) + writer.writeString(6, this.lineColor); + if (this.fillColor.length) + writer.writeString(7, this.fillColor); + if (this.alpha != 0) + writer.writeFloat(8, this.alpha); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Circle { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Circle(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.common, () => message.common = dependency_1.common.CommonInfo.deserialize(reader)); + break; + case 2: + message.code = reader.readString(); + break; + case 3: + reader.readMessage(message.position, () => message.position = dependency_1.common.Point.deserialize(reader)); + break; + case 4: + message.radius = reader.readFloat(); + break; + case 5: + message.lineWidth = reader.readInt32(); + break; + case 6: + message.lineColor = reader.readString(); + break; + case 7: + message.fillColor = reader.readString(); + break; + case 8: + message.alpha = reader.readFloat(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Circle { + return Circle.deserialize(bytes); + } + } export class CCTVButton extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | { diff --git a/yarn.lock b/yarn.lock index 0444ae5..8e0a362 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.18": - version "0.1.16" - resolved "git+https://gitea.joylink.club/joylink/graphic-pixi.git#38045a10271f81b65820db402051fefc62b0a2cd" +"jl-graphic@git+https://gitea.joylink.club/joylink/graphic-pixi.git#v0.1.19": + version "0.1.18" + resolved "git+https://gitea.joylink.club/joylink/graphic-pixi.git#1c803d096585e258be3f60d3d95d1bd0c318d316" dependencies: "@pixi/graphics-extras" "^7.3.2" "@pixi/utils" "^7.3.2"