YaolongHan 4 jaren geleden
bovenliggende
commit
d1c728b90b

+ 2 - 2
src/api/editer.js

@@ -1,7 +1,7 @@
 // 登录校验接口
 import httputils from '@/api/httputils'
-const serveApi = '/serve/topology-wanda';
-const testApi = '/serve'
+const testApi = '/serve/topology-wanda';
+// const testApi = '/serve'
 //获取图例分类结构
 export function queryByGroup(params) {
     return httputils.getJson(`${testApi}/graphCategory/queryByGroup`, params)

+ 4 - 3
src/components/baseEditer.vue

@@ -31,7 +31,7 @@ export default {
     return {
       appName: "万达可视化系统",
       key: "23f30a832a862c58637a4aadbf50a566",
-      mapServerURL: "/wanda",
+      mapServerURL: "/wdfn",
       fmapID: "1001724_29",
       fmap: null,
       canvasWidth: 700,
@@ -56,7 +56,7 @@ export default {
       this.scene = new EditScence();
       this.fmap = new SFengParser(
         "fengMap",
-        this.mapServerURL,
+        this.mapServerURL+'/1001724_29',
         this.key,
         this.appName,
         null
@@ -83,6 +83,7 @@ export default {
         parserData.parseData(data.data.Data[0].Elements);
         parserData.zoneLegendList.forEach(t => {
           this.scene.addItem(t);
+          this.scene.Nodes.push(t)
         });
       });
       this.scene.emitChange = this.emitChange;
@@ -189,7 +190,7 @@ export default {
     // 读取数据
     readGroup() {
       const data = {
-        graphId: "000423a4afdc421da6c6096cedf48552",
+        graphId: "f37e59ec5bfa4e76939582f55efca29a",
         projectId: 1
       };
       return readGroup(data);

+ 25 - 9
src/components/mapClass/EditScence.ts

@@ -4,10 +4,11 @@ import { SFloorParser, SLineItem, SPolylineItem, SItemStatus, ItemOrder } from "
 import { SGraphItem, SImageItem, STextItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate, SGraphAddCommand } from "@saga-web/graph/lib";
 import { SZoneLegendItem } from "@/lib/items/SZoneLegendItem";
 import { TipelineItem } from "@/lib/items/TipelineItem";
-import { SImgTextItem } from "@/lib/items/SImgTextItem"
+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 {uuid} from "@/components/mapClass/until"
+import { uuid } from "@/components/mapClass/until"
 
 /**
  * 在线绘图
@@ -149,11 +150,11 @@ export class EditScence extends SGraphScene {
             Num: 123
         }
         const LegendData: Legend = {
-            ID:uuid(),
+            ID: uuid(),
             Name: this._legend.Name,
             GraphElementType: this._legend.Type,
             Num: 0,
-            GraphElementId:this._legend.Id,
+            GraphElementId: this._legend.Id,
             AttachObjectIds: [],
             Pos: { x: 0, y: 0 },
             OutLine: [[new SPoint(event.x, event.y)]],
@@ -166,7 +167,7 @@ export class EditScence extends SGraphScene {
             },
         }
 
-        const Polylines = new SZoneLegendItem(null,LegendData);
+        const Polylines = new SZoneLegendItem(null, LegendData);
         Polylines.selectable = true;
         //设置状态
         Polylines.setStatus = SItemStatus.Create;
@@ -185,13 +186,28 @@ export class EditScence extends SGraphScene {
      * 增加图片Item
      */
     addImgItem(event: SMouseEvent) {
-        const url = require('./../../assets/logo.png')
-        const item = new SImageItem(null);
-        item.url = url;
+        const data = {
+            /** ID */
+            ID:'123',
+            /** 名称  */
+            Name: '嗡嗡嗡',
+            /** 图标(Image),线类型(Line) */
+            Type: 'Image',
+            /** 位置  */
+            Pos: new SPoint(event.x, event.y),
+            /** 由应用自己定义  */
+            Properties:{
+                Url:require('./../../assets/logo.png'),
+                Name: '嗡嗡嗡',
+            }
+        }
+
+        const item = new SImageMarkerItem(null, data);
+        // item.url = url;
         item.zOrder = ItemOrder.imageOrder;
         item.selectable = true;
         item.moveable = true;
-        item.moveTo(event.x, event.y);
+        // item.moveTo(event.x, event.y);
         this.addItem(item);
         this.grabItem == null;
         this.focusItem = item;

+ 7 - 6
src/lib/items/SImageMarkerItem.ts

@@ -51,9 +51,9 @@ export class SImageMarkerItem extends SImageItem {
         this.update();
     }
 
-    set name(v: string) {
-        this.data.Name = v;
-    }
+    // set name(v: string) {
+    //     this.data.Name = v;
+    // }
 
     set url(v: string) {
         if (this.data.Properties) {
@@ -103,9 +103,10 @@ export class SImageMarkerItem extends SImageItem {
             this.height = this.data.Size.Height;
         }
         if (this.data.Properties && this.data.Properties.Url) {
-            if (this.data.Properties.Url instanceof String) {
-                this.url = this.data.Properties.Url;
-            }
+            // if (this.data.Properties.Url instanceof String) {
+
+            // }
+            this.url = this.data.Properties.Url;
         }
     } // Constructor
 

+ 2 - 1
src/lib/items/SZoneLegendItem.ts

@@ -73,7 +73,8 @@ export class SZoneLegendItem extends SPolygonItem {
             }
 
             // 设置线宽
-            this.lineWidth = data.Properties.lineWidth;
+            this.lineWidth = data.LineWidth;
+            console.log('lineWidth',this.lineWidth)
             // 设置线宽颜色
             this.strokeColor = data.Properties.strokeColor.includes('#') ? new SColor(data.Properties.strokeColor) : new SColor(hexify(data.Properties.strokeColor));
             this.fillColor = data.Properties.fillColor.includes('#') ? new SColor(data.Properties.fillColor) : new SColor(hexify(data.Properties.fillColor))

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

@@ -29,7 +29,7 @@ import { SMarkerType } from "../../enums/SMarkerType";
  */
 export interface Marker {
     /** ID */
-    ID: string;
+    ID?: string;
     /** 名称  */
     Name: string;
     /** 图标(Image),线类型(Line) */

+ 2 - 2
vue.config.js

@@ -14,8 +14,8 @@ module.exports = {
                 },
             },
             "/serve": {
-                // target: 'http://192.168.200.87:8088/',
-                 target: 'http://192.168.200.83:8085/',
+                target: 'http://192.168.200.87:8088/',
+                //  target: 'http://192.168.200.83:8085/',
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {