Переглянути джерело

实体墙掏洞;更新包

haojianlong 5 роки тому
батько
коміт
94f0386f03

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

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/big",
-    "version": "1.0.106",
+    "version": "1.0.107",
     "description": "上格云建筑信息化库",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -42,6 +42,6 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@saga-web/graph": "2.1.122"
+        "@saga-web/graph": "2.1.123"
     }
 }

+ 56 - 24
saga-web-big/src/items/floor/SWallItem.ts

@@ -18,7 +18,7 @@
  * ********************************************************************************************************************
  */
 
-import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { SPainter, SPath2D, SPoint, SRect } from "@saga-web/draw/lib";
 import { Wall } from "../../types/floor/Wall";
 import { ItemOrder } from "../..";
 import { ItemColor } from "../..";
@@ -42,6 +42,10 @@ export class SWallItem extends SGraphItem {
     private maxY = Number.MIN_SAFE_INTEGER;
     /** 墙轮廓线坐标list  */
     private readonly pointArr: SPoint[][] = [];
+    /** 墙内轮廓线坐标list  */
+    private readonly holesArr: SPoint[][] = [];
+    /** path对象      */
+    private path = new SPath2D();
 
     /**
      * 构造函数
@@ -54,32 +58,62 @@ export class SWallItem extends SGraphItem {
         this.data = data;
         this.zOrder = ItemOrder.wallOrder;
         let tempArr = this.data.OutLine;
+        let holes = data.Holes;
         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);
+            this.pointArr = [];
+            let WLine = tempArr[0].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(WLine);
+            // 外轮廓
+            this.pointArr.push(WLine);
+            // 内轮廓
+            if (holes && holes.length) {
+                this.holesArr = holes.map(t => {
+                    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
 
@@ -106,8 +140,6 @@ export class SWallItem extends SGraphItem {
         painter.pen.color = ItemColor.wallColor;
         painter.pen.lineWidth = painter.toPx(1);
         painter.brush.color = ItemColor.wallColor;
-        this.pointArr.forEach((t): void => {
-            painter.drawPolygon(t);
-        });
+        painter.drawPath(this.path);
     } // Function onDraw()
 } // Class SWallItem

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

@@ -0,0 +1,113 @@
+/*
+ * ********************************************************************************************************************
+ *
+ *                      :*$@@%$*:                         ;:                ;;    ;;
+ *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
+ *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
+ *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
+ *                   =@*                                  %!              @ $= % %@=   =%@!      %=
+ *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
+ *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
+ *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
+ *          $@*   ;@@@%=!:                *@*
+ *          =@$    ;;;!=%@@@@=!           =@!
+ *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
+ *            ;%@@$=$@@%*       *@@@$=%@@%;
+ *               ::;::             ::;::                                              All rights reserved.
+ *
+ * ********************************************************************************************************************
+ */
+
+import { SPainter, SPoint, SRect } from "@saga-web/draw/lib";
+import { Wall } from "../../types/floor/Wall";
+import { ItemOrder } from "../..";
+import { ItemColor } from "../..";
+import { SGraphItem } from "@saga-web/graph/lib";
+
+/**
+ * 墙item
+ *
+ * @author  郝建龙
+ */
+export class SWallItem extends SGraphItem {
+    /** 墙数据 */
+    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: SGraphItem | 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

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

@@ -37,6 +37,8 @@ export interface Wall {
     Name?: string;
     /** 轮廓线  */
     OutLine: Point[][];
+    /** 轮廓线  */
+    Holes?: Point[][];
     /** 对应Revit模型id */
     SourceId?: string;
     /** 厚度  */

+ 2 - 2
saga-web-fengmap/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/feng-map",
-    "version": "1.0.36",
+    "version": "1.0.37",
     "description": "上格云Web平面图。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -33,7 +33,7 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@saga-web/big": "1.0.106",
+        "@saga-web/big": "1.0.107",
         "axios": "^0.18.0"
     }
 }

+ 20 - 0
saga-web-fengmap/src/config/ProjectRf.ts

@@ -4,6 +4,7 @@
  * */
 export const ProjectRf = {
     1002006: [
+        //1002006_322
         {
             id: "28",
             name: "rf237032b.png",
@@ -20,5 +21,24 @@ export const ProjectRf = {
             x: 0,
             y: 0
         }
+    ],
+    1001645: [
+        //1001645_23
+        {
+            id: "27",
+            name: "rf645681a.png",
+            width: 1379,
+            height: 688,
+            x: -368,
+            y: -27
+        },
+        {
+            id: "28",
+            name: "rf645681b.png",
+            width: 1343,
+            height: 671,
+            x: 339,
+            y: -20
+        }
     ]
 };

+ 20 - 1
saga-web-fengmap/src/parser/SFengParser.ts

@@ -145,6 +145,7 @@ export class SFengParser extends SParser {
         200015,
         200016,
         200021,
+        300004,
         300005,
         300006,
         300007,
@@ -297,8 +298,26 @@ export class SFengParser extends SParser {
                             const hasHole =
                                 t.target._data.holes &&
                                 t.target._data.holes.length;
+                            let holes = [];
+                            if (hasHole) {
+                                let tempArr = t.target._data.holes;
+                                for (let j = 0; j < tempArr.length; j++) {
+                                    let holeChild = [];
+                                    for (
+                                        let i = 0;
+                                        i < tempArr[j].length - 1;
+                                        i += 2
+                                    ) {
+                                        holeChild.push({
+                                            X: tempArr[j][i] - minx,
+                                            Y: tempArr[j][i + 1] - maxy
+                                        });
+                                    }
+                                    holes.push(holeChild);
+                                }
+                            }
                             // @ts-ignore
-                            walls.push({ OutLine: [outline], HasHole: hasHole });
+                            walls.push({ OutLine: [outline], HasHole: hasHole, Holes: holes});
                         } else if (this.virtualWallType.indexOf(type) > -1) {
                             // @ts-ignore
                             virtualWall.push({ OutLine: [outline] });

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

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/graph",
-    "version": "2.1.122",
+    "version": "2.1.123",
     "description": "上格云二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",