소스 검색

万达item 废弃

haojianlong 4 년 전
부모
커밋
8f0dc8d112

+ 16 - 51
persagy-web-big/src/items/floor/SSpaceItem.ts

@@ -27,6 +27,7 @@
 import {
     SColor,
     SPainter,
+    SPath,
     SPoint,
     SPolygonUtil,
     SRect,
@@ -42,21 +43,21 @@ import { SGraphItem } from "@persagy-web/graph";
  * @author  郝建龙
  */
 export class SSpaceItem extends SGraphItem {
-    /** 空间所有数据  */
+    /** 空间所有数据 */
     data: Space;
-    /** 空间轮廓线坐标list  */
+    /** 空间轮廓线坐标list */
     readonly pointArr: SPoint[][] = [];
-    /** X坐标最小值  */
+    /** X坐标最小值 */
     minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值  */
+    /** X坐标最大值 */
     maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值  */
+    /** Y坐标最小值 */
     minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值  */
+    /** Y坐标最大值 */
     maxY = Number.MIN_SAFE_INTEGER;
-    /** path对象      */
-    // private path = new SPath2D();
-    /** 高亮状态    */
+    /** path对象 */
+    private path = new SPath();
+    /** 高亮状态 */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
         return this._highLightFlag;
@@ -65,7 +66,7 @@ export class SSpaceItem extends SGraphItem {
         this._highLightFlag = value;
         this.update();
     } // Set highLightFlag
-    /** 是否显示名字  */
+    /** 是否显示名字 */
     private _showBaseName: boolean = false;
     get showBaseName(): boolean {
         return this._showBaseName;
@@ -74,7 +75,7 @@ export class SSpaceItem extends SGraphItem {
         this._showBaseName = value;
         this.update();
     } // Set showBaseName
-    /** 是否名字大小  */
+    /** 是否名字大小 */
     private _nameSize: number = 10;
     get nameSize(): number {
         return this._nameSize;
@@ -83,7 +84,7 @@ export class SSpaceItem extends SGraphItem {
         this._nameSize = value;
         this.update();
     } // Set nameSize
-    /** 名字是否缩放  */
+    /** 名字是否缩放 */
     private _nameTransform: boolean = false;
     get nameTransform(): boolean {
         return this._nameTransform;
@@ -92,7 +93,7 @@ export class SSpaceItem extends SGraphItem {
         this._nameTransform = value;
         this.update();
     } // Set nameTransform
-    /** 名字颜色    */
+    /** 名字颜色 */
     private _nameColor: string = "#000000";
     get nameColor(): string {
         return this._nameColor;
@@ -139,7 +140,7 @@ export class SSpaceItem extends SGraphItem {
                         return new SPoint(x, y);
                     }
                 );
-                // this.path.polygon(temp);
+                this.path.polygon(temp);
                 return temp;
             });
         }
@@ -159,38 +160,6 @@ export class SSpaceItem extends SGraphItem {
         );
     } // Function boundingRect()
 
-    // /**
-    //  * 鼠标单击事件
-    //  *
-    //  * @param	event         事件参数
-    //  * @return	boolean
-    //  */
-    // onMouseDown(event: SMouseEvent): boolean {
-    //     console.log("spaceDown");
-    //     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()
-
     /**
      * 判断点是否在区域内
      *
@@ -226,10 +195,7 @@ export class SSpaceItem extends SGraphItem {
             painter.brush.color = ItemColor.spaceColor;
         }
         painter.pen.lineWidth = painter.toPx(1);
-        // painter.drawPath(this.path);
-        if (this.pointArr.length) {
-            painter.drawPolygon(this.pointArr[0]);
-        }
+        painter.drawPath(this.path);
 
         if (this.showBaseName) {
             if (this.name && this.name != "null") {
@@ -239,7 +205,6 @@ export class SSpaceItem extends SGraphItem {
                 } else {
                     painter.font.size = painter.toPx(this.nameSize);
                 }
-                // painter.font.size = 500;
                 painter.font.textAlign = STextAlign.Center;
                 painter.drawText(
                     this.name,

+ 50 - 16
persagy-web-big/src/items/floor/SSpaceItemSS.ts

@@ -27,7 +27,6 @@
 import {
     SColor,
     SPainter,
-    SPath,
     SPoint,
     SPolygonUtil,
     SRect,
@@ -43,21 +42,21 @@ import { SGraphItem } from "@persagy-web/graph";
  * @author  郝建龙
  */
 export class SSpaceItem extends SGraphItem {
-    /** 空间所有数据 */
+    /** 空间所有数据  */
     data: Space;
-    /** 空间轮廓线坐标list */
+    /** 空间轮廓线坐标list  */
     readonly pointArr: SPoint[][] = [];
-    /** X坐标最小值 */
+    /** X坐标最小值  */
     minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
+    /** X坐标最大值  */
     maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
+    /** Y坐标最小值  */
     minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
+    /** Y坐标最大值  */
     maxY = Number.MIN_SAFE_INTEGER;
-    /** path对象 */
-    private path = new SPath();
-    /** 高亮状态 */
+    /** path对象      */
+    // private path = new SPath2D();
+    /** 高亮状态    */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
         return this._highLightFlag;
@@ -66,7 +65,7 @@ export class SSpaceItem extends SGraphItem {
         this._highLightFlag = value;
         this.update();
     } // Set highLightFlag
-    /** 是否显示名字 */
+    /** 是否显示名字  */
     private _showBaseName: boolean = false;
     get showBaseName(): boolean {
         return this._showBaseName;
@@ -75,7 +74,7 @@ export class SSpaceItem extends SGraphItem {
         this._showBaseName = value;
         this.update();
     } // Set showBaseName
-    /** 是否名字大小 */
+    /** 是否名字大小  */
     private _nameSize: number = 10;
     get nameSize(): number {
         return this._nameSize;
@@ -84,7 +83,7 @@ export class SSpaceItem extends SGraphItem {
         this._nameSize = value;
         this.update();
     } // Set nameSize
-    /** 名字是否缩放 */
+    /** 名字是否缩放  */
     private _nameTransform: boolean = false;
     get nameTransform(): boolean {
         return this._nameTransform;
@@ -93,7 +92,7 @@ export class SSpaceItem extends SGraphItem {
         this._nameTransform = value;
         this.update();
     } // Set nameTransform
-    /** 名字颜色 */
+    /** 名字颜色    */
     private _nameColor: string = "#000000";
     get nameColor(): string {
         return this._nameColor;
@@ -140,7 +139,7 @@ export class SSpaceItem extends SGraphItem {
                         return new SPoint(x, y);
                     }
                 );
-                this.path.polygon(temp);
+                // this.path.polygon(temp);
                 return temp;
             });
         }
@@ -160,6 +159,38 @@ export class SSpaceItem extends SGraphItem {
         );
     } // Function boundingRect()
 
+    // /**
+    //  * 鼠标单击事件
+    //  *
+    //  * @param	event         事件参数
+    //  * @return	boolean
+    //  */
+    // onMouseDown(event: SMouseEvent): boolean {
+    //     console.log("spaceDown");
+    //     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()
+
     /**
      * 判断点是否在区域内
      *
@@ -195,7 +226,10 @@ export class SSpaceItem extends SGraphItem {
             painter.brush.color = ItemColor.spaceColor;
         }
         painter.pen.lineWidth = painter.toPx(1);
-        painter.drawPath(this.path);
+        // painter.drawPath(this.path);
+        if (this.pointArr.length) {
+            painter.drawPolygon(this.pointArr[0]);
+        }
 
         if (this.showBaseName) {
             if (this.name && this.name != "null") {

+ 22 - 53
persagy-web-big/src/items/floor/SWallItem.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { SPainter, SPath, SPoint, SRect } from "@persagy-web/draw";
+import { SPainter, SPoint, SRect, SPath } from "@persagy-web/draw";
 import { Wall } from "../../types/floor/Wall";
 import { ItemOrder, ItemColor } from "../..";
 import { SGraphItem } from "@persagy-web/graph";
@@ -47,8 +47,6 @@ 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 SPath();
 
@@ -63,62 +61,33 @@ 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 = [];
-            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);
+            tempArr.forEach((t): void => {
+                const temp = t.map(
+                    (it): SPoint => {
+                        let x = it.X,
+                            y = -it.Y;
+                        if (x < this.minX) {
+                            this.minX = x;
                         }
-                    );
-                    this.path.polygon(temp);
-                    return temp;
-                });
-            }
+                        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);
+            });
         }
     } // Constructor
 

+ 53 - 22
persagy-web-big/src/items/floor/SWallItemSS.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { SPainter, SPoint, SRect, SPath } from "@persagy-web/draw";
+import { SPainter, SPath, SPoint, SRect } from "@persagy-web/draw";
 import { Wall } from "../../types/floor/Wall";
 import { ItemOrder, ItemColor } from "../..";
 import { SGraphItem } from "@persagy-web/graph";
@@ -47,6 +47,8 @@ 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 SPath();
 
@@ -61,33 +63,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;
-            tempArr.forEach((t): void => {
-                const temp = t.map(
-                    (it): SPoint => {
-                        let x = it.X,
-                            y = -it.Y;
-                        if (x < this.minX) {
-                            this.minX = x;
-                        }
-                        if (y < this.minY) {
-                            this.minY = y;
-                        }
-                        if (x > this.maxX) {
-                            this.maxX = x;
-                        }
-                        if (y > this.maxY) {
-                            this.maxY = y;
-                        }
-                        return new SPoint(x, y);
+            this.pointArr = [];
+            let WLine = tempArr[0].map(
+                (it): SPoint => {
+                    let x = it.X,
+                        y = -it.Y;
+                    if (x < this.minX) {
+                        this.minX = x;
                     }
-                );
-                this.path.polygon(temp);
-            });
+                    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