浏览代码

提取问题修改;折线锚点

haojianlong 5 年之前
父节点
当前提交
06061e2f0f
共有 4 个文件被更改,包括 111 次插入109 次删除
  1. 4 30
      package-lock.json
  2. 1 1
      package.json
  3. 73 62
      src/components/baseEditer.vue
  4. 33 16
      src/components/mapClass/EditScence.ts

+ 4 - 30
package-lock.json

@@ -1080,38 +1080,12 @@
       }
     },
     "@saga-web/feng-map": {
-      "version": "1.0.11",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/feng-map/-/feng-map-1.0.11.tgz",
-      "integrity": "sha512-aVKLu7TQWWajTl7w7DQ8JAayGHLiiU8phjBqDhCMwGsmUBdc+ep4F3+TQ1Zvz8NAsDBsbiEU1GNPp8zs433JTQ==",
+      "version": "1.0.13",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/feng-map/-/feng-map-1.0.13.tgz",
+      "integrity": "sha512-B/ATuj7gnl7EGw/hZguaIgFg+LD67OtYVbL/rRKcOqfNPwDirzoI1tpKkQDpiDL74RG1qH3uIhSC4mXqYEokiQ==",
       "requires": {
-        "@saga-web/big": "1.0.39",
+        "@saga-web/big": "1.0.54",
         "axios": "^0.18.0"
-      },
-      "dependencies": {
-        "@saga-web/big": {
-          "version": "1.0.39",
-          "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/big/-/big-1.0.39.tgz",
-          "integrity": "sha512-1tdfTUkXr3mFxuakkriuiNIYFfRlbAYyh8bRHuoIOkNuJ42mXrQU4t/loWrThOe62zbUlDJx1W0qxyZajIQZdA==",
-          "requires": {
-            "@saga-web/graph": "2.1.81"
-          }
-        },
-        "@saga-web/draw": {
-          "version": "2.1.94",
-          "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/draw/-/draw-2.1.94.tgz",
-          "integrity": "sha512-niu1zEvTv4l3Gnx+Qv7LPjgaPAgKQIIjUGM0H2nyvfJlRZb96LVJSum77cGJunhTl7ak6opg28JWCUUCKW/qRw==",
-          "requires": {
-            "@saga-web/base": "^2.1.19"
-          }
-        },
-        "@saga-web/graph": {
-          "version": "2.1.81",
-          "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.81.tgz",
-          "integrity": "sha512-qZx4RUXuR/Y02/EUGZHTe10rF+SWndgVx0vexRRaslmHNn6NbRxpqRKtrGFJXJBOKoCaxIN3ZpDC62/9yUDVTg==",
-          "requires": {
-            "@saga-web/draw": "2.1.94"
-          }
-        }
       }
     },
     "@saga-web/graph": {

+ 1 - 1
package.json

@@ -11,7 +11,7 @@
     "@saga-web/base": "2.1.22",
     "@saga-web/big": "1.0.54",
     "@saga-web/draw": "2.1.100",
-    "@saga-web/feng-map": "1.0.11",
+    "@saga-web/feng-map": "1.0.13",
     "@saga-web/graph": "2.1.94",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",

+ 73 - 62
src/components/baseEditer.vue

@@ -21,7 +21,7 @@ import store from "../store";
 import { Loading } from "element-ui";
 import { Message } from 'element-ui';
 let fengmap = null;
-
+//// 底图空间增加字段 isExtracted:boolean true 已被提取过
 export default {
   props: {
     cmdType: {
@@ -91,52 +91,10 @@ export default {
           .then(response => {
             console.log("获取rf成功", response);
             this.parserData(floorid);
+            this.readGraph()
             loadings.close();
           });
         this.view.fitSceneToView();
-
-      });
-      // 获取主题数据
-      this.readGroup().then(data => {
-        this.graphId = data.Data[0].ID;
-        bus.$emit('setGraphId',this.graphId)
-        if (data.Data) {
-          const parserData = new STopologyParser(null);
-          parserData.parseData(data.Data[0].Elements);
-          // 多边形
-          parserData.zoneLegendList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Nodes.push(t);
-          });
-          // 增加文字
-          parserData.textMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加图片
-          parserData.imageMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加直线
-          parserData.lineMarkerList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Markers.push(t);
-          });
-          // 增加图标类图例
-          parserData.imageLegendList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Nodes.push(t);
-          });
-          // 增加管线类
-          // 增加图标类图例
-          parserData.relationList.forEach(t => {
-            this.scene.addItem(t);
-            this.scene.Relations.push(t);
-          });
-          this.view.fitSceneToView();
-          bus.$emit("elementDataChange", this.scene);
-        }
       });
       // 获取typeid
       this.getTypeId();
