Explorar o código

解析器添加;旧item添加修改

haojianlong %!s(int64=5) %!d(string=hai) anos
pai
achega
6045382af1
Modificáronse 54 ficheiros con 2693 adicións e 82 borrados
  1. 3 3
      saga-web-big/package.json
  2. 0 32
      saga-web-big/src/SImageItem.ts
  3. 0 8
      saga-web-big/src/STextItem.ts
  4. 65 0
      saga-web-big/src/config/ItemColor.ts
  5. 55 0
      saga-web-big/src/config/ItemOrder.ts
  6. 128 0
      saga-web-big/src/config/Transparency.ts
  7. 97 0
      saga-web-big/src/factories/SItemFactory.ts
  8. 32 14
      saga-web-big/src/index.ts
  9. 77 0
      saga-web-big/src/items/SImageItem.ts
  10. 1 1
      saga-web-big/src/SLayerItem.ts
  11. 1 1
      saga-web-big/src/SObjectItem.ts
  12. 75 0
      saga-web-big/src/items/STextItem.ts
  13. 0 0
      saga-web-big/src/items/STooltipItem.ts
  14. 93 0
      saga-web-big/src/items/floor/SColumnItem.ts
  15. 0 0
      saga-web-big/src/items/floor/SCompassItem.ts
  16. 158 0
      saga-web-big/src/items/floor/SDoorItem.ts
  17. 0 0
      saga-web-big/src/items/floor/SFloorItem.ts
  18. 74 0
      saga-web-big/src/items/floor/SHighlightItem.ts
  19. 204 0
      saga-web-big/src/items/floor/SSpaceItem.ts
  20. 113 0
      saga-web-big/src/items/floor/SVirtualWallItem.ts
  21. 113 0
      saga-web-big/src/items/floor/SWallItem.ts
  22. 83 0
      saga-web-big/src/items/floor/SWindowItem.ts
  23. 255 0
      saga-web-big/src/items/floor/ZoneItem.ts
  24. 0 0
      saga-web-big/src/items/topology/SAnchorItem.ts
  25. 0 0
      saga-web-big/src/items/topology/SCurveRelation.ts
  26. 1 1
      saga-web-big/src/SEntityItem.ts
  27. 0 0
      saga-web-big/src/items/topology/SLineRelation.ts
  28. 1 1
      saga-web-big/src/SRelation.ts
  29. 0 0
      saga-web-big/src/items/topology/SVerticalRelation.ts
  30. 2 2
      saga-web-big/src/parser/SBigParser.ts
  31. 2 2
      saga-web-big/src/parser/SEquipParser.ts
  32. 126 2
      saga-web-big/src/parser/SFloorParser.ts
  33. 21 0
      saga-web-big/src/parser/SParser.ts
  34. 2 2
      saga-web-big/src/parser/STopologyParser.ts
  35. 30 2
      saga-web-big/src/parser/SZoneParser.ts
  36. 40 0
      saga-web-big/src/types/FloorData.ts
  37. 4 0
      saga-web-big/src/types/ImageData.ts
  38. 15 0
      saga-web-big/src/types/Marker.ts
  39. 33 0
      saga-web-big/src/types/MinDis.ts
  40. 33 0
      saga-web-big/src/types/Outline.ts
  41. 31 0
      saga-web-big/src/types/Place.ts
  42. 30 0
      saga-web-big/src/types/Point.ts
  43. 32 0
      saga-web-big/src/types/PointToLine.ts
  44. 27 0
      saga-web-big/src/types/TextData.ts
  45. 48 0
      saga-web-big/src/types/floor/Casement.ts
  46. 42 0
      saga-web-big/src/types/floor/Column.ts
  47. 52 0
      saga-web-big/src/types/floor/Door.ts
  48. 46 0
      saga-web-big/src/types/floor/Space.ts
  49. 40 0
      saga-web-big/src/types/floor/VirtualWall.ts
  50. 44 0
      saga-web-big/src/types/floor/Wall.ts
  51. 45 0
      saga-web-big/src/types/floor/Zone.ts
  52. 0 9
      saga-web-big/src/utils/SImageUtil.ts
  53. 317 0
      saga-web-big/src/utils/SMathUtil.ts
  54. 2 2
      saga-web-big/tsconfig.json

+ 3 - 3
saga-web-big/package.json

