Browse Source

更新包

haojianlong 4 years ago
parent
commit
c6b6bf04a1

+ 3 - 3
package.json

@@ -10,10 +10,10 @@
     "dependencies": {
         "@mapbox/geojson-merge": "^1.1.1",
         "@saga-web/base": "2.1.22",
-        "@saga-web/big": "1.0.74",
+        "@saga-web/big": "1.0.78",
         "@saga-web/draw": "2.1.100",
-        "@saga-web/feng-map": "1.0.22",
-        "@saga-web/graph": "2.1.105",
+        "@saga-web/feng-map": "1.0.23",
+        "@saga-web/graph": "2.1.108",
         "ant-design-vue": "^1.4.10",
         "axios": "^0.19.2",
         "core-js": "^3.4.4",

+ 1 - 1
src/components/floorMap/index.vue

@@ -366,7 +366,7 @@ export default {
                 // })
                 this.topologyParser.imageLegendList.forEach(t => {
                     let id = t.data.GraphElementId
-                    t.maskFlag = !res.indexOf(id) > -1
+                    t.maskFlag = !(res.indexOf(id) > -1)
                 })
                 this.topologyParser.relationList.forEach(t => {
                     let id = t.data.GraphElementId || t.data.GraphElementID

+ 85 - 72
src/lib/items/SImageLegendItem.js

@@ -1,6 +1,6 @@
-import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem'
-import { ItemOrder, SItemStatus } from '@saga-web/big/lib'
-import { SFont, SColor } from '@saga-web/draw/lib'
+import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
+import { ItemOrder, SItemStatus } from '@saga-web/big/lib';
+import { SFont, SColor } from '@saga-web/draw/lib';
 /**
  * 图例节点Item(图标类型)
  *
@@ -14,112 +14,124 @@ export class SImageLegendItem extends SIconTextItem {
      * @param data      图例节点对象数据
      */
     constructor(parent, data) {
-        super(parent, data.AnchorList)
+        super(parent, data.AnchorList);
         /** 图例数量 */
-        this._num = 1
+        this._num = 1;
         /** 是否蒙版遮罩  */
-        this._maskFlag = false
-        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)
+        this._maskFlag = false;
+        this.isTransform = false;
+        this.zOrder = ItemOrder.markOrder;
+        this.data = data;
+        this.id = data.ID;
+        this.name = data.Name;
+        this.text = 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.Properties && data.Properties.Url) {
-            this.img.url = data.Properties.Url
-        }
-        if (data.Properties.ImgPos) {
-            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.img.url = data.Properties.Url;
         }
         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.ImgPos) {
+            this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
         }
         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.TextPos) {
+            this.textItem.moveTo(data.Properties.TextPos.X, data.Properties.TextPos.Y);
+        }
+        else {
+            // 偏移二分之一文本高度
+            this.textItem.moveTo((this.img.width * 0.5) + 2, -(this.font.size * 0.5));
         }
         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
+            this.isActive = true;
         }
         if (data.Properties && data.Properties.FrameColor) {
-            this.activeColor = new SColor(data.Properties.FrameColor)
+            this.activeColor = new SColor(data.Properties.FrameColor);
         }
     }
     get num() {
-        return this._num
+        return this._num;
     }
     set num(v) {
         if (v) {
-            this._num = v
-            this.data.Num = v
-        } else {
-            this._num = 1
-            this.data.Num = 1
-        }
-        this.data.Properties.Num = this._num
-        this.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`
-        this.update()
+            this._num = v;
+            this.data.Num = v;
+        }
+        else {
+            this._num = 1;
+            this.data.Num = 1;
+        }
+        this.data.Properties.Num = this._num;
+        this.textItem.text = `${this.name}${this.num > 1 ? `×${this.num}` : ''}`;
+        this.update();
     }
     get text() {
-        return this.textItem.text
+        return this.textItem.text;
     }
     set text(v) {
-        this.name = v
-        this.data.Name = v
-        this.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`
-        this.update()
+        this.name = v;
+        this.data.Name = v;
+        this.textItem.text = `${this.name}${this.num > 1 ? `×${this.num}` : ''}`;
+        this.update();
     }
     get maskFlag() {
-        return this._maskFlag
+        return this._maskFlag;
     }
     set maskFlag(v) {
         if (v === this._maskFlag) {
-            return
+            return;
+        }
+        this._maskFlag = v;
+        if (v) {
+            this.textItem.visible = false;
+        }
+        else {
+            this.textItem.visible = true;
         }
-        this._maskFlag = v
-        this.update()
+        this.update();
     }
     toData() {
-        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,
-                },
-            }
-        })
-        return this.data
+                    Y: t.y
+                }
+            };
+        });
+        return this.data;
     }
     /**
      * Item绘制框架
@@ -128,14 +140,15 @@ export class SImageLegendItem extends SIconTextItem {
      * @param   rect          绘制区域
      */
     onPaint(painter, rect) {
-        super.onPaint(painter, rect)
+        super.onPaint(painter, rect);
         if (this.maskFlag && this.status == SItemStatus.Normal) {
-            painter.pen.color = SColor.Transparent
-            painter.brush.color = new SColor('#ffffffa1')
+            painter.pen.color = SColor.Transparent;
+            painter.brush.color = new SColor("#ffffffa1");
             if (this.selected) {
-                painter.drawCircle(this.img.x, this.img.y, (this.sWidth / 2.0) * 1.25)
-            } else {
-                painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0)
+                painter.drawCircle(this.img.x, this.img.y, (this.sWidth / 2.0) * 1.25);
+            }
+            else {
+                painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0);
             }
         }
     } // Function onPaint()

+ 80 - 71
src/lib/items/SImageLegendItem.ts

