|
@@ -92,58 +92,16 @@ export default {
|
|
|
},
|
|
|
//下载json文件
|
|
|
getJson(jsonId) {
|
|
|
- axios({
|
|
|
- method: 'get',
|
|
|
- url: "/image-service/common/file_get/" + jsonId + "?systemId=revit",
|
|
|
- data: {},
|
|
|
- responseType: 'blob'
|
|
|
- }).then(res => {
|
|
|
- let data = null
|
|
|
- var blob = res.data;
|
|
|
- var reader = new FileReader();
|
|
|
- reader.readAsBinaryString(blob)
|
|
|
- let _this = this
|
|
|
- reader.onload = function (readerEvt) {
|
|
|
- var binaryString = readerEvt.target.result;
|
|
|
- let base64Data = btoa(binaryString)
|
|
|
- let unGzipData = pako.unzip(base64Data)
|
|
|
- data = unGzipData
|
|
|
- _this.dataMax = tools.getPoint(data);
|
|
|
- if (data.WallList && data.WallList.length) {
|
|
|
- tools.changeMap(data.WallList, -1, "PointList");
|
|
|
- }
|
|
|
- if (data.SpaceList && data.SpaceList.length) {
|
|
|
- tools.changeMap(data.SpaceList, -1, "Paths");
|
|
|
- }
|
|
|
- if (data.ColumnList && data.ColumnList.length) {
|
|
|
- tools.changeMap(data.ColumnList, -1, "Path");
|
|
|
- }
|
|
|
- if (data.VirtualWallList && data.VirtualWallList.length) {
|
|
|
- tools.changeMap(data.VirtualWallList, -1, "PointList");
|
|
|
- }
|
|
|
- if (data.EquipmentList && data.EquipmentList.length) {
|
|
|
- tools.changeMap(data.EquipmentList, -1, "PointList");
|
|
|
- }
|
|
|
- let ids = [];
|
|
|
- if (data.SpaceList && data.SpaceList.length) {
|
|
|
- data.SpaceList.map(items => {
|
|
|
- items.BimId = _this.buildMess.code + ":" + items.BimId;
|
|
|
- ids.push(items.BimId);
|
|
|
- });
|
|
|
- } else {
|
|
|
- _this.$message("没有元空间数据")
|
|
|
- }
|
|
|
- if (ids.length) {
|
|
|
- _this.bimIdToId(ids, data);
|
|
|
- } else {
|
|
|
- _this.$message("没有元空间数据")
|
|
|
- _this.type = 2
|
|
|
- if (!!this.view && !!this.view.scene) {
|
|
|
- this.view.scene.root.children = [];
|
|
|
- this.view = null;
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
+ let url = `/image-service/common/file_get/${jsonId}?systemId=revit`
|
|
|
+ this.mainScene = null;
|
|
|
+ // 初始化view类
|
|
|
+ this.view = new SGraphyView("canvas");
|
|
|
+ this.mainScene = new mainScene(null);
|
|
|
+ this.mainScene.urlGetData(url).then(() => {
|
|
|
+ this.view.scene = this.mainScene;
|
|
|
+ this.mainScene.addImageList(this.list)
|
|
|
+ this.view.fitSceneToView();
|
|
|
+ this.initGraphy()
|
|
|
});
|
|
|
},
|
|
|
//画点位坐标
|
|
@@ -180,31 +138,6 @@ export default {
|
|
|
delete this.point.FloorId
|
|
|
this.updatePoint()
|
|
|
},
|
|
|
- bimIdToId(ids, data) {
|
|
|
- formBIMToPri({
|
|
|
- type: ["Si"],
|
|
|
- ids: ids,
|
|
|
- ProjId: this.param.ProjId,
|
|
|
- secret: this.param.secret
|
|
|
- }).then(res => {
|
|
|
- if (res.data.Result == "success") {
|
|
|
- data.SpaceList.map((item, index) => {
|
|
|
- res.data.Content.map((i, li) => {
|
|
|
- //判断bimId是否相同
|
|
|
- if (item.BimId == i.infos.BIMID) {
|
|
|
- item.id = i.id;
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- this.createCanvas();
|
|
|
- this.initGraphy(data);
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.ResultMsg);
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error("请求出错");
|
|
|
- });
|
|
|
- },
|
|
|
//创建实例
|
|
|
createCanvas() {
|
|
|
if (this.view.scene) {
|
|
@@ -216,17 +149,11 @@ export default {
|
|
|
//实例化视图
|
|
|
initGraphy(data) {
|
|
|
this.resetSize();
|
|
|
- this.$nextTick(() => {
|
|
|
- data.images = this.list;
|
|
|
- this.mainScene = new mainScene(data);
|
|
|
- this.view.scene = this.mainScene;
|
|
|
- this.view.fitSceneToView();
|
|
|
- this.mainScene.click(this, this.setNewFlag)
|
|
|
- let items = this.mainScene.root.children;
|
|
|
- items.map((t, i) => {
|
|
|
- this.drawText(t)
|
|
|
- this.applyColor(t, i)
|
|
|
- })
|
|
|
+ this.mainScene.click(this, this.setNewFlag)
|
|
|
+ let items = this.mainScene.root.children;
|
|
|
+ items.map((t, i) => {
|
|
|
+ this.drawText(t)
|
|
|
+ this.applyColor(t, i)
|
|
|
})
|
|
|
},
|
|
|
//初始化canvas大小
|
|
@@ -260,9 +187,7 @@ export default {
|
|
|
},
|
|
|
//分配随机颜色
|
|
|
applyColor(t, i) {
|
|
|
- if (t.isBusiness == 2) {
|
|
|
- t.fillColor = new SColor(colorArr[i % 10]);
|
|
|
- }
|
|
|
+ t.fillColor = new SColor(colorArr[i % 10]);
|
|
|
},
|
|
|
// 定位
|
|
|
locationGraphy(point) {
|
|
@@ -340,9 +265,10 @@ export default {
|
|
|
},
|
|
|
//插旗 item - 点击的空间item
|
|
|
setNewFlag(item, event) {
|
|
|
+ console.log(event)
|
|
|
if (this.setFlag) {
|
|
|
- if (item.isBusiness) {
|
|
|
- this.view.scene.addImgList([{
|
|
|
+ if (item.businessType=='space') {
|
|
|
+ this.mainScene.addImageList([{
|
|
|
img: this.imageUrl,
|
|
|
X: event[0].x,
|
|
|
Y: event[0].y,
|