YaolongHan %!s(int64=4) %!d(string=hai) anos
pai
achega
d85b6e3060
Modificáronse 2 ficheiros con 55 adicións e 27 borrados
  1. 1 1
      package.json
  2. 54 26
      src/components/mapClass/EditScence.ts

+ 1 - 1
package.json

@@ -9,7 +9,7 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.22",
-    "@saga-web/big": "1.0.85",
+    "@saga-web/big": "1.0.86",
     "@saga-web/draw": "2.1.102",
     "@saga-web/feng-map": "1.0.25",
     "@saga-web/graph": "2.1.112",

+ 54 - 26
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 } 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"
@@ -275,9 +275,9 @@ export class EditScence extends SGraphScene {
                 font: 14,
                 color: "#1F2429",
                 TextPos: { X: 0, Y: 0 },
-                InfoTypeId:this._legend.InfoTypeId.length? this._legend.InfoTypeId :[],
-                InfoSystemId:this._legend.InfoSystemId ? this._legend.InfoSystemId :'',
-                InfoLocal:this._legend.InfoLocal.length ?this._legend.InfoLocal :[]
+                InfoTypeId: this._legend.InfoTypeId.length ? this._legend.InfoTypeId : [],
+                InfoSystemId: this._legend.InfoSystemId ? this._legend.InfoSystemId : '',
+                InfoLocal: this._legend.InfoLocal.length ? this._legend.InfoLocal : []
             },
         }
         let Polylines = null;
@@ -330,9 +330,9 @@ export class EditScence extends SGraphScene {
                     color: "#1F2429",
                     FID: item.data.SourceId,
                     TextPos: { X: item.data.Location.Points[0].X, Y: -item.data.Location.Points[0].Y },
-                    InfoTypeId:this._legend.InfoTypeId.length? this._legend.InfoTypeId :[],
-                    InfoSystemId:this._legend.InfoSystemId ? this._legend.InfoSystemId :'',
-                    InfoLocal:this._legend.InfoLocal.length ?this._legend.InfoLocal :[]
+                    InfoTypeId: this._legend.InfoTypeId.length ? this._legend.InfoTypeId : [],
+                    InfoSystemId: this._legend.InfoSystemId ? this._legend.InfoSystemId : '',
+                    InfoLocal: this._legend.InfoLocal.length ? this._legend.InfoLocal : []
                 },
             }
             let Polylines = null;
@@ -448,9 +448,9 @@ export class EditScence extends SGraphScene {
                 color: "#1F2429",  //字体颜色
                 FrameColor: this._legend.FrameColor,
                 GraphCategoryId: this._legend.GraphCategoryId,
-                InfoSystemId:this._legend.InfoSystemId ? this._legend.InfoSystemId :'' ,
-                InfoTypeId:this._legend.InfoTypeId.length? this._legend.InfoTypeId :[],// 铺位可视化Typeid(用于编辑工程信息化时默认问题)
-                InfoLocal:this._legend.InfoLocal.length ?this._legend.InfoLocal :[]
+                InfoSystemId: this._legend.InfoSystemId ? this._legend.InfoSystemId : '',
+                InfoTypeId: this._legend.InfoTypeId.length ? this._legend.InfoTypeId : [],// 铺位可视化Typeid(用于编辑工程信息化时默认问题)
+                InfoLocal: this._legend.InfoLocal.length ? this._legend.InfoLocal : []
             },
         }
         const item = new SImageLegendItem(null, LegendData);
@@ -592,9 +592,9 @@ export class EditScence extends SGraphScene {
             let p = this.focusItem.mapFromScene(x, y)
             // newx - oldx = newleft - oldleft
             // 要求的值(新的x坐标) - 旧的x坐标 = 新的左边界(用户输入的值) - 旧的左边界
-            this.focusItem.x = (p.x - this.focusItem.boundingRect().left)*this.focusItem.inverseScale + this.focusItem.x;
-            this.focusItem.y = (p.y - this.focusItem.boundingRect().top)*this.focusItem.inverseScale + this.focusItem.y;
-            if(this.focusItem instanceof SPolylineItem || this.focusItem instanceof SPolygonItem || this.focusItem instanceof SLineItem){
+            this.focusItem.x = (p.x - this.focusItem.boundingRect().left) * this.focusItem.inverseScale + this.focusItem.x;
+            this.focusItem.y = (p.y - this.focusItem.boundingRect().top) * this.focusItem.inverseScale + this.focusItem.y;
+            if (this.focusItem instanceof SPolylineItem || this.focusItem instanceof SPolygonItem || this.focusItem instanceof SLineItem) {
                 this.focusItem.moveToOrigin(this.focusItem.x, this.focusItem.y)
             }
         }
@@ -722,9 +722,9 @@ export class EditScence extends SGraphScene {
                 item instanceof SFHFQZoneLegendItem
             ) {
                 let arr = item.data.AttachObjectIds;
-                if (arr && arr.length && arr[arr.length-1].name) {
-                    item.text = arr[arr.length-1].name;
-                    item.name = arr[arr.length-1].name;
+                if (arr && arr.length && arr[arr.length - 1].name) {
+                    item.text = arr[arr.length - 1].name;
+                    item.name = arr[arr.length - 1].name;
                 }
                 // 绑定工程信息化数据后设置状态
                 if (item.data.AttachObjectIds && item.data.AttachObjectIds.length) {
@@ -908,7 +908,17 @@ export class EditScence extends SGraphScene {
         let arrList = []
         if (this.cmd == 'baseLine') {
             arrList = this.Markers;
-            this.Markers.push(item);
+            // 对数组遍历防止相同得id注入
+            let canPush = true;  //是否可注入
+            this.Markers.forEach((arrItem: any) => {
+                if (arrItem.id == item.id) {
+                    canPush = false
+                }
+            })
+            if (canPush) {
+                this.Markers.push(item);
+                this.undoStack.push(new SGraphAddCommand(this, item));
+            }
         }
         this.cmd = 'choice';
         this.selectContainer.clear()
@@ -917,15 +927,33 @@ export class EditScence extends SGraphScene {
             this.focusItem = item;
         });
 
-       if(item instanceof SZoneLegendItem || item instanceof SFHFQZoneLegendItem || item instanceof SSCPZZoneLegendItem){
-            this.Nodes.push(item); //完成后,方可扔到Node节点
-       }
-       //    管道完成后方可保存
-       if(item instanceof TipelineItem ){
-           this.Relations.push(item);
-       }
-       this.scenceUpdate(this);
-       this.undoStack.push(new SGraphAddCommand(this, item, arrList));
+        if (item instanceof SZoneLegendItem || item instanceof SFHFQZoneLegendItem || item instanceof SSCPZZoneLegendItem) {
+            let canPush = true;  //是否可注入
+            this.Nodes.forEach((arrItem: any) => {
+                if (arrItem.id == item.id) {
+                    canPush = false
+                }
+            })
+            if (canPush) {
+                this.Nodes.push(item); //完成后,方可扔到Node节点
+                this.undoStack.push(new SGraphAddCommand(this, arrList));
+            }
+        }
+        //    管道完成后方可保存
+        if (item instanceof TipelineItem) {
+            let canPush = true;  //是否可注入
+            this.Relations.forEach((arrItem: any) => {
+                if (arrItem.id == item.id) {
+                    canPush = false
+                }
+            })
+            if (canPush) {
+                this.Relations.push(item);
+                this.undoStack.push(new SGraphAddCommand(this, arrList));
+            }
+
+        }
+        this.scenceUpdate(this);
     }
     ////////////////////////
     //  以下为鼠标键盘操作事件