From b4113df1492e15021e0590526f82b0c7e184020a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Mon, 18 Jan 2021 17:43:00 +0800 Subject: [PATCH] 1.0.10.20210118_beta --- src/app/canvas-share-data.service.ts | 13 +- .../working-area/model/axArrowConnector.ts | 4 +- .../working-area/working-area.component.ts | 240 +++++++----------- 3 files changed, 100 insertions(+), 157 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 62c8cc0..adf46a6 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -8,7 +8,9 @@ import { GameMode } from './working-area/model/gameMode'; export class CanvasShareDataService { constructor() { } private _sendMessage: ReplaySubject = new ReplaySubject(1); - GameMode: any; + + examDisposalNodesData; // 考生进入时获取当前试卷的处置节点 + examFacilityAssetsData; // 考生进入时获取当前试卷要考察的消防设施 isChange = false; // 数据 是否改动 @@ -16,14 +18,23 @@ export class CanvasShareDataService { // 总平面图/建筑 楼层 selectStorey: any = {area: '', details: ''}; // 选择当前 楼层 数据 + originalcompanyBuildingData: any; // 单位/建筑 数据 + originaleveryStoreyData: any; // 总平面图/楼层/区域 楼层数据 + + + examOriginaleveryStoreyData: any; // 考生答卷 总平面图/楼层/区域 楼层数据 + + hiddenBasicInfoFacilities: any = []; // 考生答卷 当前楼层需要隐藏的基本信息素材 // 总平面图/建筑 楼层 // 处置 节点 allDisposalNode: any = []; // 所有 处置节点 allNodeMarkers: any; // 灾情 标签信息 + selectPanelPoint: DisposalNodeData = new DisposalNodeData(); + selectPanelPointBaseData: any = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}; // 当前 数据节点 所对应的 天气,详情 数据节点 // 处置 节点 /** diff --git a/src/app/working-area/model/axArrowConnector.ts b/src/app/working-area/model/axArrowConnector.ts index 6bd8b3f..d9ba040 100644 --- a/src/app/working-area/model/axArrowConnector.ts +++ b/src/app/working-area/model/axArrowConnector.ts @@ -36,7 +36,7 @@ export class AxArrowConnector extends AxShape { this.markerStart = markerStart; this.markerEnd = markerEnd; - + this.position = this.assetData.Point; this.name = assetData.Id; this.text = new PIXI.Text(this.assetData.Name + '\r\n' @@ -154,7 +154,7 @@ export class AxArrowConnector extends AxShape { + this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue; const strokeWidth = 1; - const edgeWidth = this.assetData.Thickness === 0 ? 1 : this.assetData.Thickness; // 宽度 + const edgeWidth = this.assetData.Thickness === 0 ? 5 : this.assetData.Thickness; // 宽度 const startWidth = edgeWidth * 2 + strokeWidth; const endWidth = edgeWidth * 2 + strokeWidth; diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index a886544..04d2c17 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -148,7 +148,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 * Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 */ - public VERSION = '1.0.8.20210118_beta'; + public VERSION = '1.0.10.20210118_beta'; /** * 数据初始化 */ @@ -394,18 +394,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.canvasData.selectPanelPoint.Data = new FloorNodeData(); } this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id] = axShape.assetData; + } else if (axShape.assetData.GameMode === GameMode.Examinee) { // 考生考试 + if (axShape.assetData.Tag === 1) { + this.canvasData.examOriginaleveryStoreyData.data[axShape.assetData.Id] = axShape.assetData; + } else { + if (this.canvasData.selectPanelPoint.Data === undefined + || this.canvasData.selectPanelPoint.Data === null) { + this.canvasData.selectPanelPoint.Data = new FloorNodeData(); + } + this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id] = axShape.assetData; + } } - // else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试 - // if (obj.assetData.Tag === 1) { - // this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; - // } else { - // if (this.canvasData.selectPanelPoint.Data === undefined - // || this.canvasData.selectPanelPoint.Data === null) { - // this.canvasData.selectPanelPoint.Data = new FloorNodeData(); - // } - // this.canvasData.selectPanelPoint.Data.Stock[obj.assetData.Id] = obj.assetData; - // } - // } const temp = this.backgroundImage.getChildByName('图例') as AxLegend; if ( temp !== undefined && temp !== null @@ -439,18 +438,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; - } - // else if (assetData.GameMode === GameMode.Examinee) { // 考生考试 - // if (assetData.Tag === 1) { - // // 删除楼层数据 - // delete this.canvasData.examOriginaleveryStoreyData.data[assetData.Id]; - // } else { - // delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[assetData.Id]; - // delete this.canvasData.selectPanelPoint.Data.Increment[assetData.Id]; - // delete this.canvasData.selectPanelPoint.Data.Stock[assetData.Id]; - // } + } else if (axShape.assetData.GameMode === GameMode.Examinee) { // 考生考试 + if (axShape.assetData.Tag === 1) { + // 删除楼层数据 + delete this.canvasData.examOriginaleveryStoreyData.data[axShape.assetData.Id]; + } else { + delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Increment[axShape.assetData.Id]; + delete this.canvasData.selectPanelPoint.Data.Stock[axShape.assetData.Id]; + } - // } + } this.backgroundImage.removeChild(axShape); this.emit('canvasDataChanged'); this.canvasData.isChange = true; @@ -975,28 +973,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // 创建处置预案图形 this.createNodeShape(this.canvasData.selectPanelPoint.Data); this.createAxLegend(); - - // // 测试代码 - // const tempAssetData = { - // Id: "图例",//ObjectID.default.generate() - // Color: "#066EED80", - // PropertyInfos: [ - // { - // Tag : '', - // Order : 0, - // Enabled : true, - // Visible : true, - // Required : false, - // RuleName : "", - // RuleValue : "", - // PhysicalUnit : "", - // PropertyName : "列", - // PropertyType : 2, - // PropertyValue : 2, - // }, - // ] - // }; - // var rectShape = new AxRectangleShape(0, 0, 100, 100,tempAssetData,this); } /** * 创建安信图例 @@ -1098,15 +1074,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 创建预览单点图标 */ private createPreviewImage(): void { - // if (this.previewSinglePointIcon === null) { - // this.previewSinglePointIcon = PIXI.Sprite.from(this.canvasData.selectTemplateData.imageUrl); - // this.previewSinglePointIcon.width = this.canvasData.selectTemplateData.width; - // this.previewSinglePointIcon.height = this.canvasData.selectTemplateData.height; - // this.previewSinglePointIcon.anchor.set(0.5); - // this.previewSinglePointIcon.interactive = false; - // this.backgroundImage.addChild(this.previewSinglePointIcon); - // this.previewSinglePointIcon.scale.set(1 / this.backgroundImage.scale.x); - // } this.previewImage = new AxPreviewImageShape(this); this.previewImage.visible = false; } @@ -1137,9 +1104,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * @param x 半径 */ private createCircleShadow(): void { - // this.circleShadow.beginFill(0xFFCC5A); - // this.circleShadow.drawCircle(0, 0, 10); - // this.circleShadow.endFill(); this.circleShadow.visible = false; this.backgroundImage.addChild(this.circleShadow); } @@ -1152,15 +1116,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.circleShadow.drawCircle(0, 0, 5 / this.backgroundImage.scale.x); this.circleShadow.endFill(); } - // showConnectionPoint(b: boolean) { - // this.backgroundImage?.children.forEach(item => { - // if (item instanceof AxImageShape) { - // if (item.assetData.CanConnect) { - // item.showConnectionPoint(b); - // } - // } - // }); - // } /** * 开始绘制 */ @@ -1213,14 +1168,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.circleShadow.visible = true; break; case PaintMode.Pipeline: - // if (this.canvasData.selectTemplateData.name === '水带') { - // this.showConnectionPoint(true); - // } else { - // } break; case PaintMode.endPaint: - // this.showConnectionPoint(false); if (this.previewImage !== null) { this.previewImage.visible = false; } @@ -1229,11 +1179,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV && this.paintingIcon !== null) { this.backgroundImage.removeChild(this.paintingIcon); } - - // if (this.paintingShape !== undefined - // && this.paintingShape !== null) { - // this.backgroundImage.removeChild(this.paintingShape); - // } if (this.paintingShape !== null) { this.backgroundImage.removeChild(this.paintingShape); this.paintingShape = null; @@ -1315,14 +1260,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } break; case PaintMode.Pipeline: - // if (this.canvasData.selectTemplateData.name !== '水带') { this.emit('createIcon', this.paintingShape); this.paintingShape = null; - // } break; } this.paintPoints.splice(0, this.paintPoints.length); - // this.emit('backgroundScale', this.backgroundImage.scale.x); } /** * 复制 @@ -1392,88 +1334,78 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 考生点击楼层 */ public async onExamineeClickFloor() { - // this.backgroundImage.visible = false; - // this.backgroundImage.scale.set(1); - // this.backgroundImage.pivot.set(0); - // this.backgroundImage.x = this.app.view.width / 2; - // this.backgroundImage.y = this.app.view.height / 2; - // this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); - // this.backgroundImage.angle = imageAngle; - // // 等待图片加载完成 - // let imageWidth = this.backgroundImage.texture.width; - // let imageHeight = this.backgroundImage.texture.height; - // let appWidth = this.app.view.width - 470; - // let appHeight = this.app.view.height; - // let wScale = appWidth / imageWidth; - // let hScale = appHeight / imageHeight; - // let scale = wScale < hScale ? wScale : hScale; - // // 设置图片缩放 - // this.backgroundImage.scale.set(scale); - // // 清空所有图形 - // this.selection.deselectAll(); - // let itemList = []; - // this.backgroundImage.children.forEach(item => { - // if (item instanceof AxShape && item instanceof AxPreviewImageShape===false) { - // itemList.push(item.name); - // } - // }); + await this.refreshBackgroundImage(); + // 清空所有图形 + this.selection.deselectAll(); + const itemList = []; + this.backgroundImage.children.forEach(item => { + if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { + itemList.push(item.name); + } + }); - // itemList.forEach(item => { - // this.backgroundImage.getChildByName(item).destroy(); - // }) - // // 创建楼层图形 - // this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); - // // 创建楼层图形 - // this.createFloorShape(this.canvasData.originaleveryStoreyData.data); - // // 创建处置预案图形 - // this.createNodeShape(this.canvasData.selectPanelPoint.Data); - // // 隐藏图标 - // this.setIconVisible(this.canvasData.hiddenBasicInfoFacilities, false); - // this.backgroundImage.visible = true; + itemList.forEach(item => { + this.backgroundImage.getChildByName(item).destroy(); + }); + // 创建楼层图形 + this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); + // 创建楼层图形 + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + // 创建处置预案图形 + this.createNodeShape(this.canvasData.selectPanelPoint.Data); + // 隐藏图标 + this.setIconVisible(this.canvasData.hiddenBasicInfoFacilities, false); } /** - * 考官点击楼层 + * 考官点击楼层-阅卷 */ public async onExaminerClickFloor() { - // this.backgroundImage.visible = false; - // this.backgroundImage.scale.set(1); - // this.backgroundImage.pivot.set(0); - // this.backgroundImage.x = this.app.view.width / 2; - // this.backgroundImage.y = this.app.view.height / 2; - // this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); - // this.backgroundImage.angle = imageAngle; - // // 等待图片加载完成 - // let imageWidth = this.backgroundImage.texture.width; - // let imageHeight = this.backgroundImage.texture.height; - // let appWidth = this.app.view.width - 470; - // let appHeight = this.app.view.height; - // let wScale = appWidth / imageWidth; - // let hScale = appHeight / imageHeight; - // let scale = wScale < hScale ? wScale : hScale; - // // 设置图片缩放 - // this.backgroundImage.scale.set(scale); - // // 清空所有图形 - // this.selection.deselectAll(); - // let itemList = []; - // this.backgroundImage.children.forEach(item => { - // if (item instanceof AxShape && item instanceof AxPreviewImageShape===false) { - // itemList.push(item.name); - // } - // }); + await this.refreshBackgroundImage(); + // 清空所有图形 + this.selection.deselectAll(); + const itemList = []; + this.backgroundImage.children.forEach(item => { + if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { + itemList.push(item.name); + } + }); + + itemList.forEach(item => { + this.backgroundImage.getChildByName(item).destroy(); + }); + // 创建楼层图形 + this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); + // 创建楼层图形 + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + // 创建处置预案图形 + this.createNodeShape(this.canvasData.selectPanelPoint.Data); + // 隐藏图标 + this.setIconVisible(this.canvasData.hiddenBasicInfoFacilities, false); + } + /** + * 考官点击楼层-创建试卷 + */ + public async onExaminerClickFloor_CreateTestpaper() { + await this.refreshBackgroundImage(); + // 清空所有图形 + this.selection.deselectAll(); + const itemList = []; + this.backgroundImage.children.forEach(item => { + if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { + itemList.push(item.name); + } + }); - // itemList.forEach(item => { - // this.backgroundImage.getChildByName(item).destroy(); - // }) - // // 创建楼层图形 - // this.createFloorShape(this.canvasData.examOriginaleveryStoreyData.data); - // // 创建楼层图形 - // this.createFloorShape(this.canvasData.originaleveryStoreyData.data); - // // 创建处置预案图形 - // this.createNodeShape(this.canvasData.selectPanelPoint.Data); - // // 隐藏图标 - // this.setIconVisible(this.canvasData.hiddenBasicInfoFacilities, false); - // this.backgroundImage.visible = true; + itemList.forEach(item => { + this.backgroundImage.getChildByName(item).destroy(); + }); + // 创建楼层图形 + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); + // 创建处置预案图形 + this.createNodeShape(this.canvasData.selectPanelPoint.Data); + // 隐藏图标 + this.setNameVisible(false, 0); } }