@@ -1,8 +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, SItemStatus } from '@saga-web/big/lib'
-import { SFont, SColor, SPainter, SRect } 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, SItemStatus } from '@saga-web/big/lib';
+import { SFont, SColor, SPainter, SRect } from '@saga-web/draw/lib';
 /**
  * 图例节点Item(图标类型)
  *
@@ -10,45 +10,50 @@ import { SFont, SColor, SPainter, SRect } 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.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`
-        this.update()
+        this.data.Properties.Num = this._num;
+        this.textItem.text = `${this.name}${this.num > 1 ? `×${this.num}` : ''}`;
+        this.update();
     }
 
     get text(): string {
-        return this.textItem.text
+        return this.textItem.text;
     }
     set text(v: string) {
-        this.name = v
-        this.data.Name = v
-        this.textItem.text = `${this.name}${this.num > 1 ? ` × ${this.num}` : ''}`
-        this.update()
+        this.name = v;
+        this.data.Name = v;
+        this.textItem.text = `${this.name}${this.num > 1 ? `×${this.num}` : ''}`;
+        this.update();
     }
 
-    /** 是否蒙版遮罩  */
-    _maskFlag: boolean = false
+     /** 是否蒙版遮罩  */
+    _maskFlag: boolean = false;
     get maskFlag(): boolean {
-        return this._maskFlag
+        return this._maskFlag;
     }
     set maskFlag(v: boolean) {
         if (v === this._maskFlag) {
-            return
+        return
+        }
+        this._maskFlag = v;
+        if (v) {
+            this.textItem.visible = false;
+        } else {
+            this.textItem.visible = true;
         }
-        this._maskFlag = v
         this.update()
     }
 
@@ -59,76 +64,79 @@ 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.text = 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.text = 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.Properties && data.Properties.Url) {
-            this.img.url = data.Properties.Url
-        }
-        if (data.Properties.ImgPos) {
-            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.img.url = data.Properties.Url;
         }
         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.ImgPos) {
+            this.img.moveTo(data.Properties.ImgPos.X, data.Properties.ImgPos.Y);
         }
         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.TextPos) {
+            this.textItem.moveTo(data.Properties.TextPos.X, data.Properties.TextPos.Y);
+        } else {
+            // 偏移二分之一文本高度
+            this.textItem.moveTo((this.img.width * 0.5) + 2, -(this.font.size * 0.5));
         }
         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
+            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;
     }
 
     /**
@@ -138,15 +146,16 @@ export class SImageLegendItem extends SIconTextItem {
      * @param   rect          绘制区域
      */
     onPaint(painter: SPainter, rect: SRect): void {
-        super.onPaint(painter, rect)
+        super.onPaint(painter, rect);
         if (this.maskFlag && this.status == SItemStatus.Normal) {
-            painter.pen.color = SColor.Transparent
-            painter.brush.color = new SColor('#ffffffa1')
+            painter.pen.color = SColor.Transparent;
+            painter.brush.color = new SColor("#ffffffa1");
             if (this.selected) {
-                painter.drawCircle(this.img.x, this.img.y, (this.sWidth / 2.0) * 1.25)
+                painter.drawCircle(this.img.x, this.img.y, (this.sWidth / 2.0) * 1.25);
             } else {
-                painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0)
+                painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0);
             }
         }
     } // Function onPaint()
+    
 } // Class SImageLegendItem

File diff suppressed because it is too large
+ 20 - 0
src/lib/items/SImageMarkerItem.js


File diff suppressed because it is too large
+ 21 - 1
src/lib/items/SImageMarkerItem.ts


+ 9 - 1
src/lib/items/STextMarkerItem.js

@@ -1,5 +1,5 @@
 import { STextItem } from "@saga-web/graph/lib";
-import { SColor, SFont } from "@saga-web/draw";
+import { SColor, SFont, SPoint } from "@saga-web/draw";
 import { ItemOrder } from '@saga-web/big/lib';
 /**
  * 标识对象Item(文本类型)
@@ -39,6 +39,14 @@ export class STextMarkerItem extends STextItem {
             this.backgroundColor = new SColor(data.Properties.BackgroundColor);
         }
     } // Constructor
+    /**
+     * 根据换行切割文本,绘制多行并计算外轮廓宽高
+     *
+     */
+    drawFormatText() {
+        super.drawFormatText();
+        this.origin = new SPoint(this.width / 2, this.height / 2);
+    } // Function drawFormatText()
     toData() {
         this.data.Pos = { X: this.x, Y: this.y };
         this.data.Size = { Width: this.width, Height: this.height };

+ 10 - 2
src/lib/items/STextMarkerItem.ts

@@ -1,5 +1,5 @@
 import { SGraphItem, STextItem, SLineStyle } from "@saga-web/graph/lib";
-import { SPainter, SColor,SFont } from "@saga-web/draw";
+import { SPainter, SColor,SFont, SPoint } from "@saga-web/draw";
 import { Marker } from '../types/Marker';
 import { ItemOrder } from '@saga-web/big/lib';
 
@@ -20,7 +20,6 @@ export class STextMarkerItem extends STextItem {
      */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
-        this.isTransform = false;
         this.zOrder = ItemOrder.textOrder;
         this.isTransform = false;
         this.data = data;
@@ -45,6 +44,15 @@ export class STextMarkerItem extends STextItem {
         }
     } // Constructor
 
+    /**
+     * 根据换行切割文本,绘制多行并计算外轮廓宽高
+     *
+     */
+    protected drawFormatText(): void {
+        super.drawFormatText();
+        this.origin = new SPoint(this.width / 2, this.height / 2);
+    } // Function drawFormatText()
+
     toData(): Marker {
         this.data.Pos = {X: this.x, Y: this.y};
         this.data.Size = {Width: this.width, Height: this.height};