Browse Source

空间 业务空间 墙item整理 从多边形组合 区域组派生

haojianlong 4 years ago
parent
commit
7b242ce057

+ 2 - 2
persagy-web-big/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/big",
-    "version": "2.2.7",
+    "version": "2.2.8",
     "description": "博锐尚格建筑信息化库",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -41,6 +41,6 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@persagy-web/graph": "2.2.10"
+        "@persagy-web/graph": "2.2.12"
     }
 }

+ 3 - 7
persagy-web-big/src/types/Point.ts

@@ -25,12 +25,8 @@
  */
 
 /**
- * 轮廓坐标接口
+ * 拓扑图item创建工厂
  *
- * @author  郝建龙
+ * @author 郝建龙
  */
-export interface Point {
-    X: number;
-    Y: number;
-    Z?: number;
-} // Interface Point
+export class STopoItemFactory {} // Class STopoItemFactory

+ 22 - 70
persagy-web-big/src/items/floor/SColumnItem.ts

@@ -25,28 +25,17 @@
  */
 
 import { Column } from "../../types/floor/Column";
-import { SGraphItem } from "@persagy-web/graph";
-import { SPainter, SPoint, SRect } from "@persagy-web/draw";
-import { ItemColor, ItemOrder } from "../..";
+import { ItemOrder } from "../..";
+import { SGraphPolyGroupItem, SGraphItem, Point } from "@persagy-web/graph";
 
 /**
  * 柱子item
  *
  * @author  郝建龙
  */