@@ -1,7 +1,7 @@
 {
     "name": "@saga-web/big",
-    "version": "1.0.1",
-    "description": "上格云Web基础库。",
+    "version": "1.0.2",
+    "description": "上格云Web平面图。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
     "scripts": {
@@ -15,7 +15,7 @@
         "sybotan",
         "base"
     ],
-    "author": "庞利祥 (sybotan@126.com)",
+    "author": "郝建龙 (1061851420@qq.com)",
     "license": "ISC",
     "publishConfig": {
         "registry": "http://dev.dp.sagacloud.cn:8082/repository/npm-hosted/"

+ 0 - 32
saga-web-big/src/SImageItem.ts

@@ -1,32 +0,0 @@
-import { SObjectItem } from "./SObjectItem";
-import { SGraphyItem } from "@saga-web/graphy/lib";
-import { ImageData } from "./types/ImageData";
-
-/**
- *  图片绘制
- *
- * * @author  郝建龙(1061851420@qq.com)
- */
-export class SImageItem extends SObjectItem {
-    /** 标志宽度 */
-    private width: number = 28;
-    /** 标志高度 */
-    private height: number = 37;
-    /** 图片地址    */
-    url: string = "";
-    /** 图片dom */
-    Img: CanvasImageSource;
-
-    /**
-     * 构造函数
-     *
-     *  @param parent    指向父对象
-     *  @param data      空间数据
-     * */
-    constructor(parent: SGraphyItem | null, data: ImageData) {
-        super(parent);
-        this.url = data.Url;
-    }
-
-    /****/
-} // Class SImageItem

+ 0 - 8
saga-web-big/src/STextItem.ts

@@ -1,8 +0,0 @@
-import { SObjectItem } from "./SObjectItem";
-
-/**
- * 文本item
- *
- * @author  郝建龙(1061851420@qq.com)
- */
-export class STextItem extends SObjectItem {} // Class STextItem

+ 65 - 0
saga-web-big/src/config/ItemColor.ts

@@ -0,0 +1,65 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SColor } from "@saga-web/draw/lib";
+
+/**
+ * 接口item颜色配置
+ *
+ * @author  郝建龙
+ */
+export class ItemColor {
+    /** 墙颜色 */
+    static wallColor = new SColor("#2b2b2b");
+    /** 柱子颜色 */
+    static columnColor = SColor.Black;
+    /** 虚拟墙颜色 */
+    static virtualWallColor = SColor.Black;
+    /** 空间颜色 */
+    static spaceColor = new SColor("#f1fffd80");
+    /** 门颜色 */
+    static doorColor = new SColor("#f5b36f");
+    /** 窗户颜色 */
+    static windowColor = new SColor("#fcd6ff");
+    /** 蒙版颜色    */
+    static sceneMarkColor = new SColor("#00000080");
+    /** 遮罩颜色    */
+    static shadeColor = new SColor("#00000080");
+    /** 高亮item吸附点颜色    */
+    static highLightPointColor = new SColor("#ff8d00");
+    /** 高亮item吸附线颜色    */
+    static highLightLineColor = new SColor("#409EFF");
+    /** 矩形选择对象边框颜色  */
+    static rectSelectOutColor = new SColor("#3e78f9e8");
+    /** 矩形选择对象填充颜色  */
+    static rectSelectInColor = new SColor("#8cf2fd73");
+    /** 空间边框颜色  */
+    static spaceBorderColor = new SColor("#2b2b2b");
+    /** 空间,业务空间选中颜色 */
+    static selectColor = new SColor("#1abc9c");
+    /** 空间高亮颜色 */
+    static spaceHighColor = new SColor("#fbb029");
+    /** 业务空间不可选中颜色 */
+    static zoneUnselectColor = new SColor("#cecece");
+    /** 受影响业务空间颜色 */
+    static zoneInfectedColor = new SColor("#ff0000");
+    /** 受影响的业务空间边框颜色    */
+    static zoneInfectedBorder = new SColor("#e2675c");
+} // Interface ItemColor

+ 55 - 0
saga-web-big/src/config/ItemOrder.ts

@@ -0,0 +1,55 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+/**
+ * 接口
+ *
+ * @author  郝建龙
+ */
+export class ItemOrder {
+    /** 空间层级 */
+    static spaceOrder = 2;
+    /** 业务空间层级 */
+    static zoneOrder = 8;
+    /** 类空间层级 */
+    static likeSpaceOrder = 10;
+    /** 柱子层级 */
+    static columnOrder = 12;
+    /** 墙层级 */
+    static wallOrder = 16;
+    /** 虚拟墙层级 */
+    static virtualWallOrder = 20;
+    /** 门层级 */
+    static doorOrder = 24;
+    /** 窗户层级 */
+    static windowOrder = 28;
+    /** 位置标签对象层级 */
+    static markOrder = 99;
+    /** 遮罩层级    */
+    static shadeOrder = 120;
+    /** 框选矩形对象层级 */
+    static rectSelectOrder = 99999;
+    /** 高亮对象层级 */
+    static highLightOrder = 9999;
+    /** 业务空间关系点位层级 */
+    static RelationOrder = 9999;
+    /** 蒙版层级 */
+    static sceneMarkOrder = 99999;
+} // Interface ItemOrder

+ 128 - 0
saga-web-big/src/config/Transparency.ts

@@ -0,0 +1,128 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+/**
+ * 透明度接口
+ *
+ * @author  郝建龙
+ */
+export const Transparency = [
+    "00",
+    "03",
+    "05",
+    "08",
+    "0A",
+    "0D",
+    "0F",
+    "12",
+    "14",
+    "17",
+    "1A",
+    "1C",
+    "1F",
+    "21",
+    "24",
+    "26",
+    "29",
+    "2B",
+    "2E",
+    "30",
+    "33",
+    "36",
+    "38",
+    "3B",
+    "3D",
+    "40",
+    "42",
+    "45",
+    "47",
+    "4A",
+    "4D",
+    "4F",
+    "52",
+    "54",
+    "57",
+    "59",
+    "5C",
+    "5E",
+    "61",
+    "63",
+    "66",
+    "69",
+    "6B",
+    "6E",
+    "70",
+    "73",
+    "75",
+    "78",
+    "7A",
+    "7D",
+    "80",
+    "82",
+    "85",
+    "87",
+    "8A",
+    "8C",
+    "8F",
+    "91",
+    "94",
+    "96",
+    "99",
+    "9C",
+    "9E",
+    "A1",
+    "A3",
+    "A6",
+    "A8",
+    "AB",
+    "AD",
+    "B0",
+    "B3",
+    "B5",
+    "B8",
+    "BA",
+    "BD",
+    "BF",
+    "C2",
+    "C4",
+    "C7",
+    "C9",
+    "CC",
+    "CF",
+    "D1",
+    "D4",
+    "D6",
+    "D9",
+    "DB",
+    "DE",
+    "E0",
+    "E3",
+    "E6",
+    "E8",
+    "EB",
+    "ED",
+    "F0",
+    "F2",
+    "F5",
+    "F7",
+    "FA",
+    "FC",
+    "FF"
+]; // Interface Transparency

+ 97 - 0
saga-web-big/src/factories/SItemFactory.ts

@@ -0,0 +1,97 @@
+import { Column } from "../types/floor/Column";
+import { SColumnItem } from "../items/floor/SColumnItem";
+import { SWallItem } from "../items/floor/SWallItem";
+import { Wall } from "../types/floor/Wall";
+import { SVirtualWallItem } from "../items/floor/SVirtualWallItem";
+import { VirtualWall } from "../types/floor/VirtualWall";
+import { SSpaceItem } from "../items/floor/SSpaceItem";
+import { Space } from "../types/floor/Space";
+import { Door } from "../types/floor/Door";
+import { SDoorItem } from "../items/floor/SDoorItem";
+import { SWindowItem } from "../items/floor/SWindowItem";
+import { Casement } from "../types/floor/Casement";
+import { SZoneItem } from "../items/floor/ZoneItem";
+import { Zone } from "../types/floor/Zone";
+
+/**
+ * 拓扑图信息解析器
+ *
+ */
+
+export class SItemFactory {
+    /**
+     * 构造函数
+     *
+     * */
+    constructor() {} // Constructor
+
+    /**
+     * 创建柱子item
+     *
+     * @param   data    柱子数据
+     * @return  柱子item
+     * */
+    createColumn(data: Column): SColumnItem {
+        return new SColumnItem(null, data);
+    } // Function createColumn()
+
+    /**
+     * 创建墙item
+     *
+     * @param   data    墙数据
+     * @return  墙item
+     * */
+    createWall(data: Wall): SWallItem {
+        return new SWallItem(null, data);
+    } // Function createWall()
+
+    /**
+     * 创建虚拟墙item
+     *
+     * @param   data    虚拟墙数据
+     * @return  虚拟墙item
+     * */
+    createVirtualWall(data: VirtualWall): SVirtualWallItem {
+        return new SVirtualWallItem(null, data);
+    } // Function createVirtualWall()
+
+    /**
+     * 创建空间item
+     *
+     * @param   data    空间数据
+     * @return  空间item
+     * */
+    createSpace(data: Space): SSpaceItem {
+        return new SSpaceItem(null, data);
+    } // Function createSpace()
+
+    /**
+     * 创建门item
+     *
+     * @param   data    门数据
+     * @return  门item
+     * */
+    createDoor(data: Door): SDoorItem {
+        return new SDoorItem(null, data);
+    } // Function createDoor()
+
+    /**
+     * 创建窗item
+     *
+     * @param   data    窗户数据
+     * @return  窗户item
+     * */
+    createWindow(data: Casement): SWindowItem {
+        return new SWindowItem(null, data);
+    } // Function createWindow()
+
+    /**
+     * 创建业务空间item
+     *
+     * @param   data    业务空间数据
+     * @return  业务空间item
+     * */
+    createZone(data: Zone): SZoneItem {
+        return new SZoneItem(null, data);
+    } // Function createZone()
+} // class SItemFactory

+ 32 - 14
saga-web-big/src/index.ts

@@ -1,16 +1,25 @@
-import { SAnchorItem } from "./SAnchorItem";
-import { SCompassItem } from "./SCompassItem";
-import { SCurveRelation } from "./SCurveRelation";
-import { SEntityItem } from "./SEntityItem";
-import { SFloorItem } from "./SFloorItem";
-import { SImageItem } from "./SImageItem";
-import { SLayerItem } from "./SLayerItem";
-import { SLineRelation } from "./SLineRelation";
-import { SObjectItem } from "./SObjectItem";
-import { SRelation } from "./SRelation";
-import { STextItem } from "./STextItem";
-import { STooltipItem } from "./STooltipItem";
-import { SVerticalRelation } from "./SVerticalRelation";
+import { SAnchorItem } from "./items/topology/SAnchorItem";
+import { SCompassItem } from "./items/floor/SCompassItem";
+import { SCurveRelation } from "./items/topology/SCurveRelation";
+import { SEntityItem } from "./items/topology/SEntityItem";
+import { SFloorItem } from "./items/floor/SFloorItem";
+import { SImageItem } from "./items/SImageItem";
+import { SLayerItem } from "./items/SLayerItem";
+import { SLineRelation } from "./items/topology/SLineRelation";
+import { SObjectItem } from "./items/SObjectItem";
+import { SRelation } from "./items/topology/SRelation";
+import { STextItem } from "./items/STextItem";
+import { STooltipItem } from "./items/STooltipItem";
+import { SVerticalRelation } from "./items/topology/SVerticalRelation";
+import { ItemColor } from "./config/ItemColor";
+import { Transparency } from "./config/Transparency";
+import { ItemOrder } from "./config/ItemOrder";
+import { SItemFactory } from "./factories/SItemFactory";
+import { SBigParser } from "./parser/SBigParser";
+import { SEquipParser } from "./parser/SEquipParser";
+import { SZoneParser } from "./parser/SZoneParser";
+import { STopologyParser } from "./parser/STopologyParser";
+import { SFloorParser } from "./parser/SFloorParser";
 
 export {
     SAnchorItem,
@@ -25,5 +34,14 @@ export {
     SRelation,
     STextItem,
     STooltipItem,
-    SVerticalRelation
+    SVerticalRelation,
+    ItemColor,
+    ItemOrder,
+    Transparency,
+    SItemFactory,
+    SFloorParser,
+    STopologyParser,
+    SZoneParser,
+    SEquipParser,
+    SBigParser,
 };

+ 77 - 0
saga-web-big/src/items/SImageItem.ts

@@ -0,0 +1,77 @@
+import { SObjectItem } from "./SObjectItem";
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { ImageData } from "../types/ImageData";
+import { SPainter, SRect } from "@saga-web/draw/lib";
+
+/**
+ *  图片绘制
+ *
+ * * @author  郝建龙(1061851420@qq.com)
+ */
+export class SImageItem extends SObjectItem {
+    /** 标志宽度 */
+    private width: number = 20;
+    /** 标志高度 */
+    private height: number = 20;
+    /** 图片地址    */
+    url: string = "";
+    /** 图片dom */
+    Img: CanvasImageSource | undefined;
+    /** 图片item所有数据  */
+    private data: ImageData;
+
+    /**
+     * 构造函数
+     *
+     *  @param parent    指向父对象
+     *  @param data      图片数据
+     * */
+    constructor(parent: SGraphyItem | null, data: ImageData) {
+        super(parent);
+        this.data = data;
+        if (data.Url) {
+            this.Img = new Image();
+            this.url = data.Url;
+            this.Img.src = this.url;
+            this.Img.onload = (): void => {
+                // @ts-ignore
+                this.width = data.Width ? data.Width : this.Img.width;
+                // @ts-ignore
+                this.height = data.Height ? data.Height : this.Img.height;
+                this.update();
+            };
+        }
+        this.isTransform = false;
+    }
+
+    /**
+     * Item对象边界区域
+     *
+     * @return	SRect
+     */
+    boundingRect(): SRect {
+        return new SRect(
+            -this.width / 2,
+            -this.height / 2,
+            this.width,
+            this.height
+        );
+    }
+
+    /**
+     * Item绘制操作
+     *
+     * @param   painter       painter对象
+     */
+    onDraw(painter: SPainter): void {
+        if (this.Img) {
+            painter.drawImage(
+                this.Img,
+                -this.width / 2,
+                -this.height / 2,
+                this.width,
+                this.height
+            );
+        }
+    } // Function onDraw()
+} // Class SImageItem

+ 1 - 1
saga-web-big/src/SLayerItem.ts

@@ -1,4 +1,4 @@
-import { SFloorItem } from "./SFloorItem";
+import { SFloorItem } from "./floor/SFloorItem";
 
 /**
  *  编辑器图层-图层锁定,业务层组合使用

+ 1 - 1
saga-web-big/src/SObjectItem.ts

@@ -1,5 +1,5 @@
 import { SGraphyItem } from "@saga-web/graphy/lib";
-import { SAnchorItem } from "./SAnchorItem";
+import { SAnchorItem } from "./topology/SAnchorItem";
 
 /**
  * 对象item

+ 75 - 0
saga-web-big/src/items/STextItem.ts

@@ -0,0 +1,75 @@
+import { SObjectItem } from "./SObjectItem";
+import { TextData } from "../types/TextData";
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import {
+    SPainter,
+    SRect,
+    STextAlign,
+    STextBaseLine,
+    STextDirection
+} from "@saga-web/draw/lib";
+
+/**
+ * 文本item
+ *
+ * @author  郝建龙(1061851420@qq.com)
+ */
+export class STextItem extends SObjectItem {
+    /** 文本item所有数据  */
+    data: TextData | null = null;
+    /** 文本内容    */
+    text: string = "";
+    /** 文本对齐    */
+    private textAlign: STextAlign;
+    /** 文本基准线   */
+    private baseLine: STextBaseLine;
+    /** 文本绘制方向  */
+    private textDirection: STextDirection;
+    /** 文本绘制最大宽 */
+    maxWidth: number | undefined = undefined;
+    /** 文本大小    */
+    private size: number;
+
+    /**
+     * 构造体
+     *
+     * @param   parent  指向父对象
+     * @param   data    文本数据
+     * */
+    constructor(parent: SGraphyItem | null, data: TextData) {
+        super(parent);
+        this.data = data;
+        this.text = data.Text;
+        this.textAlign = data.TextAlign ? data.TextAlign : STextAlign.Start;
+        this.baseLine = data.BaseLine
+            ? data.BaseLine
+            : STextBaseLine.Alphabetic;
+        this.textDirection = data.TextDirection
+            ? data.TextDirection
+            : STextDirection.Inherit;
+        this.maxWidth = data.Width;
+        this.size = data.Size ? data.Size : 12;
+    }
+
+    /**
+     * Item对象边界区域
+     *
+     * @return	SRect
+     */
+    boundingRect(): SRect {
+        return new SRect();
+    }
+
+    /**
+     * Item绘制操作
+     *
+     * @param   painter painter对象
+     */
+    onDraw(painter: SPainter): void {
+        painter.font.textAlign = this.textAlign;
+        painter.font.textBaseLine = this.baseLine;
+        painter.font.textDirection = this.textDirection;
+        painter.font.size = painter.toPx(this.size);
+        painter.drawText(this.text, 0, 0, this.maxWidth);
+    } // Function onDraw()
+} // Class STextItem

saga-web-big/src/STooltipItem.ts → saga-web-big/src/items/STooltipItem.ts


+ 93 - 0
saga-web-big/src/items/floor/SColumnItem.ts

@@ -0,0 +1,93 @@
+import { Column } from "../../types/floor/Column";
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 柱子item
+ *
+ * @author  郝建龙
+ */
+export class SColumnItem extends SGraphyItem {
+    /** 柱子数据    */
+    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[][] = [];
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      柱子数据
+     */
+    constructor(parent: SGraphyItem | null, data: Column) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.columnOrder;
+        let tempArr = this.data.OutLine;
+        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);
+                    }
+                );
+            });
+        }
+    } // 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()
+} // Class SColumnItem

