|
|
|
@ -2,7 +2,7 @@ import { Component, OnInit, ElementRef, ViewChild, AfterViewInit, Input } from '
|
|
|
|
|
import * as PIXI from 'pixi.js'; |
|
|
|
|
import { EventEmitter } from 'events'; |
|
|
|
|
import { EventManager } from '@angular/platform-browser'; |
|
|
|
|
import { OutlineFilter } from 'pixi-filters'; |
|
|
|
|
// import { OutlineFilter } from 'pixi-filters';
|
|
|
|
|
import { AssetData, CanvasShareDataService, DisposalNodeData, FloorNodeData } from '../canvas-share-data.service'; |
|
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
|
import { Charm } from './charm'; |
|
|
|
@ -15,7 +15,8 @@ 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'; |
|
|
|
|
import { AxLegend, Legend } from './model/axLegend'; |
|
|
|
|
import { NullTemplateVisitor } from '@angular/compiler'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -97,7 +98,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 绿色描边 |
|
|
|
|
*/ |
|
|
|
|
public outlineFilterGreen = new OutlineFilter(2, 0x00ff00); |
|
|
|
|
// public outlineFilterGreen = new OutlineFilter(2, 0x00ff00);
|
|
|
|
|
/** |
|
|
|
|
* 拷贝素材数据 |
|
|
|
|
*/ |
|
|
|
@ -135,10 +136,18 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
public carData: Map<string, any> = new Map<string, any>(); |
|
|
|
|
// 当前选择的车辆id
|
|
|
|
|
public selectCar: any = null; |
|
|
|
|
// 本软件版本号由四部分组成:<主版本号><次版本号><修订版本号><日期加希腊字母版本号> 例如:1.0.0.20210105_beta
|
|
|
|
|
// Alpha版: 此版本表示该软件在此阶段主要是以实现软件功能为主,通常只在软件开发者内部交流,一般而言,该版本软件的Bug较多,需要继续修改。
|
|
|
|
|
// Beta版: 该版本相对于α版已有了很大的改进,消除了严重的错误,但还是存在着一些缺陷,需要经过多次测试来进一步消除,此版本主要的修改对像是软件的UI。
|
|
|
|
|
// RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。
|
|
|
|
|
// Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。
|
|
|
|
|
public VERSION = '1.0.0.20210107_beta'; |
|
|
|
|
/** |
|
|
|
|
* 数据初始化 |
|
|
|
|
*/ |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
PIXI.utils.skipHello() |
|
|
|
|
this.sayHello(); |
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { |
|
|
|
|
if (event.keyCode === 17) { |
|
|
|
|
this.selection.isMultiselection = true; |
|
|
|
@ -152,40 +161,51 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
} |
|
|
|
|
// 按Del键删除选中的图标
|
|
|
|
|
if (event.keyCode === 46) { |
|
|
|
|
this.selection.objects.forEach(item => { |
|
|
|
|
if (this.allowEdit |
|
|
|
|
&& this.canvasData.gameMode === item.assetData.GameMode) { |
|
|
|
|
switch (this.canvasData.gameMode) { |
|
|
|
|
case 0: |
|
|
|
|
// 删除楼层数据
|
|
|
|
|
delete this.canvasData.originaleveryStoreyData.data[item.assetData.Id]; |
|
|
|
|
// 删除建筑数据
|
|
|
|
|
delete this.canvasData.originalcompanyBuildingData.data[item.assetData.Id]; |
|
|
|
|
// 取消渲染
|
|
|
|
|
this.backgroundImage.removeChild(this.backgroundImage.getChildByName(item.assetData.Id)); |
|
|
|
|
// 数据更改
|
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
delete this.canvasData.selectPanelPoint.Data.DefinedIncrement[item.assetData.Id]; |
|
|
|
|
delete this.canvasData.selectPanelPoint.Data.Increment[item.assetData.Id]; |
|
|
|
|
delete this.canvasData.selectPanelPoint.Data.Stock[item.assetData.Id]; |
|
|
|
|
this.backgroundImage.removeChild(this.backgroundImage.getChildByName(item.assetData.Id)); |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
break; |
|
|
|
|
this.deleteSelectedShape(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 删除选中的图标 |
|
|
|
|
*/ |
|
|
|
|
public deleteSelectedShape() { |
|
|
|
|
this.selection.objects.forEach(item => { |
|
|
|
|
this.deleteShape(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.emit('deleteIcon'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
*
|
|
|
|
|
* @param obj 删除一个形状 |
|
|
|
|
*/ |
|
|
|
|
public deleteShape(shape) { |
|
|
|
|
if (this.allowEdit && this.canvasData.gameMode === shape.assetData.GameMode) { |
|
|
|
|
this.emit('deleteIcon',shape); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 打招呼 |
|
|
|
|
*/ |
|
|
|
|
sayHello() { |
|
|
|
|
var _a; |
|
|
|
|
if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { |
|
|
|
|
var args = [ |
|
|
|
|
"\n %c 版本号 - " + this.VERSION + "\n", |
|
|
|
|
'color: #ff66a5; background: #000000; padding:5px 0;', |
|
|
|
|
]; |
|
|
|
|
(_a = window.console).log.apply(_a, args); |
|
|
|
|
} |
|
|
|
|
else if (window.console) { |
|
|
|
|
window.console.log("\n %c 版本号 - " + this.VERSION + "\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 页面初始化 |
|
|
|
|
*/ |
|
|
|
|
ngAfterViewInit(): void { |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.createCanvas(); |
|
|
|
|
}); |
|
|
|
|
window.onresize = () => { |
|
|
|
|
this.resetCanvas(); |
|
|
|
|
}; |
|
|
|
@ -203,7 +223,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
if (this.backgroundImage.scale.x >= 32) { |
|
|
|
|
this.backgroundImage.scale.x = 32; |
|
|
|
|
this.backgroundImage.scale.y = 32; |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
this.resizeItem(1/this.backgroundImage.scale.x) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.backgroundImage.pivot.set(pivot.x, pivot.y); |
|
|
|
@ -217,7 +237,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
if (this.backgroundImage.scale.x <= 0.1) { |
|
|
|
|
this.backgroundImage.scale.x = 0.1; |
|
|
|
|
this.backgroundImage.scale.y = 0.1; |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
this.resizeItem(1/this.backgroundImage.scale.x) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.backgroundImage.pivot.set(pivot.x, pivot.y); |
|
|
|
@ -228,7 +248,16 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.backgroundImage.position.x += delX; |
|
|
|
|
this.backgroundImage.position.y += delY; |
|
|
|
|
} |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
this.resizeItem(1/this.backgroundImage.scale.x) |
|
|
|
|
} |
|
|
|
|
// 重置图形缩放
|
|
|
|
|
public resizeItem(size:number) { |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape) { |
|
|
|
|
item.setItemScale(size); |
|
|
|
|
item.drawBorder(size); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
@ -268,19 +297,21 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
backgroundColor: 0xE9FAFF |
|
|
|
|
}); |
|
|
|
|
this.content.nativeElement.appendChild(this.app.view); |
|
|
|
|
this.app.view.style.border = '1px dashed blue'; |
|
|
|
|
this.animator = new Charm(PIXI); |
|
|
|
|
|
|
|
|
|
this.createBackgroundImage(); |
|
|
|
|
this.app.ticker.add((delta) => { |
|
|
|
|
this.animator.update(); |
|
|
|
|
this.mousePosition = this.app.renderer.plugins.interaction.mouse.global; |
|
|
|
|
// 预览图片
|
|
|
|
|
if (this.previewImage !== null) { |
|
|
|
|
if (this.previewImage !== undefined && this.previewImage !== null) { |
|
|
|
|
this.previewImage.position = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.backgroundImage !== null) { |
|
|
|
|
if (this.circleShadow !== undefined && this.circleShadow !== null) { |
|
|
|
|
this.circleShadow.position = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
this.refreshPreviewLineSegment(this.currentClickPoint.position, this.circleShadow.position); |
|
|
|
|
this.refreshPreviewPoint(); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 显示框选 |
|
|
|
@ -308,101 +339,87 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('select', obj => { |
|
|
|
|
if (this.allowEdit) { |
|
|
|
|
if (obj instanceof AxArrowConnector) { |
|
|
|
|
obj.setPointsVisible(true); |
|
|
|
|
} |
|
|
|
|
else if (obj instanceof MultipointIcon) { |
|
|
|
|
if (obj.assetData.GameMode === this.canvasData.gameMode) { |
|
|
|
|
obj.setPointVisiable(true); |
|
|
|
|
} else { |
|
|
|
|
obj.filters = [this.outlineFilterGreen]; |
|
|
|
|
} |
|
|
|
|
} else if (obj instanceof PolygonIcon) { |
|
|
|
|
if (obj.assetData.GameMode === this.canvasData.gameMode) { |
|
|
|
|
obj.setPointVisiable(true); |
|
|
|
|
} else { |
|
|
|
|
obj.filters = [this.outlineFilterGreen]; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
obj.filters = [this.outlineFilterGreen]; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
obj.filters = [this.outlineFilterGreen]; |
|
|
|
|
} |
|
|
|
|
this.on('select', (axShape:AxShape)=> { |
|
|
|
|
axShape.showBorder(); |
|
|
|
|
axShape.setPointVisiable(this.allowEdit); |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 取消选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('deselect', obj => { |
|
|
|
|
if (this.allowEdit) { |
|
|
|
|
if (obj instanceof AxArrowConnector) { |
|
|
|
|
obj.setPointsVisible(false); |
|
|
|
|
} |
|
|
|
|
else if (obj instanceof MultipointIcon) { |
|
|
|
|
obj.setPointVisiable(false); |
|
|
|
|
} else if (obj instanceof PolygonIcon) { |
|
|
|
|
obj.filters = []; |
|
|
|
|
obj.setPointVisiable(false); |
|
|
|
|
} else { |
|
|
|
|
obj.filters = []; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
obj.filters = []; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 根据背景缩放事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('backgroundScale', scale => { |
|
|
|
|
this.backgroundImage?.children.forEach(item => { |
|
|
|
|
if (item instanceof AxImageShape) { |
|
|
|
|
if (item.assetData.FixedSize) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.scale.set(data); |
|
|
|
|
} else { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(data); |
|
|
|
|
} |
|
|
|
|
} else if (item instanceof MultipointIcon) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(data); |
|
|
|
|
} else if (item instanceof PolygonIcon) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(data); |
|
|
|
|
item.pointsGraphics.forEach(point => { |
|
|
|
|
point.scale.set(data); |
|
|
|
|
}); |
|
|
|
|
} else if (item instanceof AxPreviewImageShape) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.scale.set(data); |
|
|
|
|
}else if (item instanceof AxArrowConnector) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(data); |
|
|
|
|
item.pointSprites.forEach(point => { |
|
|
|
|
point.scale.set(data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.on('deselect', (axShape:AxShape)=> { |
|
|
|
|
axShape.hideBorder(); |
|
|
|
|
axShape.setPointVisiable(false); |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 创建图标事件 |
|
|
|
|
* 创建图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
|
this.on('createIcon', obj => { |
|
|
|
|
if (obj.assetData.GameMode === GameMode.BasicInformation) { |
|
|
|
|
this.on('createIcon', (axShape:AxShape)=> { |
|
|
|
|
if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 基本信息
|
|
|
|
|
// 添加楼层数据
|
|
|
|
|
this.canvasData.originaleveryStoreyData.data[obj.assetData.Id] = obj.assetData; |
|
|
|
|
this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id] = axShape.assetData; |
|
|
|
|
// 添加建筑数据
|
|
|
|
|
this.canvasData.originalcompanyBuildingData.data[obj.assetData.Id] = obj.assetData; |
|
|
|
|
} else { |
|
|
|
|
this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id] = axShape.assetData; |
|
|
|
|
} else if (axShape.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; |
|
|
|
|
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;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
var temp = this.backgroundImage.getChildByName("图例") as AxLegend; |
|
|
|
|
if ( temp !== undefined |
|
|
|
|
&& temp !== null) { |
|
|
|
|
var itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); |
|
|
|
|
temp.addItem(itemLegend); |
|
|
|
|
} |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 删除图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
|
this.on('deleteIcon', (axShape:AxShape)=>{ |
|
|
|
|
// 删除图例对象
|
|
|
|
|
var temp = this.backgroundImage.getChildByName("图例") as AxLegend; |
|
|
|
|
if ( temp !== undefined |
|
|
|
|
&& temp !== null) { |
|
|
|
|
var itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); |
|
|
|
|
temp.deleteItem(itemLegend); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 基本信息
|
|
|
|
|
// 删除楼层数据
|
|
|
|
|
delete this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id]; |
|
|
|
|
// 删除建筑数据
|
|
|
|
|
delete this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id]; |
|
|
|
|
} else if (axShape.assetData.GameMode === GameMode.Assignment) { // 处置预案
|
|
|
|
|
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];
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
this.backgroundImage.removeChild(axShape); |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -474,29 +491,22 @@ 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(); |
|
|
|
|
if (this.canvasData.gameMode === GameMode.Assignment) { |
|
|
|
|
this.createWorkNode(); |
|
|
|
|
} |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
} |
|
|
|
|
// /**
|
|
|
|
|
// * 创建背景图
|
|
|
|
|
// */
|
|
|
|
|
// public createBackground(imageUrl:string,imageAngle:number) {
|
|
|
|
|
// if (this.backgroundImage !== null) {
|
|
|
|
|
// this.backgroundImage.destroy();
|
|
|
|
|
// this.backgroundImage = null;
|
|
|
|
|
// }
|
|
|
|
|
// this.createBackgroundImage()
|
|
|
|
|
// this.refreshBackgroundImage(imageUrl,imageAngle);
|
|
|
|
|
// }
|
|
|
|
|
/** |
|
|
|
|
* 创建楼层图形 |
|
|
|
|
*/ |
|
|
|
|
private createFloorShape() { |
|
|
|
|
const floorData = this.canvasData.originaleveryStoreyData.data; |
|
|
|
|
public createFloorShape(floorData: any) { |
|
|
|
|
if (floorData === undefined || floorData === null) return; |
|
|
|
|
Object.keys(floorData).forEach((key) => { |
|
|
|
|
switch (floorData[key].InteractiveMode) { |
|
|
|
|
case 0: |
|
|
|
@ -511,22 +521,24 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
if (floorData[key].Name === '水带') { |
|
|
|
|
const distance = new AxArrowConnector(floorData[key], this,false,true); |
|
|
|
|
const distance = new AxArrowConnector(floorData[key], this, false, true); |
|
|
|
|
} else if(floorData[key].Name === '距离'){ |
|
|
|
|
const distance = new AxArrowConnector(floorData[key], this,true,true); |
|
|
|
|
const distance = new AxArrowConnector(floorData[key], this, true, true); |
|
|
|
|
}else if(floorData[key].Name === '普通墙' || floorData[key].Name === '承重墙'){ |
|
|
|
|
const wall = new AxArrowConnector(floorData[key], this,false,false); |
|
|
|
|
const wall = new AxArrowConnector(floorData[key], this, false, false); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private createWorkNode() { |
|
|
|
|
// 加载处置节点数据
|
|
|
|
|
const nodeData = this.canvasData.selectPanelPoint.Data; |
|
|
|
|
/** |
|
|
|
|
* 创建节点图形 |
|
|
|
|
*/ |
|
|
|
|
public createNodeShape(nodeData: any) { |
|
|
|
|
if (nodeData !== undefined && nodeData !== null) { |
|
|
|
|
Object.keys(nodeData).forEach((key) => { |
|
|
|
|
if (nodeData[key] === undefined || nodeData[key] === null) { return;} |
|
|
|
|
Object.keys(nodeData[key]).forEach((tempKey) => { |
|
|
|
|
switch (nodeData[key][tempKey].InteractiveMode) { |
|
|
|
|
case 0: |
|
|
|
@ -546,55 +558,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param id 图标ID |
|
|
|
|
* @param b 显示/隐藏 |
|
|
|
|
*/ |
|
|
|
|
public setIconVisible(ids: string[], b: boolean) { |
|
|
|
|
ids.forEach(item => { |
|
|
|
|
this.backgroundImage.getChildByName(item).visible = b; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// /**
|
|
|
|
|
// * 版本检查
|
|
|
|
|
// */
|
|
|
|
|
// public versionChecking(): void {
|
|
|
|
|
// const floorData = this.canvasData.originaleveryStoreyData;
|
|
|
|
|
// const buildingData = this.canvasData.originalcompanyBuildingData;
|
|
|
|
|
// const nodeData = this.canvasData.selectPanelPoint;
|
|
|
|
|
// if (floorData.version && floorData.version === '1.0') {
|
|
|
|
|
// floorData.version = '2.0';
|
|
|
|
|
// Object.keys(floorData.data).forEach(item => {
|
|
|
|
|
// floorData.data[item].Point.y *= -1;
|
|
|
|
|
// floorData.data[item].MultiPoint?.forEach(element => {
|
|
|
|
|
// element.y *= -1;
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (buildingData.version && buildingData.version === '1.0') {
|
|
|
|
|
// buildingData.version = '2.0';
|
|
|
|
|
// Object.keys(buildingData.data).forEach(item => {
|
|
|
|
|
// buildingData.data[item].Point.y *= -1;
|
|
|
|
|
// buildingData.data[item].MultiPoint?.forEach(element => {
|
|
|
|
|
// element.y *= -1;
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (nodeData.Version && nodeData.Version === '1.0') {
|
|
|
|
|
// nodeData.Version = '2.0';
|
|
|
|
|
// console.log(this.canvasData.selectPanelPoint.Version);
|
|
|
|
|
// Object.keys(nodeData.Data).forEach((key) => {
|
|
|
|
|
// Object.keys(nodeData.Data[key]).forEach((tempKey) => {
|
|
|
|
|
// nodeData.Data[key][tempKey].Point.y *= -1;
|
|
|
|
|
// nodeData.Data[key][tempKey].MultiPoint?.forEach(element => {
|
|
|
|
|
// element.y *= -1;
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
/** |
|
|
|
|
* 创建确认绘制结束按钮 |
|
|
|
|
*/ |
|
|
|
@ -606,7 +571,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.enterPaintEndButton.interactive = true; |
|
|
|
|
this.enterPaintEndButton.buttonMode = true; |
|
|
|
|
this.enterPaintEndButton |
|
|
|
|
.on('mousedown', event => { |
|
|
|
|
.on('pointerdown', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
this.enterPaint(); |
|
|
|
|
}); |
|
|
|
@ -617,33 +582,31 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 创建背景图 |
|
|
|
|
*/ |
|
|
|
|
private async createBackgroundImage(imageUrl: string): Promise<void> { |
|
|
|
|
const image = await PIXI.Texture.fromURL(imageUrl); |
|
|
|
|
this.backgroundImage = new PIXI.Sprite(image); |
|
|
|
|
public createBackgroundImage(){ |
|
|
|
|
this.backgroundImage = PIXI.Sprite.from('assets/images/noImg.png') |
|
|
|
|
this.backgroundImage.anchor.set(0.5); |
|
|
|
|
this.backgroundImage.x = this.app.view.width / 2; |
|
|
|
|
this.backgroundImage.y = this.app.view.height / 2; |
|
|
|
|
// this.backgroundImage.x = this.app.view.width / 2;
|
|
|
|
|
// this.backgroundImage.y = this.app.view.height / 2;
|
|
|
|
|
this.backgroundImage.interactive = true; |
|
|
|
|
this.backgroundImage.name = 'background'; |
|
|
|
|
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; |
|
|
|
|
// const left = this.init.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth;
|
|
|
|
|
// const right = this.init.element.nativeElement.querySelector('.functionalDomainRight').clientWidth;
|
|
|
|
|
const imageWidth = this.backgroundImage.texture.width; |
|
|
|
|
const imageHeight = this.backgroundImage.texture.height; |
|
|
|
|
const appWidth = this.app.view.width - 470; |
|
|
|
|
const appHeight = this.app.view.height; |
|
|
|
|
// this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
|
|
|
|
|
// const imageWidth = 665;
|
|
|
|
|
// const imageHeight = 530;
|
|
|
|
|
// const appWidth = this.app.view.width - 470;
|
|
|
|
|
// const appHeight = this.app.view.height;
|
|
|
|
|
|
|
|
|
|
const wScale = appWidth / imageWidth; |
|
|
|
|
const hScale = appHeight / imageHeight; |
|
|
|
|
// const wScale = appWidth / imageWidth;
|
|
|
|
|
// const hScale = appHeight / imageHeight;
|
|
|
|
|
|
|
|
|
|
const scale = wScale < hScale |
|
|
|
|
? wScale |
|
|
|
|
: hScale; |
|
|
|
|
this.backgroundImage.scale.set(scale); |
|
|
|
|
// const scale = wScale < hScale
|
|
|
|
|
// ? wScale
|
|
|
|
|
// : hScale;
|
|
|
|
|
// this.backgroundImage.scale.set(scale);
|
|
|
|
|
this.backgroundImage.sortableChildren = true; |
|
|
|
|
this.backgroundImage |
|
|
|
|
.on('mousedown', event => { |
|
|
|
|
.on('pointerdown', event => { |
|
|
|
|
if (!event.currentTarget.dragging && this.selection.isMultiselection === false) { |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
event.currentTarget.data = event.data; |
|
|
|
|
event.currentTarget.dragging = true; |
|
|
|
|
event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
@ -651,7 +614,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
event.currentTarget.dragPoint.y -= event.currentTarget.y; |
|
|
|
|
switch (this.paintMode) { |
|
|
|
|
case PaintMode.endPaint: |
|
|
|
|
console.log(this.backgroundImage.toLocal(this.mousePosition)); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.singlePointIcon: |
|
|
|
|
const json = JSON.parse(JSON.stringify(this.canvasData.selectTemplateData.propertyInfos)); |
|
|
|
@ -685,11 +647,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode : this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness : this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding : this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode : this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
const singleIcon = new AxImageShape(assetData, this); |
|
|
|
|
this.emit('createIcon', singleIcon); |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
break; |
|
|
|
|
case PaintMode.lineIcon: |
|
|
|
|
this.previewLineSegment.visible = true; |
|
|
|
@ -732,7 +695,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode: this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness: this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode: this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
// const assetData1 = {
|
|
|
|
|
// ImageUrl: this.canvasData.selectTemplateData.imageUrl,
|
|
|
|
@ -745,7 +709,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.paintingIcon = new MultipointIcon(assetData1, this); |
|
|
|
|
// this.paintingIcon = new MultipointIcon(this.previewSinglePointIcon.texture, new PIXI.Point(0, 0), this.paintPoints, this,
|
|
|
|
|
// this.canvasData.selectTemplateData.name);
|
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
break; |
|
|
|
|
case PaintMode.polygonIcon: |
|
|
|
|
this.previewLineSegment.visible = true; |
|
|
|
@ -817,7 +781,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
DrawMode: this.canvasData.selectTemplateData.drawMode, |
|
|
|
|
Thickness: this.canvasData.selectTemplateData.thickness, |
|
|
|
|
IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, |
|
|
|
|
GameMode: this.canvasData.gameMode |
|
|
|
|
GameMode: this.canvasData.gameMode, |
|
|
|
|
Tag: this.canvasData.selectTemplateData.tag |
|
|
|
|
}; |
|
|
|
|
if (this.canvasData.selectTemplateData.name === '距离') { |
|
|
|
|
this.paintingShape = new AxArrowConnector(assetData2, this,true,true);
|
|
|
|
@ -829,7 +794,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.paintingShape.redraw(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else if (!event.currentTarget.dragging && this.selection.isMultiselection === true) { |
|
|
|
@ -839,7 +804,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('mouseup', event => { |
|
|
|
|
.on('pointerup', event => { |
|
|
|
|
if (event.currentTarget.dragging) { |
|
|
|
|
event.currentTarget.dragging = false; |
|
|
|
|
event.currentTarget.data = null; |
|
|
|
@ -862,13 +827,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.rectToolGraphics.visible = false; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('mouseupoutside', event => { |
|
|
|
|
.on('pointerupoutside', event => { |
|
|
|
|
if (event.currentTarget.dragging) { |
|
|
|
|
event.currentTarget.dragging = false; |
|
|
|
|
event.currentTarget.data = null; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('mousemove', event => { |
|
|
|
|
.on('pointermove', event => { |
|
|
|
|
if (event.currentTarget.dragging && this.selection.isMultiselection === false) { |
|
|
|
|
const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
|
event.currentTarget.x = newPosition.x - event.currentTarget.dragPoint.x; |
|
|
|
@ -921,37 +886,123 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 刷新背景图 |
|
|
|
|
*/ |
|
|
|
|
public refreshBackgroundImage(): void { |
|
|
|
|
if (!this.canvasData.selectStorey.imageUrl) { |
|
|
|
|
public async refreshBackgroundImage(imageUrl:string = this.canvasData.selectStorey.imageUrl,imageAngle:number = this.canvasData.selectStorey.imageAngle): Promise<void> { |
|
|
|
|
if (!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.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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 清空画布 |
|
|
|
|
* 刷新 |
|
|
|
|
* @param imageUrl
|
|
|
|
|
* @param imageAngle
|
|
|
|
|
*/ |
|
|
|
|
public destroyBackgroundImage(): void { |
|
|
|
|
this.app.stage.removeChild(this.backgroundImage); |
|
|
|
|
public async refresh(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise<void> { |
|
|
|
|
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);
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置背景图缩放 |
|
|
|
|
* @param scale 缩放系数 |
|
|
|
|
*/ |
|
|
|
|
public setBackgroundScale(scale: number): void { |
|
|
|
|
this.backgroundImage?.scale.set(scale); |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage?.scale.x); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
itemList.forEach(item => {
|
|
|
|
|
this.backgroundImage.getChildByName(item).destroy(); |
|
|
|
|
// let child = this.backgroundImage.getChildByName(item);
|
|
|
|
|
// this.backgroundImage.removeChild(child);
|
|
|
|
|
}) |
|
|
|
|
//加载当前数据
|
|
|
|
|
this.createFloorShape(this.canvasData.originaleveryStoreyData.data); |
|
|
|
|
// 创建处置预案图形
|
|
|
|
|
this.createNodeShape(this.canvasData.selectPanelPoint.Data); |
|
|
|
|
this.createAxLegend(); |
|
|
|
|
this.backgroundImage.visible = true; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置背景图角度 |
|
|
|
|
* @param imageAngle 角度值 |
|
|
|
|
* 创建安信图例 |
|
|
|
|
*/ |
|
|
|
|
public setBackgroundAngle(imageAngle: number) { |
|
|
|
|
this.backgroundImage.angle = imageAngle; |
|
|
|
|
public createAxLegend() { |
|
|
|
|
const tempAssetData = { |
|
|
|
|
Id: "图例",//ObjectID.default.generate()
|
|
|
|
|
Color: "#066EED80", |
|
|
|
|
PropertyInfos:[] |
|
|
|
|
}; |
|
|
|
|
let shapeMap: Map<string,Legend> = new Map<string,Legend>(); |
|
|
|
|
|
|
|
|
|
for (let item in this.canvasData.originaleveryStoreyData.data) { |
|
|
|
|
if (shapeMap.has(this.canvasData.originaleveryStoreyData.data[item].Name)) { |
|
|
|
|
shapeMap.get(this.canvasData.originaleveryStoreyData.data[item].Name).Count++; |
|
|
|
|
} else { |
|
|
|
|
shapeMap.set(this.canvasData.originaleveryStoreyData.data[item].Name, new Legend( |
|
|
|
|
this.canvasData.originaleveryStoreyData.data[item].Name, |
|
|
|
|
this.canvasData.originaleveryStoreyData.data[item].ImageUrl, |
|
|
|
|
1 |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
var axLegend = new AxLegend(tempAssetData, this, shapeMap); |
|
|
|
|
var rect = this.backgroundImage.getLocalBounds(); |
|
|
|
|
var itemRect = axLegend.getLocalBounds(); |
|
|
|
|
axLegend.x = rect.right - itemRect.right; |
|
|
|
|
axLegend.y = rect.bottom - itemRect.bottom; |
|
|
|
|
} |
|
|
|
|
// /**
|
|
|
|
|
// * 清空画布
|
|
|
|
|
// */
|
|
|
|
|
// public destroyBackgroundImage(): void {
|
|
|
|
|
// this.app.stage.removeChild(this.backgroundImage);
|
|
|
|
|
// this.backgroundImage = null;
|
|
|
|
|
// }
|
|
|
|
|
/** |
|
|
|
|
// // * 设置背景图缩放
|
|
|
|
|
// // * @param scale 缩放系数
|
|
|
|
|
// // */
|
|
|
|
|
// public setBackgroundScale(scale: number): void {
|
|
|
|
|
// this.backgroundImage?.scale.set(scale);
|
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage?.scale.x);
|
|
|
|
|
// }
|
|
|
|
|
// /**
|
|
|
|
|
// * 设置背景图角度
|
|
|
|
|
// * @param imageAngle 角度值
|
|
|
|
|
// */
|
|
|
|
|
// public setBackgroundAngle(imageAngle: number) {
|
|
|
|
|
// this.backgroundImage.angle = imageAngle;
|
|
|
|
|
// }
|
|
|
|
|
/** |
|
|
|
|
* 创建预览单点图标 |
|
|
|
|
*/ |
|
|
|
@ -986,7 +1037,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
*/ |
|
|
|
|
private refreshPreviewLineSegment(pointA: PIXI.Point, pointB: PIXI.Point) { |
|
|
|
|
this.previewLineSegment.clear(); |
|
|
|
|
this.previewLineSegment.lineStyle(5, 0x00ff00, 1); |
|
|
|
|
this.previewLineSegment.lineStyle(1/this.backgroundImage.scale.x, 0x00ff00, 1); |
|
|
|
|
this.previewLineSegment.moveTo(pointA.x, pointA.y); |
|
|
|
|
this.previewLineSegment.lineTo(pointB.x, pointB.y ); |
|
|
|
|
} |
|
|
|
@ -995,12 +1046,21 @@ 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.beginFill(0xFFCC5A);
|
|
|
|
|
// this.circleShadow.drawCircle(0, 0, 10);
|
|
|
|
|
// this.circleShadow.endFill();
|
|
|
|
|
this.circleShadow.visible = false; |
|
|
|
|
this.backgroundImage.addChild(this.circleShadow); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 刷新预览点 |
|
|
|
|
*/ |
|
|
|
|
private refreshPreviewPoint() { |
|
|
|
|
this.circleShadow.clear(); |
|
|
|
|
this.circleShadow.beginFill(0x00ff00); |
|
|
|
|
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) { |
|
|
|
@ -1014,6 +1074,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); |
|
|
|
@ -1170,7 +1231,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
this.paintPoints.splice(0, this.paintPoints.length); |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 复制 |
|
|
|
@ -1219,9 +1280,111 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
} |
|
|
|
|
this.selection.select(this.backgroundImage.getChildByName(newData.Id)); |
|
|
|
|
}); |
|
|
|
|
this.emit('backgroundScale', this.backgroundImage.scale.x); |
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
} |
|
|
|
|
////////////////////////////////////////////////////////////////////////通用/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param id 图标ID |
|
|
|
|
* @param b 显示/隐藏 |
|
|
|
|
*/ |
|
|
|
|
public setIconVisible(ids: string[], b: boolean) { |
|
|
|
|
ids.forEach(item => { |
|
|
|
|
this.backgroundImage.getChildByName(item).visible = b; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
////////////////////////////////////////////////////////////////////////采集平台加载逻辑///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////编制平台加载逻辑///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////考试系统加载逻辑///////////////////////////////////////////////////////////////////////
|
|
|
|
|
/** |
|
|
|
|
* 考生点击楼层 |
|
|
|
|
*/ |
|
|
|
|
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);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 考官点击楼层 |
|
|
|
|
*/ |
|
|
|
|
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);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|