|
@@ -1,9 +1,10 @@
|
|
|
|
|
|
import { SRect, SSize, SPoint } from "@sybotan-web/base";
|
|
|
-import SGraphyPolygonItem from './newItems/SGraphyPolygonItem.js'
|
|
|
+import SGraphyPolygonItem from './newItems/SGraphyPolygonItem.js'
|
|
|
+import SGraphyImgItem from './newItems/SGraphyImgItem.js'
|
|
|
import { SGraphyScene, SMouseEvent } from "@sybotan-web/graphy";
|
|
|
import { SPen, SPainter, SColor } from "@sybotan-web/draw";
|
|
|
-import { dataItemPath, dataItem, dataSpaceItem, dataInterface, PolygonItemInterface } from './dataType' //传入参数的参数接口类型
|
|
|
+import { dataItemPath, dataItem, dataSpaceItem, dataInterface, PolygonItemInterface, ImgItemInterface } from './dataType' //传入参数的参数接口类型
|
|
|
import Axios from 'axios';
|
|
|
import pako from "./until/pako.js"
|
|
|
import tools from "./until/tool.js"
|
|
@@ -77,26 +78,26 @@ export default class mainScene extends SGraphyScene {
|
|
|
// contentType: "charset=utf-8"
|
|
|
}).then(res => {
|
|
|
var blob = res.data;
|
|
|
- this.zipToJson(blob).then((jsonData:any)=>{
|
|
|
+ this.zipToJson(blob).then((jsonData: any) => {
|
|
|
that.addAllItemList(jsonData)
|
|
|
relove()
|
|
|
- }).catch((error:any)=>{
|
|
|
+ }).catch((error: any) => {
|
|
|
console.log(error)
|
|
|
});
|
|
|
// console.log(reader)
|
|
|
- }).catch(res=>{
|
|
|
+ }).catch(res => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
}
|
|
|
// 压缩包变为json格式数据
|
|
|
- zipToJson(blob:any):any{
|
|
|
- let data = null;
|
|
|
- var reader = new FileReader();
|
|
|
- reader.readAsBinaryString(blob);
|
|
|
- let _this = this;
|
|
|
- return new Promise((resolve)=>{
|
|
|
+ zipToJson(blob: any): any {
|
|
|
+ let data = null;
|
|
|
+ var reader = new FileReader();
|
|
|
+ reader.readAsBinaryString(blob);
|
|
|
+ let _this = this;
|
|
|
+ return new Promise((resolve) => {
|
|
|
reader.onload = function (readerEvt: any) {
|
|
|
var binaryString = readerEvt.target.result;
|
|
|
//解压数据
|
|
@@ -120,7 +121,7 @@ export default class mainScene extends SGraphyScene {
|
|
|
}
|
|
|
resolve(data)
|
|
|
};
|
|
|
- })
|
|
|
+ })
|
|
|
}
|
|
|
// 以下是绘制方法
|
|
|
|
|
@@ -132,6 +133,8 @@ export default class mainScene extends SGraphyScene {
|
|
|
// let wall:
|
|
|
this.addSpaceList(space) //绘制空间
|
|
|
this.addWallList() //绘制墙
|
|
|
+ let images: ImgItemInterface[] = data.images
|
|
|
+ this.addImageList(images)
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -146,7 +149,7 @@ export default class mainScene extends SGraphyScene {
|
|
|
{
|
|
|
parent: null,
|
|
|
space: space[i],
|
|
|
- businessType:'space'
|
|
|
+ businessType: 'space'
|
|
|
}));
|
|
|
}
|
|
|
}
|
|
@@ -156,7 +159,7 @@ export default class mainScene extends SGraphyScene {
|
|
|
{
|
|
|
parent: null,
|
|
|
space: space[i],
|
|
|
- businessType:'space'
|
|
|
+ businessType: 'space'
|
|
|
}));
|
|
|
}
|
|
|
}
|
|
@@ -175,6 +178,14 @@ export default class mainScene extends SGraphyScene {
|
|
|
// 绘制虚拟墙
|
|
|
addVrtualWallList(): void {
|
|
|
}
|
|
|
+ // 绘制图片
|
|
|
+ addImageList(imageList: ImgItemInterface[]): void {
|
|
|
+ if (imageList && imageList.length) {
|
|
|
+ imageList.map(t => {
|
|
|
+ this.addItem(new SGraphyImgItem(null, t.X, t.Y, t.width, t.height))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 产生item实例
|
|
|
*/
|