saga-web-big/src/SCompassItem.ts → saga-web-big/src/items/floor/SCompassItem.ts


+ 158 - 0
saga-web-big/src/items/floor/SDoorItem.ts

@@ -0,0 +1,158 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Door } from "../../types/floor/Door";
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { SMathUtil } from "../../utils/SMathUtil";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 门item
+ *
+ * @author  郝建龙
+ */
+export class SDoorItem extends SGraphyItem {
+    /** 门数据 */
+    data: Door;
+    /** 门轮廓线坐标list  */
+    private readonly pointArr: SPoint[] = [];
+    /** 门长度 */
+    private readonly r: number = 0;
+    /** 角度  */
+    private readonly ang: number = 0;
+    /** 旋转点 */
+    private readonly p: SPoint = new SPoint(0, 0);
+    /** 旋转起始角度,结束角度+Math.PI/2 */
+    private readonly startAng: number = -Math.PI / 2;
+    /** 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;
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      门数据
+     */
+    constructor(parent: SGraphyItem | null, data: Door) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.doorOrder;
+        if (this.data.OutLine.length) {
+            this.pointArr = this.data.OutLine[0].map(
+                (t): SPoint => {
+                    let x = t.X,
+                        y = -t.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(t.X, -t.Y);
+                }
+            );
+
+            let p1 = this.pointArr[0],
+                p2 = this.pointArr[1];
+            // 旋转点
+            this.p = p1;
+            const HX = (this.data.HandDirection.X = Number(
+                this.data.HandDirection.X.toFixed()
+            ));
+            const HY = (this.data.HandDirection.Y = Number(
+                this.data.HandDirection.Y.toFixed()
+            ));
+            const FX = (this.data.FaceDirection.X = Number(
+                this.data.FaceDirection.X.toFixed()
+            ));
+            const FY = (this.data.FaceDirection.Y = Number(
+                this.data.FaceDirection.Y.toFixed()
+            ));
+            // 向量点乘 => x1 * x2 + y1 * y2,大于0同向
+            let dotProduct = (p2.x - p1.x) * HX + (p2.y - p1.y) * -HY;
+            if (dotProduct > 0) {
+                this.p = p2;
+                p2 = p1;
+                p1 = this.p;
+            }
+            // 两点间距离
+            this.r = SMathUtil.pointDistance(p1.x, p1.y, p2.x, p2.y);
+            // 门朝向角度
+            let fo = Math.atan(-FY / FX);
+            this.ang = FX > 0 ? fo : fo + Math.PI;
+            // 向量叉乘 => x1 * y2 - x2 * y1,小于0是顺时针
+            let direction = (p2.x - p1.x) * -FY - (p2.y - p1.y) * FX;
+            if (direction > 0) {
+                this.startAng = 0;
+            }
+        }
+    } // 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.translate(this.p.x, this.p.y);
+        painter.rotate(this.ang);
+        painter.pen.lineWidth = 100;
+        painter.pen.color = ItemColor.doorColor;
+        painter.drawLine(0, 0, this.r, 0);
+        painter.pen.lineDash = [50, 100];
+        painter.pen.lineWidth = painter.toPx(1);
+        // painter.drawArc(
+        //     -this.r,
+        //     -this.r,
+        //     this.r * 2,
+        //     this.r * 2,
+        //     this.startAng,
+        //     this.startAng + Math.PI / 2
+        // );
+    } // Function onDraw()
+} // Class SDoorItem

saga-web-big/src/SFloorItem.ts → saga-web-big/src/items/floor/SFloorItem.ts


+ 74 - 0
saga-web-big/src/items/floor/SHighlightItem.ts

@@ -0,0 +1,74 @@
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SColor, SLine, SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 吸附时高亮对象
+ *
+ * @author  郝建龙
+ */
+export class SHighlightItem extends SGraphyItem {
+    /** 对象与鼠标位置距离   */
+    distance: number = 0;
+    /** 对象类型   */
+    private type: number = 1;
+
+    /** 点对象数据-当吸附的为线时,此点为垂线与线段的交点   */
+    _point: SPoint = new SPoint();
+    get point(): SPoint {
+        return this._point;
+    } // Get point
+    set point(v: SPoint) {
+        this._point = v;
+        this.type = 1;
+        this.update();
+    } // Set point
+
+    /** 点对象数据   */
+    _line: SLine = new SLine();
+    get line(): SLine {
+        return this._line;
+    } // Get line
+    set line(v: SLine) {
+        this._line = v;
+        this.type = 2;
+        this.update();
+    } // Set line
+
+    /**
+     * 构造函数
+     *
+     * @param   parent  指向父对象
+     */
+    constructor(parent: SGraphyItem | null) {
+        super(parent);
+        this.visible = false;
+        this.zOrder = ItemOrder.highLightOrder;
+    } // Constructor
+
+    /**
+     * Item对象边界区域
+     *
+     * @return	SRect
+     */
+    boundingRect(): SRect {
+        return new SRect(this.point.x, this.point.y, 10, 10);
+    } // Function boundingRect()
+
+    /**
+     * Item绘制操作
+     *
+     * @param   painter painter对象
+     */
+    onDraw(painter: SPainter): void {
+        if (this.type == 2) {
+            painter.pen.color = ItemColor.highLightLineColor;
+            painter.pen.lineWidth = painter.toPx(6);
+            painter.drawLine(this.line);
+        }
+        painter.pen.color = SColor.Transparent;
+        painter.brush.color = ItemColor.highLightPointColor;
+        painter.drawCircle(this.point.x, this.point.y, painter.toPx(5));
+    } // Function onDraw()
+} // Class SHighlightItem

+ 204 - 0
saga-web-big/src/items/floor/SSpaceItem.ts

@@ -0,0 +1,204 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import {
+    SColor,
+    SPainter,
+    SPath2D,
+    SPoint,
+    SPolygonUtil,
+    SRect,
+    STextAlign
+} from "@saga-web/draw/lib";
+import { Space } from "../../types/floor/Space";
+import { SMouseEvent } from "@saga-web/base/lib";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 模型空间item
+ *
+ * @author  郝建龙
+ */
+export class SSpaceItem extends SGraphyItem {
+    /** 空间所有数据  */
+    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 SPath2D();
+    /** 高亮状态    */
+    private _highLightFlag: boolean = false;
+    get highLightFlag(): boolean {
+        return this._highLightFlag;
+    } // Get highLightFlag
+    set highLightFlag(value: boolean) {
+        this._highLightFlag = value;
+        this.update();
+    } // Set highLightFlag
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      空间数据
+     */
+    constructor(parent: SGraphyItem | null, data: Space) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.spaceOrder;
+        let tempArr = this.data.OutLine;
+        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	event         事件参数
+     * @return	boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        console.log("spaceDown");
+        if (this.selectable) {
+            this.selected = !this.selected;
+        }
+        this.$emit("click", event);
+        return true;
+    } // Function onMouseDown()
+
+    /**
+     * 鼠标移动事件
+     *
+     * @param event 事件参数
+     */
+    onMouseMove(event: SMouseEvent): boolean {
+        return false;
+    } // Function onMouseMove()
+
+    /**
+     * 鼠标抬起事件
+     *
+     * @param	event         事件参数
+     * @return	boolean
+     */
+    onMouseUp(event: SMouseEvent): boolean {
+        console.log("spaceUp");
+        return false;
+    } // Function onClick()
+
+    /**
+     * 判断点是否在区域内
+     *
+     * @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;
+            }
+        }
+        return true;
+    } // Function contains()
+
+    /**
+     * Item绘制操作
+     *
+     * @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);
+
+        painter.brush.color = SColor.Black;
+        painter.font.size = painter.toPx(10);
+        // painter.font.size = 500;
+        painter.font.textAlign = STextAlign.Center;
+        painter.drawText(
+            this.data.Name,
+            this.data.Location.Points[0].X,
+            -this.data.Location.Points[0].Y
+        );
+    } // Function onDraw()
+} // Class SSpaceItem

+ 113 - 0
saga-web-big/src/items/floor/SVirtualWallItem.ts

@@ -0,0 +1,113 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { VirtualWall } from "../../types/floor/VirtualWall";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 墙item
+ *
+ * @author  郝建龙
+ */
+export class SVirtualWallItem extends SGraphyItem {
+    /** 虚拟墙数据   */
+    data: VirtualWall;
+    /** 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[][] = [];
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      虚拟墙数据
+     */
+    constructor(parent: SGraphyItem | null, data: VirtualWall) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.virtualWallOrder;
+        let tempArr = this.data.OutLine;
+        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);
+                    }
+                );
+            });
+        }
+    } // 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.lineWidth = painter.toPx(1);
+        painter.pen.color = ItemColor.virtualWallColor;
+        painter.pen.lineDash = [20, 20];
+        this.pointArr.forEach((t): void => {
+            painter.drawPolyline(t);
+        });
+    } // Function onDraw()
+} // Class SVirtualWallItem

+ 113 - 0
saga-web-big/src/items/floor/SWallItem.ts

@@ -0,0 +1,113 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { Wall } from "../../types/floor/Wall";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 墙item
+ *
+ * @author  郝建龙
+ */
+export class SWallItem extends SGraphyItem {
+    /** 墙数据 */
+    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[][] = [];
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      墙数据
+     */
+    constructor(parent: SGraphyItem | null, data: Wall) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.wallOrder;
+        let tempArr = this.data.OutLine;
+        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);
+                    }
+                );
+            });
+        }
+    } // 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.wallColor;
+        painter.pen.lineWidth = painter.toPx(1);
+        painter.brush.color = ItemColor.wallColor;
+        this.pointArr.forEach((t): void => {
+            painter.drawPolygon(t);
+        });
+    } // Function onDraw()
+} // Class SWallItem

+ 83 - 0
saga-web-big/src/items/floor/SWindowItem.ts

@@ -0,0 +1,83 @@
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { Casement } from "../../types/floor/Casement";
+import { ItemOrder } from "../../config/ItemOrder";
+import { ItemColor } from "../../config/ItemColor";
+
+/**
+ * 窗户item
+ *
+ * @author  郝建龙
+ */
+export class SWindowItem extends SGraphyItem {
+    /** 窗户数据    */
+    data: Casement;
+    /** 窗户轮廓线坐标list  */
+    private 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;
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      窗户数据
+     */
+    constructor(parent: SGraphyItem | null, data: Casement) {
+        super(parent);
+        this.data = data;
+        this.zOrder = ItemOrder.windowOrder;
+        if (this.data.OutLine.length) {
+            this.pointArr = this.data.OutLine[0].map(
+                (t): SPoint => {
+                    let x = t.X,
+                        y = -t.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(t.X, -t.Y);
+                }
+            );
+        }
+    } // 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.windowColor;
+        painter.pen.lineWidth = painter.toPx(1);
+        painter.drawPolyline(this.pointArr);
+    } // Function onDraw()
+} // Class SWindowItem

+ 255 - 0
saga-web-big/src/items/floor/ZoneItem.ts

@@ -0,0 +1,255 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SGraphyItem } from "@saga-web/graphy/lib";
+import {
+    SColor,
+    SPainter,
+    SPath2D,
+    SPoint,
+    SPolygonUtil,
+    SRect
+} from "@saga-web/draw/lib";
+import { SMouseEvent } from "@saga-web/base/lib";
+import { Zone } from "../../types/floor/Zone";
+import { ItemColor, ItemOrder, Transparency } from "../..";
+
+/**
+ * 业务空间item
+ *
+ * @author  郝建龙
+ */
+export class SZoneItem extends SGraphyItem {
+    /** 空间所有数据  */
+    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: SPath2D[] = [];
+    /** 点击位置坐标  */
+    private clickPoint: SPoint | undefined;
+    /** 选中时的颜色  */
+    private selectColor: SColor = ItemColor.selectColor;
+    /** 不可选时的颜色  */
+    private unselectColor: SColor = ItemColor.zoneUnselectColor;
+    /** 高亮状态    */
+    private _highLightFlag: boolean = false;
+    get highLightFlag(): boolean {
+        return this._highLightFlag;
+    } // Get highLightFlag
+    set highLightFlag(value: boolean) {
+        this._highLightFlag = value;
+        this.update();
+    } // Set highLightFlag
+    /** 透明度 */
+    _transparency: number = 20;
+    get transparency(): number {
+        return this._transparency;
+    } // Get transparency
+    set transparency(value: number) {
+        this._transparency = value;
+        this.update();
+    } // Set transparency
+    /** 受影响状态   */
+    _isInfected: boolean = false;
+    get isInfected(): boolean {
+        return this._isInfected;
+    } // Get isInfected
+    set isInfected(value: boolean) {
+        this._isInfected = value;
+        this.update();
+    } // Set isInfected
+    /** 受影响的业务空间填充颜色    */
+    private infectedColor: SColor = ItemColor.zoneInfectedColor;
+    /** 受影响的业务空间边框颜色    */
+    private infectedBorder: SColor = ItemColor.zoneInfectedBorder;
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      空间数据
+     */
+    constructor(parent: SGraphyItem | null, data: Zone) {
+        super(parent);
+        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 SPath2D();
+                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   事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (this.selectable) {
+            this.selected = !this.selected;
+            this.clickPoint = new SPoint(event.x, event.y);
+        }
+        this.$emit("click", event);
+        return true;
+    } // Function onMouseDown()
+
+    /**
+     * 鼠标抬起事件
+     *
+     * @param   event   事件参数
+     * @return  boolean
+     */
+    onMouseUp(event: SMouseEvent): boolean {
+        return false;
+    } // 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;
+                }
+            }
+            if (flag) {
+                continue;
+            }
+            return true;
+        }
+        return false;
+    } // Function contains()
+
+    /**
+     * 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);
+        });
+        painter.brush.color = SColor.Black;
+        painter.font.size = painter.toPx(10);
+        if (this.clickPoint) {
+            painter.drawText(
+                this.data.RoomLocalName,
+                this.clickPoint.x,
+                this.clickPoint.y
+            );
+        }
+    } // Function onDraw()
+} // Class ZoneItem

saga-web-big/src/SAnchorItem.ts → saga-web-big/src/items/topology/SAnchorItem.ts


saga-web-big/src/SCurveRelation.ts → saga-web-big/src/items/topology/SCurveRelation.ts


+ 1 - 1
saga-web-big/src/SEntityItem.ts

@@ -1,4 +1,4 @@
-import { SObjectItem } from "./SObjectItem";
+import { SObjectItem } from "../SObjectItem";
 
 /**
  * 实例item,与物理世界对应

saga-web-big/src/SLineRelation.ts → saga-web-big/src/items/topology/SLineRelation.ts


+ 1 - 1
saga-web-big/src/SRelation.ts

@@ -1,6 +1,6 @@
 import { SGraphyItem } from "@saga-web/graphy/lib";
 import { SColor, SPoint, SArrowStyleType } from "@saga-web/draw/lib";
-import { SRelationState } from "./enums/SRelationState";
+import { SRelationState } from "../../enums/SRelationState";
 import { SAnchorItem } from "./SAnchorItem";
 
 /**

saga-web-big/src/SVerticalRelation.ts → saga-web-big/src/items/topology/SVerticalRelation.ts


+ 2 - 2
saga-web-big/src/parser/SBigParser.ts

@@ -1,7 +1,7 @@
-import { SGraphyScene } from "@saga-web/graphy/lib";
+import { SParser } from "./SParser";
 
 /**
  *  混合解析器
  *
  */
-export class SBigParser extends SGraphyScene {} // class SBigParser
+export class SBigParser extends SParser {} // class SBigParser

+ 2 - 2
saga-web-big/src/parser/SEquipParser.ts

@@ -1,7 +1,7 @@
-import { SGraphyScene } from "@saga-web/graphy/lib";
+import { SParser } from "./SParser";
 
 /**
  * 设备信息解析器
  *
  */
-export class SEquipParser extends SGraphyScene {} // class SEquipParser
+export class SEquipParser extends SParser {} // class SEquipParser

+ 126 - 2
saga-web-big/src/parser/SFloorParser.ts

@@ -1,7 +1,131 @@
-import { SGraphyScene } from "@saga-web/graphy/lib";
+import { SParser } from "./SParser";
+import { FloorData } from "../types/FloorData";
+import { Wall } from "../types/floor/Wall";
+import { Column } from "../types/floor/Column";
+import { Casement } from "../types/floor/Casement";
+import { VirtualWall } from "../types/floor/VirtualWall";
+import { Door } from "../types/floor/Door";
+import { Space } from "../types/floor/Space";
+import { SWallItem } from "../items/floor/SWallItem";
+import { SColumnItem } from "../items/floor/SColumnItem";
+import { SDoorItem } from "../items/floor/SDoorItem";
+import { SWindowItem } from "../items/floor/SWindowItem";
+import { SVirtualWallItem } from "../items/floor/SVirtualWallItem";
+import { SSpaceItem } from "../items/floor/SSpaceItem";
 
 /**
  *  楼层信息解析器
  *
  */
