|
|
|
@ -60,6 +60,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
// console.log('按下了' + event.keyCode);
|
|
|
|
|
if (event.keyCode === 17) { |
|
|
|
|
this.selection.isMultiselection = true; |
|
|
|
|
this.refresh(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.eventManager.addGlobalEventListener('window', 'keyup', (event: any) => { |
|
|
|
@ -165,7 +166,42 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 刷新 |
|
|
|
|
*/ |
|
|
|
|
public refresh(): void { |
|
|
|
|
console.log(this.canvasData.originaleveryStoreyData); |
|
|
|
|
console.log(this.canvasData.originalcompanyBuildingData); |
|
|
|
|
const tempData = this.canvasData.originaleveryStoreyData.data; |
|
|
|
|
const version = this.canvasData.originaleveryStoreyData.version; |
|
|
|
|
|
|
|
|
|
const tempDataBuild = this.canvasData.originalcompanyBuildingData.data; |
|
|
|
|
const versionBuild = this.canvasData.originalcompanyBuildingData.version; |
|
|
|
|
|
|
|
|
|
this.refreshBackgroundImage(); |
|
|
|
|
// // key=>属性名 data[key]=>属性值
|
|
|
|
|
Object.keys(tempData).forEach((key) => { |
|
|
|
|
if (version === '2.0') { |
|
|
|
|
this.createSinglePointIcon(tempData[key].ImageUrl, tempData[key].Point.x, tempData[key].Point.y, 32, 32, 1, key); |
|
|
|
|
} else { |
|
|
|
|
switch (tempData[key].InteractiveMode) { |
|
|
|
|
case 0: |
|
|
|
|
this.createSinglePointIcon(tempData[key].ImageUrl, tempData[key].Point.x, -tempData[key].Point.y, 32, 32, 1, key); |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
const texture = PIXI.Texture.from(tempData[key].ImageUrl); |
|
|
|
|
const icon = new MultipointIcon(texture, tempData[key].Point, tempData[key].MultiPoint, this, tempData[key].Name, false); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Object.keys(tempDataBuild).forEach((key) => { |
|
|
|
|
if (versionBuild === '2.0') { |
|
|
|
|
this.createSinglePointIcon(tempDataBuild[key].ImageUrl, tempDataBuild[key].Point.x, tempDataBuild[key].Point.y, 32, 32, 1, key); |
|
|
|
|
} else { |
|
|
|
|
this.createSinglePointIcon(tempDataBuild[key].ImageUrl, tempDataBuild[key].Point.x, -tempDataBuild[key].Point.y, 32, 32, 1, key); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -178,9 +214,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* @param height todo |
|
|
|
|
* @param alpha todo |
|
|
|
|
*/ |
|
|
|
|
private createSinglePointIcon(source: PIXI.Texture, x: number, y: number, width: number, height: number, |
|
|
|
|
private createSinglePointIcon(imageUri: string, x: number, y: number, width: number, height: number, |
|
|
|
|
alpha: number, name: string): PIXI.Sprite { |
|
|
|
|
const singlePointIcon = new PIXI.Sprite(source); |
|
|
|
|
const singlePointIcon = PIXI.Sprite.from(imageUri); |
|
|
|
|
singlePointIcon.x = x; |
|
|
|
|
singlePointIcon.y = y; |
|
|
|
|
singlePointIcon.width = width; |
|
|
|
@ -376,7 +412,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
break; |
|
|
|
|
case PaintMode.singlePointIcon: |
|
|
|
|
// tslint:disable-next-line: max-line-length
|
|
|
|
|
this.createSinglePointIcon(this.previewSinglePointIcon.texture, this.previewSinglePointIcon.x, this.previewSinglePointIcon.y, 32, 32, 1, this.canvasData.selectTemplateData.name); |
|
|
|
|
this.createSinglePointIcon(this.canvasData.selectTemplateData.imageUrl, this.previewSinglePointIcon.x, this.previewSinglePointIcon.y, 32, 32, 1, this.canvasData.selectTemplateData.name); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.lineIcon: |
|
|
|
|
this.previewLineSegment.visible = true; |
|
|
|
@ -390,8 +426,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
if (this.paintingIcon !== null) { |
|
|
|
|
this.backgroundImage.removeChild(this.paintingIcon); |
|
|
|
|
} |
|
|
|
|
this.paintingIcon = new MultipointIcon(this.previewSinglePointIcon.texture, this.paintPoints, this, |
|
|
|
|
this.canvasData.selectTemplateData.name); |
|
|
|
|
this.paintingIcon = new MultipointIcon(this.previewSinglePointIcon.texture, new PIXI.Point(0, 0), this.paintPoints, this, |
|
|
|
|
this.canvasData.selectTemplateData.name, true); |
|
|
|
|
break; |
|
|
|
|
case PaintMode.polygonIcon: |
|
|
|
|
this.previewLineSegment.visible = true; |
|
|
|
@ -454,10 +490,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 刷新背景图 |
|
|
|
|
*/ |
|
|
|
|
public refreshBackgroundImage(): void { |
|
|
|
|
if (this.canvasData.selectStorey === null) { |
|
|
|
|
if (this.canvasData.selectStorey.imageUrl === '') { |
|
|
|
|
this.backgroundImage.visible = false; |
|
|
|
|
} else { |
|
|
|
|
this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUri); |
|
|
|
|
this.backgroundImage.texture = PIXI.Texture.from(this.canvasData.selectStorey.imageUrl); |
|
|
|
|
this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle; |
|
|
|
|
this.backgroundImage.visible = true; |
|
|
|
|
} |
|
|
|
@ -631,10 +667,21 @@ export class MultipointIcon extends PIXI.Container {
|
|
|
|
|
* @param texture 图片素材 |
|
|
|
|
* @param points 点集合 |
|
|
|
|
*/ |
|
|
|
|
constructor(texture: PIXI.Texture, points: PIXI.Point[], private workingArea: WorkingAreaComponent, name: string) { |
|
|
|
|
constructor(texture: PIXI.Texture, private point: PIXI.Point, points: PIXI.Point[], private workingArea: WorkingAreaComponent, |
|
|
|
|
name: string, private yy: boolean) { |
|
|
|
|
super(); |
|
|
|
|
this.name = name; |
|
|
|
|
this.pointsData = points; |
|
|
|
|
if (this.yy === false) { |
|
|
|
|
this.point.y = -this.point.y; |
|
|
|
|
this.pointsData.forEach(item => { |
|
|
|
|
console.log(item.y); |
|
|
|
|
item.y = -item.y; |
|
|
|
|
console.log(item.y); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
this.x = this.point.x; |
|
|
|
|
this.y = this.point.y; |
|
|
|
|
this.workingArea.backgroundImage.addChild(this); |
|
|
|
|
// 画线图标
|
|
|
|
|
for (let i = 0, count = this.pointsData.length - 1; i < count; i++) { |
|
|
|
|