diff --git a/src/app/plan-audit/realistic-picture-look/previewImg.html b/src/app/plan-audit/realistic-picture-look/previewImg.html
new file mode 100644
index 0000000..1cde6b9
--- /dev/null
+++ b/src/app/plan-audit/realistic-picture-look/previewImg.html
@@ -0,0 +1,17 @@
+
图片详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ refresh
+
\ No newline at end of file
diff --git a/src/app/plan-audit/realistic-picture-look/realistic-picture.component.html b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.html
new file mode 100644
index 0000000..920eb22
--- /dev/null
+++ b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
{{items.nameStart}}
+
+
+ 暂无数据
+
+
+
+
+
+
+
diff --git a/src/app/plan-audit/realistic-picture-look/realistic-picture.component.scss b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.scss
new file mode 100644
index 0000000..9eed8fb
--- /dev/null
+++ b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.scss
@@ -0,0 +1,236 @@
+*{
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ scrollbar-width: none; /* Firefox */
+}
+::-webkit-scrollbar {
+ display: none; /* Chrome Safari */
+}
+.content {
+ //margin: 0 0 0 10px;
+ width: 100%;
+ height: 760px;
+ overflow-y: auto;
+ margin-top: 10px;
+ .leftBox {
+ flex: 15%;
+ padding-top: 10px;
+ .bank {
+ display: flex;
+ padding-left: 10px;
+ .mat-icon {margin-right: 15px;}
+ }
+ }
+ .rightBox {
+ border-left: 1px solid #999;
+ flex: 85%;
+ display: flex;
+ flex-direction: column;
+ .topBox {
+ flex: 5%; padding: 10px;
+ display: flex;
+ :first-child {flex: 85%;};
+ :last-child {flex: 15%;}
+ }
+ .bottomBox {
+ flex: 95%;
+ padding: 5px 0 0 25px;
+ overflow: auto;
+ .imgsBoxflex {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ }
+ }
+ }
+}
+.tableContent{
+ width: 100%;
+ height: 100%;
+ .panelhead{
+ height: 44px;
+ background-color: #F2F9FF;
+ margin-top: 10px;
+ }
+ .colum{
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: center;
+ .zanwu{
+ width: 100%;
+ height: 30px;
+ margin-top: 10px;
+ span{
+ height: 40px;
+ margin-top: 15px;
+ margin-left: 5%;
+ font-size: 16px;
+ }
+ }
+ .imghe{
+ width: 25%;
+ display: flex;
+ flex-direction: column;
+ cursor: pointer;
+ }
+ img{
+ width: 140px;
+ height: 100px;
+ margin-left: 9%;
+ margin-top: 7%;
+ }
+ label{
+ width: 140px;
+ margin-left: 9%;
+ text-align: center;
+ font-size: 14px;
+ }
+ input{
+ width: 80%;
+ border: none;
+ outline: none;
+ }
+ }
+}
+
+//icon统一样式
+.mat-icon {
+ cursor:pointer;
+ width: 18px;
+ height: 18px;
+ vertical-align:top;
+ margin-right: 10px;
+}
+.title {margin-right: 30px;font-weight: 500; font-size: 18px;}
+
+.material {
+ cursor:pointer;
+ height: 30px;
+ font-size: 16px;
+ margin-top: 10px;
+ padding-left: 15px;
+ span {
+ max-width: 200px;
+ display: inline-block;
+ overflow: hidden;
+ text-overflow:ellipsis;
+ white-space: nowrap;
+ }
+ .btn {
+ color: #FFC122;
+ }
+}
+.imgBox{
+ width: 300px;
+ height: 200px;
+ margin: 0 35px 35px 0;
+ display: inline-block;
+ position: relative;
+ .fixedImg {
+ width: 100%;
+ height: 170px;
+ text-align: center;
+ margin-bottom: 3px;
+ img {
+ width: auto;
+ height: auto;
+ max-width: 100%;
+ height: 100%;
+ cursor:pointer;
+ }
+ }
+ input{
+ font-size:12px;
+ width: 100px;
+ height:18px;
+ border-radius:3px;
+ border:1px solid #c8cccf;
+ outline:0;
+ text-align:left;
+ padding-left: 5px;
+ display:inline-block;
+ cursor: pointer;}
+ input::-webkit-input-placeholder{
+ color: #986655;
+ font-size: 12px;
+ }
+ a {display: inline-block;
+ width: 45px;
+ height: 24px;
+ line-height: 24px;
+ text-align: center;
+ border-radius: 3px;
+ background-color: #2196F3;
+ font-size: 14px;
+ color: #fff;}
+}
+.uploadFileFixed {
+ position: relative;
+ .uploadFile {
+ opacity:0;
+ display: inline-block;
+ width: 88px;
+ height: 36px;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ }
+}
+//分页
+.mat-paginator {
+ background-color: rgba(255,255,255,0);
+ padding-right: 10%;
+}
+.isLoading{
+ display: inline-block;
+ margin-left: 15px;
+ top: 8px;
+}
+
+//左侧实景图文件样式
+.leftFile {
+ background-color: rgba(225,225,225,0.8);
+}
+//选中图片样式
+.selectImg {
+ -webkit-filter: drop-shadow(0px 0px 5px #000);
+ filter: drop-shadow(0px 0px 5px #000);
+ border: 1px solid red;
+}
+.checkedImg {
+ position: absolute;
+ top: 1px;
+ right: 1px;
+ color:#00FF00;
+ font-size: 30px;
+ z-index: 999;
+}
+//预览图片旋转角度
+.rotateA {transform: rotate(90deg) scale(0.75);}
+.rotateB {transform: rotate(180deg)}
+.rotateC {transform: rotate(270deg) scale(0.75);}
+
+
+
+//预览图片
+.previewImgBox {
+ width: 1500px;
+ height: 700px;
+ text-align: center;
+ img{
+ width: auto;
+ height: auto;
+ max-width: 100%;
+ height: 100%;}
+}
+.previewImgBottom {
+ text-align: center;
+ height: 30px;
+ margin: 20px auto;
+}
diff --git a/src/app/plan-audit/realistic-picture-look/realistic-picture.component.ts b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.ts
new file mode 100644
index 0000000..a75ae55
--- /dev/null
+++ b/src/app/plan-audit/realistic-picture-look/realistic-picture.component.ts
@@ -0,0 +1,417 @@
+import { Component, OnInit, Inject, ViewChild } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { FileUploader } from 'ng2-file-upload';
+import { MatPaginator } from '@angular/material/paginator';
+import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
+import Swiper from 'swiper';
+import { Router,ActivatedRoute } from '@angular/router'
+
+@Component({
+ selector: 'app-realistic-picture-look',
+ templateUrl: './realistic-picture.component.html',
+ styleUrls: ['./realistic-picture.component.scss']
+})
+export class RealisticPictureLookComponent implements OnInit {
+ uploader:FileUploader = new FileUploader({ //初始化上传文件
+ url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`,
+ method: "POST",
+ itemAlias: "uploadedfile",
+ autoUpload: false,
+ removeAfterUpload:true,
+ });
+
+ constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { }
+
+ ngOnInit(): void {
+ let companyId = this.unitId
+ this.http.get('/api/RealityImageGroups',{params:{
+ companyId : companyId
+ }}).subscribe((data:any)=>{
+ this.allRealPicture = data
+ this.selectReal = data[0]
+ this.getAllRealPicture()
+ })
+
+ }
+
+ unitId:any = '5e9964caa760a059e84512e9'
+
+ companyId:any; //单位编号
+ allRealPicture:any=[]; //所有实景图文件
+ selectReal:any; //选中的实景图文件
+ selectRealIndex:number=0; //选中的实景图文件下标
+ allImages:any=[]; //实景图文件对应所有的实景图
+ isDownload:boolean = false; //是否批量下载
+ downloadList:any = []; //选中需要下载的图片
+
+ //分页
+ @ViewChild(MatPaginator, {static: true})
+ paginator: MatPaginator;
+ length:any; //共多少条数据
+ pageSize:any = '12'; //每页条数
+ pageSizeOptions: number[] = [12] //设置每页条数
+ PageNumber:any; //第几页
+
+ //分页切换
+ chagePage (e) {
+ this.PageNumber = e.pageIndex+1
+ this.getAllRealPicture()
+ }
+
+ //获取所有实景图分组
+ getAllGrouping () {
+ let companyId = this.unitId
+ this.http.get('/api/RealityImageGroups',{params:{
+ companyId : companyId
+ }}).subscribe((data:any)=>{
+ this.allRealPicture = data
+ this.selectReal = data[this.selectRealIndex]
+ })
+ }
+
+ //获取实景图分组对应实景图
+ getAllRealPicture () {
+ if (this.selectReal) {
+ let data ={
+ groupId: this.selectReal.id,
+ PageNumber: this.PageNumber || 1,
+ pageSize: this.pageSize,
+ }
+ this.http.get('/api/RealityImages',{params:data}).subscribe((data:any)=>{
+ this.allImages = data.items
+ // console.log(789,this.allImages)
+ this.length = data.totalCount
+ this.pageSize = data.pageSize
+ this.downloadList = []
+ //console.log(this.allImages)
+ this.allImages.forEach(element => { //每张图片设置选中状态为false
+ element.newImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址
+ element.checked = false //图片是否选中布尔值
+ element.nameStart = element.name.substring(0,element.name.lastIndexOf(".")); //图片名称前缀
+ element.nameEnd = element.name.substring(element.name.lastIndexOf("."),element.name.length); //图片名称后缀
+ });
+
+ })
+ }
+ }
+
+ //切换左侧实景图文件
+ changeReal (e,index) {
+ //this.allImages=[]
+ if (this.selectRealIndex != index) {
+ this.selectReal = e
+ this.selectRealIndex = index
+ this.isDownload = false
+ this.downloadList = []
+ this.getAllRealPicture()
+ }
+
+ }
+
+ //选择批量下载
+ download () {
+ this.isDownload = !this.isDownload
+ if (!this.isDownload) { //取消批量下载时数组清空
+ this.allImages.forEach(element => {element.checked = false});
+ this.downloadList = []
+ }
+ }
+
+ // 预览图片---批量选择图片
+ operation (e,index) {
+ if (this.isDownload) { //批量选择图片
+ e.checked = !e.checked
+ if (e.checked==true) {this.downloadList.push(e)}
+ else {this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1)}
+ } else { //预览图片
+ let data = {
+ allImages:this.allImages,
+ imgIndex: index}
+ let dialogRef = this.dialog.open(previewImg3,
+ {width: '1600px',
+ height:'900px',data});
+ dialogRef.afterClosed().subscribe();
+ }
+
+ }
+
+ //新建实景图文件
+ addReal () {
+
+ }
+
+ //编辑实景图文件
+ editReal () {
+
+ }
+
+ //删除实景图文件
+ delete () {
+ let companyId = this.unitId
+ if (this.selectReal) {
+ let isDelete = confirm('您确定要删除吗')
+ if (isDelete) {
+ this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data=>{
+ this.http.get('/api/RealityImageGroups',{params:{
+ companyId : companyId
+ }}).subscribe((data:any)=>{
+ this.allRealPicture = data
+ this.selectReal = data[this.selectRealIndex]
+ this.allImages = []
+ this.getAllRealPicture()
+ })
+ })
+ }
+ }
+ }
+
+
+
+ //实景图修改
+ preservationImg (e) {
+ let data = {
+ id:e.id,
+ name:e.nameStart+e.nameEnd,
+ imageUrl:e.imageUrl,
+ realityImageGroupId:e.realityImageGroupId
+ }
+ this.http.put(`/api/RealityImages/${e.id}`,data).subscribe(data=>{
+ this.getAllRealPicture()
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('图片修改成功','确定',config);
+ })
+ }
+
+ //实景图删除
+ deleteImg (e) {
+ let isDelete = confirm('您确定要删除吗')
+ if (isDelete) {
+ this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data=>{
+ this.getAllRealPicture()
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('图片删除成功','确定',config);
+ })
+ this.http.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`).subscribe(data=>{})
+ }
+ }
+
+
+
+
+
+ isLoading:boolean = false; //loading加载
+ //上传文件↓
+ file:any; //上传的文件
+ objectName:any; //上传对象名
+ uploadId:any; //上传分块上传事件编号
+
+ //change选择文件
+ uploadFile (e) {
+ if (this.selectReal) {
+ this.file = e.target.files[0] || null //上传的文件
+ let URL = window.URL.createObjectURL(this.file)
+ var img = new Image()
+ img.src = URL
+ let that = this
+ img.onload = function () {
+ if(img.width>=4096 || img.height>=5000 ){
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ that.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config);
+ that.uploader.clearQueue(); //清空input控件文件
+ (
document.getElementById('uploadFile')).value = null //清空input框缓存
+ }else{ that.startUploading() }
+ } //onload
+ } else {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('请选择或创建实景图文件夹','确定',config);
+ this.uploader.clearQueue(); //清空input控件文件
+ (document.getElementById('uploadFile')).value = null //清空input框缓存
+ }
+ }
+
+ //上传文件
+ startUploading () {
+ let file = this.file || null //获取上传的文件
+ let fileSize = file.size || null //上传文件的总大小
+ let shardSize = 5 * 1024 * 1024 //5MB一个分片
+ let maxdSize = 20 * 1024 * 1024 //限制20MB
+
+ if (file && fileSize<=shardSize) { //上传文件<=5MB时
+ this.uploader.queue[0].upload();//开始上传
+ this.uploader.queue[0].onSuccess = (response, status, headers) => {
+ if (status == 201) { // 上传文件成功,上传文件后获取服务器返回的数据
+ let tempRes = JSON.parse(response);
+ this.objectName = tempRes.objectName
+ this.addRealImg()
+ }else { // 上传文件后获取服务器返回的数据错误
+ let tempRes = JSON.parse(response);
+ }};
+ } else if (file && fileSize>shardSize && fileSize5MB时,分块上传
+ let data = {filename: file.name}
+ this.isLoading = true
+ this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.companyId}/RealImgs`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传
+ this.objectName = data.objectName
+ this.uploadId = data.uploadId
+ this.subsectionUploading()
+ })
+ }
+
+ }
+
+ PartNumberETag:any=[]; //每次返回需要保存的信息
+ //开始分段上传
+ async subsectionUploading () {
+ let file = this.file || null //获取上传的文件
+ let fileSize = file.size || null //上传文件的总大小
+ let shardSize = 5 * 1024 * 1024 //5MB一个分片
+ let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
+
+ for (let i = 0;i < allSlice;i++) { //循环分段上传
+ let start = i * shardSize //切割文件开始位置
+ let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
+ let formData = new FormData()
+ formData.append("file",file.slice(start, end))
+
+ //同步写法实现异步调用
+ let result = await new Promise((resolve, reject) => {
+ // await 需要后面返回一个 promise 对象
+ this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{
+ let msg = {
+ "partNumber":data.partNumber || null,
+ "eTag": data.eTag || null}
+ resolve(msg) // 调用 promise 内置方法处理成功
+ })
+ });
+ this.PartNumberETag.push(result)
+ if (this.PartNumberETag.length === allSlice) {this.endUploading()}
+ }//for循环
+
+ }
+
+ //完成分块上传
+ endUploading () {
+ let data = this.PartNumberETag
+ let paramsData = {uploadId:this.uploadId}
+ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{
+ this.addRealImg() //上传完成后,发送请求创建实景图
+ this.isLoading = false
+ this.uploader.clearQueue(); //清空input控件文件
+ this.PartNumberETag =[] //清空保存返回的信息
+ })
+ }
+
+ //上传图片成功后获取url地址发送请求创建实景图
+ addRealImg () {
+ let data = {
+ name: this.file.name,
+ imageUrl:this.objectName,
+ realityImageGroupId: this.selectReal.id,
+ }
+ this.http.post('/api/RealityImages',data).subscribe(data=>{
+ (document.getElementById('uploadFile')).value = null //清空input框缓存
+ this.getAllRealPicture()
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('图片上传成功','确定',config);
+ })
+ }
+
+
+
+ //批量下载↓
+ //开始下载
+ async batchDownload () {
+ if (this.downloadList.length) { //开始批量循环下载
+ this.isLoading = true
+ for (let i=0;i{
+ this.http.get(`/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}`,{responseType: 'blob'},).subscribe(data=>{
+ let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
+ let link = document.createElement("a");
+ link.style.display = "none";
+ link.href = url;
+ link.setAttribute("download", this.downloadList[i].name);
+ document.body.appendChild(link);
+ link.click();
+ result('success')})
+ })
+ if(i == this.downloadList.length-1) { //判断是否下载完毕
+ this.isLoading = false
+ this.isDownload = false
+ this.allImages.forEach(element => {element.checked = false});
+ this.downloadList = []}
+
+ } //for循环
+ } else {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = 'top';
+ config.duration = 3000
+ this.snackBar.open('请选择图片','确定',config);}
+ }
+
+
+
+
+
+}
+
+
+
+//预览图片组件
+@Component({
+ selector: 'app-previewImg',
+ templateUrl: './previewImg.html',
+ styleUrls: ['./realistic-picture.component.scss']
+})
+export class previewImg3 {
+
+ constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data) { }
+ testSwiper: Swiper;
+
+ ngOnInit(): void {
+ this.allImages = this.data.allImages
+ this.allImages.forEach(element => {
+ element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址
+ });
+ }
+
+ ngAfterViewInit() {
+ this.testSwiper = new Swiper('.swiper-container', {
+ lazy: true,
+ initialSlide: this.data.imgIndex,
+ direction: 'horizontal',
+ loop: false,
+
+
+
+ // 如果需要前进后退按钮
+ navigation: {
+ nextEl: '.swiper-button-next',
+ prevEl: '.swiper-button-prev',
+ }
+ });
+ }
+
+ allImages:any; //展示所有的图片
+ rotationAngle:number=0; //旋转角度
+
+ //旋转图片
+ rotate () {
+ this.rotationAngle = this.rotationAngle+90
+ if (this.rotationAngle === 360) {this.rotationAngle = 0}
+ }
+
+}
+
+
diff --git a/src/app/plan-audit/wait-examineer/show3D.html b/src/app/plan-audit/wait-examineer/show3D.html
new file mode 100644
index 0000000..df039d1
--- /dev/null
+++ b/src/app/plan-audit/wait-examineer/show3D.html
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.html b/src/app/plan-audit/wait-examineer/wait-examineer.component.html
index b85c3a1..524a57a 100644
--- a/src/app/plan-audit/wait-examineer/wait-examineer.component.html
+++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.html
@@ -89,136 +89,141 @@
-
+
diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.scss b/src/app/plan-audit/wait-examineer/wait-examineer.component.scss
index 98b0e69..3cb90af 100644
--- a/src/app/plan-audit/wait-examineer/wait-examineer.component.scss
+++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.scss
@@ -204,6 +204,18 @@ th,td{
opacity: 1;
}
}
+.twoD {
+ width: 100%;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ align-items: left;
+ .planBox {
+ margin: 30px 30px;
+ color: black;
+ :first-child {margin-right: 10px;}
+ }
+ }
//滚动条样式
::-webkit-scrollbar{
diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
index e4f15f1..33ce947 100644
--- a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
+++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
@@ -4,11 +4,12 @@
* @Author: sueRimn
* @Date: 2020-12-25 16:13:50
* @LastEditors: sueRimn
- * @LastEditTime: 2021-02-02 15:05:56
+ * @LastEditTime: 2021-02-05 09:46:54
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, Inject, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
+import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http'
declare var CryptoJS
import { DomSanitizer } from '@angular/platform-browser';
@@ -22,7 +23,7 @@ declare var echarts: any;
})
export class WaitExamineerComponent implements OnInit {
- constructor(private http:HttpClient,public snackBar: MatSnackBar,private sanitizer: DomSanitizer) {
+ constructor(private http:HttpClient,public snackBar: MatSnackBar,private sanitizer: DomSanitizer,public dialog: MatDialog) {
}
@@ -101,7 +102,14 @@ export class WaitExamineerComponent implements OnInit {
chuorzhong//判断初审还是终审
radioid//选中的id
shenheTable=[]//选中要审核的对象
- showtype = null//0:word,1:全景图,2:二维三维,3:重点单位
+ showtype//0:word,1:全景图,2:二维三维,3:重点单位
+ compantData={name:'',buildingTypes:[],address:''}
+ organizationName
+ planData
+ id
+ companyId
+ fetchUrl
+ companyName
//获取表格数据
getAlltabledate(){
@@ -146,34 +154,65 @@ export class WaitExamineerComponent implements OnInit {
radioClick(e,item){
//e.target.parentElement.bgColor='#2196F3'
console.log(e,item)
- let filename:string
- let fetchUrl
+ this.id=item.id
+ this.fetchUrl=''
+
this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data:any)=>{
- console.log(data)
-
+ this.companyId=data.companyId
+ this.companyName=data.companyName
if(data.planType!=2&&data.planType!=1){
- fetchUrl=data.attachmentUrls[0]
- var index=fetchUrl.indexOf("\/")
- if(fetchUrl.substr(0,index)=='psw'){
+ this.fetchUrl=data.attachmentUrls[0]
+ var index=this.fetchUrl.indexOf("\/")
+ if(this.fetchUrl.substr(0,index)=='psw'){
this.showtype=1
window.setTimeout(()=>{
const viewer = new Viewer({
container: document.querySelector('#viewer'),
- panorama:'/api/Objects/PlanPlatform/'+ fetchUrl,
+ panorama:'/api/Objects/PlanPlatform/'+ this.fetchUrl,
});
})
}else{
- this.showtype=0
- this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
+ this.lookWord()
+ }
+ }else{
+ this.organizationName=item.organizationName
+ this.getPlanData()
+ //this.src=`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`
+ //this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
+ //window.open(`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`)
+ }
+
+
+ })
+
+ if(e.checked){
+ this.shenheTable.push(item)
+ }
+ else{
+ for(var i=0;i
{
filename=data.fileName
let json={
doc: {
- docId: item.id,
+ docId: this.id,
title: filename,
//title: filename,
- fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
+ fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+this.fetchUrl
},
user: {
uid: "test",
@@ -191,29 +230,57 @@ export class WaitExamineerComponent implements OnInit {
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
//window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
})
- }
- }else{
- this.showtype=2
- this.src=`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`
- this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
- //window.open(`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`)
- }
-
-
- })
-
- if(e.checked){
- this.shenheTable.push(item)
+ }
+ getPlanData () {
+ let header = {
+ CompanyName: this.companyName || '',
+ //AuditStatus: this.id || '',
+ PageSize: '100',
}
- else{
- for(var i=0;i{
+ data.items.forEach(element => {
+ /* if (element.id===this.id) {
+
+ } */
+ this.planData = element
+ this.organizationName = element.committerOrganizationName
+ this.handleData()
+ return
+ });
+ })
+ }
+
+ //查看二维三维预案
+ thirdPartyURL
+ planType
+ handleData () {
+ this.planType = this.planData.planMode
+ let data = this.planData
+ console.log(this.planData)
+ if (this.planData.planMode==0) { //预案planMode=0时, 查看word
+ //this.lookWord()
+ } else if (this.planData.planMode==1) { //预案planMode=1时, 解析文档
+
+ } else if (this.planData.planMode==2) { //预案planMode=2时, 跳查看页面组件
+ sessionStorage.setItem("buildingTypeId", this.compantData.buildingTypes.length? this.compantData.buildingTypes[0].id: undefined);
+ sessionStorage.setItem("companyId",this.companyId);
+ sessionStorage.setItem("planId",this.id);
+ sessionStorage.setItem("editable",'0');
+ } else if (this.planData.planMode==3) { //预案planMode=3时, 第三方网址
+ this.showtype=2
+ this.http.get(`/api/Plans/${data.companyId}`).subscribe((data:any)=>{
+ data && data.company? this.compantData = data.company : null
+ })
+ //this.dialog.open(show3D,{width:'1350px',height:'700px',data:{url:data.url}}); //打开图片弹窗
+ this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(data.url)
}
- /* this.chuorzhong=item.verifyState
- this.radioid=item.itemId */
+
+ }
+
+ //打开三维预案弹窗
+ oopen3Dshow(){
+ this.dialog.open(show3D,{width:'1550px',height:'850px',data:{url:this.thirdPartyURL}});
}
//变更数据和全部数据切换按钮
buttonChange(){
@@ -441,3 +508,17 @@ export class WaitExamineerComponent implements OnInit {
}
}
+
+@Component({
+ selector: 'app-wait-examineer-show3D',
+ templateUrl: './show3D.html',
+ styleUrls: ['./wait-examineer.component.scss']
+})
+export class show3D{
+ constructor(private sanitizer: DomSanitizer,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public dialog: MatDialog) {}
+ ngOnInit(): void {
+ console.log(this.data.url.changingThisBreaksApplicationSecurity)
+ this.threedUrl=this.sanitizer.bypassSecurityTrustResourceUrl(this.data.url.changingThisBreaksApplicationSecurity)
+ }
+ threedUrl
+}
\ No newline at end of file
diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
index 3a8e0dc..0c01465 100644
--- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
+++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
@@ -115,34 +115,35 @@ export class EntryPlanLookComponent implements OnInit {
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
- let fetchUrl=e.attachmentUrls[0]
- this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
- filename=data.fileName
- let json={
- doc: {
- docId: e.id,
- title: filename,
- //title: filename,
- fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
- },
- user: {
- uid: "test",
- nickName: "test",
- avatar: "",
- privilege: [
- 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
- ],
- },
- }
- var stringjson=JSON.stringify(json)
- var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
- var base64 = CryptoJS.enc.Base64.stringify(wordArray);
-
- //let base64Date=this.BASE64.encode(stringjson)
- //let filedata= CryptoJS.enc.Base64.stringify(json)
- console.log(base64)
- window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
- })
+ let fetchUrl = e.attachmentUrls[0]
+ let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
+ let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
+ let jwt = sessionStorage.getItem("token");
+ let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
+ let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
+ let identityJsonparse=JSON.parse(identityJson)
+ this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
+ filename=data.fileName
+ let json={
+ doc: {
+ docId: docId,
+ title: filename,
+ fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
+ },
+ user: {
+ uid: identityJsonparse.sub,
+ nickName: identityJsonparse.name,
+ avatar: "",
+ privilege: [
+ 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
+ ],
+ },
+ }
+ var stringjson=JSON.stringify(json)
+ var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
+ var base64 = CryptoJS.enc.Base64.stringify(wordArray);
+ window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
+ })
}
}
if(e.planMode == 1){
diff --git a/src/app/plan-management/meet-plan/meet-plan.component.ts b/src/app/plan-management/meet-plan/meet-plan.component.ts
index 2b09d4b..c8b0e74 100644
--- a/src/app/plan-management/meet-plan/meet-plan.component.ts
+++ b/src/app/plan-management/meet-plan/meet-plan.component.ts
@@ -165,20 +165,26 @@ export class MeetPlanComponent implements OnInit {
//查看预案
openPlan(element){
+ //fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
let filename:string
let fetchUrl = element.attachmentUrls[0]
+ let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
+ let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
+ let jwt = sessionStorage.getItem("token");
+ let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
+ let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
+ let identityJsonparse=JSON.parse(identityJson)
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
filename=data.fileName
let json={
doc: {
- docId: element.id,
+ docId: docId,
title: filename,
- //title: filename,
- fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
+ fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
},
user: {
- uid: "test",
- nickName: "test",
+ uid: identityJsonparse.sub,
+ nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
diff --git a/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts b/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts
index 3e8d977..a55c5f8 100644
--- a/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts
+++ b/src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts
@@ -4,7 +4,7 @@
* @Author: sueRimn
* @Date: 2020-12-24 14:15:10
* @LastEditors: sueRimn
- * @LastEditTime: 2021-01-29 15:42:53
+ * @LastEditTime: 2021-02-04 10:01:46
*/
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@@ -191,34 +191,35 @@ export class OnetwoEntryPlanComponent implements OnInit {
//查看预案
openPlan(element){
let filename:string
- let fetchUrl=element.attachmentUrls[0]
- this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
- filename=data.fileName
- let json={
- doc: {
- docId: element.id,
- title: filename,
- //title: filename,
- fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
- },
- user: {
- uid: "test",
- nickName: "test",
- avatar: "",
- privilege: [
- 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
- ],
- },
- }
- var stringjson=JSON.stringify(json)
- var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
- var base64 = CryptoJS.enc.Base64.stringify(wordArray);
-
- //let base64Date=this.BASE64.encode(stringjson)
- //let filedata= CryptoJS.enc.Base64.stringify(json)
- console.log(base64)
- window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
- })
+ let fetchUrl = element.attachmentUrls[0]
+ let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
+ let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
+ let jwt = sessionStorage.getItem("token");
+ let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
+ let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
+ let identityJsonparse=JSON.parse(identityJson)
+ this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
+ filename=data.fileName
+ let json={
+ doc: {
+ docId: docId,
+ title: filename,
+ fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
+ },
+ user: {
+ uid: identityJsonparse.sub,
+ nickName: identityJsonparse.name,
+ avatar: "",
+ privilege: [
+ 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
+ ],
+ },
+ }
+ var stringjson=JSON.stringify(json)
+ var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
+ var base64 = CryptoJS.enc.Base64.stringify(wordArray);
+ window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
+ })
}
diff --git a/src/app/plan-management/type-plan/type-plan.component.ts b/src/app/plan-management/type-plan/type-plan.component.ts
index 0174bf0..12b36b7 100644
--- a/src/app/plan-management/type-plan/type-plan.component.ts
+++ b/src/app/plan-management/type-plan/type-plan.component.ts
@@ -4,7 +4,7 @@
* @Author: sueRimn
* @Date: 2021-01-06 09:47:43
* @LastEditors: sueRimn
- * @LastEditTime: 2021-01-29 15:42:14
+ * @LastEditTime: 2021-02-04 10:40:16
*/
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@@ -175,34 +175,35 @@ export class TypePlanComponent implements OnInit {
//查看预案
openPlan(element){
let filename:string
- let fetchUrl=element.attachmentUrls[0]
- this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
- filename=data.fileName
- let json={
- doc: {
- docId: element.id,
- title: filename,
- //title: filename,
- fetchUrl: `http://${location.host}/api/Objects/PlanPlatform/`+fetchUrl
- },
- user: {
- uid: "test",
- nickName: "test",
- avatar: "",
- privilege: [
- 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
- ],
- },
- }
- var stringjson=JSON.stringify(json)
- var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
- var base64 = CryptoJS.enc.Base64.stringify(wordArray);
-
- //let base64Date=this.BASE64.encode(stringjson)
- //let filedata= CryptoJS.enc.Base64.stringify(json)
- console.log(base64)
- window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
- })
+ let fetchUrl = element.attachmentUrls[0]
+ let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
+ let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
+ let jwt = sessionStorage.getItem("token");
+ let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
+ let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
+ let identityJsonparse=JSON.parse(identityJson)
+ this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
+ filename=data.fileName
+ let json={
+ doc: {
+ docId: docId,
+ title: filename,
+ fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
+ },
+ user: {
+ uid: identityJsonparse.sub,
+ nickName: identityJsonparse.name,
+ avatar: "",
+ privilege: [
+ 'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
+ ],
+ },
+ }
+ var stringjson=JSON.stringify(json)
+ var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
+ var base64 = CryptoJS.enc.Base64.stringify(wordArray);
+ window.open(`http://121.5.10.84/apps/editor/openPreview?data=${base64}`)
+ })
}
diff --git a/src/app/working-area/model/axSelection.ts b/src/app/working-area/model/axSelection.ts
index f075523..4089480 100644
--- a/src/app/working-area/model/axSelection.ts
+++ b/src/app/working-area/model/axSelection.ts
@@ -1,4 +1,3 @@
-import { allowedNodeEnvironmentFlags } from "process";
/**
* 选择器
diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts
index da4a16a..0f47f43 100644
--- a/src/app/working-area/working-area.component.ts
+++ b/src/app/working-area/working-area.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, ElementRef, ViewChild, AfterViewInit, Input } from '@angular/core';
+import { Component, OnInit, ElementRef, ViewChild, AfterViewInit, Input, OnDestroy } from '@angular/core';
import * as PIXI from 'pixi.js';
import { EventEmitter } from 'events';
import { EventManager } from '@angular/platform-browser';
@@ -32,10 +32,11 @@ import { EVENT_SELECTION_CHANGED } from './model/events';
/**
* 工作区
*/
-export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterViewInit {
+export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterViewInit,OnDestroy {
constructor(private eventManager: EventManager, public canvasData: CanvasShareDataService) {
super();
+ console.log('组件构造函数');
}
@ViewChild('content')
@@ -87,7 +88,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/**
* 选择器
*/
- public readonly selection: AxSelection = new AxSelection();
+ public selection: AxSelection = new AxSelection();
/**
* 当前鼠标的点
*/
@@ -157,32 +158,30 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。
* Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。
*/
- public VERSION = '1.0.15.20210202_beta';
+ public VERSION = '1.0.17.20210204_beta';
/**
* 数据初始化
*/
ngOnInit(): void {
+ console.log('组件OnInit');
PIXI.utils.skipHello();
this.sayHello();
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => {
- // event.stopPropagation();
- // if (event.keyCode === 17) {
- // this.isCtrlKeyClicked = true;
- // }
+
});
this.eventManager.addGlobalEventListener('window', 'keyup', (event: any) => {
- // event.stopPropagation();
- // if (event.keyCode === 17) {
- // this.isCtrlKeyClicked = false;
- // this.rectToolGraphics.visible = false;
- // this.rectToolGraphics.clear();
- // }
// 按Del键删除选中的图标
if (event.keyCode === 46) {
this.deleteSelectedShape();
}
});
}
+ ngOnDestroy(): void {
+ console.log('组件OnDestroy');
+ this.selection.clear();
+ this.camera2D.destroy();
+ this.app.destroy();
+ }
public setMulitSelect(b: boolean) {
if (b) {
@@ -348,7 +347,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
worldHeight: 20000,
interaction: this.app.renderer.plugins.interaction,
});
-
+ this.camera2D.pivot.set(0.5);
+ this.camera2D.position = new PIXI.Point(0, 0);
this.app.stage.addChild(this.camera2D);
this.camera2D
@@ -455,7 +455,43 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.grid2D.updateGrid();
this.resizeItem(1 / this.camera2D.scale.x);
}
+ /**
+ * 重置相机
+ */
+ private resetCamera2D() {
+ this.camera2D.scale.set(1);
+ this.camera2D.x = (this.app.view.width - this.backgroundImage.width) / 2;
+ this.camera2D.y = (this.app.view.height - this.backgroundImage.height) / 2;
+ this.updateCamera2D();
+ }
+ /**
+ * 缩放适应
+ */
+ public zoomFit() {
+ const imageWidth = this.backgroundImage.texture.width;
+ const imageHeight = this.backgroundImage.texture.height;
+ const appWidth = this.app.view.width - 470;
+ const appHeight = this.app.view.height;
+ const wScale = appWidth / imageWidth;
+ const hScale = appHeight / imageHeight;
+ let scale = wScale < hScale ? wScale : hScale;
+ if (scale < 0.12) {
+ scale = 0.12;
+ }
+ if (scale > 16) {
+ scale = 16;
+ }
+ this.camera2D.scale.set(scale);
+ if (wScale < hScale) {
+ this.camera2D.x = 470 / 2;
+ this.camera2D.y = (appHeight - (imageHeight * this.camera2D.scale.y)) / 2;
+ } else {
+ this.camera2D.x = 470 / 2 + (appWidth - (imageWidth * this.camera2D.scale.x)) / 2;
+ this.camera2D.y = 0;
+ }
+ this.updateCamera2D();
+ }
/**
* 创建2D网格
*/
@@ -502,11 +538,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* 创建图标事件(数据处理)
*/
this.on('createIcon', (axShape: AxShape) => {
- console.log('新增图标:' + axShape.assetData.Name);
if (axShape.assetData.GameMode === GameMode.BasicInformation) { // 基本信息
// 添加楼层数据
this.canvasData.originaleveryStoreyData.data[axShape.assetData.Id] = axShape.assetData;
- console.log(this.canvasData.originaleveryStoreyData);
// 添加建筑数据
this.canvasData.originalcompanyBuildingData.data[axShape.assetData.Id] = axShape.assetData;
} else if (axShape.assetData.GameMode === GameMode.Assignment) { // 处置预案
@@ -535,28 +569,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
}
this.emit('canvasDataChanged');
this.canvasData.isChange = true;
+ this.updateCamera2D();
});
- // ///
- // this.app.renderer.plugins.interaction.on('pointerdown', (event) => {
- // if (event.data.button !== 2) { return };
- // this.dragFlag = true;
- // this.startPoint = { x: event.data.global.x, y: event.data.global.y };
- // });
- // this.app.renderer.plugins.interaction.on('pointermove', (event) => {
- // if (this.dragFlag) {
- // const dx = event.data.global.x - this.startPoint.x;
- // const dy = event.data.global.y - this.startPoint.y;
- // this.app.stage.position.x += dx;
- // this.app.stage.position.y += dy;
- // this.startPoint = { x: event.data.global.x, y: event.data.global.y };
- // }
- // });
- // this.app.renderer.plugins.interaction.on('pointerup', (event) => {
- // this.dragFlag = false;
- // });
}
- // dragFlag;
- // startPoint;
/**
* 重置画布
*/
@@ -587,7 +602,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*/
public refreshIcon(id: string): void {
const icon = this.backgroundImage.children.find(item => item.name === id);
- // console.log(icon);
if (icon instanceof AxImageShape) {
icon.refresh();
} else if (icon instanceof MultipointIcon) {
@@ -705,28 +719,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
public createBackgroundImage() {
this.backgroundImage = PIXI.Sprite.from('assets/images/noImg.png');
this.backgroundImage.anchor.set(0.5);
- // this.backgroundImage.x = this.app.view.width / 2;
- // this.backgroundImage.y = this.app.view.height / 2;
this.backgroundImage.interactive = true;
this.backgroundImage.name = 'background';
- // this.backgroundImage.angle = this.canvasData.selectStorey.imageAngle;
- // const imageWidth = 665;
- // const imageHeight = 530;
- // const appWidth = this.app.view.width - 470;
- // const appHeight = this.app.view.height;
-
- // const wScale = appWidth / imageWidth;
- // const hScale = appHeight / imageHeight;
-
- // const scale = wScale < hScale
- // ? wScale
- // : hScale;
- // this.backgroundImage.scale.set(scale);
this.backgroundImage.sortableChildren = true;
this.backgroundImage
.on('pointerdown', event => {
if (event.data.button !== 0) { return; }
- // console.log(this.backgroundImage.toLocal(this.mousePosition));
if (this.isCtrlKeyClicked === false) {
switch (this.paintMode) {
case PaintMode.endPaint:
@@ -926,47 +924,14 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
// }
})
.on('pointerup', event => {
- // event.currentTarget.data = null;
- // if (this.rectToolGraphics.visible === true) {
- // const shapes: AxShape[] = [];
- // this.backgroundImage.children.forEach(item => {
- // if ( item instanceof AxShape
- // && item instanceof AxPreviewImageShape === false) {
- // // 判断2个矩形是否相交
- // const rect1 = this.rectToolGraphics.getBounds();
- // const rect2 = item.getBounds();
- // if (this.isOverlap(rect1, rect2)) {
- // shapes.push(item);
- // }
- // }
- // });
- // this.rectToolGraphics.clear();
- // this.rectToolGraphics.visible = false;
- // this.selectAll(shapes);
- // }
})
.on('pointerupoutside', event => {
- // if (this.isMove) {
- // event.currentTarget.data = null;
- // }
+
})
.on('pointermove', event => {
- // if (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 (this.isCtrlKeyClicked === true) {
- // if (this.rectToolGraphics.visible === true) {
- // this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition);
- // }
- // }
+
})
- // .on('rightclick', event => {
- // event.stopPropagation();
- // this.deselectAll();
- // this.setPaintMode(PaintMode.endPaint);
- // })
.on('pointerover', (event) => {
if (this.previewImage !== null
&& this.paintMode === PaintMode.singlePointIcon) {
@@ -987,6 +952,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.backgroundImage.addChild(this.paintingLine);
}
+ /**
+ * 判断矩形一是否包含矩形二
+ * @param rect1 矩形一
+ * @param rect2 矩形二
+ */
public isOverlap(rect1, rect2): boolean {
const l1 = { x: rect1.x, y: rect1.y };
const r1 = { x: rect1.x + rect1.width, y: rect1.y + rect1.height };
@@ -1009,44 +979,21 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
imageAngle = 0;
}
this.backgroundImage.scale.set(1);
- this.backgroundImage.pivot.set(0);
- // this.backgroundImage.x = this.app.view.width / 2;
- // this.backgroundImage.y = this.app.view.height / 2;
if (imageUrl === undefined || imageUrl === null || imageUrl === '') {
this.backgroundImage.texture = this.backgroundTexture;
} else {
this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl);
- console.log(imageUrl);
}
- this.backgroundImage.x = this.backgroundImage.width/2;
- this.backgroundImage.y = this.backgroundImage.height/2;
+ this.backgroundImage.x = this.backgroundImage.width / 2;
+ this.backgroundImage.y = this.backgroundImage.height / 2;
this.backgroundImage.angle = imageAngle;
- // 等待图片加载完成
- const imageWidth = this.backgroundImage.texture.width;
- const imageHeight = this.backgroundImage.texture.height;
- const appWidth = this.app.view.width - 470;
- const appHeight = this.app.view.height;
- const wScale = appWidth / imageWidth;
- const hScale = appHeight / imageHeight;
- let scale = wScale < hScale ? wScale : hScale;
- if (scale < 0.12) {
- scale = 0.12;
- }
- if (scale > 16) {
- scale = 16;
- }
- this.camera2D.scale.set(scale);
- this.camera2D.x = 235;
- this.camera2D.y = 0;
- // 设置图片缩放
- // this.backgroundImage.scale.set(scale);
- // this.backgroundImage.visible = true;
- this.backgroundImage.children.forEach((item) => {
- if (item instanceof AxShape) {
- item.refresh();
- }
- });
+ this.resetCamera2D();
+ // this.backgroundImage.children.forEach((item) => {
+ // if (item instanceof AxShape) {
+ // item.refresh();
+ // }
+ // });
}
/**
* 刷新
@@ -1246,7 +1193,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* 开始绘制
*/
public beginPaint() {
- console.log(this.canvasData.selectTemplateData);
this.deselectAll();
this.setPaintMode(PaintMode.endPaint);
this.setPaintMode(this.canvasData.selectTemplateData.interactiveMode);
@@ -1338,7 +1284,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
private enterPaint(): void {
this.previewLineSegment.visible = false;
this.enterPaintEndButton.visible = false;
- console.log(this.paintMode);
switch (this.paintMode) {
case PaintMode.singlePointIcon:
break;