-export class SFloorParser extends SGraphyScene {} // class SFloorParser
+export class SFloorParser extends SParser {
+    /** 墙list   */
+    wallList: SWallItem[] = [];
+    /** 柱子list   */
+    columnList: SColumnItem[] = [];
+    /** 门list   */
+    doorList: SDoorItem[] = [];
+    /** 窗list   */
+    casementList: SWindowItem[] = [];
+    /** 虚拟墙list   */
+    virtualWallList: SVirtualWallItem[] = [];
+    /** 空间list   */
+    spaceList: SSpaceItem[] = [];
+
+    /**
+     * 解析数据
+     *
+     * @param   data    楼层数据
+     * */
+    parseData(data: FloorData): void {
+        if (data.Walls) {
+            data.Walls.forEach((t: Wall): void => {
+                this.addWall(t);
+            });
+        }
+        if (data.Columns) {
+            data.Columns.forEach((t: Column): void => {
+                this.addColumn(t);
+            });
+        }
+        if (data.Windows) {
+            data.Windows.forEach((t: Casement): void => {
+                this.addCasement(t);
+            });
+        }
+        if (data.VirtualWalls) {
+            data.VirtualWalls.forEach((t: VirtualWall): void => {
+                this.addVirtualWall(t);
+            });
+        }
+        if (data.Doors) {
+            data.Doors.forEach((t: Door): void => {
+                this.addDoor(t);
+            });
+        }
+        if (data.Spaces) {
+            data.Spaces.forEach((t: Space): void => {
+                this.addSpace(t);
+            });
+        }
+    } // Function parseData()
+
+    /**
+     * 添加墙至场景中
+     *
+     * @param   t       墙数据
+     * */
+    private addWall(t: Wall): void {
+        let item = this.factory.createWall(t);
+        this.wallList.push(item);
+    } // Function addWall()
+
+    /**
+     * 添加柱子至场景中
+     *
+     * @param   t       柱子数据
+     * */
+    private addColumn(t: Column): void {
+        let item = this.factory.createColumn(t);
+        this.columnList.push(item);
+    } // Function addColumn()
+
+    /**
+     * 添加窗户至场景中
+     *
+     * @param   t       窗户数据
+     * */
+    private addCasement(t: Casement): void {
+        let item = this.factory.createWindow(t);
+        this.casementList.push(item);
+    } // Function addCasement()
+
+    /**
+     * 添加虚拟墙至场景中
+     *
+     * @param   t       虚拟墙数据
+     * */
+    private addVirtualWall(t: VirtualWall): void {
+        let item = this.factory.createVirtualWall(t);
+        this.virtualWallList.push(item);
+    } // Function addVirtualWall()
+
+    /**
+     * 添加门至场景中
+     *
+     * @param   t       门数据
+     * */
+    private addDoor(t: Door): void {
+        let item = this.factory.createDoor(t);
+        this.doorList.push(item);
+    } // Function addDoor()
+
+    /**
+     * 添加空间至场景中
+     *
+     * @param   t       空间数据
+     * */
+    private addSpace(t: Space): void {
+        let item = this.factory.createSpace(t);
+        this.spaceList.push(item);
+    } // Function addSpace()
+} // class SFloorParser

+ 21 - 0
saga-web-big/src/parser/SParser.ts

@@ -0,0 +1,21 @@
+import { SItemFactory } from "..";
+
+/**
+ *  解析器基类
+ *
+ */
+export abstract class SParser {
+    /** 解析器工厂   */
+    protected factory: SItemFactory = new SItemFactory();
+
+    /**
+     * 构造函数
+     *
+     * @param   factory 解析工厂
+     * */
+    constructor(factory: SItemFactory | undefined) {
+        if (factory) {
+            this.factory = factory;
+        }
+    } // Constructor
+} // class SParser

+ 2 - 2
saga-web-big/src/parser/STopologyParser.ts

@@ -1,7 +1,7 @@
-import { SGraphyScene } from "@saga-web/graphy/lib";
+import { SParser } from "./SParser";
 
 /**
  * 拓扑图信息解析器
  *
  */
-export class STopologyParser extends SGraphyScene {} // class STopologyParser
+export class STopologyParser extends SParser {} // class STopologyParser

+ 30 - 2
saga-web-big/src/parser/SZoneParser.ts

@@ -1,7 +1,35 @@
-import { SGraphyScene } from "@saga-web/graphy/lib";
+import { SParser } from "./SParser";
+import { SZoneItem } from "../items/floor/ZoneItem";
+import { Zone } from "../types/floor/Zone";
 
 /**
  * 业务空间信息解析器
  *
  */
-export class STopologyParser extends SGraphyScene {} // class STopologyParser
+export class SZoneParser extends SParser {
+    /** 业务空间list   */
+    zoneList: SZoneItem[] = [];
+
+    /**
+     * 解析业务空间数据
+     *
+     * @param   data    业务空间数据
+     * */
+    parseData(data: Zone[]): void {
+        if (data && data.length) {
+            data.forEach((t): void => {
+                this.addZone(t);
+            });
+        }
+    } // Function parseData()
+
+    /**
+     * 添加业务空间至场景中
+     *
+     * @param   t   业务空间数据
+     * */
+    private addZone(t: Zone): void {
+        let item = this.factory.createZone(t);
+        this.zoneList.push(item);
+    } // Function addZone()
+} // class SZoneParser

+ 40 - 0
saga-web-big/src/types/FloorData.ts

@@ -0,0 +1,40 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Door } from "./floor/Door";
+import { Column } from "./floor/Column";
+import { Space } from "./floor/Space";
+import { VirtualWall } from "./floor/VirtualWall";
+import { Wall } from "./floor/Wall";
+import { Casement } from "./floor/Casement";
+
+/**
+ * json数据接口
+ *
+ * @author  郝建龙
+ */
+export interface FloorData {
+    Columns: Column[];
+    Doors: Door[];
+    Spaces: Space[];
+    VirtualWalls: VirtualWall[];
+    Walls: Wall[];
+    Windows: Casement[];
+} // Interface FloorData

+ 4 - 0
saga-web-big/src/types/ImageData.ts

@@ -14,4 +14,8 @@ export interface ImageData {
     Y: number;
     /** 图片url   */
     Url: string;
+    /** 绘制图片的宽  */
+    Width: number;
+    /** 绘制图片的高  */
+    Height: number;
 } // Interface ImageData

+ 15 - 0
saga-web-big/src/types/Marker.ts

@@ -0,0 +1,15 @@
+/**
+ * 标记item接口
+ *
+ * @author  郝建龙
+ */
+export interface Marker {
+    /** 标记的id  */
+    Id?: string;
+    /** 标记的名称  */
+    Name?: string;
+    /** X坐标 */
+    X: number;
+    /** Y坐标 */
+    Y: number;
+} // Interface Marker

+ 33 - 0
saga-web-big/src/types/MinDis.ts

@@ -0,0 +1,33 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "./Point";
+
+/**
+ * 距离最短点接口
+ *
+ * @author  郝建龙
+ */
+export interface MinDis {
+    /** 最短距离      */
+    MinDis: number;
+    /** 最短距离的点  */
+    Point: Point | undefined;
+} // Interface Space

+ 33 - 0
saga-web-big/src/types/Outline.ts

@@ -0,0 +1,33 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SPoint } from "@saga-web/draw/lib";
+
+/**
+ * 轮廓线接口
+ *
+ * @author  郝建龙
+ */
+export interface Outline {
+    /** 外轮廓 */
+    Outer: SPoint[];
+    /** 内轮廓 */
+    Inner: SPoint[][];
+} // Interface Outline

+ 31 - 0
saga-web-big/src/types/Place.ts

@@ -0,0 +1,31 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "./Point";
+
+/**
+ * 位置接口
+ *
+ * @author  郝建龙
+ */
+export interface Place {
+    Points: Point[];
+    Type: string;
+} // Interface Place

+ 30 - 0
saga-web-big/src/types/Point.ts

