Explorar o código

平面图组件修改

yx %!s(int64=4) %!d(string=hai) anos
pai
achega
1a550ce767

+ 18 - 23
src/components/floorMap/index.vue

@@ -91,10 +91,6 @@ export default {
                     let imgItem = new SImageItem(null, `${this.mapServerURL}/webtheme/${this.fmapID}/${window.fengmapData.frImg}`)
                     this.scene.addItem(imgItem)
                     this.view.scene = this.scene
-                    this.view.minScale = this.view.scale
-                    if (this.$refs.canvasFun) {
-                        this.$refs.canvasFun.everyScale = this.view.scale
-                    }
                     this.view.fitSceneToView()
                 }
             } else {
@@ -108,7 +104,6 @@ export default {
                         this.fParser.parseData(res)
                         this.fParser.spaceList.forEach(t => {
                             this.scene.addItem(t)
-                            t.nameSize = 16
                             if (t.data.Name && this.bunkObj[t.data.Name]) {
                                 t.name = this.bunkObj[t.data.Name].detailtype
                             } else {
@@ -122,10 +117,6 @@ export default {
                         this.fParser.casementList.forEach(t => this.scene.addItem(t))
                         this.view.scene = this.scene
                         this.view.fitSceneToView()
-                        this.view.minScale = this.view.scale
-                        if (this.$refs.canvasFun) {
-                            this.$refs.canvasFun.everyScale = this.view.scale
-                        }
                     })
                 } else {
                     console.log('楼层不正确')
@@ -191,6 +182,10 @@ export default {
                     this.scene.addItem(t)
                 })
                 this.view.fitSceneToView()
+                this.view.minScale = this.view.scale
+                if (this.$refs.canvasFun) {
+                    this.$refs.canvasFun.everyScale = this.view.scale
+                }
             })
         },
         clearGraphy() {
@@ -342,25 +337,25 @@ export default {
                     let id = t.data.GraphElementId
                     t.maskFlag = !(res.indexOf(id) > -1)
                 })
-                this.topologyParser.textMarkerList.forEach(t => {
-                    let id = t.data.GraphElementId
-                    t.maskFlag = !(res.indexOf(id) > -1)
-                })
-                this.topologyParser.imageMarkerList.forEach(t => {
-                    let id = t.data.GraphElementId
-                    t.maskFlag = !(res.indexOf(id) > -1)
-                })
-                this.topologyParser.lineMarkerList.forEach(t => {
-                    let id = t.data.GraphElementId
-                    t.maskFlag = !(res.indexOf(id) > -1)
-                })
+                // this.topologyParser.textMarkerList.forEach(t => {
+                //     let id = t.data.GraphElementId
+                //     t.maskFlag = !(res.indexOf(id) > -1)
+                // })
+                // this.topologyParser.imageMarkerList.forEach(t => {
+                //     let id = t.data.GraphElementId
+                //     t.maskFlag = !(res.indexOf(id) > -1)
+                // })
+                // this.topologyParser.lineMarkerList.forEach(t => {
+                //     let id = t.data.GraphElementId
+                //     t.maskFlag = !(res.indexOf(id) > -1)
+                // })
                 this.topologyParser.imageLegendList.forEach(t => {
                     let id = t.data.GraphElementId
-                    t.maskFlag = !(res.indexOf(id) > -1)
+                    t.selected = (res.indexOf(id) > -1)
                 })
                 this.topologyParser.relationList.forEach(t => {
                     let id = t.data.GraphElementId
-                    t.maskFlag = !(res.indexOf(id) > -1)
+                    t.selected = (res.indexOf(id) > -1)
                 })
             })
         }

+ 11 - 0
src/lib/items/SImageLegendItem.js

