YaolongHan 4 лет назад
Родитель
Сommit
3350169a43

+ 25 - 15
package-lock.json

@@ -1059,24 +1059,24 @@
       "dev": true
     },
     "@saga-web/base": {
-      "version": "2.1.16",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/base/-/base-2.1.16.tgz",
-      "integrity": "sha512-gnItoKBjjv+kbcDfnY8f9EMMVPRJgXXgebdSEj2NTsNmygpdsjQBaqQ6AfDUYzRaWwP53sdmFHeidOCYcqg0RA=="
+      "version": "2.1.19",
+      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/base/-/base-2.1.19.tgz",
+      "integrity": "sha512-bsOw0WsGSn98oYkuf9Uah6Po2Ds7IWknxHqUmYxu7h8qaqw7SidWmT/9iwNTCnjeqJEd5f6tP+Yg4tT/8C52YA=="
     },
     "@saga-web/big": {
-      "version": "1.0.36",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/big/-/big-1.0.36.tgz",
-      "integrity": "sha512-8rbW+NtK0p74P938LBdXG4yr5JR4EJd0tI98bwk/No1xYFT1EoAAMXCTcpCRpifU76GH5fnunIr8adns+F7dAQ==",
+      "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.79"
+        "@saga-web/graph": "2.1.81"
       }
     },
     "@saga-web/draw": {
-      "version": "2.1.90",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/draw/-/draw-2.1.90.tgz",
-      "integrity": "sha512-KFICPt9qULAqQbMVXzdKAm/1iIUu0yA7qhJIzzmHrHfyRvofZAu/LVPBIOfNakrmZXkY5g+Bl3z0WboP6b1igg==",
+      "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.16"
+        "@saga-web/base": "^2.1.19"
       }
     },
     "@saga-web/feng-map": {
@@ -1101,16 +1101,26 @@
           "integrity": "sha512-pnNMSY+zy2QuHsMaSTdJs0qVcyuq6yToCGYhpKrLQF4tCcjuaLnAnhvbUHm9Tv8XlWAGGtO8BlXDwOoHK0vxYA==",
           "requires": {
             "@saga-web/draw": "2.1.90"
+          },
+          "dependencies": {
+            "@saga-web/draw": {
+              "version": "2.1.90",
+              "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/draw/-/draw-2.1.90.tgz",
+              "integrity": "sha512-KFICPt9qULAqQbMVXzdKAm/1iIUu0yA7qhJIzzmHrHfyRvofZAu/LVPBIOfNakrmZXkY5g+Bl3z0WboP6b1igg==",
+              "requires": {
+                "@saga-web/base": "^2.1.16"
+              }
+            }
           }
         }
       }
     },
     "@saga-web/graph": {
-      "version": "2.1.79",
-      "resolved": "http://192.168.200.80:8081/repository/npm-saga/@saga-web/graph/-/graph-2.1.79.tgz",
-      "integrity": "sha512-rrMrpg/jrohxvOlQZb8dHchBx329h0f6gWVWctWFEpurZ/aerJ2Ey/EkTXupmUkBIaf+jcpyAGTmnj7os2SmKg==",
+      "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.90"
+        "@saga-web/draw": "2.1.94"
       }
     },
     "@saga-web/graphy": {

+ 4 - 4
package.json

@@ -8,11 +8,11 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@saga-web/base": "2.1.16",
-    "@saga-web/big": "1.0.36",
-    "@saga-web/draw": "2.1.90",
+    "@saga-web/base": "2.1.19",
+    "@saga-web/big": "1.0.39",
+    "@saga-web/draw": "2.1.94",
     "@saga-web/feng-map": "1.0.8",
-    "@saga-web/graph": "2.1.79",
+    "@saga-web/graph": "2.1.81",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",

+ 12 - 4
src/components/baseEditer.vue

@@ -47,9 +47,7 @@ export default {
     // 挂在bus
     this.getBus();
     // 测试read数据
-    const data = {
-
-    };
+    const data = {};
     readGroup(data);
   },
   methods: {
@@ -123,11 +121,14 @@ export default {
         this.scene.updatedHeight(Number(val));
       });
       bus.$on("itemPositon", (x, y) => {
-        this.scene.updatedPosition(Number(x, y));
+        this.scene.updatedPosition(Number(x), Number(y));
       });
       bus.$on("changebackColor", val => {
         this.scene.updatedbackColor(val);
       });
+      bus.$on("deleiteItem", () => {
+        this.scene.deleiteItem();
+      });
       bus.$on("extractItem", () => {
         const map = {};
         this.fParser.spaceList.forEach(t => {
@@ -165,6 +166,13 @@ export default {
           console.log("aaaaaaaaaaaaaa", res);
         });
       });
+      bus.$on("exportByKey", val => {
+        this.fParser.spaceList.forEach(t => {
+          if (t.data.Type == val.key) {
+            t.selected = true;
+          }
+        });
+      });
     }
   },
   watch: {

+ 21 - 47
src/components/edit/left_toolbar.vue

@@ -1,37 +1,17 @@
 <template>
   <div id="left_toolbar">
     <ul class="list-1">
-      <li
-        v-on:mouseout="mouseoutActive(item)"
-        v-on:mouseover="mouseoverActive(item)"
-        v-for="(item,i) in baseChoice"
-        :key="i"
-        @click="toolActionClick(item)"
-        v-bind:class="{ actives:item.isChoice}"
-      >
+      <li v-on:mouseout="mouseoutActive(item)" v-on:mouseover="mouseoverActive(item)" v-for="(item,i) in baseChoice" :key="i"
+        @click="toolActionClick(item)" v-bind:class="{ actives:item.isChoice}">
         <div class="item">
-          <img
-            v-show="!item.isHover && !item.isChoice"
-            :src="require(`./../../assets/images/${item.img}`)"
-            alt
-          />
-          <img
-            v-show="item.isHover || item.isChoice "
-            :src="require(`./../../assets/images/${item.hoverImg}`)"
-            alt
-          />
+          <img v-show="!item.isHover && !item.isChoice" :src="require(`./../../assets/images/${item.img}`)" alt />
+          <img v-show="item.isHover || item.isChoice " :src="require(`./../../assets/images/${item.hoverImg}`)" alt />
         </div>
       </li>
     </ul>
     <ul class="list-2">
-      <li
-        v-on:mouseout="mouseoutActive(item)"
-        v-on:mouseover="mouseoverActive(item)"
-        v-for="(item,i) in systemChoice"
-        @click="showDrawer(item)"
-        :key="i"
-        v-bind:class="{ actives:item.isChoice}"
-      >
+      <li v-on:mouseout="mouseoutActive(item)" v-on:mouseover="mouseoverActive(item)" v-for="(item,i) in systemChoice" @click="showDrawer(item)"
+        :key="i" v-bind:class="{ actives:item.isChoice}">
         <div class="item">
           <img v-show="!item.isHover" :src="require(`./../../assets/images/${item.img}`)" alt />
           <img v-show="item.isHover" :src="require(`./../../assets/images/${item.hoverImg}`)" alt />
@@ -41,13 +21,7 @@
     </ul>
     <!--    提取-->
     <ul class="list-2 border-top">
-      <li
-        v-on:mouseout="mouseoutActive(item)"
-        v-on:mouseover="mouseoverActive(item)"
-        v-for="(item,i) in extractChoice"
-        :key="i"
-        @click="extractItem"
-      >
+      <li v-on:mouseout="mouseoutActive(item)" v-on:mouseover="mouseoverActive(item)" v-for="(item,i) in extractChoice" :key="i" @click="extractItem">
         <div class="item">
           <img v-show="!item.isHover" :src="require(`./../../assets/images/${item.img}`)" alt />
           <img v-show="item.isHover" :src="require(`./../../assets/images/${item.hoverImg}`)" alt />
@@ -69,15 +43,8 @@
     <!-- 打开弹窗 -->
     <transition name="fade">
       <div class="drawer-model" id="drawer-model" v-show="visible">
-        <a-drawer
-          placement="left"
-          :closable="false"
-          :visible="visible"
-          :wrap-style="{ position: 'absolute',}"
-          @close="onClose"
-          :getContainer="false"
-        >
-          <div class="drawer-model-body">
+        <a-drawer placement="left" :closable="false" :visible="visible" :wrap-style="{ position: 'absolute',}" @close="onClose" :getContainer="false">
+          <div class="drawer-model-body" v-show="activeItem ==1 || activeItem ==2">
             <div class="btn-list">
               <a-button-group>
                 <a-button type="primary">绘制</a-button>
@@ -102,9 +69,11 @@
               </ul>
             </div>
           </div>
-          <!-- <div class="drawer-model-body drawer-model-body-extract" v-show="activeItem ==3">
-            <a-table :columns="columns" :data-source="data" size="small" :pagination="false" />
-          </div>-->
+          <div class="drawer-model-body drawer-model-body-extract" v-show="activeItem ==3">
+            <a-table :columns="columns" :data-source="data" size="small" :pagination="false">
+              <a-tag slot="address" slot-scope="text, record, index" :color="'geekblue'" @click="pickUp(text, record, index)">{{ text }}</a-tag>
+            </a-table>
+          </div>
         </a-drawer>
       </div>
     </transition>
@@ -112,6 +81,7 @@
 </template>
 <script>
 import itemTree from "./leftbar_components/itemTree";
+import { queryByGroup } from "@/api/editer.js"
 import bus from "@/bus";
 import { queryGroup } from "@/api/editer.js";
 import { mapState, mapActions } from "vuex";
@@ -130,7 +100,8 @@ const columns = [
   },
   {
     title: "操作",
-    dataIndex: "address"
+    dataIndex: "address",
+    scopedSlots: { customRender: 'address' }
   }
 ];
 const data = [
@@ -311,7 +282,10 @@ export default {
     getBus() {
       bus.$on("exportItem", data => {
         this.data = data;
-      });
+      })
+    },
+    pickUp(text, record, index) {
+      bus.$emit('exportByKey', record);
     }
   },
   watch: {

+ 4 - 4
src/components/edit/right_toolbar.vue

@@ -203,14 +203,14 @@ export default {
           const Item = newVal.itemList[0];
           if (item.name == "X") {
             item.msg = Item.mapToScene(
-              Item.pos.x + Item.boundingRect().x,
-              Item.pos.y + Item.boundingRect().y
+              Item.boundingRect().left,
+              Item.boundingRect().top
             ).x;
           }
           if (item.name == "Y") {
             item.msg = Item.mapToScene(
-              Item.pos.x + Item.boundingRect().x,
-              Item.pos.y + Item.boundingRect().y
+              Item.boundingRect().left,
+              Item.boundingRect().top
             ).y;
           }
           if (item.name == "Width") {

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

@@ -1,12 +1,12 @@
 import { SMouseEvent, SUndoStack } from "@saga-web/base";
 import { SGraphScene, SGraphLayoutType } from '@saga-web/graph/lib';
-import { SPoint, SFont, SColor } from '@saga-web/draw/lib';
 import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder } from "@saga-web/big";
 import { SGraphItem, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
-// import { SZoneLegendItem } from "./SZoneLegendItem";
-import { TipelineItem } from "@/lib/TipelineItem";
-import { SImgTextItem } from "@/lib/SImgTextItem"
-import { SZoneLegendItem } from "@/lib/items/SZoneLegendItem"
+import { SPolygonItem } from "./SPolygonItem";
+import { TipelineItem } from "@/lib/items/TipelineItem";
+import { SImgTextItem } from "@/lib/items/SImgTextItem"
+import { SPoint, SFont } from '@saga-web/draw/lib';
+
 
 /**
  * 在线绘图
@@ -299,8 +299,11 @@ export class EditScence extends SGraphScene {
      */
     updatedPosition(x: number, y: number): void {
         if (this.focusItem) {
-            this.focusItem.x = x;
-            this.focusItem.y = y;
+            let p = this.focusItem.mapFromScene(x, y)
+            // newx - oldx = newleft - oldleft
+            // 要求的值(新的x坐标) - 旧的x坐标 = 新的左边界(用户输入的值) - 旧的左边界
+            this.focusItem.x = p.x - this.focusItem.boundingRect().left + this.focusItem.x;
+            this.focusItem.y = p.y - this.focusItem.boundingRect().top + this.focusItem.y;
         }
     }
 

+ 5 - 5
src/lib/FloorScene.ts

@@ -1,10 +1,10 @@
-import { SGraphScene } from '@saga-web/graph/lib';
+import { SGraphScene, SAnchorItem } from '@saga-web/graph/lib';
 import { SMouseEvent } from '@saga-web/base/lib';
-import { SPoint, SPainter, SRect, SColor } from '@saga-web/draw/lib';
-import { SFloorParser, SImageItem, STextItem, SLineItem, SPolylineItem, SAnchorItem, SItemStatus } from "@saga-web/big";
+import { SPoint, SPainter, SRect, SColor } from '@saga-web/draw';
+import { SFloorParser, SLineItem, SPolylineItem, SItemStatus } from "@saga-web/big";
 import { SMathUtil } from '@saga-web/big/lib/utils/SMathUtil';
-import { SImgTextItem } from './SImgTextItem';
-import { TipelineItem } from './TipelineItem';
+import { SImgTextItem } from './items/SImgTextItem';
+import { TipelineItem } from './items/TipelineItem';
 
 export class FloorScene extends SGraphScene {
 

+ 13 - 0
src/lib/enums/SLineStyle.ts

@@ -0,0 +1,13 @@
+/**
+ * 线样式
+ *
+ * @author  张宇
+ */
+export enum SLineStyle {
+    /** 实线    */
+    Soild,
+    /** 虚线    */
+    Dashed,
+    /** 点线    */
+    Dotted
+} // Enum SLineStyle

+ 5 - 5
src/lib/SImgTextItem.ts

@@ -1,11 +1,11 @@
 import { SItemStatus } from "@saga-web/big/lib/enums/SItemStatus";
 import { SGraphItem } from '@saga-web/graph/lib/SGraphItem';
-import { STextBaseLine } from '@saga-web/draw/lib/enums/STextBaseLine';
+import { STextBaseLine } from '@saga-web/draw/lib';
 import { SMouseEvent } from '@saga-web/base/lib/SMouseEvent';
-import { SSize } from '@saga-web/draw/lib/types/SSize';
-import { SPainter } from '@saga-web/draw/lib/SPainter';
-import { SColor } from '@saga-web/draw/lib/SColor';
-import { SRect } from '@saga-web/draw/lib/types/SRect';
+import { SSize } from '@saga-web/draw/lib';
+import { SPainter } from '@saga-web/draw/lib';
+import { SColor } from '@saga-web/draw/lib';
+import { SRect } from '@saga-web/draw/lib';
 import { SObjectItem, SImageItem, STextItem, SAnchorItem } from '@saga-web/graph/lib';
 
 /**

+ 32 - 0
src/lib/items/STextMarkerItem.ts

@@ -1,6 +1,7 @@
 import { SGraphItem, STextItem } from "@saga-web/graph/lib";
 import { SPainter, SColor } from "@saga-web/draw";
 import { Marker } from '../types/Marker';
+import { SLineStyle } from '../enums/SLineStyle';
 
 /**
  * 标识对象Item(文本类型)
@@ -11,6 +12,26 @@ export class STextMarkerItem extends STextItem {
     /** 标识对象数据 */
     data: Marker;
 
+    /** 边框宽度 */
+    private _lineWidth: number = 1;
+    get lineWidth(): number {
+        return this._lineWidth;
+    }
+    set lineWidth(v: number) {
+        this._lineWidth = v;
+        this.update();
+    }
+    
+    /** 边框样式    */
+    private _borderStyle: SLineStyle = SLineStyle.Soild;
+    get borderStyle(): SLineStyle {
+        return this._borderStyle;
+    }
+    set borderStyle(v: SLineStyle) {
+        this._borderStyle = v;
+        this.update();
+    }
+
     /** x轴缩放属性 */
     _scaleX: number = 1;
     get scaleX(): number {
@@ -119,6 +140,17 @@ export class STextMarkerItem extends STextItem {
         painter.font = this.font;
         painter.scale(this.scaleX, this.scaleY);
         painter.rotate(this.rolate);
+        if (this.borderStyle == SLineStyle.Dashed) {
+            painter.pen.lineDash = [
+                painter.toPx(this.lineWidth * 3),
+                painter.toPx(this.lineWidth * 7)
+            ];
+        } else if (this.borderStyle == SLineStyle.Dotted) {
+            painter.pen.lineDash = [
+                painter.toPx(this.lineWidth),
+                painter.toPx(this.lineWidth)
+            ];
+        }
         this.drawFormatText(painter);
     } // Function onDraw()
 } // Class STextMarkerItem

+ 10 - 8
src/lib/TipelineItem.ts

@@ -1,5 +1,7 @@
-import { SPolylineItem, SAnchorItem } from '@saga-web/big/lib';
-import { SPainter, SColor } from '@saga-web/draw/lib';
+import { SPolylineItem } from '@saga-web/big/lib';
+import { SPainter, SColor } from '@saga-web/draw';
+import { SAnchorItem, SGraphItem } from '@saga-web/graph/lib';
+import { Relation } from '../types/Relation';
 
 /**
  * 管道item
@@ -10,7 +12,9 @@ export class TipelineItem extends SPolylineItem {
   startAnchor: SAnchorItem | null = null;
   /** 结束锚点  */
   endAnchor: SAnchorItem | null = null;
-
+  /** 数据存储  */
+  data: Relation | null = null;
+  /** 接收事件作出修改  */
   changePos() {
     if (this.startAnchor) {
       // 判断删除equip后,不移动
@@ -28,10 +32,8 @@ export class TipelineItem extends SPolylineItem {
     }
   }
 
-  // onDraw(painter:SPainter){
-  //   if (this.startAnchor) {
-
-  //   }
-  //   if (this.endAnchor) 
+  // constructor(parent: SGraphItem | null, data: Relation) {
+  //   super(parent, data.PointList);
+  //   this.data = data;
   // }
 }

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

@@ -12,6 +12,7 @@ import { SImageLegendItem } from '../items/SImageLegendItem';
 import { SImageMarkerItem } from '../items/SImageMarkerItem';
 import { SLineMarkerItem } from '../items/SLineMarkerItem';
 import { STextMarkerItem } from '../items/STextMarkerItem';
+import { TipelineItem } from '../items/TipelineItem';
 
 /**
  * 拓扑图信息解析器
@@ -67,16 +68,16 @@ export class STopologyParser extends SParser {
      * */
     private addLegend(t: Legend): void {
         if (t.GraphElementType == SGraphElementType.None) {
-            let item = this.factory.createNoneLegend(t);
+            let item = new SNoneLegendItem(null, t);
             this.noneLegendList.push(item);
         } else if (t.GraphElementType == SGraphElementType.Line) {
-            let item = this.factory.createLineLegend(t);
+            let item = new SLineLegendItem(null, t)
             this.lineLegendList.push(item);
         } else if (t.GraphElementType == SGraphElementType.Zone) {
-            let item = this.factory.createZoneLegend(t);
+            let item = new SZoneLegendItem(null, t);
             this.zoneLegendList.push(item);
         } else if (t.GraphElementType == SGraphElementType.Image) {
-            let item = this.factory.createImageLegend(t);
+            let item = new SImageLegendItem(null, t);
             this.imageLegendList.push(item);
         }
     } // Function addNode()
@@ -88,13 +89,13 @@ export class STopologyParser extends SParser {
      * */
     private addMarker(t: Marker): void {
         if (t.Type == SMarkerType.Image) {
-            let item = this.factory.createImageMarker(t);
+            let item = new SImageMarkerItem(null, t);
             this.imageMarkerList.push(item);
         } else if (t.Type == SMarkerType.Line) {
-            let item = this.factory.createLineMarker(t);
+            let item = new SLineMarkerItem(null, t);
             this.lineMarkerList.push(item);
         } else if (t.Type == SMarkerType.Text) {
-            let item = this.factory.createTextMarker(t);
+            let item = new STextMarkerItem(null, t);
             this.textMarkerList.push(item);
         }
     } // Function addMarker()
@@ -105,7 +106,7 @@ export class STopologyParser extends SParser {
      * @param   t       管线关系对象数据
      * */
     private addRelation(t: Relation): void {
-        let item = this.factory.createRelation(t);
+        let item = new TipelineItem(null, t);
         this.relationList.push(item);
     } // Function addRelation()
 } // class STopologyParser

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

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