@@ -0,0 +1,30 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+/**
+ * 轮廓坐标接口
+ *
+ * @author  郝建龙
+ */
+export interface Point {
+    X: number;
+    Y: number;
+    Z: number;
+} // Interface Point

+ 32 - 0
saga-web-big/src/types/PointToLine.ts

@@ -0,0 +1,32 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SLine, SPoint } from "@saga-web/draw/lib";
+
+/**
+ * 距离最短线接口
+ *
+ * @author  郝建龙
+ */
+export interface PointToLine {
+    MinDis: number;
+    Line: SLine | undefined;
+    Point: SPoint | undefined;
+} // Interface Space

+ 27 - 0
saga-web-big/src/types/TextData.ts

@@ -0,0 +1,27 @@
+import { STextAlign, STextBaseLine, STextDirection } from "@saga-web/draw/lib";
+
+/**
+ * 文本item数据接口
+ *
+ * @author  郝建龙
+ */
+export interface TextData {
+    /** 文本的id   */
+    Id?: string;
+    /** 文本内容   */
+    Text: string;
+    /** X坐标 */
+    X: number;
+    /** Y坐标 */
+    Y: number;
+    /** 文本最大宽  */
+    Width?: number;
+    /** 文本对齐方向  */
+    TextAlign?: STextAlign;
+    /** 文本基线对齐  */
+    BaseLine?: STextBaseLine;
+    /** 文本方向    */
+    TextDirection?: STextDirection;
+    /** 文本大小    */
+    Size?: number;
+} // Interface TextData

+ 48 - 0
saga-web-big/src/types/floor/Casement.ts

@@ -0,0 +1,48 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 窗户item接口
+ *
+ * @author  郝建龙
+ */
+export interface Casement {
+    /** 位置  */
+    Location: Place;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 拥有者的RevitId */
+    Owner: string;
+    /** 对应Revit模型id */
+    SourceId: string;
+    /** 厚度  */
+    Thick: number;
+    /** 所属墙 */
+    WallId: string;
+    /** 宽度  */
+    Width: string;
+} // interface Casement

+ 42 - 0
saga-web-big/src/types/floor/Column.ts

@@ -0,0 +1,42 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 柱子item接口
+ *
+ * @author  郝建龙
+ */
+export interface Column {
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 房间边界  */
+    RoomBoundary: boolean;
+    /** 位置  */
+    Location: Place;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 对应Revit模型id */
+    SourceId: string;
+} // Interface Column

+ 52 - 0
saga-web-big/src/types/floor/Door.ts

@@ -0,0 +1,52 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 门item接口
+ *
+ * @author  郝建龙
+ */
+export interface Door {
+    /** 面朝方向  */
+    FaceDirection: Point;
+    /** 把手方向  */
+    HandDirection: Point;
+    /** 位置  */
+    Location: Place;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 拥有者的RevitId */
+    Owner: string;
+    /** 对应Revit模型id */
+    SourceId: string;
+    /** 厚度  */
+    Thick: number;
+    /** 所属墙 */
+    WallId: string;
+    /** 宽度  */
+    Width: string;
+} // Interface Door

+ 46 - 0
saga-web-big/src/types/floor/Space.ts

@@ -0,0 +1,46 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 空间item接口
+ *
+ * @author  郝建龙
+ */
+export interface Space {
+    /** 轮廓线段    */
+    BoundarySegments: string[];
+    /** 位置  */
+    Location: Place;
+    /** 高度  */
+    Height: number;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 对应Revit模型id */
+    SourceId: string;
+    /** 补充信息    */
+    Tag: string;
+} // Interface Space

+ 40 - 0
saga-web-big/src/types/floor/VirtualWall.ts

@@ -0,0 +1,40 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 虚拟墙item接口
+ *
+ * @author  郝建龙
+ */
+export interface VirtualWall {
+    /** 位置  */
+    Location: Place;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 对应Revit模型id */
+    SourceId: string;
+} // interface VirtualWall

+ 44 - 0
saga-web-big/src/types/floor/Wall.ts

@@ -0,0 +1,44 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+import { Place } from "../Place";
+
+/**
+ * 墙item接口
+ *
+ * @author  郝建龙
+ */
+export interface Wall {
+    /** 层id */
+    LevelId: string;
+    /** 位置  */
+    Location: Place;
+    /** 模型id(外键)    */
+    ModelId: string;
+    /** 名称  */
+    Name: string;
+    /** 轮廓线  */
+    OutLine: Point[][];
+    /** 对应Revit模型id */
+    SourceId: string;
+    /** 厚度  */
+    Width: number;
+} // Interface Wall

+ 45 - 0
saga-web-big/src/types/floor/Zone.ts

@@ -0,0 +1,45 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { Point } from "../Point";
+
+/**
+ * 业务空间item接口
+ *
+ * @author  郝建龙
+ */
+export interface Zone {
+    /** 名称  */
+    RoomLocalName: string;
+    /** 轮廓线  */
+    OutLine: Point[][][];
+    /** 业务空间id  */
+    RoomID: string;
+    /** 颜色  */
+    Color: string;
+    /** 高度  */
+    Height?: number;
+    /** 是否高亮  */
+    HighLightFlag?: boolean;
+    /** 透明度  */
+    Transparency?: number;
+    /** 是否受影响   */
+    Infected?: boolean;
+} // Interface Zone

+ 0 - 9
saga-web-big/src/utils/SImageUtil.ts

@@ -1,9 +0,0 @@
-/**
- *
- * 图片工具类
- *
- * */
-
-export class SImageUtil {
-    static urlToBase64(url: string) {}
-} // Class SImageUtil

+ 317 - 0
saga-web-big/src/utils/SMathUtil.ts

