diff --git a/src/app/working-area/model/axLegend.ts b/src/app/working-area/model/axLegend.ts index dffc4a8..fd47146 100644 --- a/src/app/working-area/model/axLegend.ts +++ b/src/app/working-area/model/axLegend.ts @@ -1,6 +1,3 @@ -import { Constructor } from '@angular/material/core/common-behaviors/constructor'; -import { MatGridTileHeaderCssMatStyler } from '@angular/material/grid-list'; -import { DefaultProxy } from 'cesium'; import { Sprite, Texture, Text, Graphics, Point } from 'pixi.js'; import { WorkingAreaComponent } from '../working-area.component'; import { AxShape } from './axShape'; diff --git a/src/app/working-area/model/configuration.ts b/src/app/working-area/model/configuration.ts index f26898b..7a8ec8a 100644 --- a/src/app/working-area/model/configuration.ts +++ b/src/app/working-area/model/configuration.ts @@ -77,7 +77,7 @@ export var config = { directionalDrag: true, boundsX: 500, boundsY: 500, - viewBounds: 60000 + viewBounds: 100000 }; export var wallInformation = { exterior: false, interior: false, midline: true, labels: true, exteriorlabel: 'e:', interiorlabel: 'i:', midlinelabel: 'm:' }; diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 52628f2..76e673a 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -64,6 +64,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 资源加载器 */ public loader = PIXI.Loader.shared; + /** + * 背景容器 + */ + public backgroundContainer = new PIXI.Container(); /** * 背景图 */ @@ -171,7 +175,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 重大调整-主版本号增加 * 日期变更-日期版本号增加 */ - public VERSION = '1.4.3.20210415_rc'; + public VERSION = '1.5.0.20210507_rc'; /** * 数据初始化 */ @@ -223,6 +227,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.camera2D.drag(); } } + /** * 删除选中的图标 */ @@ -478,7 +483,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.deselectAll(); this.setPaintMode(PaintMode.endPaint); }); - } /** * 更新2D相机 @@ -614,12 +618,31 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.canvasData.isChange = true; this.updateCamera2D(); }); + + + } + + /** + * 截屏 + */ + takeScreenshot() { + this.backgroundContainer.setParent(this.app.stage); + this.app.renderer.extract.canvas(this.backgroundContainer).toBlob((b) => { + const a = document.createElement('a'); + document.body.append(a); + a.download = 'screenshot'; + a.href = URL.createObjectURL(b); + a.click(); + a.remove(); + }, 'image/png'); + this.backgroundContainer.setParent(this.camera2D); } /** * 重置画布 */ public resetCanvas() { this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight); + } /** * 设置名称显示 @@ -785,6 +808,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV TemplateId: this.canvasData.selectTemplateData.id, CanConnect: this.canvasData.selectTemplateData.canConnect, Pipelines: new Array(), + BuildingId: this.canvasData.selectStorey.buildingId, FloorId: this.canvasData.selectStorey.id, Angle: this.canvasData.selectTemplateData.angle, Color: this.canvasData.selectTemplateData.color, @@ -808,6 +832,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV GameMode: this.canvasData.gameMode, Tag: this.canvasData.selectTemplateData.tag }; + const singleIcon = new AxImageShape(assetData, this); this.emit('createIcon', singleIcon); break; @@ -1035,7 +1060,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.previewImage.visible = false; } }); - this.camera2D.addChild(this.backgroundImage); + this.backgroundContainer.addChild(this.backgroundImage); + this.camera2D.addChild(this.backgroundContainer); this.createPreviewImage(); this.createPreviewLineSegment(); this.createCircleShadow(); @@ -1449,7 +1475,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const property = new PropertyInfo(element); propertyList.push(property); }); - const assetData = { + const assetData: AssetData = { TemplateId: this.canvasData.selectTemplateData.id, FloorId: this.canvasData.selectStorey.id, Angle: this.canvasData.selectTemplateData.angle, @@ -1460,6 +1486,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV FixedSize: this.canvasData.selectTemplateData.fixedSize, Height: 32, Width: 32, + BuildingId: this.canvasData.selectStorey.buildingId, + CompanyId: "", + FloorName: "", Id: ObjectID.default.generate(), ImageUrl: this.canvasData.selectTemplateData.imageUrl, InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, @@ -1708,6 +1737,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV ids.forEach(item => { const obj = this.backgroundImage.getChildByName(item); shapes.push(obj as AxShape); + console.log((obj as AxShape).assetData); }); this.selectAllWithClear(shapes); }