-export class SColumnItem extends SGraphItem {
+export class SColumnItem extends SGraphPolyGroupItem {
     /** 柱子数据 */
     data: Column;
-    /** X坐标最小值 */
-    private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
-    private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
-    private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
-    private maxY = Number.MIN_SAFE_INTEGER;
-    /** 柱子轮廓线坐标list */
-    private readonly pointArr: SPoint[][] = [];
 
     /**
      * 构造函数
@@ -55,64 +44,27 @@ export class SColumnItem extends SGraphItem {
      * @param data      柱子数据
      */
     constructor(parent: SGraphItem | null, data: Column) {
-        super(parent);
-        this.data = data;
-        this.zOrder = ItemOrder.columnOrder;
-        let tempArr = this.data.OutLine;
+        const style = {
+            Default: {
+                Stroke: "#000000",
+                Fill: "#000000",
+                LineWidth: 0,
+                Effect: {}
+            }
+        };
+        let tempArr = data.OutLine;
+        let outline: Point[][] = [];
         if (tempArr && tempArr.length) {
-            this.minX = tempArr[0][0].X;
-            this.maxX = this.minX;
-            this.minY = -tempArr[0][0].Y;
-            this.maxY = this.minY;
-            this.pointArr = tempArr.map((t): SPoint[] => {
-                return t.map(
-                    (it): SPoint => {
-                        let x = it.X,
-                            y = -it.Y;
-                        if (x < this.minX) {
-                            this.minX = x;
-                        }
-                        if (y < this.minY) {
-                            this.minY = y;
-                        }
-                        if (x > this.maxX) {
-                            this.maxX = x;
-                        }
-                        if (y > this.maxY) {
-                            this.maxY = y;
-                        }
-                        return new SPoint(x, y);
-                    }
-                );
+            outline = tempArr.map(t => {
+                return t.map(it => {
+                    it.Y = -it.Y;
+                    return it;
+                });
             });
         }
-    } // Constructor
-
-    /**
-     * Item对象边界区域
-     *
-     * @return SRect
-     */
-    boundingRect(): SRect {
-        return new SRect(
-            this.minX,
-            this.minY,
-            this.maxX - this.minX,
-            this.maxY - this.minY
-        );
-    } // Function boundingRect()
 
-    /**
-     * Item绘制操作
-     *
-     * @param   painter       painter对象
-     */
-    onDraw(painter: SPainter): void {
-        painter.pen.color = ItemColor.columnColor;
-        painter.pen.lineWidth = painter.toPx(1);
-        painter.brush.color = ItemColor.columnColor;
-        this.pointArr.forEach((t): void => {
-            painter.drawPolygon(t);
-        });
-    } // Function onDraw()
+        super(parent, { Outline: outline, Style: style });
+        this.data = data;
+        this.zOrder = ItemOrder.columnOrder;
+    } // Constructor
 } // Class SColumnItem

+ 54 - 85
persagy-web-big/src/items/floor/SSpaceItem.ts

@@ -35,28 +35,16 @@ import {
 } from "@persagy-web/draw";
 import { Space } from "../../types/floor/Space";
 import { ItemOrder, ItemColor } from "../..";
-import { SGraphItem } from "@persagy-web/graph";
+import { SGraphItem, SGraphAreaGroupItem } from "@persagy-web/graph";
 
 /**
  * 模型空间item
  *
  * @author  郝建龙
  */
-export class SSpaceItem extends SGraphItem {
+export class SSpaceItem extends SGraphAreaGroupItem {
     /** 空间所有数据 */
     data: Space;
-    /** 空间轮廓线坐标list */
-    readonly pointArr: SPoint[][] = [];
-    /** X坐标最小值 */
-    minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
-    maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
-    minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
-    maxY = Number.MIN_SAFE_INTEGER;
-    /** path对象 */
-    private path = new SPath();
     /** 高亮状态 */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
@@ -110,75 +98,66 @@ export class SSpaceItem extends SGraphItem {
      * @param data      空间数据
      */
     constructor(parent: SGraphItem | null, data: Space) {
-        super(parent);
+        super(parent, {
+            Outline: [
+                data.OutLine.map(t => {
+                    return t.map(it => {
+                        it.Y = -it.Y;
+                        return it;
+                    });
+                })
+            ],
+            Style: {
+                Default: {
+                    Stroke: "#2b2b2b",
+                    Fill: "#f1fffd80",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Selected: {
+                    Stroke: "#2b2b2b",
+                    Fill: "#1abc9c",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Disabled: {
+                    Stroke: "#2b2b2b",
+                    Fill: "#afafaf",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Highlight: {
+                    Stroke: "#2b2b2b",
+                    Fill: "#fbb029",
+                    LineWidth: 1,
+                    Effect: {}
+                }
+            }
+        });
         this.data = data;
         this.zOrder = ItemOrder.spaceOrder;
-        let tempArr = this.data.OutLine;
         this.name = data.Name || "";
-        if (tempArr && tempArr.length) {
-            this.minX = tempArr[0][0].X;
-            this.maxX = this.minX;
-            this.minY = -tempArr[0][0].Y;
-            this.maxY = this.minY;
-            this.pointArr = tempArr.map((t): SPoint[] => {
-                let temp = t.map(
-                    (it): SPoint => {
-                        let x = it.X,
-                            y = -it.Y;
-                        if (x < this.minX) {
-                            this.minX = x;
-                        }
-                        if (y < this.minY) {
-                            this.minY = y;
-                        }
-                        if (x > this.maxX) {
-                            this.maxX = x;
-                        }
-                        if (y > this.maxY) {
-                            this.maxY = y;
-                        }
-                        return new SPoint(x, y);
-                    }
-                );
-                this.path.polygon(temp);
-                return temp;
-            });
-        }
     } // Constructor
 
     /**
-     * Item对象边界区域
-     *
-     * @return SRect
-     */
-    boundingRect(): SRect {
-        return new SRect(
-            this.minX,
-            this.minY,
-            this.maxX - this.minX,
-            this.maxY - this.minY
-        );
-    } // Function boundingRect()
-
-    /**
-     * 判断点是否在区域内
+     * 绘制前设置绘制样式
      *
-     * @param x
-     * @param y
-     */
-    contains(x: number, y: number): boolean {
-        let arr = this.pointArr;
-        if (arr.length < 1 || !SPolygonUtil.pointIn(x, y, arr[0])) {
-            return false;
-        }
-
-        for (let i = 1; i < arr.length; i++) {
-            if (SPolygonUtil.pointIn(x, y, arr[i])) {
-                return false;
+     * */
+    setStyle(): string {
+        let status = "Default";
+        if (this.style) {
+            if (this.highLightFlag) {
+                status = "Highlight";
+            } else if (this.enabled) {
+                if (this.selected) {
+                    status = "Selected";
+                }
+            } else {
+                status = "Disabled";
             }
         }
-        return true;
-    } // Function contains()
+        return status;
+    } // Function setStyle()
 
     /**
      * Item绘制操作
@@ -186,17 +165,7 @@ export class SSpaceItem extends SGraphItem {
      * @param   painter       painter对象
      */
     onDraw(painter: SPainter): void {
-        painter.pen.color = ItemColor.spaceBorderColor;
-        if (this.selected) {
-            painter.brush.color = ItemColor.selectColor;
-        } else if (this.highLightFlag) {
-            painter.brush.color = ItemColor.spaceHighColor;
-        } else {
-            painter.brush.color = ItemColor.spaceColor;
-        }
-        painter.pen.lineWidth = painter.toPx(1);
-        painter.drawPath(this.path);
-
+        super.onDraw(painter);
         if (this.showBaseName) {
             if (this.name && this.name != "null") {
                 painter.brush.color = new SColor(this.nameColor);

+ 24 - 68
persagy-web-big/src/items/floor/SWallItem.ts

@@ -24,31 +24,19 @@
  * *********************************************************************************************************************
  */
 
-import { SPainter, SPoint, SRect, SPath } from "@persagy-web/draw";
 import { Wall } from "../../types/floor/Wall";
 import { ItemOrder, ItemColor } from "../..";
 import { SGraphItem } from "@persagy-web/graph";
+import { Point, SGraphAreaGroupItem } from "@persagy-web/graph";
 
 /**
  * 墙item
  *
  * @author  郝建龙
  */
-export class SWallItem extends SGraphItem {
+export class SWallItem extends SGraphAreaGroupItem {
     /** 墙数据 */
     data: Wall;
-    /** X坐标最小值 */
-    private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
-    private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
-    private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
-    private maxY = Number.MIN_SAFE_INTEGER;
-    /** 墙轮廓线坐标list */
-    private readonly pointArr: SPoint[][] = [];
-    /** path对象 */
-    private path = new SPath();
 
     /**
      * 构造函数
@@ -57,63 +45,31 @@ export class SWallItem extends SGraphItem {
      * @param data      墙数据
      */
     constructor(parent: SGraphItem | null, data: Wall) {
-        super(parent);
-        this.data = data;
-        this.zOrder = ItemOrder.wallOrder;
-        let tempArr = this.data.OutLine;
+        const style = {
+            Default: {
+                Stroke: "#000000",
+                Fill: "#000000",
+                LineWidth: 0,
+                Effect: {}
+            }
+        };
+        let tempArr = data.OutLine;
+        let outline: Point[][] = [];
         if (tempArr && tempArr.length) {
-            this.minX = tempArr[0][0].X;
-            this.maxX = this.minX;
-            this.minY = -tempArr[0][0].Y;
-            this.maxY = this.minY;
-            tempArr.forEach((t): void => {
-                const temp = t.map(
-                    (it): SPoint => {
-                        let x = it.X,
-                            y = -it.Y;
-                        if (x < this.minX) {
-                            this.minX = x;
-                        }
-                        if (y < this.minY) {
-                            this.minY = y;
-                        }
-                        if (x > this.maxX) {
-                            this.maxX = x;
-                        }
-                        if (y > this.maxY) {
-                            this.maxY = y;
-                        }
-                        return new SPoint(x, y);
-                    }
-                );
-                this.path.polygon(temp);
+            outline = tempArr.map(t => {
+                return t.map(it => {
+                    it.Y = -it.Y;
+                    return it;
+                });
             });
         }
-    } // Constructor
 
-    /**
-     * Item对象边界区域
-     *
-     * @return SRect
-     */
-    boundingRect(): SRect {
-        return new SRect(
-            this.minX,
-            this.minY,
-            this.maxX - this.minX,
-            this.maxY - this.minY
-        );
-    } // Function boundingRect()
+        super(parent, {
+            Outline: outline.length ? [outline] : [],
+            Style: style
+        });
 
-    /**
-     * Item绘制操作
-     *
-     * @param   painter       painter对象
-     */
-    onDraw(painter: SPainter): void {
-        painter.pen.color = ItemColor.wallColor;
-        painter.pen.lineWidth = painter.toPx(1);
-        painter.brush.color = ItemColor.wallColor;
-        painter.drawPath(this.path);
-    } // Function onDraw()
+        this.data = data;
+        this.zOrder = ItemOrder.wallOrder;
+    } // Constructor
 } // Class SWallItem

+ 72 - 133
persagy-web-big/src/items/floor/ZoneItem.ts

@@ -24,45 +24,22 @@
  * *********************************************************************************************************************
  */
 
-import {
-    SColor,
-    SPainter,
-    SPath,
-    SPoint,
-    SPolygonUtil,
-    SRect
-} from "@persagy-web/draw";
+import { SColor, SPainter, SPoint, SRect } from "@persagy-web/draw";
 import { SMouseEvent } from "@persagy-web/base";
 import { Zone } from "../../types/floor/Zone";
 import { ItemColor, ItemOrder, Transparency } from "../..";
-import { SGraphItem } from "@persagy-web/graph";
+import { Point, SGraphAreaGroupItem, SGraphItem } from "@persagy-web/graph";
 
 /**
  * 业务空间item
  *
  * @author  郝建龙
  */
-export class SZoneItem extends SGraphItem {
+export class SZoneItem extends SGraphAreaGroupItem {
     /** 空间所有数据 */
     data: Zone;
-    /** 空间轮廓线坐标list */
-    readonly pointArr: SPoint[][][] = [];
-    /** X坐标最小值 */
-    private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
-    private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
-    private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
-    private maxY = Number.MIN_SAFE_INTEGER;
-    /** path */
-    private pathList: SPath[] = [];
     /** 点击位置坐标 */
     private clickPoint: SPoint | undefined;
-    /** 选中时的颜色 */
-    private selectColor: SColor = ItemColor.selectColor;
-    /** 不可选时的颜色 */
-    private unselectColor: SColor = ItemColor.zoneUnselectColor;
     /** 高亮状态 */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
@@ -90,10 +67,6 @@ export class SZoneItem extends SGraphItem {
         this._isInfected = value;
         this.update();
     } // Set isInfected
-    /** 受影响的业务空间填充颜色 */
-    private infectedColor: SColor = ItemColor.zoneInfectedColor;
-    /** 受影响的业务空间边框颜色 */
-    private infectedBorder: SColor = ItemColor.zoneInfectedBorder;
 
     /**
      * 构造函数
@@ -102,69 +75,58 @@ export class SZoneItem extends SGraphItem {
      * @param data      空间数据
      */
     constructor(parent: SGraphItem | null, data: Zone) {
-        super(parent);
+        super(parent, {
+            Outline: data.OutLine.map((t): Point[][] => {
+                return t.map((it): Point[] => {
+                    return it.map(
+                        (item): Point => {
+                            item.Y = -item.Y;
+                            return item;
+                        }
+                    );
+                });
+            }),
+            Style: {
+                Default: {
+                    Stroke: "#00000000",
+                    Fill: "#ffee2280",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Selected: {
+                    Stroke: "#00000000",
+                    Fill: "#1abc9c",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Highlight: {
+                    Stroke: "#00000000",
+                    Fill: data.Color || "#fbb029",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Unselect: {
+                    Stroke: "#00000000",
+                    Fill: "#cecece",
+                    LineWidth: 1,
+                    Effect: {}
+                },
+                Infected: {
+                    Stroke: "#00000000",
+                    Fill: "#ff0000",
+                    LineWidth: 1,
+                    Effect: {}
+                }
+            }
+        });
         this.data = data;
         this.zOrder = ItemOrder.zoneOrder;
         this.highLightFlag = data.HighLightFlag || false;
         this.transparency = data.Transparency || 20;
         this.isInfected = data.Infected || false;
-        if (
-            this.data.OutLine.length &&
-            this.data.OutLine[0] &&
-            this.data.OutLine[0].length
-        ) {
-            let tempArr = this.data.OutLine;
-            this.minX = tempArr[0][0][0].X;
-            this.maxX = this.minX;
-            this.minY = -tempArr[0][0][0].Y;
-            this.maxY = this.minY;
-            // 处理轮廓点数组,同时计算最大最小值
-            this.pointArr = tempArr.map((t): SPoint[][] => {
-                let sPath = new SPath();
-                let tempArr = t.map((it): SPoint[] => {
-                    let array = it.map(
-                        (item): SPoint => {
-                            let x = item.X,
-                                y = -item.Y;
-                            if (x < this.minX) {
-                                this.minX = x;
-                            }
-                            if (y < this.minY) {
-                                this.minY = y;
-                            }
-                            if (x > this.maxX) {
-                                this.maxX = x;
-                            }
-                            if (y > this.maxY) {
-                                this.maxY = y;
-                            }
-                            return new SPoint(x, y);
-                        }
-                    );
-                    sPath.polygon(array);
-                    return array;
-                });
-                this.pathList.push(sPath);
-                return tempArr;
-            });
-        }
     } // Constructor
 
     /**
-     * Item对象边界区域
-     *
-     * @return SRect
-     */
-    boundingRect(): SRect {
-        return new SRect(
-            this.minX,
-            this.minY,
-            this.maxX - this.minX,
-            this.maxY - this.minY
-        );
-    } // Function boundingRect()
-
-    /**
      * 鼠标单击事件
      *
      * @param   event   事件参数
@@ -190,64 +152,41 @@ export class SZoneItem extends SGraphItem {
     } // Function onMouseUp()
 
     /**
-     * 判断点是否在区域内
+     * 绘制前设置绘制样式
      *
-     * @param x
-     * @param y
-     */
-    contains(x: number, y: number): boolean {
-        // return true;
-        for (let j = 0; j < this.pointArr.length; j++) {
-            let arr = this.pointArr[j];
-            if (arr.length < 1 || !SPolygonUtil.pointIn(x, y, arr[0])) {
-                continue;
-            }
-            if (arr.length == 1) {
-                return true;
-            }
-            let flag = false;
-            for (let i = 1; i < arr.length; i++) {
-                if (SPolygonUtil.pointIn(x, y, arr[i])) {
-                    flag = true;
-                    break;
+     * */
+    setStyle(): string {
+        let status = "Default";
+        if (this.style) {
+            if (!this.selectable) {
+                status = "Unselect";
+            } else {
+                if (this.selected) {
+                    status = "Selected";
+                } else if (this.highLightFlag) {
+                    status = "Highlight";
+                } else if (this.isInfected) {
+                    status = "Infected";
+                } else {
+                    status = "Default";
+                    if (this.data.Color) {
+                        this.style.Default.Fill = `${this.data.Color}${
+                            Transparency[this.transparency]
+                        }`;
+                    }
                 }
             }
-            if (flag) {
-                continue;
-            }
-            return true;
         }
-        return false;
-    } // Function contains()
+        return status;
+    } // Function setStyle()
 
     /**
      * Item绘制操作
      *
      * @param   painter painter对象
-     * @param   rect    绘制区域
      */
-    onDraw(painter: SPainter, rect?: SRect): void {
-        painter.pen.color = SColor.Transparent;
-        if (!this.selectable) {
-            painter.brush.color = this.unselectColor;
-        } else {
-            if (this.selected) {
-                painter.brush.color = this.selectColor;
-            } else if (this.highLightFlag) {
-                painter.brush.color = new SColor(this.data.Color);
-            } else if (this.isInfected) {
-                painter.brush.color = this.infectedColor;
-                // painter.pen.color = this.infectedBorder;
-            } else {
-                painter.brush.color = new SColor(
-                    `${this.data.Color}${Transparency[this.transparency]}`
-                );
-            }
-        }
-        painter.pen.lineWidth = painter.toPx(1);
-        this.pathList.forEach((t): void => {
-            painter.drawPath(t);
-        });
+    onDraw(painter: SPainter): void {
+        super.onDraw(painter);
         painter.brush.color = SColor.Black;
         painter.font.size = painter.toPx(10);
         if (this.clickPoint) {

+ 82 - 0
persagy-web-big/src/parser/STopologyParser.ts

@@ -0,0 +1,82 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { SParser } from "./SParser";
+import { TopologyData } from "../types/TopologyData";
+import { MarkerTopo } from "../types/topology/MarkerTopo";
+import { Node } from "../types/topology/Node";
+import { Relation } from "../types/topology/Relation";
+
+/**
+ *  拓扑图信息解析器
+ *
+ */
+export class STopologyParser extends SParser {
+    /** 节点list */
+    nodeList = [];
+    /** 标记list */
+    markList = [];
+    /** 关系list */
+    relationList = [];
+
+    /**
+     * 解析数据
+     *
+     * @param   data    楼层数据
+     * */
+    parseData(data: TopologyData): void {
+        if (data.Marks) {
+            data.Marks.forEach((t: MarkerTopo): void => {
+                this.addMarks(t);
+            });
+        }
+        if (data.Nodes) {
+            data.Nodes.forEach((t: Node): void => {
+                this.addNodes(t);
+            });
+        }
+        if (data.Relations) {
+            data.Relations.forEach((t: Relation): void => {
+                this.addRelations(t);
+            });
+        }
+    } // Function parseData
+
+    /**
+     * 添加标识对象
+     * */
+    private addMarks(t: MarkerTopo): void {} // Function addMarks
+
+    /**
+     * 添加关系对象
+     * */
+    private addRelations(t: Relation): void {} // Function addRelations
+
+    /**
+     * 添加节点对象
+     * */
+    private addNodes(t: Node): void {} // Function addNodes
+} // class STopologyParser

+ 1 - 1
persagy-web-big/src/types/MinDis.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "./Point";
+import { Point } from "@persagy-web/graph";
 
 /**
  * 距离最短点接口

+ 1 - 1
persagy-web-big/src/types/Place.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "./Point";
+import { Point } from "@persagy-web/graph";
 
 /**
  * 位置接口

+ 41 - 0
persagy-web-big/src/types/TopologyData.ts

@@ -0,0 +1,41 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { Node } from "./topology/Node";
+import { MarkerTopo } from "./topology/MarkerTopo";
+import { Relation } from "./topology/Relation";
+
+/**
+ * 对象关系
+ * */
+export interface TopologyData {
+    /** 图例节点 */
+    Nodes: Node[];
+    /** 标识对象 */
+    Marks: MarkerTopo[];
+    /** 对象关系 */
+    Relations: Relation[];
+} // interface TopologyData

+ 1 - 1
persagy-web-big/src/types/floor/Casement.ts

@@ -24,8 +24,8 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
 import { Place } from "../Place";
+import { Point } from "@persagy-web/graph";
 
 /**
  * 窗户item接口

+ 1 - 1
persagy-web-big/src/types/floor/Column.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
 
 /**

+ 1 - 1
persagy-web-big/src/types/floor/Door.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
 
 /**

+ 1 - 1
persagy-web-big/src/types/floor/Space.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
 
 /**

+ 1 - 1
persagy-web-big/src/types/floor/VirtualWall.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
 
 /**

+ 1 - 1
persagy-web-big/src/types/floor/Wall.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
 
 /**

+ 1 - 1
persagy-web-big/src/types/floor/Zone.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "../Point";
+import { Point } from "@persagy-web/graph";
 
 /**
  * 业务空间item接口

+ 37 - 0
persagy-web-big/src/types/topology/Anchor.ts

@@ -0,0 +1,37 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { Point } from "@persagy-web/graph/lib";
+
+/**
+ * 锚点
+ * */
+export interface Anchor {
+    /** ID */
+    ID: string;
+    /** 位置 */
+    Pos: Point;
+} // interface Anchor

+ 51 - 0
persagy-web-big/src/types/topology/MarkerTopo.ts

@@ -0,0 +1,51 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { Point } from "@persagy-web/graph";
+import { Size } from "../Size";
+
+/**
+ * 标识对象接口
+ *
+ * */
+export interface MarkerTopo {
+    /** ID */
+    ID: string;
+    /** 名称 */
+    Name: string;
+    /** 类型 */
+    Type: string;
+    /** 位置 */
+    Pos: Point;
+    /** 缩放 */
+    Scale: Point;
+    /** 旋转 */
+    Rotate: Point;
+    /** 大小 */
+    Size: Size;
+    /** 由应用自己定义 */
+    Properties: any;
+} // interface MarkerTo

+ 61 - 0
persagy-web-big/src/types/topology/Node.ts

@@ -0,0 +1,61 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { Point } from "@persagy-web/graph/lib";
+import { Size } from "../Size";
+import { Anchor } from "./Anchor";
+
+/**
+ * 图例节点
+ * */
+export interface Node {
+    /** ID */
+    ID: string;
+    /** 名称 */
+    Name: string;
+    /** 图例类型 */
+    GraphElementType: string;
+    /** 对应的图元ID */
+    GraphElementId: string;
+    /** 图例数量 */
+    Num: number;
+    /** 节点类型 */
+    Type: string;
+    /** 位置 */
+    Pos: Point;
+    /** 缩放 */
+    Scale: Point;
+    /** 旋转 */
+    Rotate: Point;
+    /** 大小 */
+    Size: Size;
+    /** 锚点 */
+    AnchorList: Anchor[];
+    /** 轮廓线 */
+    OutLine: Point[][];
+    /** 由应用自己定义 */
+    Properties: any;
+} // interface Node

+ 56 - 0
persagy-web-big/src/types/topology/Relation.ts

@@ -0,0 +1,56 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+import { SRelationDir } from "../../enums/SRelationDir";
+import { Point } from "@persagy-web/graph/lib";
+
+/**
+ * 对象关系
+ * */
+export interface Relation {
+    /** ID */
+    ID: string;
+    /** 名称 */
+    Name: string;
+    /** 对应的图元ID */
+    GraphElementId: string;
+    /** 关联节点1_id */
+    Node1ID: string;
+    /** 关联节点2_id */
+    Node2ID: string;
+    /** 关联锚点1_id */
+    Anchor1ID: string;
+    /** 关联锚点2_id */
+    Anchor2ID: string;
+    /** 方向 */
+    Dir: SRelationDir;
+    /** 直线(Line),水平垂直 */
+    LineType: string;
+    /** 线的顶点坐标 */
+    PointList: Point[];
+    /** 线的绘图样式 */
+    Style: any;
+} // interface Relation

+ 1 - 1
persagy-web-big/src/utils/SMathUtil.ts

@@ -26,7 +26,7 @@
 
 import { SLine, SPoint, SRect } from "@persagy-web/draw";
 import { MinDis } from "../types/MinDis";
-import { Point } from "../types/Point";
+import { Point } from "@persagy-web/graph";
 import { PointToLine } from "../types/PointToLine";
 import { Outline } from "../types/Outline";
 // @ts-ignore

+ 1 - 1
persagy-web-graph/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/graph",
-    "version": "2.2.10",
+    "version": "2.2.12",
     "description": "博锐尚格二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 13 - 8
persagy-web-graph/src/SGraphScene.ts

@@ -105,18 +105,23 @@ export class SGraphScene {
 
     /**
      * 所有item占用的矩形区域
+     *
+     * @param   flag 是否只对可见item处理
      */
-    allItemRect(): SRect | null {
+    allItemRect(flag: boolean = true): SRect | null {
         let rect: SRect | null = null;
-
         // 依次取item列中的所有item。将所有item的边界做并焦处理。
         for (let item of this.root.children) {
-            if (rect == null) {
-                rect = item.boundingRect().translated(item.pos.x, item.pos.y);
-            } else {
-                rect.union(
-                    item.boundingRect().translated(item.pos.x, item.pos.y)
-                );
+            if ((flag && item.visible) || !flag) {
+                if (rect == null) {
+                    rect = item
+                        .boundingRect()
+                        .translated(item.pos.x, item.pos.y);
+                } else {
+                    rect.union(
+                        item.boundingRect().translated(item.pos.x, item.pos.y)
+                    );
+                }
             }
         }
 

+ 2 - 2
persagy-web-graph/src/items/SGraphAreaGroupItem.ts

@@ -62,8 +62,8 @@ export class SGraphAreaGroupItem extends SGraphShape {
      * */
     constructor(parent: SGraphItem | null, data: AreaGroup) {
         super(parent, data.Style);
-        if (data.OutLine.length && data.OutLine[0] && data.OutLine[0].length) {
-            let tempArr = data.OutLine;
+        if (data.Outline.length && data.Outline[0] && data.Outline[0].length) {
+            let tempArr = data.Outline;
             this.minX = tempArr[0][0][0].X;
             this.maxX = this.minX;
             this.minY = tempArr[0][0][0].Y;

+ 26 - 24
persagy-web-graph/src/items/SGraphPolyGroupItem.ts

@@ -54,31 +54,33 @@ export class SGraphPolyGroupItem extends SGraphShape {
      * */
     constructor(parent: SGraphItem | null, data: PolyGroup) {
         super(parent, data.Style);
-        this.minX = data.Outline[0][0].X;
-        this.maxX = this.minX;
-        this.minY = data.Outline[0][0].Y;
-        this.maxY = this.minY;
-        this.pointList = data.Outline.map((t): SPoint[] => {
-            return t.map(
-                (it): SPoint => {
-                    let x = it.X,
-                        y = it.Y;
-                    if (x < this.minX) {
-                        this.minX = x;
+        if (data.Outline.length && data.Outline[0] && data.Outline[0].length) {
+            this.minX = data.Outline[0][0].X;
+            this.maxX = this.minX;
+            this.minY = data.Outline[0][0].Y;
+            this.maxY = this.minY;
+            this.pointList = data.Outline.map((t): SPoint[] => {
+                return t.map(
+                    (it): SPoint => {
+                        let x = it.X,
+                            y = it.Y;
+                        if (x < this.minX) {
+                            this.minX = x;
+                        }
+                        if (y < this.minY) {
+                            this.minY = y;
+                        }
+                        if (x > this.maxX) {
+                            this.maxX = x;
+                        }
+                        if (y > this.maxY) {
+                            this.maxY = y;
+                        }
+                        return new SPoint(x, y);
                     }
-                    if (y < this.minY) {
-                        this.minY = y;
-                    }
-                    if (x > this.maxX) {
-                        this.maxX = x;
-                    }
-                    if (y > this.maxY) {
-                        this.maxY = y;
-                    }
-                    return new SPoint(x, y);
-                }
-            );
-        });
+                );
+            });
+        }
     } // Constructor
 
     /**

+ 1 - 1
persagy-web-graph/src/types/AreaGroup.ts

@@ -32,7 +32,7 @@ import { Style } from "./Style";
  * */
 export interface AreaGroup {
     /** 轮廓线集合 */
-    OutLine: Point[][][];
+    Outline: Point[][][];
     /** Item 风格 */
     Style?: Style;
 } // Interface AreaGroup