@@ -0,0 +1,317 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SLine, SPoint, SRect } from "@saga-web/draw/lib";
+import { MinDis } from "../types/MinDis";
+import { Point } from "../types/Point";
+import { PointToLine } from "../types/PointToLine";
+import { Outline } from "../types/Outline";
+// @ts-ignore
+import { intersect } from "polybooljs";
+
+export class SMathUtil {
+    /**
+     * 计算点到点距离
+     *
+     * @return  距离
+     * @param x1
+     * @param y1
+     * @param x2
+     * @param y2
+     */
+    static pointDistance(
+        x1: number,
+        y1: number,
+        x2: number,
+        y2: number
+    ): number {
+        return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
+    } // Function pointDistance()
+
+    /**
+     * 计算点到点集中点最小距离,返回该点和该距离
+     *
+     * @param   p       第一个点
+     * @param   arr     点集
+     * @return  距离,点坐标
+     */
+    static getMinDisPoint(p: SPoint, arr: Point[]): MinDis | null {
+        if (!arr.length) {
+            return null;
+        }
+        let minDis = {
+            MinDis: SMathUtil.pointDistance(p.x, p.y, arr[0].X, -arr[0].Y),
+            Point: arr[0]
+        };
+        for (let i = 1; i < arr.length; i++) {
+            let ds = SMathUtil.pointDistance(p.x, p.y, arr[i].X, -arr[i].Y);
+            if (ds < minDis.MinDis) {
+                minDis.MinDis = ds;
+                minDis.Point = arr[i];
+            }
+        }
+        return minDis;
+    } // Function getMinDisPoint()
+
+    /**
+     * 计算点到线段垂线与线段的交点
+     *
+     * @param   p   点
+     * @param   l   线段
+     * @return  距离
+     */
+    static pointToLine(p: SPoint, l: SLine): PointToLine {
+        let d = {
+            MinDis: Number.MAX_SAFE_INTEGER,
+            Line: new SLine(),
+            Point: new SPoint()
+        };
+        let bgX = Math.max(l.x1, l.x2);
+        let smX = Math.min(l.x1, l.x2);
+        if (l.dx == 0) {
+            // l.dx为0 说明线段是垂直于x轴的
+            let bgY = Math.max(l.y1, l.y2);
+            let smY = Math.min(l.y1, l.y2);
+            if (p.y > smY && p.y < bgY) {
+                d.MinDis = Math.abs(p.x - l.x1);
+                d.Line = l;
+                d.Point = new SPoint(l.x1, p.y);
+            }
+        } else if (l.dy == 0) {
+            // l.dy为0 说明线段是平行于x轴的
+            if (p.x > smX && p.x < bgX) {
+                d.MinDis = Math.abs(p.y - l.y1);
+                d.Line = l;
+                d.Point = new SPoint(p.x, l.y1);
+            }
+        } else {
+            // 直线1
+            let k1 = (l.y1 - l.y2) / (l.x1 - l.x2);
+            let b1 = l.y1 - k1 * l.x1;
+            // 直线2
+            let k2 = -1 / k1;
+            let b2 = p.y - k2 * p.x;
+            // 交点
+            let x = (b1 - b2) / (k2 - k1);
+            let y = k1 * x + b1;
+            if (x > smX && x < bgX) {
+                d.MinDis = SMathUtil.pointDistance(p.x, p.y, x, y);
+                d.Line = l;
+                d.Point = new SPoint(x, y);
+            }
+        }
+        return d;
+    } // Function pointDistance()
+
+    /**
+     * 计算点到点集中线段最小距离,返回该点和该距离
+     *
+     * @param   p       第一个点
+     * @param   arr     点集
+     * @return  距离,点坐标
+     */
+    static getMinDisLine(p: SPoint, arr: Point[]): PointToLine | null {
+        if (arr.length < 2) {
+            return null;
+        }
+        let PTL = SMathUtil.pointToLine(
+            p,
+            new SLine(
+                arr[arr.length - 1].X,
+                -arr[arr.length - 1].Y,
+                arr[0].X,
+                -arr[0].Y
+            )
+        );
+        for (let i = 0; i < arr.length - 1; i++) {
+            let temp = SMathUtil.pointToLine(
+                p,
+                new SLine(arr[i].X, -arr[i].Y, arr[i + 1].X, -arr[i + 1].Y)
+            );
+            if (temp.MinDis < PTL.MinDis) {
+                PTL = temp;
+            }
+        }
+        return PTL;
+    } // Function getMinDisPoint()
+
+    /**
+     * 计算矩形是否有交集(外包矩形算法)
+     *
+     * @param   rect1   矩形1
+     * @param   rect2   矩形2
+     * @return  boolean
+     * */
+    static rectIntersection(rect1: SRect, rect2: SRect): boolean {
+        let minX = rect1.x < rect2.x ? rect1.x : rect2.x;
+        let minY = rect1.y < rect2.y ? rect1.y : rect2.y;
+        let maxX = rect1.right > rect2.right ? rect1.right : rect2.right;
+        let maxY = rect1.bottom > rect2.bottom ? rect2.bottom : rect2.bottom;
+        return (
+            rect1.width + rect2.width > maxX - minX &&
+            rect1.height + rect2.height > maxY - minY
+        );
+    } // Function rectIntersection()
+
+    /**
+     * 计算线段交点
+     *
+     * @param   line1   线段1
+     * @param   line2   线段2
+     * @return  SPoint  交点 null 平行但不重合 'repeat' 重合
+     */
+    static lineIntersection(
+        line1: SLine,
+        line2: SLine
+    ): SPoint | null | string {
+        let k1 = line1.dy / line1.dx;
+        let b1 = line1.y1 - k1 * line1.x1;
+        let k2 = line2.dy / line2.dx;
+        let b2 = line2.y1 - k2 * line2.x1;
+        if (k1 == k2) {
+            if (b1 == b2) {
+                return "repeat";
+            }
+            return null;
+        }
+        let intersectionX = (b2 - b1) / (k1 - k2);
+        let intersectionY = k1 * intersectionX + b1;
+        let minX = Math.min(line1.x1, line1.x2);
+        let maxX = Math.min(line2.x1, line2.x2);
+        if (intersectionX >= minX && intersectionX <= maxX) {
+            return new SPoint(intersectionX, intersectionY);
+        }
+        return null;
+    } // Function lineIntersection()
+
+    /**
+     * 转化数据格式为[][]
+     *
+     * @param  SP  SPoint[]
+     * @return Arr number[][]
+     */
+    static transferToArray(SP: SPoint[]): number[][] {
+        return SP.map((t): number[] => {
+            return [t.x, t.y];
+        });
+    } // Function transferToArray()
+
+    /**
+     * 转化数据格式为SPoint[]
+     *
+     * @param   arr number[][]
+     * @return  SP  SPoint[]
+     */
+    static transferToSPoint(arr: number[][]): SPoint[] {
+        return arr.map(
+            (t): SPoint => {
+                return new SPoint(t[0], t[1]);
+            }
+        );
+    } // Function transferToSPoint()
+
+    /**
+     * 计算数组中每一项的交集,并返回外轮廓与内轮廓
+     *
+     */
+    static getIntersectInArray(array: number[][][]): Outline[] {
+        let outlineList: Outline[] = [];
+        if (!array.length) {
+            // 无数据不做处理
+        } else if (array.length == 1) {
+            // 只有一条则为外轮廓
+            let outline: Outline = {
+                Outer: [],
+                Inner: []
+            };
+            outline.Outer = array[0].map(
+                (t): SPoint => {
+                    return new SPoint(t[0], t[1]);
+                }
+            );
+            outlineList.push(outline);
+        } else {
+            // 多条的时候,最后一条未外轮廓,倒序遍历与之相交的为内轮廓,不相交为另外的外轮廓
+            let poly2 = {
+                regions: [],
+                inverted: false
+            };
+            // @ts-ignore
+            poly2.regions.push(array[array.length - 1]);
+            let indexArr: number[] = [array.length - 1];
+            for (let i = array.length - 2; i > 0; i--) {
+                let poly1 = {
+                    regions: [],
+                    inverted: false
+                };
+                // @ts-ignore
+                poly1.regions.push(array[i]);
+                let intersectObj = intersect(poly1, poly2);
+                console.log(intersectObj);
+                if (!intersectObj.regions.length) {
+                    indexArr.unshift(i);
+                    poly2.regions = [];
+                    // @ts-ignore
+                    poly2.regions.push(array[i]);
+                }
+            }
+            indexArr.unshift(0);
+            console.log(indexArr);
+            for (let i = 0; i < indexArr.length - 1; i++) {
+                let axArr = array.slice(
+                    i == 0 ? 0 : indexArr[i] + 1,
+                    indexArr[i + 1]
+                );
+                let outline: Outline = {
+                    Outer: [],
+                    Inner: []
+                };
+                outline.Outer = array[indexArr[i + 1]].map(
+                    (t): SPoint => {
+                        return new SPoint(t[0], t[1]);
+                    }
+                );
+                outline.Inner = axArr.map((t): SPoint[] => {
+                    return t.map(
+                        (item): SPoint => {
+                            return new SPoint(item[0], item[1]);
+                        }
+                    );
+                });
+                outlineList.push(outline);
+            }
+        }
+        console.log(outlineList);
+        return outlineList;
+    } // Function getIntersectInArray()
+
+    /**
+     * 计算轮廓线面积
+     * */
+    static calculateArea(arr: SPoint[]): number {
+        let sum = 0;
+        let n = arr.length;
+        arr[n] = arr[0];
+        for (let i = 1; i <= n; i++) {
+            sum += arr[i].x * arr[i - 1].y - arr[i - 1].x * arr[i].y;
+        }
+        return sum / 2;
+    }
+} // Class SMathUtil

+ 2 - 2
saga-web-big/tsconfig.json

@@ -1,7 +1,7 @@
 {
     "compilerOptions": {
-        "target": "es5",                            // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.
-        "module": "commonjs",                       // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
+        "target": "es2015",                         // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.
+        "module": "es2015",                         // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
         "outDir": "./lib",                          // 编译后生成的文件目录
         "strict": true,                             // 开启严格的类型检测
         "declaration": true,                        // 生成 `.d.ts` 文件