YaolongHan 5 年之前
父節點
當前提交
794c7c8838

+ 13 - 3
package-lock.json

@@ -1069,6 +1069,16 @@
       "integrity": "sha512-1tdfTUkXr3mFxuakkriuiNIYFfRlbAYyh8bRHuoIOkNuJ42mXrQU4t/loWrThOe62zbUlDJx1W0qxyZajIQZdA==",
       "requires": {
         "@saga-web/graph": "2.1.81"
+      },
+      "dependencies": {
+        "@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/draw": {
@@ -1088,9 +1098,9 @@
       }
     },
     "@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==",
+      "version": "2.1.82",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.82.tgz",
+      "integrity": "sha512-JyX74MLDZdRK4hbbwV7d5YJaaQJ84FCTqeJFlBOaXS0prXUmlGdB8HikQuQAyK15smosdw0ILYUNTn3wjGkgQw==",
       "requires": {
         "@saga-web/draw": "2.1.94"
       }

+ 1 - 1
package.json

@@ -12,7 +12,7 @@
     "@saga-web/big": "1.0.39",
     "@saga-web/draw": "2.1.94",
     "@saga-web/feng-map": "1.0.10",
-    "@saga-web/graph": "2.1.81",
+    "@saga-web/graph": "2.1.82",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",

+ 15 - 0
src/components/baseEditer.vue

@@ -94,6 +94,17 @@ export default {
           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.scene.emitChange = this.emitChange;
     },
@@ -251,6 +262,10 @@ export default {
       bus.$on("changeBorder", val => {
         this.scene.upadataBorder(val);
       });
+      // 改变图例名称
+      bus.$on("changeLengedName", val => {
+        this.scene.upadataLengedName(val);
+      });
     },
     // 读取数据
     readGroup() {

+ 9 - 3
src/components/edit/attr_select.vue

@@ -115,7 +115,7 @@
         <a-button type="link" class="edit-option-btn">{{editStatus[type]}}</a-button>
       </div>
       <div class="row">
-        <a-input />
+        <a-input v-model="lengedName" @change="changeLengedName" />
       </div>
       <div class="row">
         <div class="row-tit">字号</div>
@@ -252,7 +252,8 @@ export default {
         "fire-area": "编辑区域",
         position: "编辑区域"
       },
-      swatchess: ["#57C5FC", "#5F70E1", "#4DAE6C", "#028FAA"]
+      swatchess: ["#57C5FC", "#5F70E1", "#4DAE6C", "#028FAA"],
+      lengedName:'' // 图例名称
     };
   },
   methods: {
@@ -303,6 +304,10 @@ export default {
         }
       });
     },