@@ -54,6 +54,15 @@ export class SImageLegendItem extends SIconTextItem {
         if (data.Properties && data.Properties.color) {
             this.color = new SColor(data.Properties.color);
         }
+        if (data.Properties && data.Properties.IsActive) {
+            this.isActive = data.Properties.IsActive;
+        }
+        if (data.AttachObjectIds && data.AttachObjectIds.length) {
+            this.isActive = true;
+        }
+        if (data.Properties && data.Properties.FrameColor) {
+            this.activeColor = new SColor(data.Properties.FrameColor);
+        }
     }
     get num() {
         return this._num;
@@ -82,6 +91,8 @@ export class SImageLegendItem extends SIconTextItem {
         this.data.Properties.sHeight = this.sHeight;
         this.data.Properties.font = this.font.size;
         this.data.Properties.color = this.color.value;
+        this.data.Properties.FrameColor = this.activeColor.value;
+        this.data.Properties.IsActive = this.isActive;
         this.data.AnchorList = this.anchorList.map(t => {
             return {
                 ID: t.id,

+ 54 - 52
src/lib/items/SImageLegendItem.ts

@@ -1,9 +1,8 @@
-
-import { SGraphItem } from "@saga-web/graph/lib";
-import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
-import { Legend } from '../types/Legend';
-import { ItemOrder } from '@saga-web/big/lib';
-import { SFont, SColor } from '@saga-web/draw/lib';
+import { SGraphItem } from '@saga-web/graph/lib'
+import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem'
+import { Legend } from '../types/Legend'
+import { ItemOrder } from '@saga-web/big/lib'
+import { SFont, SColor } from '@saga-web/draw/lib'
 /**
  * 图例节点Item(图标类型)
  *
@@ -11,23 +10,23 @@ import { SFont, SColor } from '@saga-web/draw/lib';
  */
 export class SImageLegendItem extends SIconTextItem {
     /** 图例节点对象数据 */
-    data: Legend;
+    data: Legend
     /** 图例数量 */
-    _num: number = 1;
+    _num: number = 1
     get num(): number {
-        return this._num;
+        return this._num
     }
     set num(v: number) {
         if (v) {
-            this._num = v;
-            this.data.Num = v;
+            this._num = v
+            this.data.Num = v
         } else {
-            this._num = 1;
-            this.data.Num = 1;
+            this._num = 1
+            this.data.Num = 1
         }
-        this.data.Properties.Num = this._num;
-        this.text = `${this.data.Name}${this.data.Num > 1 ? ` × ${this.data.Num}` : ''}`;
-        this.update();
+        this.data.Properties.Num = this._num
+        this.text = `${this.data.Name}${this.data.Num > 1 ? ` × ${this.data.Num}` : ''}`
+        this.update()
     }
 
     /**
@@ -37,74 +36,77 @@ export class SImageLegendItem extends SIconTextItem {
      * @param data      图例节点对象数据
      */
     constructor(parent: SGraphItem | null, data: Legend) {
-        super(parent, data.AnchorList);
-        this.isTransform = false;
-        this.zOrder = ItemOrder.markOrder;
-        this.data = data;
-        this.id = data.ID;
-        this.name = data.Name;
-        this.moveTo(data.Pos.X, data.Pos.Y);
+        super(parent, data.AnchorList)
+        this.isTransform = false
+        this.zOrder = ItemOrder.markOrder
+        this.data = data
+        this.id = data.ID
+        this.name = data.Name
+        this.moveTo(data.Pos.X, data.Pos.Y)
         if (data.Num) {
-            this._num = data.Num;
+            this._num = data.Num
         }
         if (data.Size) {
-            this.width = data.Size.Width;
-            this.height = data.Size.Height;
+            this.width = data.Size.Width
+            this.height = data.Size.Height
         }
         if (data.Num) {
-            this.text = `${data.Name}${data.Num > 1 ? ` × ${data.Num}` : ''}`;
+            this.text = `${data.Name}${data.Num > 1 ? ` × ${data.Num}` : ''}`
         }
         if (data.Properties && data.Properties.Url) {
-            this.img.url = data.Properties.Url;
+            this.img.url = data.Properties.Url
         }
         if (data.Properties.ImgPos) {
-            this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
+            this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y)
         }
         if (data.Properties.TextPos) {
-            this.textItem.moveTo(data.Properties.TextPos.X, data.Properties.TextPos.Y);
+            this.textItem.moveTo(data.Properties.TextPos.X, data.Properties.TextPos.Y)
         }
         if (data.Properties && data.Properties.sWidth) {
-            this.sWidth = data.Properties.sWidth;
+            this.sWidth = data.Properties.sWidth
         }
         if (data.Properties && data.Properties.sHeight) {
-            this.sHeight = data.Properties.sHeight;
+            this.sHeight = data.Properties.sHeight
         }
         if (data.Properties && data.Properties.font) {
-            this.font = new SFont("sans-serif", data.Properties.font);
+            this.font = new SFont('sans-serif', data.Properties.font)
         }
         if (data.Properties && data.Properties.color) {
-            this.color = new SColor(data.Properties.color);
+            this.color = new SColor(data.Properties.color)
         }
         if (data.Properties && data.Properties.IsActive) {
-            this.isActive = data.Properties.IsActive;
+            this.isActive = data.Properties.IsActive
+        }
+        if (data.AttachObjectIds && data.AttachObjectIds.length) {
+            this.isActive = true
         }
         if (data.Properties && data.Properties.FrameColor) {
-            this.activeColor = new SColor(data.Properties.FrameColor);
+            this.activeColor = new SColor(data.Properties.FrameColor)
         }
     }
 
     toData(): Legend {
-        this.data.Pos = { X: this.x, Y: this.y };
-        this.data.Size = { Width: this.width, Height: this.height };
-        this.data.Name = this.name;
-        this.data.Properties.Url = this.img.url;
-        this.data.Properties.TextPos = { X: this.textItem.x, Y: this.textItem.y };
-        this.data.Properties.ImgPos = { X: this.img.x, Y: this.img.y };
-        this.data.Properties.sWidth = this.sWidth;
-        this.data.Properties.sHeight = this.sHeight;
-        this.data.Properties.font = this.font.size;
-        this.data.Properties.color = this.color.value;
-        this.data.Properties.FrameColor = this.activeColor.value;
-        this.data.Properties.IsActive = this.isActive;
-        this.data.AnchorList = this.anchorList.map(t => {
+        this.data.Pos = { X: this.x, Y: this.y }
+        this.data.Size = { Width: this.width, Height: this.height }
+        this.data.Name = this.name
+        this.data.Properties.Url = this.img.url
+        this.data.Properties.TextPos = { X: this.textItem.x, Y: this.textItem.y }
+        this.data.Properties.ImgPos = { X: this.img.x, Y: this.img.y }
+        this.data.Properties.sWidth = this.sWidth
+        this.data.Properties.sHeight = this.sHeight
+        this.data.Properties.font = this.font.size
+        this.data.Properties.color = this.color.value
+        this.data.Properties.FrameColor = this.activeColor.value
+        this.data.Properties.IsActive = this.isActive
+        this.data.AnchorList = this.anchorList.map((t) => {
             return {
                 ID: t.id,
                 Pos: {
                     X: t.x,
-                    Y: t.y
-                }
+                    Y: t.y,
+                },
             }
         })
-        return this.data;
+        return this.data
     }
 } // Class SImageLegendItem