|
|
|
@ -4,7 +4,7 @@ import { EventEmitter } from 'events';
|
|
|
|
|
import { EventManager } from '@angular/platform-browser'; |
|
|
|
|
import { OutlineFilter } from 'pixi-filters'; |
|
|
|
|
import { CanvasShareDataService, GameMode } from '../canvas-share-data.service'; |
|
|
|
|
import {CacheTokenService} from '../http-interceptors/cache-token.service' //引入自动登录 获取token服务
|
|
|
|
|
import {CacheTokenService} from '../http-interceptors/cache-token.service'; // 引入自动登录 获取token服务
|
|
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
|
import { Router } from '@angular/router'; |
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 确认绘制按钮 |
|
|
|
|
*/ |
|
|
|
|
private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.jpg'); |
|
|
|
|
private enterPaintEndButton = PIXI.Sprite.from('assets/images/enterPaintButton.png'); |
|
|
|
|
/** |
|
|
|
|
* 框选工具图形 |
|
|
|
|
*/ |
|
|
|
@ -111,20 +111,20 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
// 根据ID 找到数据
|
|
|
|
|
|
|
|
|
|
// 是否登录
|
|
|
|
|
public verificationURL = '/ui/plan' //验证url地址是否为验证页面
|
|
|
|
|
public verificationURL = '/ui/plan'; // 验证url地址是否为验证页面
|
|
|
|
|
isLogin() { |
|
|
|
|
let token = sessionStorage.getItem('token') // 判断 是否登录状态
|
|
|
|
|
const token = sessionStorage.getItem('token'); // 判断 是否登录状态
|
|
|
|
|
if (token) { |
|
|
|
|
this.init.getAllLibrary() |
|
|
|
|
this.init.getAllBuildings() |
|
|
|
|
this.init.getAllFirePlan() |
|
|
|
|
// this.init.getAllLibrary() //获取素材库
|
|
|
|
|
this.init.getAllBuildings() //获取所有建筑
|
|
|
|
|
this.init.getAllFirePlan() //获取所有灾情
|
|
|
|
|
this.init.getSitePlan() //调用父组件 初始化方法
|
|
|
|
|
} else { |
|
|
|
|
this.token.login().then(res=>{ |
|
|
|
|
this.init.params.companyId = sessionStorage.getItem('companyId') |
|
|
|
|
this.init.getAllLibrary() |
|
|
|
|
this.init.getAllBuildings() |
|
|
|
|
this.init.getAllFirePlan() |
|
|
|
|
// this.init.getAllLibrary() //获取素材库
|
|
|
|
|
this.init.getAllBuildings() //获取所有建筑
|
|
|
|
|
this.init.getAllFirePlan() //获取所有灾情
|
|
|
|
|
this.init.getSitePlan() //调用父组件 初始化方法
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
@ -168,14 +168,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keypress', (event: any) => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.createCanvas(); |
|
|
|
|
this.loadDemoScene(); |
|
|
|
|
}, 0); |
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
// this.createCanvas();
|
|
|
|
|
// }, 0);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngAfterViewInit(): void { |
|
|
|
|
|
|
|
|
|
this.createCanvas(); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
@ -230,8 +229,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
backgroundColor: 0xE9FAFF |
|
|
|
|
}); |
|
|
|
|
this.content.nativeElement.appendChild(this.app.view); |
|
|
|
|
let url = this.router.url |
|
|
|
|
url == this.verificationURL? this.isLogin() : null |
|
|
|
|
const url = this.router.url; |
|
|
|
|
// tslint:disable-next-line: no-unused-expression
|
|
|
|
|
url === this.verificationURL ? this.isLogin() : null; |
|
|
|
|
|
|
|
|
|
this.createBackgroundImage(); |
|
|
|
|
// this.createPreviewSinglePointIcon();
|
|
|
|
@ -257,6 +257,22 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
obj.filters = []; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.on('backgroundScale', scale => { |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof SinglePointIcon) { |
|
|
|
|
if (item.assetData.FixedSize) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.scale.set(data); |
|
|
|
|
} |
|
|
|
|
} else if (item instanceof MultipointIcon) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(scale); |
|
|
|
|
} else if (item instanceof PolygonIcon) { |
|
|
|
|
const data = 1 / scale; |
|
|
|
|
item.text.scale.set(scale); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.app.ticker.add((delta) => { |
|
|
|
|
this.mousePosition = this.app.renderer.plugins.interaction.mouse.global; |
|
|
|
@ -381,37 +397,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 加载测试界面 |
|
|
|
|
*/ |
|
|
|
|
public loadDemoScene() { |
|
|
|
|
public loadDemoScene(list: any[]) { |
|
|
|
|
this.backgroundImage.texture = PIXI.Texture.from('./assets/images/demo.jpg'); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
const assetData = { |
|
|
|
|
TemplateId: null, |
|
|
|
|
FloorId: null, |
|
|
|
|
Angle: 0, |
|
|
|
|
Color: 0, |
|
|
|
|
Enabled: true, |
|
|
|
|
FillMode: 0, |
|
|
|
|
FireElementId: 0, |
|
|
|
|
FixedSize: true, |
|
|
|
|
Height: 32, |
|
|
|
|
Width: 32, |
|
|
|
|
Id: ObjectID.default.generate(), |
|
|
|
|
ImageUrl: './assets/images/泡沫消防车.png', |
|
|
|
|
InteractiveMode: 0, |
|
|
|
|
MultiPoint: null, |
|
|
|
|
Point: new PIXI.Point(5295 - (this.backgroundImage.texture.width / 2), 4067 - (this.backgroundImage.texture.height / 2)), |
|
|
|
|
Name: '', |
|
|
|
|
PropertyInfos: null, |
|
|
|
|
Border: null, |
|
|
|
|
DrawMode: null, |
|
|
|
|
Thickness: 0, |
|
|
|
|
IsFromBuilding: false, |
|
|
|
|
GameMode: 0 |
|
|
|
|
}; |
|
|
|
|
const single = new SinglePointIcon(assetData, this); |
|
|
|
|
}, 100); |
|
|
|
|
|
|
|
|
|
// this.backgroundImage.anchor.set(0);
|
|
|
|
|
list.forEach(element => { |
|
|
|
|
const single = new SinglePointIcon(element, this); |
|
|
|
|
}); |
|
|
|
|
this.setNameVisible(false, GameMode.BasicInformation); |
|
|
|
|
this.allowEdit = false; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
@ -993,6 +985,7 @@ export class SinglePointIcon extends PIXI.Container {
|
|
|
|
|
this.image.interactive = true; |
|
|
|
|
this.image |
|
|
|
|
.on('mousedown', event => { |
|
|
|
|
console.log(this.assetData.Name); |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
this.workingArea.selection.selectOne(this); |
|
|
|
|
if (this.workingArea.allowEdit) { |
|
|
|
@ -1031,12 +1024,12 @@ export class SinglePointIcon extends PIXI.Container {
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.workingArea.on('backgroundScale', data => { |
|
|
|
|
if (this.assetData.FixedSize) { |
|
|
|
|
const scale = 1 / data; |
|
|
|
|
this.scale.set(scale); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.workingArea.on('backgroundScale', data => {
|
|
|
|
|
// if (this.assetData.FixedSize) {
|
|
|
|
|
// const scale = 1 / data;
|
|
|
|
|
// this.scale.set(scale);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
this.text.x = this.image.x; |
|
|
|
|
this.text.y = this.image.y - this.image.height / 2; |
|
|
|
@ -1087,7 +1080,7 @@ export class MultipointIcon extends PIXI.Container {
|
|
|
|
|
wordWrapWidth: 100, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
private text = new PIXI.Text(this.assetData.Name |
|
|
|
|
public text = new PIXI.Text(this.assetData.Name |
|
|
|
|
+ '\r\n' |
|
|
|
|
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style); |
|
|
|
|
/** |
|
|
|
@ -1230,11 +1223,11 @@ export class MultipointIcon extends PIXI.Container {
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
// 缩放
|
|
|
|
|
this.workingArea.on('backgroundScale', data => { |
|
|
|
|
const scale = 1 / data; |
|
|
|
|
this.text.scale.set(scale); |
|
|
|
|
}); |
|
|
|
|
// // 缩放
|
|
|
|
|
// this.workingArea.on('backgroundScale', data => {
|
|
|
|
|
// const scale = 1 / data;
|
|
|
|
|
// this.text.scale.set(scale);
|
|
|
|
|
// });
|
|
|
|
|
// 添加选中事件
|
|
|
|
|
this.iconsTilingSprite.forEach((item, index, array) => { |
|
|
|
|
item.interactive = true; |
|
|
|
@ -1327,7 +1320,7 @@ export class PolygonIcon extends PIXI.Container {
|
|
|
|
|
wordWrapWidth: 100, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
private text = new PIXI.Text(this.assetData.Name |
|
|
|
|
public text = new PIXI.Text(this.assetData.Name |
|
|
|
|
+ '\r\n' |
|
|
|
|
+ this.assetData.PropertyInfos.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style); |
|
|
|
|
/** |
|
|
|
@ -1468,11 +1461,11 @@ export class PolygonIcon extends PIXI.Container {
|
|
|
|
|
.on('rightclick', event => { |
|
|
|
|
// this.workingArea.selection.deselectAll();
|
|
|
|
|
}); |
|
|
|
|
// 缩放
|
|
|
|
|
this.workingArea.on('backgroundScale', data => { |
|
|
|
|
const scale = 1 / data; |
|
|
|
|
this.text.scale.set(scale); |
|
|
|
|
}); |
|
|
|
|
// // 缩放
|
|
|
|
|
// this.workingArea.on('backgroundScale', data => {
|
|
|
|
|
// const scale = 1 / data;
|
|
|
|
|
// this.text.scale.set(scale);
|
|
|
|
|
// });
|
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置点显示状态 |
|
|
|
|