@@ -166,8 +124,10 @@ export default {
             }
             this.fParser = new SFloorParser(null);
             this.fParser.parseData(res);
+            this.scene.fidToItem = {}
             this.fParser.spaceList.forEach(t => {
               t.selectable = true;
+              this.scene.fidToItem[t.data.SourceId] = t;
               this.scene.addItem(t);
             });
             this.scene.spaceList = this.fParser.spaceList;
@@ -190,6 +150,54 @@ export default {
         }
       }
     },
+    // 读取绘制数据
+    readGraph(){
+      this.readGroup().then(data => {
+        this.graphId = data.Data[0].ID;
+        bus.$emit('setGraphId',this.graphId)
+        if (data.Data) {
+          const parserData = new STopologyParser(null);
+          parserData.parseData(data.Data[0].Elements);
+          // 多边形
+          parserData.zoneLegendList.forEach(t => {
+            this.scene.addItem(t);
+            // 记录提取
+            if (t.data.Properties && t.data.Properties.FID) {
+              this.scene.fidToItem[t.data.Properties.FID].isExtracted = true
+            }
+            this.scene.Nodes.push(t);
+          });
+          // 增加文字
+          parserData.textMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图片
+          parserData.imageMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加直线
+          parserData.lineMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图标类图例
+          parserData.imageLegendList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Nodes.push(t);
+          });
+          // 增加管线类
+          // 增加图标类图例
+          parserData.relationList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Relations.push(t);
+          });
+          this.view.fitSceneToView();
+          bus.$emit("elementDataChange", this.scene);
+        }
+      });
+    },
     // 监听变化
     emitChange(itemMsg) {
       this.chiceItemList = itemMsg.itemList;
@@ -289,24 +297,27 @@ export default {
         const list = this.fParser.spaceList
           .map(t => {
             if (t.data.Type == val.key) {
-              return {
-                ID: uuid(),
-                Name: val.name,
-                GraphElementType: val.properties.Type,
-                GraphElementId: "273d633cc5c54a4882794b34843d1a00",
-                AttachObjectIds: [],
-                Pos: { x: t.x, y: t.y },
-                OutLine: t.pointArr[0],
-                SubType: "",
-                Properties: {
-                  StrokeColor: "#3d73c0",
-                  FillColor: "#72f5f980",
-                  font: 0,
-                  color: "",
-                  TextPos: { X: 0, Y: 0 }
-                },
-                Num: 1
-              };
+              if (!t.isExtracted) {
+                t.isExtracted = true
+                return {
+                  ID: uuid(),
+                  Name: val.name,
+                  GraphElementType: val.properties.Type,
+                  GraphElementId: "273d633cc5c54a4882794b34843d1a00",
+                  AttachObjectIds: [],
+                  Pos: { x: t.x, y: t.y },
+                  OutLine: t.pointArr[0],
+                  SubType: "",
+                  Properties: {
+                    StrokeColor: "#3d73c0",
+                    FillColor: "#72f5f980",
+                    font: 0,
+                    color: "",
+                    TextPos: { X: 0, Y: 0 }
+                  },
+                  Num: 1
+                };
+              }
             }
           })
           .filter(item => item);

+ 33 - 16
src/components/mapClass/EditScence.ts

@@ -81,6 +81,9 @@ export class EditScence extends SGraphScene {
         this._legend = obj;
         console.log('aaaaaa', obj)
     }
+    /** fid=>item映射,由解析器存入   */
+    fidToItem = {}
+
     /**
      * 监听变化
      * @param obj 变化后的对象
@@ -180,6 +183,13 @@ export class EditScence extends SGraphScene {
      * 增加管道 lenged
      */
     addTipelineItem(event: SMouseEvent): boolean {
+        const anc = this.clickIsAnchor(event);
+        if (anc) {
+            const p = anc.mapToScene(0, 0)
+            anc.isConnected = true;
+            event.x = p.x;
+            event.y = p.y;
+        }
         const LegendData: Relation = {
             ID: uuid(),
             Name: this._legend.Name,
@@ -205,6 +215,11 @@ export class EditScence extends SGraphScene {
         // this.undoStack.push(new SGraphAddCommand(this, item));
         this.grabItem = item;
         this.focusItem = item;
+        // 起始锚点
+        item.startAnchor = anc;
+        if (anc) {
+            anc.parent?.connect('changePos', item, item.changePos)
+        }
         this.scenceUpdate(this);
         return true
     }
@@ -261,11 +276,12 @@ export class EditScence extends SGraphScene {
      * 点选创建区域
     */
     clickToAddArea(item: SSpaceItem): void {
-        console.log(item)
         if (this.cmd != 'Zone') {
             return
         }
-        if (this.isSelecting  && this._legend) {
+        if (this.isSelecting && this._legend) {
+            //@ts-ignore
+            item.isExtracted = true
             const SubType = this._legend.SubType ? this._legend.SubType : ''
             const LegendData: Legend = {
                 ID: uuid(),
@@ -286,6 +302,7 @@ export class EditScence extends SGraphScene {
                     LineWidth: this._legend.LineWidth,
                     font: 12,
                     color: '',
+                    FID: item.data.SourceId,
                     TextPos: { X: item.data.Location.Points[0].X, Y: -item.data.Location.Points[0].Y }
                 },
             }
@@ -584,7 +601,7 @@ export class EditScence extends SGraphScene {
     upadataLengedName(val: string): void {
         if (this.focusItem && this.focusItem.data) {
             this.focusItem.text = val;
-            this.scenceUpdate(this); 
+            this.scenceUpdate(this);
         }
     }
 
@@ -637,7 +654,7 @@ export class EditScence extends SGraphScene {
                         a = index
                     }
                 });
-                if(a > -1) {
+                if (a > -1) {
                     this.Nodes.splice(a, 1);
                 }
                 let b = -1;
@@ -666,7 +683,7 @@ export class EditScence extends SGraphScene {
             }
         }
     }
-    scenceUpdate(scence: any) {}
+    scenceUpdate(scence: any) { }
 
     /**
      * 对齐指定item
@@ -775,7 +792,7 @@ export class EditScence extends SGraphScene {
         }
     }
 
-    onMouseMove(event: SMouseEvent):boolean {
+    onMouseMove(event: SMouseEvent): boolean {
         if (this.isAbsorbing) {
             if (!this.highLight) {
                 this.highLight = new HighlightItem(null);
@@ -816,7 +833,6 @@ export class EditScence extends SGraphScene {
         this.Nodes.forEach(image => {
             if (image.anchorList && image.anchorList.length) {
                 image.anchorList.forEach(anchor => {
-                    console.log(anchor)
                     let anchorPoint = anchor.mapToScene(0, 0);
                     let dis = SMathUtil.pointDistance(
                         event.x,
@@ -836,18 +852,19 @@ export class EditScence extends SGraphScene {
         })
         console.log('-----------------------')
         console.log(minAnchor)
+        console.log('-----------------------')
         return minAnchor;
     }
 
-   /**
-     *  点是否在吸附区域内
-     *
-     *  @param  p       要判断的点
-     *  @param  minX    空间区域
-     *  @param  minY    空间区域
-     *  @param  maxX    空间区域
-     *  @param  maxY    空间区域
-     */
+    /**
+      *  点是否在吸附区域内
+      *
+      *  @param  p       要判断的点
+      *  @param  minX    空间区域
+      *  @param  minY    空间区域
+      *  @param  maxX    空间区域
+      *  @param  maxY    空间区域
+      */
     static isPointInAbsorbArea(
         p: SPoint,
         minX: number,