chenjingyu 4 years ago
parent
commit
816a83382d
  1. 1
      src/app/ui/collection-tools-building/collection-tools.component.html
  2. 25
      src/app/ui/collection-tools-building/collection-tools.component.ts
  3. 1
      src/app/ui/collection-tools-plan/collection-tools.component.html
  4. 24
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  5. 3
      src/app/working-area/model/axLegend.ts
  6. 2
      src/app/working-area/model/configuration.ts
  7. 38
      src/app/working-area/working-area.component.ts

1
src/app/ui/collection-tools-building/collection-tools.component.html

@ -35,6 +35,7 @@
<img src="/assets/images/重置缩放.png" alt=""> <img src="/assets/images/重置缩放.png" alt="">
重置缩放 重置缩放
</span> </span>
<button (click)="takeScreenshot()">导出图片</button>
<span class="rightSave"> <span class="rightSave">
<!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon> <!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> --> <mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> -->

25
src/app/ui/collection-tools-building/collection-tools.component.ts

@ -842,7 +842,10 @@ export class CollectionToolsBuildingComponent implements OnInit {
this.canvas.paste(companyId, buildingId, floorId) this.canvas.paste(companyId, buildingId, floorId)
this.renovateTreeData(false) this.renovateTreeData(false)
} }
//截图
takeScreenshot() {
this.canvas.takeScreenshot();
}
isMultiSelect: boolean = false; // 多选/单选 切换 isMultiSelect: boolean = false; // 多选/单选 切换
changeMultiSelect(e) { this.canvas.setMulitSelect(this.isMultiSelect) } changeMultiSelect(e) { this.canvas.setMulitSelect(this.isMultiSelect) }
isShowLegend: boolean = true; //图例是否显示 isShowLegend: boolean = true; //图例是否显示
@ -1429,16 +1432,16 @@ export class CollectionToolsBuildingComponent implements OnInit {
//子节点跟随父节点的islook变化 //子节点跟随父节点的islook变化
  if(node.children && node.children.length != 0){ if (node.children && node.children.length != 0) {
      node.children.forEach(item=>{ node.children.forEach(item => {
        item.isLook = !node.isLook  item.isLook = !node.isLook
        if(item.children && item.children.length != 0){ if (item.children && item.children.length != 0) {
          item.children.forEach(i=>{ item.children.forEach(i => {
            i.isLook =  !node.isLook  i.isLook = !node.isLook
          }) })
        } }
      }) })
     } }
const nodes = this.treeControl.dataNodes; const nodes = this.treeControl.dataNodes;

1
src/app/ui/collection-tools-plan/collection-tools.component.html

@ -30,6 +30,7 @@
<img src="/assets/images/重置缩放.png" alt=""> <img src="/assets/images/重置缩放.png" alt="">
重置缩放 重置缩放
</span> </span>
<button (click)="takeScreenshot()">导出图片</button>
<span class="rightSave"> <span class="rightSave">
<!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon> <!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> --> <mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> -->

24
src/app/ui/collection-tools-plan/collection-tools.component.ts

@ -846,6 +846,10 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.paste(companyId, buildingId, floorId) this.canvas.paste(companyId, buildingId, floorId)
// this.renovateTreeData(false) // this.renovateTreeData(false)
} }
//截图
takeScreenshot() {
this.canvas.takeScreenshot();
}
isMultiSelect: boolean = false; // 多选/单选 切换 isMultiSelect: boolean = false; // 多选/单选 切换
changeMultiSelect(e) { this.canvas.setMulitSelect(this.isMultiSelect) } changeMultiSelect(e) { this.canvas.setMulitSelect(this.isMultiSelect) }
@ -1426,16 +1430,16 @@ export class CollectionToolsPlanComponent implements OnInit {
//子节点跟随父节点的islook变化 //子节点跟随父节点的islook变化
  if(node.children && node.children.length != 0){ if (node.children && node.children.length != 0) {
      node.children.forEach(item=>{ node.children.forEach(item => {
        item.isLook = !node.isLook  item.isLook = !node.isLook
        if(item.children && item.children.length != 0){ if (item.children && item.children.length != 0) {
          item.children.forEach(i=>{ item.children.forEach(i => {
            i.isLook =  !node.isLook  i.isLook = !node.isLook
          }) })
        } }
      }) })
     } }
const nodes = this.treeControl.dataNodes; const nodes = this.treeControl.dataNodes;

3
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 { Sprite, Texture, Text, Graphics, Point } from 'pixi.js';
import { WorkingAreaComponent } from '../working-area.component'; import { WorkingAreaComponent } from '../working-area.component';
import { AxShape } from './axShape'; import { AxShape } from './axShape';

2
src/app/working-area/model/configuration.ts

@ -77,7 +77,7 @@ export var config = {
directionalDrag: true, directionalDrag: true,
boundsX: 500, boundsX: 500,
boundsY: 500, boundsY: 500,
viewBounds: 60000 viewBounds: 100000
}; };
export var wallInformation = { exterior: false, interior: false, midline: true, labels: true, exteriorlabel: 'e:', interiorlabel: 'i:', midlinelabel: 'm:' }; export var wallInformation = { exterior: false, interior: false, midline: true, labels: true, exteriorlabel: 'e:', interiorlabel: 'i:', midlinelabel: 'm:' };

