Browse Source

修改批量创建计算交集

haojianlong 5 years ago
parent
commit
5cdb0db059
2 changed files with 41 additions and 14 deletions
  1. 3 3
      package.json
  2. 38 11
      src/components/business_space/newGraphy/graphy.vue

+ 3 - 3
package.json

@@ -26,9 +26,9 @@
         "vuex": "^3.1.0",
         "cad-engine": "2.0.250",
         "@saga-web/base": "2.1.9",
-        "@saga-web/draw": "2.1.58",
-        "@saga-web/graphy": "2.1.30",
-        "@saga-web/cad-engine": "2.0.406"
+        "@saga-web/draw": "2.1.61",
+        "@saga-web/graphy": "2.1.34",
+        "@saga-web/cad-engine": "2.0.420"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 38 - 11
src/components/business_space/newGraphy/graphy.vue

@@ -604,21 +604,48 @@ export default {
     // 根据图批量创建所选业务空间
     groupCreateZone() {
       let arr = this.scene.getSelectedSpaces();
-      let spaces = arr.map(t => {
-        return {
-          IspaceId: this.BIMIDToSID[t.data.SourceId],
-          RoomLocalName: t.data.Name,
-          Outline: [t.data.OutLine],
-          BuildingId: this.buildFloor[0],
-          FloorId: this.buildFloor[1],
-          Height: t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height || 0
+      let spaces = [];
+      // 如果有划分,求交集
+      if (this.scene.cutItem || this.scene.sceneMark) {
+        let outlines = this.scene.getIntersectInSpace();
+        for (let k in outlines) {
+          outlines[k] = outlines[k].map(t => {
+            t = t.map(item => {
+              item = item.map(j => {
+                return { X: j.x, Y: -j.y, Z: 0 }
+              })
+              return item
+            })
+            return t;
+          })
         }
-      })
+        spaces = arr.map(t => {
+          return {
+            IspaceId: this.BIMIDToSID[t.data.SourceId],
+            RoomLocalName: t.data.Name,
+            Outline: outlines[t.data.SourceId],
+            BuildingId: this.buildFloor[0],
+            FloorId: this.buildFloor[1],
+            Height: t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height || 0
+          }
+        }).filter(item => item.Outline && item.Outline.length)
+      } else {
+        spaces = arr.map(t => {
+          return {
+            IspaceId: this.BIMIDToSID[t.data.SourceId],
+            RoomLocalName: t.data.Name,
+            Outline: [t.data.OutLine],
+            BuildingId: this.buildFloor[0],
+            FloorId: this.buildFloor[1],
+            Height: t.data.Height > 100 ? (t.data.Height / 1000).toFixed(2) : t.data.Height || 0
+          }
+        })
+      }
       if (spaces.length) {
         this.canvasLoading = true;
         this.groupCreateBSP(spaces)
       } else {
-        this.$message.warning('未选择空间');
+        this.$message.warning('未选择本层空间');
       }
     },
     // 更新业务空间和元空间的关系
@@ -753,7 +780,7 @@ export default {
     },
     // 框选
     groupSelect() {
-      this.scene.isRectSelection = true;
+      this.scene.isRectSelection = 1;
     },
     // 适配底图到窗口
     fit() {