+    //更改图例名称
+    changeLengedName(){
+      bus.$emit("changeLengedName",this.lengedName);
+    },
     changeImage(info) {
       const status = info.file.status;
       console.log(status);
@@ -321,7 +326,6 @@ export default {
   },
   watch: {
     focusItemList: function(newval) {
-      console.log("newval", newval);
       const Item = newval.itemList[0];
       if (newval.itemList.length == 1) {
         if (newval.itemType == "baseText") {
@@ -332,6 +336,8 @@ export default {
         } else if (newval.itemType == "baseLine") {
           this.lineWidth = Item.lineWidth;
           this.borderColor = Item.strokeColor;
+        }else if(newval.itemType == "Zone" || newval.itemType == "Line" || newval.itemType == "Image"){
+          this.lengedName=Item.data.Name
         }
       }
     }

+ 64 - 10
src/components/mapClass/EditScence.ts

@@ -9,6 +9,8 @@ import { SImgTextItem } from "@/lib/items/SImgTextItem";
 import { SImageMarkerItem } from "@/lib/items/SImageMarkerItem"
 import { SPoint, SFont } from '@saga-web/draw/lib';
 import { Legend } from '@/lib/types/Legend';
+import { Relation } from '@/lib/types/Legend';
+
 import { uuid } from "@/components/mapClass/until";
 import { STextMarkerItem } from '@/lib/items/STextMarkerItem';
 import { SLineMarkerItem } from '@/lib/items/SLineMarkerItem';
@@ -154,7 +156,42 @@ export class EditScence extends SGraphScene {
     }
 
     /**
-     * 增加多边形item
+     * 增加管道 lenged
+     */
+    addTipelineItem(event: SMouseEvent): boolean {
+        const LegendData: Relation = {
+            ID: uuid(),
+            Name: this._legend.Name,
+            GraphElementType: this._legend.Type,
+            Num: 0,
+            GraphElementId: this._legend.Id,
+            AttachObjectIds: [],
+            Type: "Line",
+            PointList: [{ X: event.x, Y: event.y }],
+            LineType: 0,
+            Properties: {
+                LineDash: this._legend.LineDash,
+                LineWidth: this._legend.LineWidth,
+                Color: this._legend.Color,
+            },
+        }
+
+        const item = new TipelineItem(null, LegendData);
+        //设置状态
+        item.selectable = true;
+        item.status = SItemStatus.Create;
+        item.zOrder = ItemOrder.polylineOrder
+        this.addItem(item);
+        this.Relations.push(item);
+        item.connect("finishCreated", this, this.finishCreated);
+        // this.undoStack.push(new SGraphAddCommand(this, item));
+        this.grabItem = item;
+        this.focusItem = item;
+        return true
+    }
+
+    /**
+     * 增加多边形item lenged
      */
     addPolygonItem(event: SMouseEvent): void {
         const LegendData: Legend = {
@@ -172,6 +209,7 @@ export class EditScence extends SGraphScene {
                 fillColor: this._legend.FillColor,
                 LineDash: this._legend.LineDash,
                 LineWidth: this._legend.LineWidth,
+                Text:this._legend.Name
             },
         }
 
@@ -189,7 +227,7 @@ export class EditScence extends SGraphScene {
     }
 
     /**
-     * 增加图片Item
+     * 增加图片Item mark
      */
     addImgItem(event: SMouseEvent) {
         const data = {
@@ -203,8 +241,8 @@ export class EditScence extends SGraphScene {
             Pos: { X: event.x, Y: event.y },
             /** 由应用自己定义  */
             Properties: {
-                Url: '/serve/topology-wanda/Picture/query/' + '1bcff19d6f3547488673dcba7dd9507f',
-                Name: '嗡嗡嗡',
+                Url: '',
+                Name: '',
             }
         }
 
@@ -252,7 +290,7 @@ export class EditScence extends SGraphScene {
     }
 
     /**
-     * 增加图标
+     * 增加图标lenged图标
      */
     addIconItem(event: SMouseEvent): void {
         console.log('this._legend.url', this._legend)
@@ -268,7 +306,7 @@ export class EditScence extends SGraphScene {
             Rolate: { X: 0, Y: 0, Z: 0 },
             Size: { Width: 0, Height: 0 },         // 大小
             Properties: {
-                Url: '/serve/topology-wanda/Picture/query/' + this._legend.url
+                Url: '/serve/topology-wanda/Picture/query/' + this._legend.Url
             },
         }
         const item = new SImageLegendItem(null, LegendData);
@@ -277,8 +315,9 @@ export class EditScence extends SGraphScene {
         item.selectable = true;
         item.moveable = true;
         item.zOrder = ItemOrder.markOrder;
-        item.moveTo(event.x, event.y);
+        // item.moveTo(event.x, event.y);
         this.addItem(item);
+        this.Nodes.push(item);
     }
 
     /**
@@ -433,6 +472,17 @@ export class EditScence extends SGraphScene {
     }
 
     /**
+     * 更改item 名称
+     * @param val string border类型
+     */
+    upadataLengedName(val: string): void {
+        console.log('xxxxxxx',val)
+        if (this.focusItem && this.focusItem.data) {
+            this.focusItem.data.Name = val
+        }
+    }
+
+    /**
      * 删除指定item
      */
     deleiteItem(): void {
@@ -460,7 +510,6 @@ export class EditScence extends SGraphScene {
             });
             this.Relations.splice(c, 1);
             this.focusItem = null;
-           console.log('this.Nodes',this.Nodes)
         }
         if (this.view) {
             this.view.update();
@@ -488,14 +537,19 @@ export class EditScence extends SGraphScene {
     saveMsgItem(): any {
         const Nodes: any = [];
         const Markers: any = [];
+        const Relations: any = [];
         this.Nodes.forEach(e => {
             Nodes.push(e.toData())
         });
         this.Markers.forEach(e => {
             Markers.push(e.toData())
         });
+        this.Relations.forEach(e => {
+            Relations.push(e.toData())
+        });
+
         let element = {
-            Nodes, Markers
+            Nodes, Markers, Relations
         }
         return element
     }
@@ -549,7 +603,7 @@ export class EditScence extends SGraphScene {
                 this.addIconItem(event);
                 break;
             case 'Line':
-                this.addPolylineItem(event);
+                this.addTipelineItem(event);
                 break;
             default:
                 return super.onMouseDown(event);

+ 14 - 2
src/lib/items/TipelineItem.ts

@@ -92,7 +92,7 @@ export class TipelineItem extends SPolylineItem {
   constructor(parent: SGraphItem | null, data: Relation) {
     super(parent, []);
     this.pointList = data.PointList.map(item => {
-      return new SPoint(item.X,item.Y);
+      return new SPoint(item.X, item.Y);
     });
     this.data = data;
     this.id = data.ID;
@@ -111,12 +111,21 @@ export class TipelineItem extends SPolylineItem {
     if (data.Anchor2ID) {
       this._anchor2ID = data.Anchor2ID
     }
+    if (data.Properties && data.Properties.Color) {
+      this.strokeColor = data.Properties.Color
+    }
+    // if(data.Properties && data.Properties.LineDash){
+    //   this.LineDash = data.Properties.LineDash
+    // }
+    if (data.Properties && data.Properties.LineWidth) {
+      this.lineWidth = data.Properties.LineWidth;
+    }
 
   }
 
   /** 获取data数据  */
   toData(): Relation | null {
-    let pointList:Point[] = this.pointList.map(item => {
+    let pointList: Point[] = this.pointList.map(item => {
       return {
         X: item.x,
         Y: item.y
@@ -125,6 +134,9 @@ export class TipelineItem extends SPolylineItem {
 
     if (this.data) {
       this.data.PointList = pointList;
+      this.data.Properties.LineWidth = this.lineWidth;
+      // this.data.Properties.LineDash = this.LineDash;
+      this.data.Properties.Color = this.strokeColor
     }
 
     return this.data

+ 8 - 3
src/lib/parsers/STopologyParser.ts

@@ -14,7 +14,7 @@ import { SLineMarkerItem } from '../items/SLineMarkerItem';
 import { STextMarkerItem } from '../items/STextMarkerItem';
 import { TipelineItem } from '../items/TipelineItem';
 import { ItemOrder } from "@saga-web/big";
-
+import { SItemStatus } from "@saga-web/big";
 /**
  * 拓扑图信息解析器
  *
@@ -72,8 +72,12 @@ export class STopologyParser extends SParser {
             let item = new SNoneLegendItem(null, t);
             this.noneLegendList.push(item);
         } else if (t.GraphElementType == 'Line') {
-            let item = new SLineLegendItem(null, t)
-            this.lineLegendList.push(item);
+            let item = new TipelineItem(null, t);
+            item.selectable = true;
+            item.status = 0;
+            item.zOrder == ItemOrder.polylineOrder;
+            alert(123)
+            this.relationList.push(item);
         } else if (t.GraphElementType == "Zone") {
             let item = new SZoneLegendItem(null, t);
             item.selectable = true;
@@ -81,6 +85,7 @@ export class STopologyParser extends SParser {
             this.zoneLegendList.push(item);
         } else if (t.GraphElementType == 'Image') {
             let item = new SImageLegendItem(null, t);
+            item.selectable = true;
             this.imageLegendList.push(item);
         }
     } // Function addNode()

+ 2 - 0
src/lib/types/Legend.ts

@@ -44,6 +44,8 @@ export interface Legend {
     Num?: number;
     /** 位置  */
     Pos: Point;
+    /** item类型 */
+    Type: string
     /** 缩放  */
     Scale?: Point;
     /** 旋转  */

+ 1 - 1
src/lib/types/Relation.ts

@@ -51,5 +51,5 @@ export interface Relation {
     /** 线的顶点坐标 */
     PointList: Point[];
     /** 线的绘图样式 */
-    Style?: any;
+    Properties?: any;
 } // Interface Relation