38
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 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(); this.camera2D.drag();
} }
} }
/** /**
* *
*/ */
@ -478,7 +483,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.deselectAll(); this.deselectAll();
this.setPaintMode(PaintMode.endPaint); this.setPaintMode(PaintMode.endPaint);
}); });
} }
/** /**
* 2D相机 * 2D相机
@ -614,12 +618,31 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.canvasData.isChange = true; this.canvasData.isChange = true;
this.updateCamera2D(); 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() { public resetCanvas() {
this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight); 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, TemplateId: this.canvasData.selectTemplateData.id,
CanConnect: this.canvasData.selectTemplateData.canConnect, CanConnect: this.canvasData.selectTemplateData.canConnect,
Pipelines: new Array(), Pipelines: new Array(),
BuildingId: this.canvasData.selectStorey.buildingId,
FloorId: this.canvasData.selectStorey.id, FloorId: this.canvasData.selectStorey.id,
Angle: this.canvasData.selectTemplateData.angle, Angle: this.canvasData.selectTemplateData.angle,
Color: this.canvasData.selectTemplateData.color, Color: this.canvasData.selectTemplateData.color,
@ -808,6 +832,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
GameMode: this.canvasData.gameMode, GameMode: this.canvasData.gameMode,
Tag: this.canvasData.selectTemplateData.tag Tag: this.canvasData.selectTemplateData.tag
}; };
const singleIcon = new AxImageShape(assetData, this); const singleIcon = new AxImageShape(assetData, this);
this.emit('createIcon', singleIcon); this.emit('createIcon', singleIcon);
break; break;
@ -1035,7 +1060,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.previewImage.visible = false; this.previewImage.visible = false;
} }
}); });
this.camera2D.addChild(this.backgroundImage); this.backgroundContainer.addChild(this.backgroundImage);
this.camera2D.addChild(this.backgroundContainer);
this.createPreviewImage(); this.createPreviewImage();
this.createPreviewLineSegment(); this.createPreviewLineSegment();
this.createCircleShadow(); this.createCircleShadow();
@ -1449,7 +1475,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
const property = new PropertyInfo(element); const property = new PropertyInfo(element);
propertyList.push(property); propertyList.push(property);
}); });
const assetData = { const assetData: AssetData = {
TemplateId: this.canvasData.selectTemplateData.id, TemplateId: this.canvasData.selectTemplateData.id,
FloorId: this.canvasData.selectStorey.id, FloorId: this.canvasData.selectStorey.id,
Angle: this.canvasData.selectTemplateData.angle, Angle: this.canvasData.selectTemplateData.angle,
@ -1460,6 +1486,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
FixedSize: this.canvasData.selectTemplateData.fixedSize, FixedSize: this.canvasData.selectTemplateData.fixedSize,
Height: 32, Height: 32,
Width: 32, Width: 32,
BuildingId: this.canvasData.selectStorey.buildingId,
CompanyId: "",
FloorName: "",
Id: ObjectID.default.generate(), Id: ObjectID.default.generate(),
ImageUrl: this.canvasData.selectTemplateData.imageUrl, ImageUrl: this.canvasData.selectTemplateData.imageUrl,
InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, InteractiveMode: this.canvasData.selectTemplateData.interactiveMode,
@ -1708,6 +1737,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
ids.forEach(item => { ids.forEach(item => {
const obj = this.backgroundImage.getChildByName(item); const obj = this.backgroundImage.getChildByName(item);
shapes.push(obj as AxShape); shapes.push(obj as AxShape);
console.log((obj as AxShape).assetData);
}); });
this.selectAllWithClear(shapes); this.selectAllWithClear(shapes);
} }

Loading…
Cancel
Save