|
@@ -302,12 +302,6 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 清空绘制业务空间
|
|
|
|
- clearZoneCanvas() {
|
|
|
|
- this.zoneList.map(t => {
|
|
|
|
- this.scene.removeItem(t);
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
// 获取当前分区下的业务空间
|
|
// 获取当前分区下的业务空间
|
|
getBusinessSpace() {
|
|
getBusinessSpace() {
|
|
this.canvasLoading = true
|
|
this.canvasLoading = true
|
|
@@ -341,8 +335,7 @@ export default {
|
|
Color: colorArr[i % colorArr.length],
|
|
Color: colorArr[i % colorArr.length],
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- this.clearZoneCanvas();
|
|
|
|
- this.scene.zoneList = [];
|
|
|
|
|
|
+ this.scene.removeAllZone();
|
|
this.scene.addZoneList(tempArr);
|
|
this.scene.addZoneList(tempArr);
|
|
this.scene.click(this, this.canvasClick);
|
|
this.scene.click(this, this.canvasClick);
|
|
this.zoneList = this.scene.zoneList;
|
|
this.zoneList = this.scene.zoneList;
|
|
@@ -486,13 +479,15 @@ export default {
|
|
let selectSpaces = this.scene.getSelectedSpaces();
|
|
let selectSpaces = this.scene.getSelectedSpaces();
|
|
selectSpaces.map(t => {
|
|
selectSpaces.map(t => {
|
|
zoneObj.Outline.push(t.data.OutLine);
|
|
zoneObj.Outline.push(t.data.OutLine);
|
|
- IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
|
|
+ if (this.BIMIDToSID[t.data.SourceId]) {
|
|
|
|
+ IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
+ }
|
|
if (t.data.Height && (zoneObj.Height == 0 || t.data.Height < zoneObj.Height)) {
|
|
if (t.data.Height && (zoneObj.Height == 0 || t.data.Height < zoneObj.Height)) {
|
|
zoneObj.Height = t.data.Height;
|
|
zoneObj.Height = t.data.Height;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
// 如果有划分,求交集
|
|
// 如果有划分,求交集
|
|
- if (this.scene.cutItem) {
|
|
|
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
zoneObj.Outline = [];
|
|
zoneObj.Outline = [];
|
|
let arr = this.scene.getIntersect();
|
|
let arr = this.scene.getIntersect();
|
|
arr.map(t => {
|
|
arr.map(t => {
|
|
@@ -506,6 +501,9 @@ export default {
|
|
zoneObj.Outline.push([temp]);
|
|
zoneObj.Outline.push([temp]);
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ if (!zoneObj.Outline.length) {
|
|
|
|
+ zoneObj.Outline = null;
|
|
|
|
+ }
|
|
zoneObj.RoomLocalName = val;
|
|
zoneObj.RoomLocalName = val;
|
|
zoneObj.BuildingId = this.buildFloor[0];
|
|
zoneObj.BuildingId = this.buildFloor[0];
|
|
zoneObj.FloorId = this.buildFloor[1];
|
|
zoneObj.FloorId = this.buildFloor[1];
|
|
@@ -518,7 +516,9 @@ export default {
|
|
let arr = this.scene.getSelectedSpaces(), IspaceIdList = [];
|
|
let arr = this.scene.getSelectedSpaces(), IspaceIdList = [];
|
|
arr.map(t => {
|
|
arr.map(t => {
|
|
BSP.Outline.push(t.data.OutLine);
|
|
BSP.Outline.push(t.data.OutLine);
|
|
- IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
|
|
+ if (this.BIMIDToSID[t.data.SourceId]) {
|
|
|
|
+ IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
+ }
|
|
if (t.Height && (BSP.Height == 0 || t.Height < BSP.Height)) {
|
|
if (t.Height && (BSP.Height == 0 || t.Height < BSP.Height)) {
|
|
BSP.Height = t.Height;
|
|
BSP.Height = t.Height;
|
|
}
|
|
}
|
|
@@ -556,7 +556,9 @@ export default {
|
|
// 空间
|
|
// 空间
|
|
selectSpace.map(t => {
|
|
selectSpace.map(t => {
|
|
zoneObj.Outline.push(t.data.OutLine);
|
|
zoneObj.Outline.push(t.data.OutLine);
|
|
- IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
|
|
+ if (this.BIMIDToSID[t.data.SourceId]) {
|
|
|
|
+ IspaceIdList.push(this.BIMIDToSID[t.data.SourceId]);
|
|
|
|
+ }
|
|
if (t.Height && (zoneObj.Height == 0 || t.Height < zoneObj.Height)) {
|
|
if (t.Height && (zoneObj.Height == 0 || t.Height < zoneObj.Height)) {
|
|
zoneObj.Height = t.Height;
|
|
zoneObj.Height = t.Height;
|
|
}
|
|
}
|
|
@@ -566,7 +568,7 @@ export default {
|
|
zoneObj.Outline.push(t.data);
|
|
zoneObj.Outline.push(t.data);
|
|
})
|
|
})
|
|
// 如果有划分,求交集
|
|
// 如果有划分,求交集
|
|
- if (this.scene.cutItem) {
|
|
|
|
|
|
+ if (this.scene.cutItem || this.scene.sceneMark) {
|
|
zoneObj.Outline = [];
|
|
zoneObj.Outline = [];
|
|
let spaceIntersect = this.scene.getIntersect();
|
|
let spaceIntersect = this.scene.getIntersect();
|
|
spaceIntersect.map(t => {
|
|
spaceIntersect.map(t => {
|
|
@@ -644,6 +646,10 @@ export default {
|
|
},
|
|
},
|
|
// 批量创建
|
|
// 批量创建
|
|
groupCreateBSP(spaces) {
|
|
groupCreateBSP(spaces) {
|
|
|
|
+ spaces = spaces.map(t => {
|
|
|
|
+ t.BIMLocation = this.getAverageVal(t.Outline);
|
|
|
|
+ return t;
|
|
|
|
+ })
|
|
let pa = {
|
|
let pa = {
|
|
zone: this.tab.code,
|
|
zone: this.tab.code,
|
|
data: {
|
|
data: {
|
|
@@ -664,6 +670,7 @@ export default {
|
|
},
|
|
},
|
|
// 单个创建
|
|
// 单个创建
|
|
createSingleBSP(space, IspaceIdList) {
|
|
createSingleBSP(space, IspaceIdList) {
|
|
|
|
+ space.BIMLocation = space.Outline ? this.getAverageVal(space.Outline) : null;
|
|
let pa = {
|
|
let pa = {
|
|
zone: this.tab.code,
|
|
zone: this.tab.code,
|
|
data: {
|
|
data: {
|
|
@@ -676,11 +683,12 @@ export default {
|
|
},
|
|
},
|
|
// 更新业务空间区域
|
|
// 更新业务空间区域
|
|
updateBSPOutline(zoneObj, IspaceIdList) {
|
|
updateBSPOutline(zoneObj, IspaceIdList) {
|
|
|
|
+ zoneObj.BIMLocation = zoneObj.Outline ? this.getAverageVal(zoneObj.Outline) : null;
|
|
let pa = {
|
|
let pa = {
|
|
zone: this.tab.code,
|
|
zone: this.tab.code,
|
|
data: {
|
|
data: {
|
|
Content: [zoneObj],
|
|
Content: [zoneObj],
|
|
- Projection: ['Outline']
|
|
|
|
|
|
+ Projection: ['Outline', 'BIMLocation']
|
|
},
|
|
},
|
|
}
|
|
}
|
|
updateZone(pa, res => {
|
|
updateZone(pa, res => {
|
|
@@ -699,6 +707,24 @@ export default {
|
|
this.num = res.Count;
|
|
this.num = res.Count;
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 计算平均值 作为业务空间BIMLocation
|
|
|
|
+ getAverageVal(Outline) {
|
|
|
|
+ let X = 0, Y = 0, Z = 0, len = 0;
|
|
|
|
+ Outline.map(t => {
|
|
|
|
+ if (t[0]) {
|
|
|
|
+ t[0].map(item => {
|
|
|
|
+ X += item.X;
|
|
|
|
+ Y += item.Y;
|
|
|
|
+ Z += item.Z;
|
|
|
|
+ })
|
|
|
|
+ len += t[0].length
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ X = (X / len).toFixed(2);
|
|
|
|
+ Y = (Y / len).toFixed(2);
|
|
|
|
+ Z = (Z / len).toFixed(2);
|
|
|
|
+ return `${X},${Y},${Z}`
|
|
|
|
+ },
|
|
// canvas 获取焦点
|
|
// canvas 获取焦点
|
|
focus() {
|
|
focus() {
|
|
document.getElementById(`floorCanvas`).focus()
|
|
document.getElementById(`floorCanvas`).focus()
|