diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..012261b --- /dev/null +++ b/debug.log @@ -0,0 +1 @@ +[1225/112746.821:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/src/app/working-area/model/gameMode.ts b/src/app/working-area/model/gameMode.ts index feabdbb..d656a7f 100644 --- a/src/app/working-area/model/gameMode.ts +++ b/src/app/working-area/model/gameMode.ts @@ -3,5 +3,6 @@ */ export enum GameMode { BasicInformation, - Assignment + Assignment, + Examinee } \ No newline at end of file diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index e211dce..1ce8484 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -15,7 +15,6 @@ import { AxShape } from './model/axShape'; import { PropertyInfo } from './model/PropertyInfo'; import { AxPreviewImageShape } from './model/axPreviewImageShape'; import { AxArrowConnector } from './model/axArrowConnector'; -import { Legend } from './model/legend'; @Component({ @@ -274,7 +273,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.animator.update(); this.mousePosition = this.app.renderer.plugins.interaction.mouse.global; // 预览图片 - if (this.previewImage !== null) { + if (this.previewImage !== null && this.backgroundImage !== null) { this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition); } @@ -391,17 +390,19 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 创建图标事件 */ this.on('createIcon', obj => { - if (obj.assetData.GameMode === GameMode.BasicInformation) { + if (obj.assetData.GameMode === GameMode.BasicInformation) { // 基本信息 // 添加楼层数据 this.canvasData.originaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; // 添加建筑数据 this.canvasData.originalcompanyBuildingData.data[obj.assetData.Id] = obj.assetData; - } else { + } else if(obj.assetData.GameMode === GameMode.Assignment){ // 处置预案 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; + } else if (obj.assetData.GameMode === GameMode.Examinee) { // 考生考试 + // this.canvasData.examOriginaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; } this.canvasData.isChange = true; }); @@ -474,30 +475,39 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.selection.select(obj); }); } - /** - * 刷新工作区 - */ + // /** + // * 刷新工作区 + // */ public async refresh() { this.setPaintMode(PaintMode.endPaint); this.resetCanvas(); this.destroyBackgroundImage(); if (!this.canvasData.selectStorey.imageUrl) { + return; } await this.createBackgroundImage(this.canvasData.selectStorey.imageUrl); - this.createFloorShape(); - this.createBuildingShape(); + this.createFloorShape(this.canvasData.originaleveryStoreyData.data); if (this.canvasData.gameMode === GameMode.Assignment) { - this.createWorkNode(); + this.createNodeShape(this.canvasData.selectPanelPoint.Data); } - this.emit('backgroundScale', this.backgroundImage.scale.x); + // await this.createBackground(this.canvasData.selectStorey.imageUrl); + + } + /** + * 异步创建背景图 + */ + public async createBackground(imageUrl:string) { + if (this.backgroundImage !== null) { + this.destroyBackgroundImage(); + } + await this.createBackgroundImage(imageUrl) } /** * 创建楼层图形 */ - private createFloorShape() { - const floorData = this.canvasData.originaleveryStoreyData.data; + public createFloorShape(floorData: any) { Object.keys(floorData).forEach((key) => { switch (floorData[key].InteractiveMode) { case 0: @@ -521,42 +531,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV break; } }); + this.emit('backgroundScale', this.backgroundImage.scale.x); } /** - * 创建建筑图形 + * 创建节点图形 */ - private createBuildingShape() { - const buildingData = this.canvasData.originalcompanyBuildingData.data; - const floor = this.canvasData.selectStorey; - Object.keys(buildingData).forEach((key) => { - if (buildingData[key].FloorId === floor.id) { - switch (buildingData[key].InteractiveMode) { - case 0: - const singleIcon = new AxImageShape(buildingData[key], this); - singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode; - break; - case 1: - const icon = new MultipointIcon(buildingData[key], this); - break; - case 2: - const polygonIcon = new PolygonIcon(buildingData[key], this); - break; - case 3: - if (buildingData[key].Name === '水带') { - const distance = new AxArrowConnector(buildingData[key], this, false, true); - } else if (buildingData[key].Name === '距离') { - const distance = new AxArrowConnector(buildingData[key], this, true, true); - } else if (buildingData[key].Name === '普通墙' || buildingData[key].Name === '承重墙') { - const wall = new AxArrowConnector(buildingData[key], this, false, false); - } - break; - } - } - }); - } - private createWorkNode() { - // 加载处置节点数据 - const nodeData = this.canvasData.selectPanelPoint.Data; + public createNodeShape(nodeData: any) { if (nodeData !== undefined && nodeData !== null) { Object.keys(nodeData).forEach((key) => { Object.keys(nodeData[key]).forEach((tempKey) => { @@ -578,6 +558,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }); }); } + this.emit('backgroundScale', this.backgroundImage.scale.x); } /** * @@ -649,7 +630,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 创建背景图 */ - private async createBackgroundImage(imageUrl: string): Promise { + public async createBackgroundImage(imageUrl: string): Promise { const image = await PIXI.Texture.fromURL(imageUrl); this.backgroundImage = new PIXI.Sprite(image); this.backgroundImage.anchor.set(0.5); @@ -957,10 +938,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (!this.canvasData.selectStorey.imageUrl) { this.backgroundImage.visible = false; } else { - // this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); - // this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; - // this.backgroundImage.visible = true; - this.refresh(); + this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); + this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; + this.backgroundImage.visible = true; + // this.refresh(); } } /** @@ -968,6 +949,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public destroyBackgroundImage(): void { this.app.stage.removeChild(this.backgroundImage); + this.backgroundImage = null; } /** * 设置背景图缩放 @@ -1046,6 +1028,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 开始绘制 */ public beginPaint() { + console.log(this.canvasData.selectTemplateData); this.selection.deselectAll(); this.setPaintMode(PaintMode.endPaint); this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode);