haojianlong 4 роки тому
батько
коміт
bb7c4f10ed
2 змінених файлів з 69 додано та 15 видалено
  1. 54 13
      src/components/baseEditer.vue
  2. 15 2
      src/components/mapClass/EditScence.ts

+ 54 - 13
src/components/baseEditer.vue

@@ -8,7 +8,7 @@
   </div>
 </template>
 <script>
-import { SFengParser } from "@saga-web/feng-map";
+import { SFengParser, ProjectRf } from "@saga-web/feng-map";
 import { SFloorParser } from "@saga-web/big";
 import { FloorView } from "./../lib/FloorView";
 import { EditScence } from "./mapClass/EditScence";
@@ -69,7 +69,8 @@ export default {
       menuStyle: {
         top: 0,
         left: 0
-      }
+      },
+      count: 0, // 顶楼为多张图时计数器
     };
   },
   mounted() {
@@ -159,16 +160,42 @@ export default {
       if (floor == "g80") {
         // 屋顶
         if (window.FENGMAP.frImg) {
-          const imgItem = new SImageItem(
-            null,
-            `${this.mapServerURL}/webtheme/${this.urlMsg.fmapID}/${window.FENGMAP.frImg}`
-          );
-          imgItem.showType = SImageShowType.AutoFit;
-          imgItem.connect("imgLoadOver", this, () => {
-            this.readGraph();
-          });
-          this.scene.addItem(imgItem);
-          this.view.scene = this.scene;
+          // const pj = this.urlMsg.fmapID.split('_')[0]
+          // // 单张图片
+          // if (!ProjectRf[pj]) {
+            const imgItem = new SImageItem(
+              null,
+              `${this.mapServerURL}/webtheme/${this.urlMsg.fmapID}/${window.FENGMAP.frImg}`
+            );
+            imgItem.showType = SImageShowType.AutoFit;
+            imgItem.connect("imgLoadOver", this, () => {
+              this.readGraph();
+            });
+            this.scene.addItem(imgItem);
+            this.view.scene = this.scene;
+          // } else {
+          //   // 多张图
+          //   try {
+          //     // 初始化0
+          //     this.count = 0;
+          //     ProjectRf[pj].forEach(t => {
+          //       const item = new SImageItem(
+          //         null,
+          //         `${this.mapServerURL}/webtheme/${this.urlMsg.fmapID}/${t.name}`
+          //       );
+          //       item.width = t.width
+          //       item.height = t.width
+          //       item.moveTo(t.x, t.y)
+          //       item.connect("imgLoadOver", this, () => {
+          //         this.countRf(ProjectRf[pj].length);
+          //       });
+          //       this.scene.addItem(item);
+          //     })
+              // this.view.scene = this.scene;
+          //   } catch(e) {
+          //     console.log(e);
+          //   }
+          // }
         } else {
           // 屋顶图不为图片
           this.readBaseMap(floor);
@@ -199,7 +226,11 @@ export default {
           this.scene.addItem(t);
         });
         this.scene.spaceList = this.fParser.spaceList;
-        this.fParser.wallList.forEach(t => this.scene.addItem(t));
+        this.fParser.wallList.forEach(t => {
+          // if (!t.data.HasHole) {
+            this.scene.addItem(t)
+          // }
+        });
         this.fParser.virtualWallList.forEach(t => this.scene.addItem(t));
         this.fParser.doorList.forEach(t => this.scene.addItem(t));
         this.fParser.columnList.forEach(t => this.scene.addItem(t));
@@ -300,6 +331,7 @@ export default {
             }
           });
         }
+        console.log(11111111111111111111111111);
         this.view.fitSceneToView();
         // 设置初始化缩放比例
         this.initScale = this.view.scale;
@@ -310,6 +342,15 @@ export default {
         this.loadings.close()
       });
     },
+    // 顶楼为多张图时计数器
+    countRf(len) {
+      this.count++
+      if (len == this.count) {
+        this.readGraph();
+      } else {
+        console.log('所有图片未加载完成');
+      }
+    },
     // 监听变化
     emitChange(itemMsg) {
       this.chiceItemList = itemMsg.itemList;

+ 15 - 2
src/components/mapClass/EditScence.ts

@@ -1,6 +1,6 @@
 import { SMouseEvent, SUndoStack } from "@saga-web/base";
 import { SGraphScene, SGraphLayoutType, SAnchorItem } from '@saga-web/graph/lib';
-import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder, STooltipItem, ItemColor, Transparency, SPolygonItem } from "@saga-web/big";
+import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder, STooltipItem, ItemColor, Transparency, SPolygonItem, SRectSelectItem } from "@saga-web/big";
 import { SGraphItem, SLineStyle, SGraphPropertyCommand, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
 import { SGraphAddListCommand } from "./SGraphAddListCommand"
 import { SGraphDeleteCommand } from "./SGraphDeleteCommand"
@@ -64,7 +64,10 @@ export class EditScence extends SGraphScene {
     isAbsorbing: boolean = false;
     /** 吸附展示item    */
     highLight: HighlightItem | null = null;
-
+    /** 矩形选择区域  */
+    rectSelectItem: SRectSelectItem | null = null;
+    /** 框选    */
+    isRectSelection: number = 0;
     /** 当前选中焦点Item */
     focusItem: SGraphItem | null = null;
     /** 当前选中焦点ItemList */
@@ -1868,4 +1871,14 @@ export class EditScence extends SGraphScene {
             }
         }
     }
+
+    /** 
+     * 框选
+    */
+    addRectSelect(event: SMouseEvent) {
+        let point = new SPoint(event.x, event.y);
+        let rect = new SRectSelectItem(null, point);
+        this.addItem(rect);
+        this.rectSelectItem = rect;
+    }
 }