|
|
|
@ -16,9 +16,9 @@ import { PropertyInfo } from './model/PropertyInfo';
|
|
|
|
|
import { AxPreviewImageShape } from './model/axPreviewImageShape'; |
|
|
|
|
import { AxArrowConnector } from './model/axArrowConnector'; |
|
|
|
|
import { AxLegend, Legend } from './model/axLegend'; |
|
|
|
|
import { NullTemplateVisitor } from '@angular/compiler'; |
|
|
|
|
import { AxRectangleShape } from './model/axRectangleShape'; |
|
|
|
|
import { AxGrid } from './model/axGrid'; |
|
|
|
|
import { AxSelection } from './model/axSelection'; |
|
|
|
|
import { AxMessageSystem } from './model/axMessageSystem'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -76,7 +76,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
/** |
|
|
|
|
* 选择器 |
|
|
|
|
*/ |
|
|
|
|
public selection: Selection = new Selection(this); |
|
|
|
|
public readonly selection: AxSelection = new AxSelection(); |
|
|
|
|
/** |
|
|
|
|
* 当前鼠标的点 |
|
|
|
|
*/ |
|
|
|
@ -141,6 +141,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 网格 |
|
|
|
|
*/ |
|
|
|
|
public grid: AxGrid = null; |
|
|
|
|
// 是否按下Ctrl键
|
|
|
|
|
isCtrlKeyClicked = false; |
|
|
|
|
isMove = false; |
|
|
|
|
/** |
|
|
|
|
* 本软件版本号由四部分组成:<主版本号><次版本号><修订版本号><日期加希腊字母版本号> 例如:1.0.0.20210105_beta |
|
|
|
|
* Alpha版: 此版本表示该软件在此阶段主要是以实现软件功能为主,通常只在软件开发者内部交流,一般而言,该版本软件的Bug较多,需要继续修改。 |
|
|
|
@ -148,7 +151,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 |
|
|
|
|
* Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 |
|
|
|
|
*/ |
|
|
|
|
public VERSION = '1.0.11.20210122_beta'; |
|
|
|
|
public VERSION = '1.0.12.20210125_beta'; |
|
|
|
|
/** |
|
|
|
|
* 数据初始化 |
|
|
|
|
*/ |
|
|
|
@ -157,12 +160,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.sayHello(); |
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => { |
|
|
|
|
if (event.keyCode === 17) { |
|
|
|
|
this.selection.isMultiselection = true; |
|
|
|
|
this.isCtrlKeyClicked = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keyup', (event: any) => { |
|
|
|
|
if (event.keyCode === 17) { |
|
|
|
|
this.selection.isMultiselection = false; |
|
|
|
|
this.isCtrlKeyClicked = false; |
|
|
|
|
this.rectToolGraphics.visible = false; |
|
|
|
|
this.rectToolGraphics.clear(); |
|
|
|
|
} |
|
|
|
@ -176,18 +179,43 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 删除选中的图标 |
|
|
|
|
*/ |
|
|
|
|
public deleteSelectedShape() { |
|
|
|
|
this.selection.objects.forEach(item => { |
|
|
|
|
this.deleteShape(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param obj 删除一个形状 |
|
|
|
|
*/ |
|
|
|
|
public deleteShape(shape) { |
|
|
|
|
if (this.allowEdit && this.canvasData.gameMode === shape.assetData.GameMode) { |
|
|
|
|
this.emit('deleteIcon', shape); |
|
|
|
|
if (this.selection.all().size > 0) { |
|
|
|
|
this.selection.all().forEach(axShape => { |
|
|
|
|
if (this.allowEdit && this.canvasData.gameMode === axShape.assetData.GameMode) { |
|
|
|
|
// 删除图例对象
|
|
|
|
|
const temp = this.backgroundImage.getChildByName('图例') as AxLegend; |
|
|
|
|
if ( temp !== undefined |
|
|
|
|
&& temp !== null |
|
|
|
|
&& axShape.assetData.Name !== '图例') { |
|
|
|
|
const 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 (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.selection.clear(); |
|
|
|
|
this.emit('canvasDataChanged'); |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
@ -315,7 +343,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.app.stage.addChild(this.grid); |
|
|
|
|
this.grid.drawGrid(); |
|
|
|
|
this.grid.onMousemove = (evt, gridCoord) => { |
|
|
|
|
// console.log(gridCoord);
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
this.createBackgroundImage(); |
|
|
|
@ -355,28 +383,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.rectToolGraphics.endFill(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('select', (axShape: AxShape) => { |
|
|
|
|
// if (axShape instanceof AxRectangleShape) {
|
|
|
|
|
// let upLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let upRight: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let downLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let downRight: PIXI.Sprite = new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// } else {
|
|
|
|
|
axShape.showBorder(); |
|
|
|
|
axShape.drawBorder(1 / this.backgroundImage.scale.x); |
|
|
|
|
axShape.setPointVisiable(this.allowEdit); |
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 取消选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('deselect', (axShape: AxShape) => { |
|
|
|
|
axShape.hideBorder(); |
|
|
|
|
axShape.setPointVisiable(false); |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 创建图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
@ -415,44 +421,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.emit('canvasDataChanged'); |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 删除图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
|
this.on('deleteIcon', (axShape: AxShape) => { |
|
|
|
|
// 删除图例对象
|
|
|
|
|
const temp = this.backgroundImage.getChildByName('图例') as AxLegend; |
|
|
|
|
if ( temp !== undefined |
|
|
|
|
&& temp !== null |
|
|
|
|
&& axShape.assetData.Name !== '图例') { |
|
|
|
|
const 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 (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; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 重置画布 |
|
|
|
@ -513,19 +481,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置高亮 |
|
|
|
|
*/ |
|
|
|
|
public setHighlight(ids: string[]): void { |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
ids.forEach(item => { |
|
|
|
|
let obj = this.backgroundImage.getChildByName(item); |
|
|
|
|
if (obj === null) { |
|
|
|
|
obj = this.app.stage.getChildByName(item); |
|
|
|
|
} |
|
|
|
|
this.selection.select(obj); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 创建楼层图形 |
|
|
|
|
*/ |
|
|
|
@ -631,10 +586,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
.on('pointerdown', event => { |
|
|
|
|
if (event.data.button !== 0) { return; } |
|
|
|
|
console.log(this.backgroundImage.toLocal(this.mousePosition)); |
|
|
|
|
if (!event.currentTarget.dragging && this.selection.isMultiselection === false) { |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
if (!this.isMove && this.isCtrlKeyClicked === false) { |
|
|
|
|
event.currentTarget.data = event.data; |
|
|
|
|
event.currentTarget.dragging = true; |
|
|
|
|
this.isMove = true; |
|
|
|
|
event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
|
event.currentTarget.dragPoint.x -= event.currentTarget.x; |
|
|
|
|
event.currentTarget.dragPoint.y -= event.currentTarget.y; |
|
|
|
@ -828,48 +782,47 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
// this.emit('backgroundScale', this.backgroundImage.scale.x);
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else if (!event.currentTarget.dragging && this.selection.isMultiselection === true) { |
|
|
|
|
} else if (!this.isMove && this.isCtrlKeyClicked === true) { |
|
|
|
|
this.rectToolGraphics.visible = true; |
|
|
|
|
event.currentTarget.dragging = true; |
|
|
|
|
this.isMove = true; |
|
|
|
|
this.initialScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('pointerup', event => { |
|
|
|
|
if (event.currentTarget.dragging) { |
|
|
|
|
event.currentTarget.dragging = false; |
|
|
|
|
event.currentTarget.data = null; |
|
|
|
|
} |
|
|
|
|
this.isMove = false; |
|
|
|
|
event.currentTarget.data = null; |
|
|
|
|
|
|
|
|
|
if (this.rectToolGraphics.visible === true) { |
|
|
|
|
const shapes: AxShape[] = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if ( item instanceof AxImageShape |
|
|
|
|
|| item instanceof MultipointIcon |
|
|
|
|
|| item instanceof PolygonIcon |
|
|
|
|
|| item instanceof AxArrowConnector) { |
|
|
|
|
if ( item instanceof AxShape |
|
|
|
|
&& item instanceof AxPreviewImageShape === false) { |
|
|
|
|
// 判断2个矩形是否相交
|
|
|
|
|
const rect1 = this.rectToolGraphics.getBounds(); |
|
|
|
|
const rect2 = item.getBounds(); |
|
|
|
|
if (this.isOverlap(rect1, rect2)) { |
|
|
|
|
this.selection.select(item); |
|
|
|
|
shapes.push(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.rectToolGraphics.clear(); |
|
|
|
|
this.rectToolGraphics.visible = false; |
|
|
|
|
this.selectAll(shapes); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('pointerupoutside', event => { |
|
|
|
|
if (event.currentTarget.dragging) { |
|
|
|
|
event.currentTarget.dragging = false; |
|
|
|
|
if (this.isMove) { |
|
|
|
|
this.isMove = false; |
|
|
|
|
event.currentTarget.data = null; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('pointermove', event => { |
|
|
|
|
if (event.currentTarget.dragging && this.selection.isMultiselection === false) { |
|
|
|
|
if (this.isMove && this.isCtrlKeyClicked === false) { |
|
|
|
|
const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent); |
|
|
|
|
event.currentTarget.x = newPosition.x - event.currentTarget.dragPoint.x; |
|
|
|
|
event.currentTarget.y = newPosition.y - event.currentTarget.dragPoint.y; |
|
|
|
|
} else if (event.currentTarget.dragging && this.selection.isMultiselection === true) { |
|
|
|
|
} else if (this.isMove && this.isCtrlKeyClicked === true) { |
|
|
|
|
if (this.rectToolGraphics.visible === true) { |
|
|
|
|
this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); |
|
|
|
|
} |
|
|
|
@ -877,7 +830,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
}) |
|
|
|
|
.on('rightclick', event => { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
this.setPaintMode(PaintMode.endPaint); |
|
|
|
|
}) |
|
|
|
|
.on('pointerover', (event) => { |
|
|
|
@ -951,11 +904,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* @param imageUrl |
|
|
|
|
* @param imageAngle |
|
|
|
|
*/ |
|
|
|
|
public async refresh(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise<void> { |
|
|
|
|
public async refresh(imageUrl: string = this.canvasData.selectStorey.imageUrl, |
|
|
|
|
imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise<void> { |
|
|
|
|
await this.refreshBackgroundImage(); |
|
|
|
|
|
|
|
|
|
// 清空所有图形
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
const itemList = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { |
|
|
|
@ -978,10 +931,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 加载无关联信息处置预案 |
|
|
|
|
* @data 处置预案数据 |
|
|
|
|
*/ |
|
|
|
|
public async loadNoRelevantInformationDisposalPlan(data:DisposalNodeData): Promise<void> { |
|
|
|
|
await this.refreshBackgroundImage(data.BackgroundImageUrl,data.BackgroundImageAngle); |
|
|
|
|
public async loadNoRelevantInformationDisposalPlan(data: DisposalNodeData): Promise<void> { |
|
|
|
|
await this.refreshBackgroundImage(data.BackgroundImageUrl, data.BackgroundImageAngle); |
|
|
|
|
// 清空所有图形
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
const itemList = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { |
|
|
|
@ -1142,7 +1095,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
*/ |
|
|
|
|
public beginPaint() { |
|
|
|
|
console.log(this.canvasData.selectTemplateData); |
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
this.setPaintMode(PaintMode.endPaint); |
|
|
|
|
this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode); |
|
|
|
|
} |
|
|
|
@ -1291,49 +1244,53 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 复制 |
|
|
|
|
*/ |
|
|
|
|
public copy(): void { |
|
|
|
|
this.copyData = []; |
|
|
|
|
this.selection.objects.forEach(item => { |
|
|
|
|
const newData = JSON.parse(JSON.stringify(item.assetData)); |
|
|
|
|
this.copyData.push(newData); |
|
|
|
|
}); |
|
|
|
|
this.copyData = []; |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
const newData = JSON.parse(JSON.stringify(item.assetData)); |
|
|
|
|
this.copyData.push(newData); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 粘贴 |
|
|
|
|
*/ |
|
|
|
|
public paste(companyId: string, buildingId: string, floorId: string): void { |
|
|
|
|
this.copyData.forEach(item => { |
|
|
|
|
item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
|
const newData = JSON.parse(JSON.stringify(item)); |
|
|
|
|
newData.Id = ObjectID.default.generate(), |
|
|
|
|
newData.CompanyId = companyId; |
|
|
|
|
newData.BuildingId = buildingId; |
|
|
|
|
newData.FloorId = floorId; |
|
|
|
|
newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
|
switch (item.InteractiveMode) { |
|
|
|
|
case PaintMode.singlePointIcon: |
|
|
|
|
const singleIcon = new AxImageShape(newData, this); |
|
|
|
|
this.emit('createIcon', singleIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.lineIcon: |
|
|
|
|
const lineIcon = new MultipointIcon(newData, this); |
|
|
|
|
this.emit('createIcon', lineIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.polygonIcon: |
|
|
|
|
const polygonIcon = new PolygonIcon(newData, this); |
|
|
|
|
this.emit('createIcon', polygonIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.Pipeline: |
|
|
|
|
if (item.Name === '距离') { |
|
|
|
|
const wall = new AxArrowConnector(newData, this, true, true); |
|
|
|
|
this.emit('createIcon', wall); |
|
|
|
|
} else if (item.Name === '普通墙' || item.Name === '承重墙') { |
|
|
|
|
const wall = new AxArrowConnector(newData, this, false, false); |
|
|
|
|
this.emit('createIcon', wall); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
this.selection.select(this.backgroundImage.getChildByName(newData.Id)); |
|
|
|
|
}); |
|
|
|
|
const ids: string[] = []; |
|
|
|
|
if (this.copyData.length > 0) { |
|
|
|
|
this.copyData.forEach(item => { |
|
|
|
|
item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
|
const newData = JSON.parse(JSON.stringify(item)); |
|
|
|
|
newData.Id = ObjectID.default.generate(), |
|
|
|
|
newData.CompanyId = companyId; |
|
|
|
|
newData.BuildingId = buildingId; |
|
|
|
|
newData.FloorId = floorId; |
|
|
|
|
newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
|
switch (item.InteractiveMode) { |
|
|
|
|
case PaintMode.singlePointIcon: |
|
|
|
|
const singleIcon = new AxImageShape(newData, this); |
|
|
|
|
this.emit('createIcon', singleIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.lineIcon: |
|
|
|
|
const lineIcon = new MultipointIcon(newData, this); |
|
|
|
|
this.emit('createIcon', lineIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.polygonIcon: |
|
|
|
|
const polygonIcon = new PolygonIcon(newData, this); |
|
|
|
|
this.emit('createIcon', polygonIcon); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.Pipeline: |
|
|
|
|
if (item.Name === '距离') { |
|
|
|
|
const wall = new AxArrowConnector(newData, this, true, true); |
|
|
|
|
this.emit('createIcon', wall); |
|
|
|
|
} else if (item.Name === '普通墙' || item.Name === '承重墙') { |
|
|
|
|
const wall = new AxArrowConnector(newData, this, false, false); |
|
|
|
|
this.emit('createIcon', wall); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
ids.push(newData.Id); |
|
|
|
|
}); |
|
|
|
|
this.setHighlight(ids); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//////////////////////////////////////////////////////////////////////// 通用/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/** |
|
|
|
@ -1357,7 +1314,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
public async onExamineeClickFloor() { |
|
|
|
|
await this.refreshBackgroundImage(); |
|
|
|
|
// 清空所有图形
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
const itemList = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { |
|
|
|
@ -1384,7 +1341,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
public async onExaminerClickFloor() { |
|
|
|
|
await this.refreshBackgroundImage(); |
|
|
|
|
// 清空所有图形
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
const itemList = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { |
|
|
|
@ -1410,7 +1367,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
public async onExaminerClickFloor_CreateTestpaper() { |
|
|
|
|
await this.refreshBackgroundImage(); |
|
|
|
|
// 清空所有图形
|
|
|
|
|
this.selection.deselectAll(); |
|
|
|
|
this.deselectAll(); |
|
|
|
|
const itemList = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { |
|
|
|
@ -1428,94 +1385,113 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
// 隐藏图标
|
|
|
|
|
this.setNameVisible(false, 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 选择器 |
|
|
|
|
*/ |
|
|
|
|
export class Selection { |
|
|
|
|
constructor(private workingArea: WorkingAreaComponent) {} |
|
|
|
|
public objects: any[] = []; |
|
|
|
|
public isMultiselection = false; |
|
|
|
|
//////////////////////////////////////////////////////////////////// 选择逻辑
|
|
|
|
|
/** |
|
|
|
|
* 返回选择器中是否包含对象 |
|
|
|
|
* @param obj 对象 |
|
|
|
|
* 清空选择,选择单个形状 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public contains(obj: any): boolean { |
|
|
|
|
return this.objects.includes(obj); |
|
|
|
|
public selectSingle(shape: AxShape) { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.add(shape); |
|
|
|
|
this.setSelectEffect(shape); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选定对象 |
|
|
|
|
* @param obj 对象 |
|
|
|
|
* 选择 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public select(obj: any) { |
|
|
|
|
if (!this.contains(obj)) { |
|
|
|
|
this.workingArea.emit('select', obj); |
|
|
|
|
this.objects.push(obj); |
|
|
|
|
public select(shape: AxShape) { |
|
|
|
|
if (this.selection.first() !== null |
|
|
|
|
&& !this.isCtrlKeyClicked |
|
|
|
|
&& !this.selection.has(shape)) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.add(shape); |
|
|
|
|
this.setSelectEffect(shape); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 取消选定对象 |
|
|
|
|
* @param obj 对象 |
|
|
|
|
* 选择集合中的形状 |
|
|
|
|
* @param shape 形状集合 |
|
|
|
|
*/ |
|
|
|
|
public deselect(obj: any) { |
|
|
|
|
if (this.contains(obj)) { |
|
|
|
|
this.workingArea.emit('deselect', obj); |
|
|
|
|
const idx = this.objects.findIndex(x => x === obj); |
|
|
|
|
this.objects.splice(idx, 1); |
|
|
|
|
} |
|
|
|
|
public selectAll(shape: AxShape[]) { |
|
|
|
|
this.selection.addArray(shape); |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.setSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选定或取消选定对象 |
|
|
|
|
* @param obj 对象 |
|
|
|
|
* 先清空再选择全部 |
|
|
|
|
* @param shape 形状集合 |
|
|
|
|
*/ |
|
|
|
|
public selectOrDeselect(obj: any) { |
|
|
|
|
if (this.contains(obj)) { |
|
|
|
|
this.deselect(obj); |
|
|
|
|
} else { |
|
|
|
|
this.select(obj); |
|
|
|
|
public selectAllWithClear(shape: AxShape[]) { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.addArray(shape); |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.setSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 取消选定所有已选定对象 |
|
|
|
|
* 选择集合中所有id的形状 |
|
|
|
|
* @param ids 形状id集合 |
|
|
|
|
*/ |
|
|
|
|
public deselectAll() { |
|
|
|
|
this.objects.forEach(item => { |
|
|
|
|
this.workingArea.emit('deselect', item); |
|
|
|
|
public setHighlight(ids: string[]): void { |
|
|
|
|
const shapes: AxShape[] = []; |
|
|
|
|
// 重新选择
|
|
|
|
|
ids.forEach(item => { |
|
|
|
|
const obj = this.backgroundImage.getChildByName(item); |
|
|
|
|
shapes.push(obj as AxShape); |
|
|
|
|
}); |
|
|
|
|
this.objects.splice(0, this.objects.length); |
|
|
|
|
this.selectAllWithClear(shapes); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 取消选定所有对象后选定一个对象 |
|
|
|
|
* @param obj 对象 |
|
|
|
|
* 取消所有选择 |
|
|
|
|
*/ |
|
|
|
|
public selectOne(obj: any) { |
|
|
|
|
if (this.isMultiselection) { |
|
|
|
|
this.selectOrDeselect(obj); |
|
|
|
|
} else { |
|
|
|
|
this.deselectAll(); |
|
|
|
|
this.select(obj); |
|
|
|
|
public deselectAll() { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选定对象集合中所有对象 |
|
|
|
|
* @param objects 对象集合 |
|
|
|
|
* 设置选中效果 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public selectAll(objects: any[]) { |
|
|
|
|
this.objects.forEach(item => { |
|
|
|
|
this.select(item); |
|
|
|
|
}); |
|
|
|
|
public setSelectEffect(shape: AxShape) { |
|
|
|
|
shape.hideBorder(); |
|
|
|
|
shape.setPointVisiable(false); |
|
|
|
|
shape.showBorder(); |
|
|
|
|
shape.drawBorder(1 / this.backgroundImage.scale.x); |
|
|
|
|
shape.setPointVisiable(this.allowEdit); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置形状选中效果 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public clearSelectEffect(shape: AxShape) { |
|
|
|
|
shape.hideBorder(); |
|
|
|
|
shape.setPointVisiable(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 车辆类型 |
|
|
|
|
*/ |
|
|
|
|
export enum Type { |
|
|
|
|
水源 = 0, |
|
|
|
|
举高喷射消防车 = 1, |
|
|
|
|
泡沫消防车 = 2, |
|
|
|
|
水罐消防车 = 3, |
|
|
|
|
压缩空气泡沫消防车 = 4 |
|
|
|
|
enum CanvasAction { |
|
|
|
|
selectionChanged = 'selectionChanged', |
|
|
|
|
copyDataChanged = 'copyDataChanged' |
|
|
|
|
} |
|
|
|
|