瀏覽代碼

fix:解决冲突

YaolongHan 4 年之前
父節點
當前提交
4d8cd7e24f
共有 100 個文件被更改,包括 1388 次插入1455 次删除
  1. 3 1
      persagy-web-base/.eslintrc.js
  2. 120 108
      persagy-web-base/src/SMatrix.ts
  3. 3 3
      persagy-web-base/src/SMouseEvent.ts
  4. 7 8
      persagy-web-base/src/SObject.ts
  5. 7 7
      persagy-web-base/src/SObjectObserver.ts
  6. 1 2
      persagy-web-base/src/enums/SKeyCode.ts
  7. 1 1
      persagy-web-base/src/enums/SMouseButton.ts
  8. 1 1
      persagy-web-base/src/enums/STouchState.ts
  9. 1 1
      persagy-web-base/src/undo/SCommandLog.ts
  10. 11 11
      persagy-web-base/src/undo/SUndoCommand.ts
  11. 27 24
      persagy-web-base/src/undo/SUndoStack.ts
  12. 3 3
      persagy-web-base/src/utils/SNetUtil.ts
  13. 7 7
      persagy-web-base/src/utils/SStringBuilder.ts
  14. 3 3
      persagy-web-base/src/utils/SStringUtil.ts
  15. 4 3
      persagy-web-base/src/utils/SUuid.ts
  16. 10 10
      persagy-web-big-edit/src/BigEditFactory.ts
  17. 17 17
      persagy-web-big-edit/src/SBaseEditScene.ts
  18. 9 9
      persagy-web-big-edit/src/items/SBaseArrow.ts
  19. 3 3
      persagy-web-big-edit/src/items/SBaseEquipment.ts
  20. 4 4
      persagy-web-big-edit/src/items/SBaseExpainEdit.ts
  21. 4 4
      persagy-web-big-edit/src/items/SBasePipe.ts
  22. 4 4
      persagy-web-big-edit/src/items/SBasePipeUninTool.ts
  23. 1 1
      persagy-web-big-edit/src/types/Anchor.ts
  24. 1 1
      persagy-web-big-edit/src/types/ElementData.ts
  25. 1 1
      persagy-web-big-edit/src/types/Legend.ts
  26. 1 1
      persagy-web-big-edit/src/types/Marker.ts
  27. 1 1
      persagy-web-big-edit/src/types/Relation.ts
  28. 13 6
      persagy-web-big/.eslintrc.js
  29. 2 2
      persagy-web-big/package.json
  30. 1 1
      persagy-web-big/src/config/ItemColor.ts
  31. 1 1
      persagy-web-big/src/config/ItemOrder.ts
  32. 1 1
      persagy-web-big/src/config/Transparency.ts
  33. 1 1
      persagy-web-big/src/enums/SGraphElementType.ts
  34. 2 2
      persagy-web-big/src/enums/SItemStatus.ts
  35. 1 1
      persagy-web-big/src/enums/SLineType.ts
  36. 1 1
      persagy-web-big/src/enums/SMarkerType.ts
  37. 1 1
      persagy-web-big/src/enums/SRelationDir.ts
  38. 1 1
      persagy-web-big/src/enums/SRelationState.ts
  39. 25 25
      persagy-web-big/src/factories/SItemFactory.ts
  40. 1 1
      persagy-web-big/src/factories/STopoItemFactory.ts
  41. 9 8
      persagy-web-big/src/items/SArrowItem.ts
  42. 115 2
      persagy-web-big/src/items/SArrowPoly.ts
  43. 151 91
      persagy-web-big/src/items/SIconTextItem.ts
  44. 1 1
      persagy-web-big/src/items/SLayerItem.ts
  45. 125 56
      persagy-web-big/src/items/SLineItem.ts
  46. 81 79
      persagy-web-big/src/items/SPolygonItem.ts
  47. 80 72
      persagy-web-big/src/items/SPolylineItem.ts
  48. 9 9
      persagy-web-big/src/items/SRectSelectItem.ts
  49. 1 1
      persagy-web-big/src/items/STooltipItem.ts
  50. 9 8
      persagy-web-big/src/items/floor/SBoardItem.ts
  51. 5 5
      persagy-web-big/src/items/floor/SColumnItem.ts
  52. 18 7
      persagy-web-big/src/items/floor/SDoorItem.ts
  53. 11 11
      persagy-web-big/src/items/floor/SHighlightItem.ts
  54. 31 23
      persagy-web-big/src/items/floor/SSpaceItem.ts
  55. 0 253
      persagy-web-big/src/items/floor/SSpaceItems.ts
  56. 17 7
      persagy-web-big/src/items/floor/SVirtualWallItem.ts
  57. 7 4
      persagy-web-big/src/items/floor/SWallItem.ts
  58. 0 151
      persagy-web-big/src/items/floor/SWallItems.ts
  59. 16 8
      persagy-web-big/src/items/floor/SWindowItem.ts
  60. 28 17
      persagy-web-big/src/items/floor/ZoneItem.ts
  61. 16 15
      persagy-web-big/src/parser/SFloorParser.ts
  62. 3 3
      persagy-web-big/src/parser/SParser.ts
  63. 9 9
      persagy-web-big/src/parser/STopologyParser.ts
  64. 5 5
      persagy-web-big/src/parser/SZoneParser.ts
  65. 1 1
      persagy-web-big/src/types/BigPoint.ts
  66. 1 1
      persagy-web-big/src/types/FloorData.ts
  67. 1 1
      persagy-web-big/src/types/ImageData.ts
  68. 1 1
      persagy-web-big/src/types/Marker.ts
  69. 1 1
      persagy-web-big/src/types/MinDis.ts
  70. 1 1
      persagy-web-big/src/types/Outline.ts
  71. 1 1
      persagy-web-big/src/types/Place.ts
  72. 1 1
      persagy-web-big/src/types/PointToLine.ts
  73. 1 1
      persagy-web-big/src/types/Size.ts
  74. 1 1
      persagy-web-big/src/types/TextData.ts
  75. 1 1
      persagy-web-big/src/types/TopologyData.ts
  76. 1 1
      persagy-web-big/src/types/floor/Casement.ts
  77. 1 1
      persagy-web-big/src/types/floor/Column.ts
  78. 1 1
      persagy-web-big/src/types/floor/Door.ts
  79. 1 1
      persagy-web-big/src/types/floor/Space.ts
  80. 1 1
      persagy-web-big/src/types/floor/VirtualWall.ts
  81. 1 1
      persagy-web-big/src/types/floor/Wall.ts
  82. 1 1
      persagy-web-big/src/types/floor/Zone.ts
  83. 1 1
      persagy-web-big/src/types/topology/Anchor.ts
  84. 1 1
      persagy-web-big/src/types/topology/MarkerTopo.ts
  85. 1 1
      persagy-web-big/src/types/topology/Node.ts
  86. 1 1
      persagy-web-big/src/types/topology/Relation.ts
  87. 25 24
      persagy-web-big/src/utils/SMathUtil.ts
  88. 18 12
      persagy-web-draw/.eslintrc.js
  89. 11 11
      persagy-web-draw/src/SBrush.ts
  90. 67 66
      persagy-web-draw/src/SCanvasView.ts
  91. 31 31
      persagy-web-draw/src/SColor.ts
  92. 6 6
      persagy-web-draw/src/SFont.ts
  93. 16 16
      persagy-web-draw/src/SGradient.ts
  94. 5 5
      persagy-web-draw/src/SGradientStop.ts
  95. 8 8
      persagy-web-draw/src/SLinearGradient.ts
  96. 87 87
      persagy-web-draw/src/SPainter.ts
  97. 25 25
      persagy-web-draw/src/SPath.ts
  98. 6 6
      persagy-web-draw/src/SPen.ts
  99. 8 8
      persagy-web-draw/src/SRadialGradient.ts
  100. 0 0
      persagy-web-draw/src/SShadow.ts

+ 3 - 1
persagy-web-base/.eslintrc.js

@@ -51,12 +51,14 @@ module.exports = {
         "max-lines-per-function": ["error", 200],       // 一个函数最多200行代码
         "max-statements-per-line": ["error", {max: 1}], // 一行只允许有一条语句
         // 缩进
-        "indent": ["error", 4],                         // 缩进控制4空格
+        "indent": ["error", 4, { SwitchCase: 1 }],                         // 缩进控制4空格
         "max-len": ["error", 120],                      // 每行字符不超过120
         "no-mixed-spaces-and-tabs": "error",            // 禁止使用空格和tab混合缩进
         // 语句
         "curly": ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
         "semi": ["error", "always"],                    // 不得省略语句结束的分号
         "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],       // public访问不需加访问修饰符
+        "@typescript-eslint/no-explicit-any": ["off"],
+        "@typescript-eslint/no-unused-vars": ["off"],
     }
 };

+ 120 - 108
persagy-web-base/src/SMatrix.ts

@@ -50,61 +50,73 @@ export class SMatrix {
     m24 = 0;
     m34 = 0;
     m44 = 1;
+
     // 结束:矩阵元素定义
 
     /** x 轴方向的缩放比例 */
     get a(): number {
         return this.m11;
-    } // Get a
+    }
+
     set a(v: number) {
         this.m11 = v;
-    } // Set a
+    }
+
     /** x 轴方向斜切 */
     get b(): number {
         return this.m12;
-    } // Get b
+    }
+
     set b(v: number) {
         this.m12 = v;
-    } // Set b
+    }
+
     /** y轴方向斜切 */
     get c(): number {
         return this.m21;
-    } // Get c
+    }
+
     set c(v: number) {
         this.m21 = v;
-    } // Set c
+    }
+
     /** y轴方向缩放比例   */
     get d(): number {
         return this.m22;
-    } // Get d
+    }
+
     set d(v: number) {
         this.m22 = v;
-    } // Set d
+    }
+
     /** x轴方向平移 */
     get e(): number {
         return this.m41;
-    } // Get e
+    }
+
     set e(v: number) {
         this.m41 = v;
-    } // Set e
+    }
+
     /** y轴方向平移 */
     get f(): number {
         return this.m42;
-    } // Get f
+    }
+
     set f(v: number) {
         this.m42 = v;
-    } // Set f
+    }
 
     /**
      * 是否为 2D 矩阵
-    */
+     */
     get is2D(): boolean {
         return true;
-    } // Get is2D
+    }
 
     /**
      * 是否为单位矩阵
-    */
+     */
     get isIdentity(): boolean {
         return (
             this.m11 == 1 &&
@@ -124,13 +136,13 @@ export class SMatrix {
             this.m34 == 0 &&
             this.m44 == 1
         );
-    } // Get isIdentity
+    }
 
     /**
      * 重置变换矩阵
      *
      * @return 返回自身
-    */
+     */
     reset(): SMatrix {
         this.m11 = 1;
         this.m21 = 0;
@@ -152,14 +164,14 @@ export class SMatrix {
         this.m34 = 0;
         this.m44 = 1;
         return this;
-    } // Function reset()
+    }
 
     /**
      * 原始矩阵乘以给定的变换矩阵
      *
      * @param mat   给定的变换矩阵
      * @return 返回自身
-    */
+     */
     multiply(mat: SMatrix): SMatrix {
         [
             this.m11,
@@ -183,75 +195,75 @@ export class SMatrix {
             this.m44
         ] = [
             this.m11 * mat.m11 +
-                this.m21 * mat.m12 +
-                this.m31 * mat.m13 +
-                this.m41 * mat.m14,
+            this.m21 * mat.m12 +
+            this.m31 * mat.m13 +
+            this.m41 * mat.m14,
             this.m11 * mat.m21 +
-                this.m21 * mat.m22 +
-                this.m31 * mat.m23 +
-                this.m41 * mat.m24,
+            this.m21 * mat.m22 +
+            this.m31 * mat.m23 +
+            this.m41 * mat.m24,
             this.m11 * mat.m31 +
-                this.m21 * mat.m32 +
-                this.m31 * mat.m33 +
-                this.m41 * mat.m34,
+            this.m21 * mat.m32 +
+            this.m31 * mat.m33 +
+            this.m41 * mat.m34,
             this.m11 * mat.m41 +
-                this.m21 * mat.m42 +
-                this.m31 * mat.m43 +
-                this.m41 * mat.m44,
+            this.m21 * mat.m42 +
+            this.m31 * mat.m43 +
+            this.m41 * mat.m44,
 
             this.m12 * mat.m11 +
-                this.m22 * mat.m12 +
-                this.m32 * mat.m13 +
-                this.m42 * mat.m14,
+            this.m22 * mat.m12 +
+            this.m32 * mat.m13 +
+            this.m42 * mat.m14,
             this.m12 * mat.m21 +
-                this.m22 * mat.m22 +
-                this.m32 * mat.m23 +
-                this.m42 * mat.m24,
+            this.m22 * mat.m22 +
+            this.m32 * mat.m23 +
+            this.m42 * mat.m24,
             this.m12 * mat.m31 +
-                this.m22 * mat.m32 +
-                this.m32 * mat.m33 +
-                this.m42 * mat.m34,
+            this.m22 * mat.m32 +
+            this.m32 * mat.m33 +
+            this.m42 * mat.m34,
             this.m12 * mat.m41 +
-                this.m22 * mat.m42 +
-                this.m32 * mat.m43 +
-                this.m42 * mat.m44,
+            this.m22 * mat.m42 +
+            this.m32 * mat.m43 +
+            this.m42 * mat.m44,
 
             this.m13 * mat.m11 +
-                this.m23 * mat.m12 +
-                this.m33 * mat.m13 +
-                this.m43 * mat.m14,
+            this.m23 * mat.m12 +
+            this.m33 * mat.m13 +
+            this.m43 * mat.m14,
             this.m13 * mat.m21 +
-                this.m23 * mat.m22 +
-                this.m33 * mat.m23 +
-                this.m43 * mat.m24,
+            this.m23 * mat.m22 +
+            this.m33 * mat.m23 +
+            this.m43 * mat.m24,
             this.m13 * mat.m31 +
-                this.m23 * mat.m32 +
-                this.m33 * mat.m33 +
-                this.m43 * mat.m34,
+            this.m23 * mat.m32 +
+            this.m33 * mat.m33 +
+            this.m43 * mat.m34,
             this.m13 * mat.m41 +
-                this.m23 * mat.m42 +
-                this.m33 * mat.m43 +
-                this.m43 * mat.m44,
+            this.m23 * mat.m42 +
+            this.m33 * mat.m43 +
+            this.m43 * mat.m44,
 
             this.m14 * mat.m11 +
-                this.m24 * mat.m12 +
-                this.m34 * mat.m13 +
-                this.m44 * mat.m14,
+            this.m24 * mat.m12 +
+            this.m34 * mat.m13 +
+            this.m44 * mat.m14,
             this.m14 * mat.m21 +
-                this.m24 * mat.m22 +
-                this.m34 * mat.m23 +
-                this.m44 * mat.m24,
+            this.m24 * mat.m22 +
+            this.m34 * mat.m23 +
+            this.m44 * mat.m24,
             this.m14 * mat.m31 +
-                this.m24 * mat.m32 +
-                this.m34 * mat.m33 +
-                this.m44 * mat.m34,
+            this.m24 * mat.m32 +
+            this.m34 * mat.m33 +
+            this.m44 * mat.m34,
             this.m14 * mat.m41 +
-                this.m24 * mat.m42 +
-                this.m34 * mat.m43 +
-                this.m44 * mat.m44
+            this.m24 * mat.m42 +
+            this.m34 * mat.m43 +
+            this.m44 * mat.m44
         ];
         return this;
-    } // Function multiply()
+    }
 
     /**
      * 位移变换
@@ -260,7 +272,7 @@ export class SMatrix {
      * @param dy    Y 轴位移
      * @param dz    Z 轴位移
      * @return 返回自身
-    */
+     */
     translate(dx: number, dy: number, dz = 0): SMatrix {
         const mat = new SMatrix();
         mat.m41 = dx;
@@ -268,7 +280,7 @@ export class SMatrix {
         mat.m43 = dz;
         this.multiply(mat);
         return this;
-    } // Function translate()
+    }
 
     /**
      * 缩放变换
@@ -276,21 +288,21 @@ export class SMatrix {
      * @param sx    X 轴缩放比例
      * @param sy    Y 轴缩放比例
      * @return 返回自身
-    */
+     */
     scale(sx: number, sy: number): SMatrix {
         const mat = new SMatrix();
         mat.m11 = sx;
         mat.m22 = sy;
         this.multiply(mat);
         return this;
-    } // Function scale
+    }
 
     /**
      * 旋转变形
      *
      * @param angle     绕 Z 轴旋转角度(单位角度度)
      * @return 返回自身
-    */
+     */
     rotate(angle: number): SMatrix;
 
     /**
@@ -300,7 +312,7 @@ export class SMatrix {
      * @param rotY  绕 X 轴旋转角度(单位角度 度)
      * @param rotZ  绕 X 轴旋转角度(单位角度 度)
      * @return 返回自身
-    */
+     */
     rotate(rotX: number, rotY: number, rotZ: number): SMatrix;
 
     /**
@@ -310,7 +322,7 @@ export class SMatrix {
      * @param rotY  绕 X 轴旋转角度(单位度)
      * @param rotZ  绕 X 轴旋转角度(单位度)
      * @return 返回自身
-    */
+     */
     rotate(rotX: number, rotY?: number, rotZ?: number): SMatrix {
         const matZ = new SMatrix();
         if (rotY != undefined && rotZ != undefined) {
@@ -342,13 +354,13 @@ export class SMatrix {
             this.multiply(matZ);
             return this;
         }
-    } // Function rotate()
+    }
 
     /**
      * 转置当前矩阵
      *
      * @return 返回自身
-    */
+     */
     transpose(): SMatrix {
         [this.m12, this.m21] = [this.m21, this.m12];
         [this.m13, this.m31] = [this.m31, this.m13];
@@ -359,13 +371,13 @@ export class SMatrix {
 
         [this.m34, this.m43] = [this.m43, this.m34];
         return this;
-    } // Function transpose()
+    }
 
     /**
      * 返回当前矩阵的逆矩阵
      *
      * @return 当前矩阵的逆矩阵
-    */
+     */
     inversed(): SMatrix {
         const detMat = this.det();
         const d = this.value();
@@ -390,13 +402,13 @@ export class SMatrix {
         ret.m34 = detMat.m34 / d;
         ret.m44 = detMat.m44 / d;
         return ret;
-    } // Function inversed()
+    }
 
     /**
      * 返回当前矩阵的伴随矩阵
      *
      * @return 当前矩阵的伴随矩阵
-    */
+     */
     det(): SMatrix {
         const m = new SMatrix();
         m.m11 =
@@ -523,43 +535,43 @@ export class SMatrix {
             this.m21 * this.m12 * this.m33 -
             this.m11 * this.m32 * this.m23;
         return m;
-    } // Function det()
+    }
 
     /**
      * 返回当前矩阵的值
      *
      * @return 当前矩阵的值
-    */
+     */
     value(): number {
         return (
             this.m11 *
-                (this.m22 * this.m33 * this.m44 +
-                    this.m32 * this.m43 * this.m24 +
-                    this.m42 * this.m23 * this.m34 -
-                    this.m42 * this.m33 * this.m24 -
-                    this.m32 * this.m23 * this.m44 -
-                    this.m22 * this.m43 * this.m34) -
+            (this.m22 * this.m33 * this.m44 +
+                this.m32 * this.m43 * this.m24 +
+                this.m42 * this.m23 * this.m34 -
+                this.m42 * this.m33 * this.m24 -
+                this.m32 * this.m23 * this.m44 -
+                this.m22 * this.m43 * this.m34) -
             this.m21 *
-                (this.m12 * this.m33 * this.m44 +
-                    this.m32 * this.m43 * this.m14 +
-                    this.m42 * this.m13 * this.m34 -
-                    this.m42 * this.m33 * this.m14 -
-                    this.m32 * this.m13 * this.m44 -
-                    this.m12 * this.m43 * this.m34) +
+            (this.m12 * this.m33 * this.m44 +
+                this.m32 * this.m43 * this.m14 +
+                this.m42 * this.m13 * this.m34 -
+                this.m42 * this.m33 * this.m14 -
+                this.m32 * this.m13 * this.m44 -
+                this.m12 * this.m43 * this.m34) +
             this.m31 *
-                (this.m12 * this.m23 * this.m44 +
-                    this.m22 * this.m43 * this.m14 +
-                    this.m42 * this.m13 * this.m24 -
-                    this.m42 * this.m23 * this.m14 -
-                    this.m22 * this.m13 * this.m44 -
-                    this.m12 * this.m43 * this.m24) -
+            (this.m12 * this.m23 * this.m44 +
+                this.m22 * this.m43 * this.m14 +
+                this.m42 * this.m13 * this.m24 -
+                this.m42 * this.m23 * this.m14 -
+                this.m22 * this.m13 * this.m44 -
+                this.m12 * this.m43 * this.m24) -
             this.m41 *
-                (this.m12 * this.m23 * this.m34 +
-                    this.m22 * this.m33 * this.m14 +
-                    this.m32 * this.m13 * this.m24 -
-                    this.m32 * this.m23 * this.m14 -
-                    this.m22 * this.m13 * this.m34 -
-                    this.m12 * this.m33 * this.m24)
+            (this.m12 * this.m23 * this.m34 +
+                this.m22 * this.m33 * this.m14 +
+                this.m32 * this.m13 * this.m24 -
+                this.m32 * this.m23 * this.m14 -
+                this.m22 * this.m13 * this.m34 -
+                this.m12 * this.m33 * this.m24)
         );
-    } // Function value()
+    }
 }

+ 3 - 3
persagy-web-base/src/SMouseEvent.ts

@@ -65,7 +65,7 @@ export class SMouseEvent {
      * 构造函数
      *
      * @param event     系统鼠标事件
-    */
+     */
     constructor(event: MouseEvent | SMouseEvent) {
         // let bbox = (this.type = event.type); //event.srcElement.getBoundingClientRect()
         this.type = event.type;
@@ -102,5 +102,5 @@ export class SMouseEvent {
             this.x = event.offsetX;
             this.y = event.offsetY;
         }
-    } // Constructor()
-} // Class SMouseEvent
+    }
+}

+ 7 - 8
persagy-web-base/src/SObject.ts

@@ -45,8 +45,7 @@ export class SObject {
      * @param name        信息名称
      * @param receiver    信号接收者
      * @param callback    回调函数
-    */
-    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+     */
     connect(name: string, receiver: any, callback: Function): void {
         // @ts-ignore
         let observerList = this.listeners[name];
@@ -64,14 +63,14 @@ export class SObject {
 
         // @ts-ignore
         this.listeners[name].push(new SObjectObserver(receiver, callback));
-    } // Function
+    }
 
     /**
      * 断开连接的信号
      *
      * @param name        信息名称
      * @param receiver    信号接收者
-    */
+     */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     disconnect(name: string, receiver: any): void {
         // @ts-ignore
@@ -92,14 +91,14 @@ export class SObject {
             // @ts-ignore
             delete this.listeners[name];
         }
-    } // Function disconnect()
+    }
 
     /**
      * 发出事件
      *
      * @param name    事件名称
      * @param args    参数
-    */
+     */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     $emit(name: string, ...args: any): void {
         // @ts-ignore
@@ -111,5 +110,5 @@ export class SObject {
         for (let observer of observerList) {
             observer.notify(this, args);
         }
-    } // Function $emit()
-} // Class SObject
+    }
+}

+ 7 - 7
persagy-web-base/src/SObjectObserver.ts

@@ -41,31 +41,31 @@ export class SObjectObserver {
      *
      * @param receiver  信号接收者
      * @param callback  回调函数
-    */
+     */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     constructor(receiver: any, callback: Function) {
         this.receiver = receiver;
         this.callback = callback;
-    } // Constructor
+    }
 
     /**
      * 发送通知
      *
      * @param args  参数
-    */
+     */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     notify(...args: any): void {
         this.callback.call(this.receiver, ...args);
-    } // Function notify()
+    }
 
     /**
      * 上一个信号接收者比较
      *
      * @param receiver  信号接收者
      * @return 是否相同
-    */
+     */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     compar(receiver: any): boolean {
         return receiver == this.receiver;
-    } // Function compar()
-} // Class EventObserver
+    }
+}

+ 1 - 2
persagy-web-base/src/enums/SKeyCode.ts

@@ -90,5 +90,4 @@ export enum SKeyCode {
     x = 120,
     y = 121,
     z = 122
-} // Enum SKeyCode
-
+}

+ 1 - 1
persagy-web-base/src/enums/SMouseButton.ts

@@ -36,4 +36,4 @@ export enum SMouseButton {
     RightButton = 0x2,
     /** 鼠标中键 */
     MidButton = 0x4
-} // Enum SMouseButton
+}

+ 1 - 1
persagy-web-base/src/enums/STouchState.ts

@@ -36,4 +36,4 @@ export enum STouchState {
     Move,
     /** 缩放状态 */
     Zoom
-} // Enum STouchState
+}

+ 1 - 1
persagy-web-base/src/undo/SCommandLog.ts

@@ -36,4 +36,4 @@ export interface SCommandLog {
     desc: string;
     /** 命令细节 */
     detail: string;
-} // interface SCommandLog
+}

+ 11 - 11
persagy-web-base/src/undo/SUndoCommand.ts

@@ -39,17 +39,17 @@ export abstract class SUndoCommand {
      * 构造函数
      *
      * @param  parent   指向父命令
-    */
-    protected constructor(parent: SUndoCommand | null = null) {} // Constructor
+     */
+    protected constructor(parent: SUndoCommand | null = null) {}
 
     /**
      * undo回调
-    */
+     */
     abstract undo(): void;
 
     /**
      * redo回调
-    */
+     */
     abstract redo(): void;
 
     /**
@@ -57,22 +57,22 @@ export abstract class SUndoCommand {
      *
      * @param command     合并的命令
      * @return 成功能返回true,否则返回false
-    */
+     */
     mergeWith(command: SUndoCommand): boolean {
         return false;
-    } // Function mergeWith()
+    }
 
     /**
      * 命令 ID 。如果命令不能合并,则返回 -1 。如果支持合并则返回一个正整数。
-    */
+     */
     id(): number {
         return -1;
-    } // Function id()
+    }
 
     /**
      * 命令转为描述谢姐
-    */
+     */
     toString(): string {
         return "";
-    } // toString()
-} // Class SUndoCommand
+    }
+}

+ 27 - 24
persagy-web-base/src/undo/SUndoStack.ts

@@ -41,95 +41,98 @@ export class SUndoStack extends SObject {
     private _index = -1;
     get index(): number {
         return this._index;
-    } // Get index
+    }
 
     /** 命令栈是否为空 */
     get isEmpty(): boolean {
         return this.cmdStack.length <= 0;
-    } // Get isEmpty
+    }
 
     /** 是否更改 */
     isChange: boolean = false;
 
     /**
      * 执行 redo 操作
-    */
+     */
     redo(): void {
-        if (!this.canRedo()) { // 不能执行 redo ,直接返回
+        if (!this.canRedo()) {
+            // 不能执行 redo ,直接返回
             return;
         }
 
         this._index++;
         this.cmdStack[this._index].redo();
         this.isChange = true;
-    } // Function redo()
+    }
 
     /**
      * 执行 undo 操作
-    */
+     */
     undo(): void {
-        if (!this.canUndo()) { // 不能执行 undo ,直接返回
+        if (!this.canUndo()) {
+            // 不能执行 undo ,直接返回
             return;
         }
 
         this.cmdStack[this._index].undo();
         this._index--;
         this.isChange = true;
-    } // Function undo()
+    }
 
     /**
      * 是否可以执行 Redo 操作
      *
      * @return 可以执行,返回 true ;否则返回 false 。
-    */
+     */
     canRedo(): boolean {
         return this.index + 1 < this.cmdStack.length;
-    } // Function canRedo()
+    }
 
     /**
      * 是否可以执行 Undo 操作
      *
      * @return 可以执行,返回 true ;否则返回 false 。
-    */
+     */
     canUndo(): boolean {
         return this.index >= 0;
-    } // Function canUndo()
+    }
 
     /**
      * 清空堆栈
-    */
+     */
     clear(): void {
         this.cmdStack.length = 0;
         this._index = -1;
         this.isChange = true;
-    } // Function clear()
+    }
 
     /**
      * 返回指定索引的命令
      *
      * @param index     命令在栈中的索引
-    */
+     */
     command(index: number): SUndoCommand | null {
-        if (index < 0 || index >= this.cmdStack.length) { // 如果索引越界
+        if (index < 0 || index >= this.cmdStack.length) {
+            // 如果索引越界
             // 返回null
             return null;
         }
 
         return this.cmdStack[index];
-    } // Function command()
+    }
 
     /**
      * 统计命令栈中命令的数量
-    */
+     */
     count(): number {
         return this.cmdStack.length;
-    } // Function count()
+    }
 
     /**
      * 将命令添加到命令栈
      *
      * @param cmd     被添加的命令
-    */
+     */
     push(cmd: SUndoCommand): void {
         this.cmdStack.length = this._index + 1;
         if (this._index >= 0 && cmd.mergeWith(this.cmdStack[this._index])) {
@@ -139,11 +142,11 @@ export class SUndoStack extends SObject {
         this.cmdStack.push(cmd);
         this._index = this.cmdStack.length - 1;
         this.isChange = true;
-    } // Function push()
+    }
 
     /**
      * 将命令堆栈转为日志(命令数组)
-    */
+     */
     toLog(): SCommandLog[] {
         let stackList: SCommandLog[] = [];
         for (let i = 0; i <= this.index; i++) {
@@ -154,5 +157,5 @@ export class SUndoStack extends SObject {
             });
         }
         return stackList;
-    } // Function toLog()
-} // Class SUndoStack
+    }
+}

+ 3 - 3
persagy-web-base/src/utils/SNetUtil.ts

@@ -34,7 +34,7 @@ export class SNetUtil {
      *
      * @param name  下载文件名称
      * @param url   下载url地址
-    */
+     */
     static downLoad(name: string, url: string): void {
         let oA = document.createElement("a");
         oA.download = name;
@@ -43,5 +43,5 @@ export class SNetUtil {
         oA.click();
         // 下载之后把创建的元素删除
         oA.remove();
-    } // Function downLoad()
-} // Class SNetUtil
+    }
+}

+ 7 - 7
persagy-web-base/src/utils/SStringBuilder.ts

@@ -37,31 +37,31 @@ export class SStringBuilder {
      * 构造函数
      *
      * @param msg   初始字符串
-    */
+     */
     constructor(msg?: string) {
         if (msg != undefined) {
             this.append(msg);
         }
-    } // Constructor()
+    }
 
     /**
      * 追加字符串
      *
      * @param msg   追加的字符串
      * @return 字符串 builder 对象
-    */
+     */
     append(msg: string): SStringBuilder {
         this._strArray.push(msg);
         return this;
-    } // Function append()
+    }
 
     /**
      * 转换为字符串
      *
      * @param gap   分隔符,默认换行 (\n)
      * @return 转换后的字符串
-    */
+     */
     toString(gap: string = "\n"): string {
         return this._strArray.join(gap);
-    } // Function toString()
-} // Class SStringBuilder
+    }
+}

+ 3 - 3
persagy-web-base/src/utils/SStringUtil.ts

@@ -35,7 +35,7 @@ export class SStringUtil {
      * @param n         要转换的数值
      * @param len       转换后的长度(默认为 2)
      * @return 转换后的数据
-    */
+     */
     static num2Hex(n: number, len: number = 2): string {
         let hex = "";
         let numStr: string[] = [
@@ -62,5 +62,5 @@ export class SStringUtil {
             len--;
         }
         return hex;
-    } // Function num2Hex()
-} // Class SStringUtil
+    }
+}

+ 4 - 3
persagy-web-base/src/utils/SUuid.ts

@@ -26,6 +26,7 @@
 
 /**
  * 生成uuid工具
+ *
  * @author 郝洁 <haojie@persagy.com>
  */
 export class SUuid {
@@ -34,7 +35,7 @@ export class SUuid {
      *
      * @param len       要生成的 uuid 的长度
      * @param radix     生成 uuid 的基数
-    */
+     */
     static uuid(len: number, radix: number): string {
         const chars = "0123456789abcdef".split("");
         let uuid = [],
@@ -56,5 +57,5 @@ export class SUuid {
             }
         }
         return uuid.join("");
-    } // Function uuid()
-} // Class SUuid()
+    }
+}

+ 10 - 10
persagy-web-big-edit/src/BigEditFactory.ts

@@ -46,7 +46,7 @@ export class BigEditFactory extends SItemFactory {
      */
     constructor() {
         super()
-    } // Constructor
+    }
 
     /**
      * 创建基础直线
@@ -56,7 +56,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseLineEdit(data: Marker): SBaseLineEdit {
         return new SBaseLineEdit(null, data);
-    } // Function createBaseLineEdit()
+    }
 
     /**
      * 创建基础文本
@@ -66,7 +66,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseTextEdit(data: Marker): SBaseTextEdit {
         return new SBaseTextEdit(null, data);
-    } // Function createBaseTextEdit()
+    }
 
     /**
      * 创建基础图片
@@ -76,7 +76,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseImageEdit(data: Marker): SBaseImageEdit {
         return new SBaseImageEdit(null, data);
-    } // Function createBaseImageEdit()
+    }
 
     /**
      * 创建基础矩形
@@ -86,7 +86,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseRectEdit(data: Marker): SBaseRectEdit {
         return new SBaseRectEdit(null, data);
-    } // Function createBaseRectEdit()
+    }
 
     /**
      * 创建基础圆
@@ -96,7 +96,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseCircleEdit(data: Marker): SBaseCircleEdit {
         return new SBaseCircleEdit(null, data);
-    } // Function createBaseRectEdit()
+    }
 
     /**
      * 创建基础注释
@@ -106,7 +106,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseExpainEdit(data: Marker): SBaseExpainEdit {
         return new SBaseExpainEdit(null, data);
-    } // Function createBaseExpainEdit()
+    }
 
     /**
      * 创建基础多边形
@@ -116,7 +116,7 @@ export class BigEditFactory extends SItemFactory {
      */
     createBasePolygonEdit(data: Marker): SBasePolygonEdit {
         return new SBasePolygonEdit(null, data);
-    } // Function createBasePolygonEdit()
+    }
 
     /**
      * 创建基础基础箭头(折线)
@@ -126,6 +126,6 @@ export class BigEditFactory extends SItemFactory {
      */
     createBaseArrow(data: Marker): SBaseArrow {
         return new SBaseArrow(null, data);
-    } // Function createBasePolygonEdit()
+    }
 
-} // Class BigEditFactory
+}

+ 17 - 17
persagy-web-big-edit/src/SBaseEditScene.ts

@@ -55,7 +55,7 @@ export class SBaseEditScene extends SGraphEditScene {
      */
     constructor() {
         super()
-    } // Constructor
+    }
 
     /**
      * 新增基础类注释
@@ -91,7 +91,7 @@ export class SBaseEditScene extends SGraphEditScene {
         this.undoStack.push(new SGraphAddCommand(this, item));
         this.grabItem = null;
         this.finishCreated(item);
-    } // Function addExplainItem()
+    }
 
     /**
      * 新增基础箭头(折线)
@@ -125,7 +125,7 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    } // Function addPolyLineArrow()
+    }
 
     /**
      * 添加基本设备 item
@@ -166,7 +166,7 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    } // Function addEuqipment()
+    }
 
     /**
      * 新增管道
@@ -198,7 +198,7 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    } // Function addBasePipe()
+    }
 
     /**
      * 添加基本管道联通器
@@ -242,7 +242,7 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    } // Function addPipeUninTool()
+    }
 
     /**
      * 重做
@@ -253,7 +253,7 @@ export class SBaseEditScene extends SGraphEditScene {
         } else {
             this.undoStack.redo();
         }
-    } // Function redo()
+    }
 
     /**
      * 撤销
@@ -264,7 +264,7 @@ export class SBaseEditScene extends SGraphEditScene {
         } else {
             this.undoStack.undo();
         }
-    } // Function undo()
+    }
 
     /**
      * 删除
@@ -283,7 +283,7 @@ export class SBaseEditScene extends SGraphEditScene {
             this.view.update()
         }
         return itemList
-    } // Function deleteItem()
+    }
 
     /**
      * 框选
@@ -293,7 +293,7 @@ export class SBaseEditScene extends SGraphEditScene {
         let rect = new SRectSelectItem(null, point);
         this.addItem(rect);
         this.grabItem = rect;
-    } // Function addRectSelect()
+    }
 
     /**
      * 计算框选交集
@@ -308,7 +308,7 @@ export class SBaseEditScene extends SGraphEditScene {
             const rect = this.grabItem.boundingRect();
             this.arrToSelect(this.root.children, rect)
         }
-    } // Function groupSelect()
+    }
 
     /**
      * 选中item:框选
@@ -330,7 +330,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 }
             })
         }
-    } // Function arrToSelect()
+    }
 
     /////////////////////////////////////////////////////////////////////
     // 鼠标事件
@@ -344,7 +344,7 @@ export class SBaseEditScene extends SGraphEditScene {
         if (!super.onMouseDown(event) && 1 == event.buttons) {
             this.addRectSelect(event);
         }
-    } // Function onMouseDown()
+    }
 
     /**
      * 鼠标抬起
@@ -367,7 +367,7 @@ export class SBaseEditScene extends SGraphEditScene {
             return this.grabItem.onMouseUp(event);
         }
         return super.onMouseUp(event)
-    } // Function onMouseUp()
+    }
 
     /**
      * 复制
@@ -395,7 +395,7 @@ export class SBaseEditScene extends SGraphEditScene {
             console.log(input.value, Date.now());
             document.body.removeChild(input)
         }
-    } // Function copy()
+    }
 
     /**
      * 粘贴
@@ -414,5 +414,5 @@ export class SBaseEditScene extends SGraphEditScene {
         });
         this.view ? this.view.update() : ''
         console.log(this.view)
-    } // Function paste()
-} // Class SBaseEditScene
+    }
+} 

+ 9 - 9
persagy-web-big-edit/src/items/SBaseArrow.ts

@@ -43,21 +43,21 @@ export class SBaseArrow extends SBasePolylineEdit {
     _begin = SArrowStyleType.None;
     get begin(): SArrowStyleType {
         return this._begin;
-    } // Get begin
+    }
     set begin(v: SArrowStyleType) {
         this._begin = v;
         this.update();
-    } // Set begin
+    }
 
     /** 结束点样式 */
     _end = SArrowStyleType.None;
     get end(): SArrowStyleType {
         return this._end;
-    } // Get end
+    }
     set end(v: SArrowStyleType) {
         this._end = v;
         this.update();
-    } // Set end
+    }
 
     /**
      * 构造函数
@@ -73,7 +73,7 @@ export class SBaseArrow extends SBasePolylineEdit {
             this.begin = data.style.begin ? data.style.begin : SArrowStyleType.None;
             this.end = data.style.end ? data.style.end : SArrowStyleType.None
         }
-    } // Constructor
+    }
 
     /**
      * 鼠标按下事件
@@ -84,7 +84,7 @@ export class SBaseArrow extends SBasePolylineEdit {
     onMouseDown(event: SMouseEvent): boolean {
         super.onMouseDown(event)
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 绘制基本图形
@@ -119,7 +119,7 @@ export class SBaseArrow extends SBasePolylineEdit {
             }
         );
         painter.drawPolyline(this.pointList);
-    } // Function drawBaseLine()
+    }
 
     /**
      * 返回对象储存的相关数据
@@ -130,5 +130,5 @@ export class SBaseArrow extends SBasePolylineEdit {
         this.data.style.begin = this.begin;
         this.data.style.end = this.end;
         return super.toData();
-    } // Function toData()
-} // Class SBaseArrow
+    }
+}

+ 3 - 3
persagy-web-big-edit/src/items/SBaseEquipment.ts

@@ -43,7 +43,7 @@ export class SBaseEquipment extends SBaseImageEdit {
      */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent, data);
-    } // Constructor
+    }
 
     /**
      * 返回对象储存的相关数据
@@ -52,5 +52,5 @@ export class SBaseEquipment extends SBaseImageEdit {
      */
     toData(): any {
         return super.toData()
-    } // Function toData
-} // Class SBaseEquipment
+    }
+}

+ 4 - 4
persagy-web-big-edit/src/items/SBaseExpainEdit.ts

@@ -45,7 +45,7 @@ import {SMouseEvent} from "@persagy-web/base/lib";
       */
      constructor(parent: SGraphItem | null, data: Marker) {
          super(parent, data);
-     } // Constructor
+     }
 
      /**
       * 鼠标按下事件
@@ -56,7 +56,7 @@ import {SMouseEvent} from "@persagy-web/base/lib";
      onMouseDown(event: SMouseEvent): boolean {
          super.onMouseDown(event);
          return true;
-     } // Function onMouseDown()
+     }
 
      /**
       * 返回对象储存的相关数据
@@ -65,5 +65,5 @@ import {SMouseEvent} from "@persagy-web/base/lib";
       */
      toData(): any {
          return super.toData()
-     } // Function toData()
- } // Class SBaseExpainEdit
+     }
+ }

+ 4 - 4
persagy-web-big-edit/src/items/SBasePipe.ts

@@ -45,7 +45,7 @@ export class SBasePipe extends SBasePolylineEdit {
      */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent, data);
-    } // Constructor
+    }
 
     /**
      * 鼠标按下事件
@@ -56,7 +56,7 @@ export class SBasePipe extends SBasePolylineEdit {
     onMouseDown(event: SMouseEvent): boolean {
         super.onMouseDown(event);
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 返回对象储存的相关数据
@@ -65,5 +65,5 @@ export class SBasePipe extends SBasePolylineEdit {
      */
     toData(): any {
         return super.toData()
-    } // Function toData()
-} // Class SBasePipe
+    }
+}

+ 4 - 4
persagy-web-big-edit/src/items/SBasePipeUninTool.ts

@@ -61,7 +61,7 @@ export class SBasePipeUninTool extends SBaseImageEdit {
                 //     break;
             }
         }
-    } // Constructor
+    }
 
     /**
      * 鼠标按下事件
@@ -72,7 +72,7 @@ export class SBasePipeUninTool extends SBaseImageEdit {
     onMouseDown(event: SMouseEvent): boolean {
         super.onMouseDown(event);
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 返回对象储存的相关数据
@@ -81,5 +81,5 @@ export class SBasePipeUninTool extends SBaseImageEdit {
      */
     toData(): any {
         return super.toData()
-    } // Function toData()
-} // Class SBasePipeUninTool
+    }
+}

+ 1 - 1
persagy-web-big-edit/src/types/Anchor.ts

@@ -36,4 +36,4 @@ export interface Anchor {
     ID: string;
     /** 锚点的坐标 */
     Pos: Point;
-} // Interface Anchor
+}

+ 1 - 1
persagy-web-big-edit/src/types/ElementData.ts

@@ -40,4 +40,4 @@ export interface ElementData {
 s: Marker[];
     /** 关系类节点 */
     Relations: Relation[];
-} // Interface ElementData
+}

+ 1 - 1
persagy-web-big-edit/src/types/Legend.ts

@@ -65,4 +65,4 @@ export interface Legend {
     Properties?: any;
      /** zone 区分防火分区和石材铺装 */
     SubType?:string
-} // Interface Legend
+}

+ 1 - 1
persagy-web-big-edit/src/types/Marker.ts

@@ -51,4 +51,4 @@ export interface Marker {
     style: any;
     /** 由应用自己定义 */
     properties?: any;
-} // Interface Marker
+}

+ 1 - 1
persagy-web-big-edit/src/types/Relation.ts

@@ -55,4 +55,4 @@ export interface Relation {
     PointList: Point[];
     /** 线的绘图样式 */
     Properties?: any;
-} // Interface Relation
+}

+ 13 - 6
persagy-web-big/.eslintrc.js

@@ -45,13 +45,20 @@ module.exports = {
         sourceType: "module"
     },
     rules: {
+        // 注释
+        // 文件
+        "max-classes-per-file": ["error", 1],           // 一个文件中只能定义一个类
+        "max-lines-per-function": ["error", 200],       // 一个函数最多200行代码
+        "max-statements-per-line": ["error", {max: 1}], // 一行只允许有一条语句
         // 缩进
-        'indent': ['error', 4, { SwitchCase: 1 }],                         // 缩进控制4空格
-        'max-len': ['error', 120],                      // 每行字符不超过120
-        'no-mixed-spaces-and-tabs': 'error',            // 禁止使用空格和tab混合缩进
+        "indent": ["error", 4, { SwitchCase: 1 }],                         // 缩进控制4空格
+        "max-len": ["error", 120],                      // 每行字符不超过120
+        "no-mixed-spaces-and-tabs": "error",            // 禁止使用空格和tab混合缩进
         // 语句
-        'curly': ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
-        'semi': ['error', 'always'],                    //不得省略语句结束的分号
-        '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }]       // public访问不需加访问修饰符
+        "curly": ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
+        "semi": ["error", "always"],                    // 不得省略语句结束的分号
+        "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],       // public访问不需加访问修饰符
+        "@typescript-eslint/no-explicit-any": ["off"],
+        "@typescript-eslint/no-unused-vars": ["off"],
     }
 };

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

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

+ 1 - 1
persagy-web-big/src/config/ItemColor.ts

@@ -69,4 +69,4 @@ export class ItemColor {
     static zoneInfectedColor = new SColor("#ff0000");
     /** 受影响的业务空间边框颜色 */
     static zoneInfectedBorder = new SColor("#e2675c");
-} // Class ItemColor
+}

+ 1 - 1
persagy-web-big/src/config/ItemOrder.ts

@@ -69,4 +69,4 @@ export class ItemOrder {
     static RelationOrder = 999900;
     /** 蒙版层级 */
     static sceneMarkOrder = 9999900;
-} // Class ItemOrder
+}

+ 1 - 1
persagy-web-big/src/config/Transparency.ts

@@ -132,4 +132,4 @@ export const Transparency = [
     "FA",
     "FC",
     "FF"
-]; // Interface Transparency
+];

+ 1 - 1
persagy-web-big/src/enums/SGraphElementType.ts

@@ -39,4 +39,4 @@ export enum SGraphElementType {
     Zone,
     /** 图类型 */
     Image
-} // Enum SGraphElementType
+}

+ 2 - 2
persagy-web-big/src/enums/SItemStatus.ts

@@ -25,7 +25,7 @@
  */
 
 /**
- * item状态
+ * item 状态
  *
  * @author  郝建龙 <haojianlong@sagacloud.cn>
  * @deprecated move to edit
@@ -37,4 +37,4 @@ export enum SItemStatus {
     Edit,
     /** 创建态 */
     Create
-} // Enum SItemStatus
+}

+ 1 - 1
persagy-web-big/src/enums/SLineType.ts

@@ -33,4 +33,4 @@
 export enum SLineType {
     /** 直线 */
     Line
-} // Enum SLineType
+}

+ 1 - 1
persagy-web-big/src/enums/SMarkerType.ts

@@ -37,4 +37,4 @@ export enum SMarkerType {
     Line,
     /** 文本类型 */
     Text
-} // Enum SMarkerType
+}

+ 1 - 1
persagy-web-big/src/enums/SRelationDir.ts

@@ -37,4 +37,4 @@ export enum SRelationDir {
     Forward,
     /** 逆向(节点2到节点1) */
     Reverse
-} // Enum SRelationDir
+}

+ 1 - 1
persagy-web-big/src/enums/SRelationState.ts

@@ -39,4 +39,4 @@ export enum SRelationState {
     Edit,
     /** 创建态 */
     Create
-} // Enum SRelationState
+}

+ 25 - 25
persagy-web-big/src/factories/SItemFactory.ts

@@ -40,83 +40,83 @@ import { SZoneItem } from "../items/floor/ZoneItem";
 import { Zone } from "../types/floor/Zone";
 
 /**
- * item创建工厂
+ * item 创建工厂
  *
  * @author 郝建龙 <haojianlong@sagacloud.cn>
  */
 export class SItemFactory {
     /**
      * 构造函数
-    */
-    constructor() {} // Constructor
+     */
+    constructor() {}
 
     /**
-     * 创建柱子item
+     * 创建柱子 item
      *
      * @param data    柱子数据
      * @return 柱子 item
-    */
+     */
     createColumn(data: Column): SColumnItem {
         return new SColumnItem(null, data);
-    } // Function createColumn()
+    }
 
     /**
-     * 创建墙item
+     * 创建墙 item
      *
      * @param data    墙数据
      * @return 墙 item
-    */
+     */
     createWall(data: Wall): SWallItem {
         return new SWallItem(null, data);
-    } // Function createWall()
+    }
 
     /**
-     * 创建虚拟墙item
+     * 创建虚拟墙 item
      *
      * @param data    虚拟墙数据
      * @return 虚拟墙 item
-    */
+     */
     createVirtualWall(data: VirtualWall): SVirtualWallItem {
         return new SVirtualWallItem(null, data);
-    } // Function createVirtualWall()
+    }
 
     /**
-     * 创建空间item
+     * 创建空间 item
      *
      * @param data    空间数据
      * @return 空间 item
-    */
+     */
     createSpace(data: Space): SSpaceItem {
         return new SSpaceItem(null, data);
-    } // Function createSpace()
+    }
 
     /**
-     * 创建门item
+     * 创建门 item
      *
      * @param data    门数据
      * @return 门item
-    */
+     */
     createDoor(data: Door): SDoorItem {
         return new SDoorItem(null, data);
-    } // Function createDoor()
+    }
 
     /**
-     * 创建窗item
+     * 创建窗 item
      *
      * @param data    窗户数据
      * @return 窗户 item
-    */
+     */
     createWindow(data: Casement): SWindowItem {
         return new SWindowItem(null, data);
-    } // Function createWindow()
+    }
 
     /**
-     * 创建业务空间item
+     * 创建业务空间 item
      *
      * @param data    业务空间数据
      * @return 业务空间 item
-    */
+     */
     createZone(data: Zone): SZoneItem {
         return new SZoneItem(null, data);
-    } // Function createZone()
-} // Class SItemFactory
+    }
+}

+ 1 - 1
persagy-web-big/src/factories/STopoItemFactory.ts

@@ -29,4 +29,4 @@
  *
  * @author 郝建龙 <haojianlong@sagacloud.cn>
  */
-export class STopoItemFactory {} // Class STopoItemFactory
+export class STopoItemFactory {}

+ 9 - 8
persagy-web-big/src/items/SArrowItem.ts

@@ -38,35 +38,36 @@ export class SArrowItem extends SPolylineItem {
     _begin = SArrowStyleType.None;
     get begin(): SArrowStyleType {
         return this._begin;
-    } // Get begin
+    }
     set begin(v: SArrowStyleType) {
         this._begin = v;
         this.update();
-    } // Set begin
+    }
 
     /** 结束点样式 */
     _end = SArrowStyleType.None;
     get end(): SArrowStyleType {
         return this._end;
-    } // Get end
+    }
     set end(v: SArrowStyleType) {
         this._end = v;
         this.update();
-    } // Set end
+    }
 
     /**
      * 绘制基本图形
      *
      * @param painter   绘制对象
-    */
+     */
     drawBaseLine(painter: SPainter): void {
-        // 绘制基本图形
+        // 绘制基本图形,线样式是虚线时
         if (this.lineStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 7)
             ];
         } else if (this.lineStyle == SLineStyle.Dotted) {
+            // 绘制基本图形,线样式是点线时
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth),
                 painter.toPx(this.lineWidth)
@@ -87,5 +88,5 @@ export class SArrowItem extends SPolylineItem {
             }
         );
         painter.drawPolyline(this.pointList);
-    } // Function drawBaseLine()
-} // Class SArrowItem
+    }
+}

+ 115 - 2
persagy-web-big/src/items/SArrowPoly.ts

@@ -24,11 +24,124 @@
  * *********************************************************************************************************************
  */
 
-import { SGraphItem } from "@persagy-web/graph";
+import { SLineItem } from "./SLineItem";
+import { SColor, SLine, SPainter, SPoint } from "@persagy-web/draw";
+import { SMathUtil } from "@persagy-web/graph/lib/utils/SMathUtil";
+import { SItemStatus } from "..";
 
 /**
  * 箭头多边形类型
  *
  * @author  郝建龙 <haojianlong@sagacloud.cn>
  */
-export class SArrowPoly extends SGraphItem {} // Class SArrowPoly
+export class SArrowPoly extends SLineItem {
+    /** 多边形数组 */
+    pointList: SPoint[] = [];
+    /** 绘制时需要旋转的角度 */
+    private _ang: number = 0;
+    /** 箭头中间粗细 */
+    arrowWidth: number = 8;
+
+    /** 是否为单向箭头 是-只绘制末端箭头 */
+    _isSingle: boolean = true;
+    get isSingle(): boolean {
+        return this._isSingle;
+    }
+
+    set isSingle(v: boolean) {
+        this._isSingle = v;
+        this.update();
+    }
+
+    /** 多边形填充色 */
+    private _polyFillColor: SColor = SColor.White;
+    get polyFillColor(): SColor {
+        return this._polyFillColor;
+    }
+
+    set polyFillColor(v: SColor) {
+        this._polyFillColor = v;
+        this.update();
+    }
+
+    /**
+     * 根据两个顶点生成多边形数组
+     */
+    pointChange(): void {
+        // 如果线段的长度大于1
+        if (this.line.length > 1) {
+            const line = new SLine(this.line[0], this.line[1]);
+            const dis = SMathUtil.pointDistance(
+                this.line[0].x,
+                this.line[0].y,
+                this.line[1].x,
+                this.line[1].y
+            );
+            if (line.dx != 0) {
+                const tempFo = Math.atan(line.dy / line.dx);
+                this._ang = line.dx > 0 ? tempFo : tempFo + Math.PI;
+            } else {
+                this._ang = line.dy > 0 ? Math.PI / 2 : (3 * Math.PI) / 2;
+            }
+
+            // 是否为单向箭头 是-只绘制末端箭头
+            if (this.isSingle) {
+                this.pointList = [
+                    new SPoint(0, this.arrowWidth / 2),
+                    new SPoint(dis - this.arrowWidth, this.arrowWidth / 2),
+                    new SPoint(dis - this.arrowWidth, this.arrowWidth),
+                    new SPoint(dis, 0),
+                    new SPoint(dis - this.arrowWidth, -this.arrowWidth),
+                    new SPoint(dis - this.arrowWidth, -this.arrowWidth / 2),
+                    new SPoint(0, -this.arrowWidth / 2)
+                ];
+            } else {
+                this.pointList = [
+                    new SPoint(0, 0),
+                    new SPoint(this.arrowWidth, this.arrowWidth),
+                    new SPoint(this.arrowWidth, this.arrowWidth / 2),
+                    new SPoint(dis - this.arrowWidth, this.arrowWidth / 2),
+                    new SPoint(dis - this.arrowWidth, this.arrowWidth),
+                    new SPoint(dis, 0),
+                    new SPoint(dis - this.arrowWidth, -this.arrowWidth),
+                    new SPoint(dis - this.arrowWidth, -this.arrowWidth / 2),
+                    new SPoint(this.arrowWidth, -this.arrowWidth / 2),
+                    new SPoint(this.arrowWidth, -this.arrowWidth)
+                ];
+            }
+        }
+    }
+
+    /**
+     * 绘制
+     *
+     * @param painter   绘制对象
+     */
+    onDraw(painter: SPainter): void {
+        // 如果线段存在
+        if (this.line.length) {
+            painter.save();
+            painter.pen.lineWidth = painter.toPx(this.lineWidth);
+            painter.translate(this.line[0].x, this.line[0].y);
+            painter.rotate((this._ang * 180) / Math.PI);
+            painter.pen.color = this.strokeColor;
+            painter.brush.color = this.polyFillColor;
+            painter.drawPolygon(this.pointList);
+            painter.restore();
+            // item 状态为编辑或创建时
+            if (
+                this.status == SItemStatus.Edit ||
+                this.status == SItemStatus.Create
+            ) {
+                this.line.forEach((p, i): void => {
+                    painter.brush.color = this.fillColor;
+                    if (i == this.curIndex) {
+                        painter.brush.color = this.activeFillColor;
+                    }
+
+                    painter.drawCircle(p.x, p.y, painter.toPx(5));
+                });
+            }
+        }
+    }
+}

+ 151 - 91
persagy-web-big/src/items/SIconTextItem.ts

@@ -53,52 +53,68 @@ export class SIconTextItem extends SObjectItem {
     _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
-    } // Get status
+    }
     set status(v: SItemStatus) {
         this._status = v;
+        // 标准状态时
         if (v == SItemStatus.Normal) {
             this.moveable = true;
-            this.textItem.moveable = false;
+            this.textItemList.forEach((t): void => {
+                t.moveable = false;
+            });
             this.img.moveable = false;
         } else if (v == SItemStatus.Edit) {
+            // 编辑状态时
             this.moveable = false;
-            this.textItem.moveable = true;
+            this.textItemList.forEach((t): void => {
+                t.moveable = true;
+            });
             this.img.moveable = true;
         } else if (v == SItemStatus.Create) {
+            // 创建状态时
             this.moveable = true;
-            this.textItem.moveable = false;
+            this.textItemList.forEach((t): void => {
+                t.moveable = false;
+            });
             this.img.moveable = false;
         }
         this.update();
-    } // Set status
+    }
 
     /** 是否显示文字 */
     _showText: boolean = true;
     get showText(): boolean {
         return this._showText;
-    } // Get showText
+    }
     set showText(v: boolean) {
+        // 当文字是显示状态时
         if (v === this._showText) {
             return;
         }
         this._showText = v;
+        // 是否显示文字
         if (v) {
-            this.textItem.show();
+            this.textItemList.forEach((t): void => {
+                t.show();
+            });
         } else {
-            this.textItem.hide();
+            this.textItemList.forEach((t): void => {
+                t.hide();
+            });
         }
-    } // Set showText
+    }
 
     /** 是否被选中 */
     get selected(): boolean {
         return this._selected && this.selectable && this.enabled;
-    } // Get selected
+    }
     set selected(value: boolean) {
         // 如果选择状态未变更
         if (this.selected == value) {
             return;
         }
         this._selected = value;
+        // 选中时
         if (value) {
             this.img.scale = 1.25;
             this.zOrder = ItemOrder.highLightOrder;
@@ -107,61 +123,58 @@ export class SIconTextItem extends SObjectItem {
             this.zOrder = ItemOrder.markOrder;
         }
         this.update();
-    } // Set selected
+    }
 
     /** 是否激活 */
     _isActive: boolean = false;
     get isActive(): boolean {
         return this._isActive;
-    } // Get isActive
+    }
     set isActive(v: boolean) {
         this._isActive = v;
+        // 激活状态
         if (v) {
             this.cursor = "pointer";
-            this.textItem.cursor = "pointer";
-            this.img.cursor = "pointer";
         } else {
             this.cursor = "auto";
-            this.textItem.cursor = "auto";
-            this.img.cursor = "auto";
         }
         this.update();
-    } // Set isActive
+    }
 
     /** 激活显示颜色 */
     _activeColor: SColor = new SColor("#00000033");
     get activeColor(): SColor {
         return this._activeColor;
-    } // Get activeColor
+    }
     set activeColor(v: SColor) {
         this._activeColor = v;
         this.update();
-    } // Set activeColor
+    }
 
     /** X 轴坐标 */
     get x(): number {
         return this.pos.x;
-    } // Get x
+    }
     set x(v: number) {
         this.pos.x = v;
         this.$emit("changePos");
         this.update();
-    } // Set x
+    }
 
     /** Y 轴坐标 */
     get y(): number {
         return this.pos.y;
-    } // Get y
+    }
     set y(v: number) {
         this.pos.y = v;
         this.$emit("changePos");
         this.update();
-    } // Set y
+    }
 
     /** icon宽 */
     get sWidth(): number {
         return this.img.width;
-    } // Get sWidth
+    }
     set sWidth(v: number) {
         this.img.width = v;
         this.img.origin = new SPoint(
@@ -170,12 +183,12 @@ export class SIconTextItem extends SObjectItem {
         );
         this.changeAnchorPoint();
         this.update();
-    } // Set sWidth
+    }
 
     /** icon高 */
     get sHeight(): number {
         return this.img.height;
-    } // Get sHeight
+    }
     set sHeight(v: number) {
         this.img.height = v;
         this.img.origin = new SPoint(
@@ -184,59 +197,62 @@ export class SIconTextItem extends SObjectItem {
         );
         this.changeAnchorPoint();
         this.update();
-    } // Set sHeight
+    }
 
     /** 是否显示锚点 */
     private _showAnchor: boolean = false;
     get showAnchor(): boolean {
         return this._showAnchor;
-    } // Get showAnchor
+    }
     set showAnchor(v: boolean) {
         this._showAnchor = v;
-        this.anchorList.forEach(t => {
+        this.anchorList.forEach((t): void => {
             t.visible = v;
         });
-    } // Set showAnchor
-
-    /** 文本内容 */
-    get text(): string {
-        return this.textItem.text;
-    } // Get text
-    set text(v: string) {
-        this.textItem.text = v;
-        this.update();
-    } // Set text
+    }
 
     /** 文本颜色 */
     get color(): SColor {
-        return this.textItem.color;
-    } // Get color
+        if (this.textItemList.length) {
+            return this.textItemList[0].color;
+        } else {
+            return new SColor();
+        }
+    }
     set color(v: SColor) {
-        this.textItem.color = v;
+        this.textItemList.forEach((item): void => {
+            item.color = v;
+        });
         this.update();
-    } // Get color
+    }
 
     /** 文本字体 */
     get font(): SFont {
-        return this.textItem.font;
-    } // Get font
+        if (this.textItemList.length) {
+            return this.textItemList[0].font;
+        } else {
+            return new SFont();
+        }
+    }
     set font(v: SFont) {
-        this.textItem.font = v;
+        this.textItemList.forEach((item): void => {
+            item.font = v;
+        });
         this.update();
-    } // Set font
+    }
 
     /** img Item */
     img: SImageItem = new SImageItem(this);
 
     /** text Item */
-    textItem: STextItem = new STextItem(this);
+    textItemList: STextItem[] = [];
 
     /**
      * 构造体
      *
      * @param parent  父类
      * @param data    锚点数据
-    */
+     */
     constructor(parent: SGraphItem | null, data?: Anchor[]) {
         super(parent);
         this.img.width = 32;
@@ -247,8 +263,9 @@ export class SIconTextItem extends SObjectItem {
         );
         this.img.connect("onMove", this, this.changeAnchorPoint.bind(this));
         let anchorPoint;
+        // 锚点数据存在时
         if (data && data.length) {
-            anchorPoint = data.map(t => {
+            anchorPoint = data.map((t): any => {
                 return {
                     x: t.pos.x,
                     y: t.pos.y,
@@ -267,29 +284,31 @@ export class SIconTextItem extends SObjectItem {
                 // { x: this.img.x + this.img.width / 2, y: this.img.y, id: "" }
             ];
         }
-        this.anchorList = anchorPoint.map(t => {
-            let item = new SAnchorItem(this);
-            if (t.id) {
-                item.id = t.id;
+        this.anchorList = anchorPoint.map(
+            (t): SAnchorItem => {
+                let item = new SAnchorItem(this);
+                if (t.id) {
+                    item.id = t.id;
+                }
+                item.moveTo(t.x, t.y);
+                return item;
             }
-            item.moveTo(t.x, t.y);
-            return item;
-        });
-        this.showAnchor = false;
-        this.textItem.text = "";
-        this.textItem.font.size = 12;
-        // 偏移二分之一文本高度
-        this.textItem.moveTo(
-            this.img.width * 0.5,
-            -(this.font.size * 1.25 * 0.5)
         );
+        this.showAnchor = false;
+        // this.textItem.text = "";
+        // this.textItem.font.size = 12;
+        // // 偏移二分之一文本高度
+        // this.textItem.moveTo(
+        //     this.img.width * 0.5,
+        //     -(this.font.size * 1.25 * 0.5)
+        // );
         this.moveable = true;
         this.selectable = true;
-    } // Constructor
+    }
 
     /**
      * 计算并移动锚点的位置
-    */
+     */
     private changeAnchorPoint(): void {
         // 判断是否有锚点
         if (this.anchorList.length) {
@@ -303,93 +322,133 @@ export class SIconTextItem extends SObjectItem {
                 // { x: this.img.x - this.img.width / 2, y: this.img.y },
                 // { x: this.img.x + this.img.width / 2, y: this.img.y }
             ];
-            this.anchorList.forEach((item, index) => {
+            this.anchorList.forEach((item, index): void => {
                 item.moveTo(anchorPoint[index].x, anchorPoint[index].y);
             });
         }
-    } // Function changeAnchorPoint()
+    }
+
+    /**
+     * 添加文本
+     *
+     * @param item 文本图例
+     */
+    addTextItem(item: STextItem): void {
+        this.textItemList.push(item);
+    }
+
+    /**
+     * 删除文本
+     *
+     * @param index 索引
+     */
+    removeTextItem(index: number): void {
+        let [deleteItem] = this.textItemList.splice(index, 1);
+        if (this.scene) {
+            this.scene.removeItem(deleteItem);
+        }
+    }
 
     /**
      * 鼠标按下事件
      *
      * @param event   事件对象
      * @return 是否处理事件
-    */
+     */
     onMouseDown(event: SMouseEvent): boolean {
+        // 如果为show状态 双击改对象则需改为编辑状态
         if (this.status == SItemStatus.Normal) {
-            return super.onMouseDown(event);
+            super.onMouseDown(event);
+            return true;
         } else if (this.status == SItemStatus.Edit) {
+            // 编辑状态时
             return super.onMouseDown(event);
         }
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 宽高发发生变化
      *
      * @param oldSize 改之前的大小
      * @param newSize 改之后大小
-    */
+     */
     onResize(oldSize: SSize, newSize: SSize): void {
         console.log(arguments);
-    } // Function onResize()
+    }
 
     /**
      * 鼠标双击事件
      *
      * @param event   鼠标事件
      * @return 是否处理事件
-    */
+     */
     onDoubleClick(event: SMouseEvent): boolean {
-        // 如果show状态 双击改对象则需改为编辑状态
+        // 如果show状态 双击改对象则需改为编辑状态,处于编辑状态时
         if (SItemStatus.Normal == this.status) {
             this.status = SItemStatus.Edit;
             this.grabItem(this);
         } else if (SItemStatus.Edit == this.status) {
+            // 处于编辑状态时
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
         this.update();
         return true;
-    } // Function onDoubleClick()
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界矩阵
-    */
+     */
     boundingRect(): SRect {
         let rect = this.img
             .boundingRect()
             .adjusted(this.img.pos.x, this.img.pos.y, 0, 0);
+        // 显示文字时
         if (this.showText) {
-            rect = rect.unioned(
-                this.textItem
-                    .boundingRect()
-                    .adjusted(this.textItem.pos.x, this.textItem.pos.y, 0, 0)
-            );
+            this.textItemList.forEach((t): void => {
+                rect = rect.unioned(
+                    t.boundingRect().adjusted(t.pos.x, t.pos.y, 0, 0)
+                );
+            });
         }
-
         return rect.adjusted(-5, -5, 10, 10);
-    } // Function boundingRect()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
-        if (this.status == SItemStatus.Edit) {
-            painter.pen.lineWidth = painter.toPx(1);
-            painter.pen.lineDash = [painter.toPx(3), painter.toPx(7)];
+        const rect = this.boundingRect();
+        const lw = painter.toPx(1);
+        // 编辑态和选中态出现绘制区域
+        if (this.status == SItemStatus.Edit || this.selected) {
+            // doto 如果子元素被选中
+            painter.pen.lineWidth = lw;
+            painter.pen.lineDash = [3 * lw, 7 * lw];
             painter.pen.color = SColor.Black;
             painter.brush.color = SColor.Transparent;
-            painter.drawRect(this.boundingRect());
+            painter.drawRect(rect);
+        }
+        // 编辑态出现四个角的圆点
+        if (this.status == SItemStatus.Edit) {
+            painter.pen.lineDash = [];
+            painter.brush.color = SColor.White;
+            painter.drawCircle(rect.x, rect.y, 5 * lw);
+            painter.drawCircle(rect.right, rect.bottom, 5 * lw);
+            painter.drawCircle(rect.x, rect.bottom, 5 * lw);
+            painter.drawCircle(rect.right, rect.y, 5 * lw);
         }
 
+        // 处于激活状态时
         if (this.isActive) {
             painter.pen.color = SColor.Transparent;
             painter.brush.color = this.activeColor;
+            // 是否选中
             if (this.selected) {
                 painter.shadow.shadowBlur = 10;
                 painter.shadow.shadowColor = this.activeColor;
@@ -408,6 +467,7 @@ export class SIconTextItem extends SObjectItem {
                 );
             }
         } else {
+            // 是否选中
             if (this.selected) {
                 painter.pen.color = SColor.Transparent;
                 painter.brush.color = SColor.Transparent;
@@ -418,5 +478,5 @@ export class SIconTextItem extends SObjectItem {
                 painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0);
             }
         }
-    } // Function onDraw()
-} // Class SIconTextItem
+    }
+}

+ 1 - 1
persagy-web-big/src/items/SLayerItem.ts

@@ -31,4 +31,4 @@ import { SGraphItem } from "@persagy-web/graph";
  *
  * @author 郝建龙 <haojianlong@sagacloud.cn>
  */
-export class SLayerItem extends SGraphItem {} // Class SLayerItem
+export class SLayerItem extends SGraphItem {}

+ 125 - 56
persagy-web-big/src/items/SLineItem.ts

@@ -54,72 +54,79 @@ export class SLineItem extends SGraphItem {
     private _line: SPoint[] = [];
     get line(): SPoint[] {
         return this._line;
-    } // Get line
+    }
+
     set line(arr: SPoint[]) {
         this._line = arr;
         this.update();
-    } // Set line
+    }
 
     /** 是否完成绘制 */
     protected _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
-    } // Get status
+    }
+
     set status(v: SItemStatus) {
         this._status = v;
         this.undoStack.clear();
         this.update();
-    } // Set status
+    }
 
     /** 线条颜色 */
     private _strokeColor: SColor = SColor.Black;
     get strokeColor(): SColor {
         return this._strokeColor;
-    } // Get strokeColor
+    }
+
     set strokeColor(v: SColor) {
         this._strokeColor = v;
         this.update();
-    } // Set strokeColor
+    }
 
     /** 线条样式 */
     private _lineStyle: SLineStyle = SLineStyle.Solid;
     get lineStyle(): SLineStyle {
         return this._lineStyle;
-    } // Get lineStyle
+    }
+
     set lineStyle(v: SLineStyle) {
         this._lineStyle = v;
         this.update();
-    } // Set lineStyle
+    }
 
     /** 端点填充色 */
     private _fillColor: SColor = SColor.White;
     get fillColor(): SColor {
         return this._fillColor;
-    } // Get fillColor
+    }
+
     set fillColor(v: SColor) {
         this._fillColor = v;
         this.update();
-    } // Set fillColor
+    }
 
     /** 选中端点填充色 */
     private _activeFillColor: SColor = new SColor("#2196f3");
     get activeFillColor(): SColor {
         return this._activeFillColor;
-    } // Get activeFillColor
+    }
+
     set activeFillColor(v: SColor) {
         this._activeFillColor = v;
         this.update();
-    } // Set activeFillColor
+    }
 
     /** 线条宽度 */
     private _lineWidth: number = 1;
     get lineWidth(): number {
         return this._lineWidth;
-    } // Get lineWidth
+    }
+
     set lineWidth(v: number) {
         this._lineWidth = v;
         this.update();
-    } // Set lineWidth
+    }
 
     /** 拖动灵敏度 */
     dis: number = 5;
@@ -140,7 +147,7 @@ export class SLineItem extends SGraphItem {
      * 构造函数
      *
      * @param parent  父级
-    */
+     */
     constructor(parent: SGraphItem | null);
 
     /**
@@ -148,7 +155,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent  父级
      * @param line    坐标集合
-    */
+     */
     constructor(parent: SGraphItem | null, line: SPoint[]);
 
     /**
@@ -156,7 +163,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent  父级
      * @param point   第一个点坐标
-    */
+     */
     constructor(parent: SGraphItem | null, point: SPoint);
 
     /**
@@ -164,92 +171,115 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent    父级
      * @param line      坐标集合|第一个点坐标
-    */
+     */
     constructor(parent: SGraphItem | null, line?: SPoint | SPoint[]) {
         super(parent);
+        //  坐标集合存在时
         if (line) {
+            // 坐标集合出现在 SPoint 的实例对象上
             if (line instanceof SPoint) {
                 this.line.push(line);
             } else {
+                // 没有在 SPoint 的实例对象上
                 this.line = line;
             }
         } else {
+            // 坐标集合不存在时
             this.line = [];
         }
-    } // Constructor
+    }
+
+    /**
+     * 点发生变化
+     */
+    protected pointChange(): void {
+        // do nothing
+    }
 
     /**
      * 添加点至数组中
      *
      * @param p 添加的点
-    */
+     */
     private addPoint(p: SPoint): void {
+        // 坐标集合长度大于2时
         if (this.line.length < 2) {
             this.line.push(p);
             this.recordAction(SGraphPointListInsert, [this.line, p]);
         } else {
+            // 坐标集合长度不大于2时
             this.line[1] = p;
             this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
             this.status = SItemStatus.Normal;
             this.releaseItem();
             this.$emit("finishCreated");
+            this.pointChange();
         }
         this.update();
-    } // Function addPoint()
+    }
 
     /**
      * 鼠标双击事件
      *
      * @param event     事件参数
      * @return 是否处理事件
-    */
+     */
     onDoubleClick(event: SMouseEvent): boolean {
+        // 如果为show状态 双击改对象则需改为编辑状态
         if (this.status == SItemStatus.Normal) {
             this.status = SItemStatus.Edit;
             this.grabItem(this);
         } else if (this.status == SItemStatus.Edit) {
+            // 处于编辑状态时
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
         this.update();
         return true;
-    } // Function onDoubleClick()
+    }
 
     /**
      * 鼠标按下事件
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-    */
+     */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
+        // 按下 shiftKey 键
         if (event.shiftKey) {
             event = this.compare(event);
         }
+        // 按下鼠标左键
         if (event.buttons == SMouseButton.LeftButton) {
             if (this.status == SItemStatus.Normal) {
+                //标准状态时
                 return super.onMouseDown(event);
             } else if (this.status == SItemStatus.Edit) {
+                // 编辑状态时
                 // 判断是否点击到端点上(获取端点索引值)
                 this.findNearestPoint(new SPoint(event.x, event.y));
             } else if (this.status == SItemStatus.Create) {
+                // 创建状态时
                 this.addPoint(new SPoint(event.x, event.y));
                 return true;
             }
         }
 
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 鼠标抬起事件
      *
      * @param event     事件参数
      * @return 是否处理事件
-    */
+     */
     onMouseUp(event: SMouseEvent): boolean {
+        // 处于编辑状态时
         if (this.status == SItemStatus.Edit) {
+            // 当前点索引大于 -1 时
             if (this.curIndex > -1) {
                 const p = new SPoint(
                     this.line[this.curIndex].x,
@@ -263,6 +293,7 @@ export class SLineItem extends SGraphItem {
                 ]);
             }
         } else if (this.status == SItemStatus.Normal) {
+            // 标准状态时
             this.moveToOrigin(this.x, this.y);
             return super.onMouseUp(event);
         }
@@ -270,27 +301,33 @@ export class SLineItem extends SGraphItem {
         this.curIndex = -1;
         this.curPoint = null;
         return true;
-    } // Function onMouseUp()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event     事件参数
      * @return 是否处理事件
-    */
+     */
     onMouseMove(event: SMouseEvent): boolean {
+        // 按下 shiftKey 键
         if (event.shiftKey) {
             event = this.compare(event);
         }
 
+        // 处于创建状态时
         if (this.status == SItemStatus.Create) {
             if (this.line[0] instanceof SPoint) {
                 this.line[1] = new SPoint(event.x, event.y);
+                this.pointChange();
             }
         } else if (this.status == SItemStatus.Edit) {
+            // 处于编辑状态时
+            // 当前索引不等于 -1 时
             if (-1 != this.curIndex) {
                 this.line[this.curIndex].x = event.x;
                 this.line[this.curIndex].y = event.y;
+                this.pointChange();
             }
         } else {
             return super.onMouseMove(event);
@@ -298,74 +335,84 @@ export class SLineItem extends SGraphItem {
 
         this.update();
         return true;
-    } // Function onMouseMove()
+    }
 
     /**
      * 获取点击点与 Point[] 中的点距离最近点
      *
      * @param p     鼠标点击点
-    */
+     */
     findNearestPoint(p: SPoint): void {
+        // 拖动灵敏度
         let len = this.sceneDis;
         for (let i = 0; i < this.line.length; i++) {
+            // 计算点到点距离
             let dis = SMathUtil.pointDistance(
                 p.x,
                 p.y,
                 this.line[i].x,
                 this.line[i].y
             );
+            // 点到点的距离大于灵敏度时
             if (dis < len) {
                 len = dis;
                 this.curIndex = i;
                 this.curPoint = new SPoint(this.line[this.curIndex]);
             }
         }
-    } // Function findNearestPoint()
+    }
 
     /**
      * 记录相关动作并推入栈中
      *
      * @param SGraphCommand 相关命令类
      * @param any           对应传入参数
-    */
+     */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中 todo
         const command = new SGraphCommand(this.scene, this, ...any);
         this.undoStack.push(command);
-    } // Function recordAction()
+    }
 
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
      * @param x     x 坐标
      * @param y     y 坐标
-    */
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
-        this.line = this.line.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
-            return t;
-        });
+        this.line = this.line.map(
+            (t): SPoint => {
+                t.x = t.x + x;
+                t.y = t.y + y;
+                return t;
+            }
+        );
         this.x = 0;
         this.y = 0;
-    } // Function moveToOrigin()
+    }
 
     /**
      * shift 垂直水平创建或编辑
      *
      * @param event     事件
      * @return 处理后的事件对象
-    */
+     */
     compare(event: SMouseEvent): SMouseEvent {
+        // 线段长度存在时
         if (this.line.length) {
             let last = new SPoint(event.x, event.y);
+            // 处于创建状态时
             if (this.status == SItemStatus.Create) {
                 last = this.line[0];
             } else if (this.status == SItemStatus.Edit) {
+                // 处于编辑状态时
+                // 当前索引等于 1 时
                 if (this.curIndex == 1) {
                     last = this.line[0];
                 } else if (this.curIndex == 0) {
+                    // 当前索引等于 0 时
                     last = this.line[1];
                 }
             }
@@ -379,7 +426,7 @@ export class SLineItem extends SGraphItem {
         }
 
         return event;
-    } // Function compare()
+    }
 
     /**
      * 判断点是否在区域内
@@ -387,10 +434,12 @@ export class SLineItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否包含
-    */
+     */
     contains(x: number, y: number): boolean {
+        // 线段长度大于 2 时
         if (this.line.length == 2) {
             let p = new SPoint(x, y);
+            // 计算点到线段垂线与线段的交点
             if (
                 SMathUtil.pointToLine(p, new SLine(this.line[0], this.line[1]))
                     .MinDis < this.dis
@@ -400,62 +449,75 @@ export class SLineItem extends SGraphItem {
         }
 
         return false;
-    } // Function contains()
+    }
 
     /**
      * 撤销操作
-    */
+     */
     undo(): void {
+        // 处于标准状态时
         if (this.status != SItemStatus.Normal) {
             this.undoStack.undo();
         }
-    } // Function undo()
+    }
 
     /**
      * 重做操作
-    */
+     */
     redo(): void {
+        // 处于标准状态时
         if (this.status != SItemStatus.Normal) {
             this.undoStack.redo();
         }
-    } // Function redo()
+    }
 
     /**
      * 取消操作 item 事件
-    */
+     */
     cancelOperate(): void {
+        // 处于创建状态时
         if (this.status == SItemStatus.Create) {
             this.parent = null;
             this.releaseItem();
         } else if (this.status == SItemStatus.Edit) {
+            // 处于编辑状态时
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
-    } // Function cancelOperate()
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界区域
-    */
+     */
     boundingRect(): SRect {
+        // 线段长度存在时
         if (this.line.length) {
             this.minX = this.line[0].x;
             this.maxX = this.line[0].x;
             this.minY = this.line[0].y;
             this.maxY = this.line[0].y;
-            this.line.forEach(it => {
+            this.line.forEach((it): void => {
                 let x = it.x,
                     y = it.y;
+
+                // 如果数据 x 坐标小于 x 坐标最小值
                 if (x < this.minX) {
                     this.minX = x;
                 }
+
+                // 如果数据 y 坐标小于 y 坐标最小值
                 if (y < this.minY) {
                     this.minY = y;
                 }
+
+                // 如果数据 x 坐标大于 x 坐标最小值
                 if (x > this.maxX) {
                     this.maxX = x;
                 }
+
+                // 如果数据 y 坐标大于 y 坐标最小值
                 if (y > this.maxY) {
                     this.maxY = y;
                 }
@@ -468,32 +530,36 @@ export class SLineItem extends SGraphItem {
             this.maxX - this.minX,
             this.maxY - this.minY
         );
-    } // Function boundingRect()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         this.sceneDis = painter.toPx(this.dis);
         painter.pen.lineWidth = painter.toPx(this.lineWidth);
         painter.pen.color = this.strokeColor;
+        // 线段长度等于 2 时
         if (this.line.length == 2) {
             // 绘制直线
             painter.pen.color = new SColor(this.strokeColor);
+            // 绘制基本图形,线样式是虚线时
             if (this.lineStyle == SLineStyle.Dashed) {
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth * 3),
                     painter.toPx(this.lineWidth * 7)
                 ];
             } else if (this.lineStyle == SLineStyle.Dotted) {
+                // 绘制基本图形,线样式是点线时
                 painter.pen.lineDash = [
                     painter.toPx(this.lineWidth),
                     painter.toPx(this.lineWidth)
                 ];
             }
 
+            // 选中状态并且处于标准状态
             if (this.selected && this.status == SItemStatus.Normal) {
                 painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
                 painter.shadow.shadowBlur = 10;
@@ -503,6 +569,7 @@ export class SLineItem extends SGraphItem {
             }
 
             painter.drawLine(this.line[0], this.line[1]);
+            // 处于编辑状态或创建状态时
             if (
                 this.status == SItemStatus.Edit ||
                 this.status == SItemStatus.Create
@@ -518,6 +585,8 @@ export class SLineItem extends SGraphItem {
                 });
             }
         } else if (this.line.length == 1) {
+            // 线段长度等于 1 时
+            // 处于编辑状态或创建状态时
             if (
                 this.status == SItemStatus.Edit ||
                 this.status == SItemStatus.Create
@@ -531,5 +600,5 @@ export class SLineItem extends SGraphItem {
                 );
             }
         }
-    } // Function onDraw()
-} // Class SLineItem
+    }
+}

+ 81 - 79
persagy-web-big/src/items/SPolygonItem.ts

@@ -61,65 +61,66 @@ export class SPolygonItem extends SGraphItem {
 
     /** 轮廓线坐标 */
     private pointList: SPoint[] = [];
+
     get getPointList(): SPoint[] {
         return this.pointList;
-    } // Get getPointList
+    }
     set setPointList(arr: SPoint[]) {
         this.pointList = arr;
         this.update();
-    } // Set getPointList
+    }
 
     /** 当前状态 */
     protected _status: number = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
-    } // Get status
+    }
     set status(value: SItemStatus) {
         this._status = value;
         this.undoStack.clear();
         this.update();
-    } // Set status
+    }
 
     /** 边框颜色 */
     _strokeColor: SColor = new SColor("#0091FF");
     /** 画笔颜色 */
     get strokeColor(): SColor {
         return this._strokeColor;
-    } // Get strokeColor
+    }
     set strokeColor(v: SColor) {
         this._strokeColor = v;
         this.update();
-    } // Set strokeColor
+    }
 
     /** 填充颜色 */
     _fillColor: SColor = new SColor("#1EE887");
     get fillColor(): SColor {
         return this._fillColor;
-    } // Get fillColor
+    }
     set fillColor(v: SColor) {
         this._fillColor = v;
         this.update();
-    } // Set fillColor
+    }
 
     /** 边框样式 */
     _lineStyle: SLineStyle = SLineStyle.Solid;
     get lineStyle(): SLineStyle {
         return this._lineStyle;
-    } // Get lineStyle
+    }
     set lineStyle(v: SLineStyle) {
         this._lineStyle = v;
         this.update();
-    } // Set lineStyle
+    }
 
     /** 边框的宽 只可输入像素宽 */
     _lineWidth: number = 4;
     get lineWidth(): number {
         return this._lineWidth;
-    } // Get lineWidth
+    }
     set lineWidth(v: number) {
         this._lineWidth = v;
         this.update();
-    } // Set lineWidth
+    }
 
     /** 是否闭合 */
     closeFlag: boolean = false;
@@ -142,10 +143,10 @@ export class SPolygonItem extends SGraphItem {
      * 构造函数
      *
      * @param parent    指向父对象
-    */
+     */
     constructor(parent: SGraphItem | null) {
         super(parent);
-    } // Constructor
+    }
 
     //////////////////
     //  以下为对pointList 数组的操作方法
@@ -157,7 +158,7 @@ export class SPolygonItem extends SGraphItem {
      * @param y   点位得 y 坐标
      * @param i   储存所在索引
      * @return SPoint 添加的顶点
-    */
+     */
     insertPoint(x: number, y: number, i: number | null = null): SPoint {
         const point = new SPoint(x, y);
         if (i == null) {
@@ -167,14 +168,14 @@ export class SPolygonItem extends SGraphItem {
         }
         this.update();
         return point;
-    } // Function insertPoint()
+    }
 
     /**
      * 删除点位
      *
      * @param i   删除点所在的索引
      * @return 索引不在数组范围则返回 null
-    */
+     */
     deletePoint(i: number | null = null): SPoint | null {
         let point = null;
         if (i != null) {
@@ -196,7 +197,7 @@ export class SPolygonItem extends SGraphItem {
         this.curPoint = null;
         this.update();
         return point;
-    } // Function deletePoint()
+    }
 
     /**
      * 多边形顶点的移动位置
@@ -205,7 +206,7 @@ export class SPolygonItem extends SGraphItem {
      * @param y   点位得 y 坐标
      * @param i   点位得 i 坐标
      * @return   移动对应得点。如果索引无法找到移动顶点,则返回 null
-    */
+     */
     movePoint(x: number, y: number, i: number): SPoint | null {
         let point = null;
         if (i >= this.pointList.length || i < 0) {
@@ -219,7 +220,7 @@ export class SPolygonItem extends SGraphItem {
 
         point = this.pointList[i];
         return point;
-    } // Function movePoint()
+    }
 
     ////////////
     //  以下为三种状态下的绘制多边形方法
@@ -229,7 +230,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
-    */
+     */
     protected drawShowPolygon(painter: SPainter, pointList: SPoint[]): void {
         painter.save();
         painter.pen.lineCapStyle = SLineCapStyle.Square;
@@ -248,6 +249,7 @@ export class SPolygonItem extends SGraphItem {
             ];
         }
 
+        // 是否选中
         if (this.selected) {
             painter.shadow.shadowBlur = 10;
             painter.shadow.shadowColor = new SColor(`#00000033`);
@@ -259,14 +261,14 @@ export class SPolygonItem extends SGraphItem {
 
         painter.drawPolygon([...pointList]);
         painter.restore();
-    } // Function drawShowPolygon()
+    }
 
     /**
      * 创建状态 --绘制多边形数组
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
-    */
+     */
     protected drawCreatePolygon(painter: SPainter, pointList: SPoint[]): void {
         painter.pen.lineCapStyle = SLineCapStyle.Square;
         painter.pen.color = this.strokeColor;
@@ -290,7 +292,7 @@ export class SPolygonItem extends SGraphItem {
             // 绘制顶点块
             painter.pen.color = SColor.Black;
             painter.brush.color = SColor.White;
-            pointList.forEach(item => {
+            pointList.forEach((item): void => {
                 painter.drawCircle(item.x, item.y, painter.toPx(this.len / 2));
             });
             // 如果最后一个点在第一个点的灵敏度范围内,第一个点填充变红
@@ -316,14 +318,14 @@ export class SPolygonItem extends SGraphItem {
         } else {
             painter.drawPolygon(pointList);
         }
-    } // Function drawCreatePolygon()
+    }
 
     /**
      * 编辑状态 --绘制多边形数组
      *
      * @param painter       绘制类
      * @param pointList    绘制多边形数组
-    */
+     */
     protected drawEditPolygon(painter: SPainter, pointList: SPoint[]): void {
         // 展示多边形
         painter.pen.lineCapStyle = SLineCapStyle.Square;
@@ -334,7 +336,7 @@ export class SPolygonItem extends SGraphItem {
         // 绘制顶点块
         painter.pen.color = SColor.Black;
         painter.brush.color = SColor.White;
-        pointList.forEach((item, index) => {
+        pointList.forEach((item, index): void => {
             painter.brush.color = SColor.White;
             if (index == this.curIndex) {
                 painter.brush.color = new SColor("#2196f3");
@@ -342,20 +344,20 @@ export class SPolygonItem extends SGraphItem {
 
             painter.drawCircle(item.x, item.y, painter.toPx(this.len / 2));
         });
-    } // Function drawCreatePolygon()
+    }
 
     /**
      * 编辑状态操作多边形数组
      *
      * @param event    鼠标事件
-    */
+     */
     protected editPolygonPoint(event: SMouseEvent): void {
         //  判断是否为删除状态 isAlt = true为删除状态
         if (this.isAlt) {
             // 1 判断是否点击在多边形顶点
             let lenIndex = -1; // 当前点击到的点位索引;
             let curenLen = this.scenceLen; // 当前的灵敏度
-            this.pointList.forEach((item, index) => {
+            this.pointList.forEach((item, index): void => {
                 let dis = SMathUtil.pointDistance(
                     event.x,
                     event.y,
@@ -391,7 +393,7 @@ export class SPolygonItem extends SGraphItem {
             this.curPoint = null;
             let lenIndex = -1; // 当前点击到的点位索引;
             let curenLen = this.scenceLen; // 当前的灵敏度
-            this.pointList.forEach((item, index) => {
+            this.pointList.forEach((item, index): void => {
                 let dis = SMathUtil.pointDistance(
                     event.x,
                     event.y,
@@ -457,42 +459,41 @@ export class SPolygonItem extends SGraphItem {
             // 刷新视图
             this.update();
         }
-    } // Function editPolygonPoint()
+    }
 
     /////////////////////
-    // undo、redo相关操作
 
     /**
      * 记录相关动作并推入栈中
      *
-     * @param	SGraphCommand   相关命令类
-     * @param	any             对应传入参数
-    */
+     * @param    SGraphCommand   相关命令类
+     * @param    any             对应传入参数
+     */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
         const sgraphcommand = new SGraphCommand(this.scene, this, ...any);
         this.undoStack.push(sgraphcommand);
-    } // Function recordAction()
+    }
 
     /**
      * 执行取消操作执行
-    */
+     */
     undo(): void {
         if (this.status == SItemStatus.Normal) {
             return;
         }
         this.undoStack.undo();
-    } // Function undo()
+    }
 
     /**
      * 执行重做操作执行
-    */
+     */
     redo(): void {
         if (this.status == SItemStatus.Normal) {
             return;
         }
         this.undoStack.redo();
-    } // Function redo()
+    }
 
     ///////////////////////////////
     // 以下为鼠标事件
@@ -502,7 +503,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event   事件参数
      * @return 是否处理
-    */
+     */
     onDoubleClick(event: SMouseEvent): boolean {
         // 如果位show状态 双击改对象则需改为编辑状态
         if (SItemStatus.Normal == this.status) {
@@ -515,14 +516,14 @@ export class SPolygonItem extends SGraphItem {
 
         this.update();
         return true;
-    } // Function onDoubleClick()
+    }
 
     /**
      * 键盘事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
 
     onKeyDown(event: KeyboardEvent): boolean {
         if (this.status == SItemStatus.Normal) {
@@ -546,14 +547,14 @@ export class SPolygonItem extends SGraphItem {
 
         this.update();
         return true;
-    } // Function onKeyDown()
+    }
 
     /**
      * 键盘键抬起事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onKeyUp(event: KeyboardEvent): void {
         if (this.status == SItemStatus.Edit) {
             if (event.key == "Alt") {
@@ -567,14 +568,14 @@ export class SPolygonItem extends SGraphItem {
         }
 
         this.update();
-    } // Function onKeyUp()
+    }
 
     /**
      * 鼠标按下事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseDown(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -613,34 +614,34 @@ export class SPolygonItem extends SGraphItem {
         }
 
         return true;
-    } // Function onMouseDown()
+    }
 
     /**
      * 鼠标移入事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseEnter(event: SMouseEvent): boolean {
         return true;
-    } // Function onMouseEnter()
+    }
 
     /**
      * 鼠标移出事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseLeave(event: SMouseEvent): boolean {
         return true;
-    } // Function onMouseLeave()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -665,14 +666,14 @@ export class SPolygonItem extends SGraphItem {
         }
 
         return true;
-    } // Function onMouseMove()
+    }
 
     /**
      * shift 垂直水平创建或编辑
      *
      * @param event     事件
      * @return 处理后的事件
-    */
+     */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -694,14 +695,14 @@ export class SPolygonItem extends SGraphItem {
         }
 
         return event;
-    } // Function compare()
+    }
 
     /**
      * 鼠标抬起事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (-1 != this.curIndex) {
@@ -722,38 +723,40 @@ export class SPolygonItem extends SGraphItem {
         }
 
         return true;
-    } // Function onMouseUp()
+    }
 
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
      * @param x   x 坐标
      * @param y   y 坐标
-    */
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
-        this.pointList = this.pointList.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
-            return t;
-        });
+        this.pointList = this.pointList.map(
+            (t): SPoint => {
+                t.x = t.x + x;
+                t.y = t.y + y;
+                return t;
+            }
+        );
         this.x = 0;
         this.y = 0;
-    } // Function moveToOrigin()
+    }
 
     /**
      * 适配事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onResize(event: SMouseEvent): boolean {
         return true;
-    } // Function onResize()
+    }
 
     /**
      * 取消操作
-    */
+     */
     cancelOperate(): void {
         // 当状态为展示状态
         if (this.status == SItemStatus.Create) {
@@ -765,20 +768,20 @@ export class SPolygonItem extends SGraphItem {
         }
 
         this.update();
-    } // Function cancelOperate()
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界区域
-    */
+     */
     boundingRect(): SRect {
         if (this.pointList.length) {
             this.minX = this.pointList[0].x;
             this.maxX = this.pointList[0].x;
             this.minY = this.pointList[0].y;
             this.maxY = this.pointList[0].y;
-            this.pointList.forEach(it => {
+            this.pointList.forEach((it): void => {
                 let x = it.x,
                     y = it.y;
                 if (x < this.minX) {
@@ -796,7 +799,6 @@ export class SPolygonItem extends SGraphItem {
                 if (y > this.maxY) {
                     this.maxY = y;
                 }
-
             });
         }
 
@@ -806,7 +808,7 @@ export class SPolygonItem extends SGraphItem {
             this.maxX - this.minX,
             this.maxY - this.minY
         );
-    } // Function boundingRect()
+    }
 
     /**
      * 判断点是否在区域内
@@ -814,7 +816,7 @@ export class SPolygonItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否在区域内
-    */
+     */
     contains(x: number, y: number): boolean {
         let arr = this.pointList;
         if (arr.length < 3 || !SPolygonUtil.pointIn(x, y, arr)) {
@@ -822,13 +824,13 @@ export class SPolygonItem extends SGraphItem {
         }
 
         return true;
-    } // Function contains()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         this.scenceLen = painter.toPx(this.len);
         // 当状态为展示状态
@@ -842,5 +844,5 @@ export class SPolygonItem extends SGraphItem {
             // 编辑状态
             this.drawEditPolygon(painter, this.pointList);
         }
-    } // Function onDraw()
-} // Class SPolygonItem
+    }
+}

+ 80 - 72
persagy-web-big/src/items/SPolylineItem.ts

@@ -24,10 +24,10 @@
  * *********************************************************************************************************************
  */
 
-import { SColor, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw";
-import { SKeyCode, SMouseEvent, SUndoStack } from "@persagy-web/base";
-import { SItemStatus } from "..";
-import { SMathUtil } from "../utils/SMathUtil";
+import {SColor, SLine, SPainter, SPoint, SRect} from "@persagy-web/draw";
+import {SKeyCode, SMouseEvent, SUndoStack} from "@persagy-web/base";
+import {SItemStatus} from "..";
+import {SMathUtil} from "../utils/SMathUtil";
 import {
     SGraphItem,
     SGraphPointListDelete,
@@ -56,12 +56,12 @@ export class SPolylineItem extends SGraphItem {
     _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
-    } // Get status
+    }
     set status(v: SItemStatus) {
         this._status = v;
         this.undoStack.clear();
         this.update();
-    } // Set status
+    }
 
     /** 鼠标移动时的点 */
     protected lastPoint: SPoint | null = null;
@@ -69,41 +69,41 @@ export class SPolylineItem extends SGraphItem {
     _strokeColor: SColor = SColor.Black;
     get strokeColor(): SColor {
         return this._strokeColor;
-    } // Get strokeColor
+    }
     set strokeColor(v: SColor) {
         this._strokeColor = v;
         this.update();
-    } // Set strokeColor
+    }
 
     /** 填充色 */
     _fillColor: SColor = new SColor("#2196f3");
     get fillColor(): SColor {
         return this._fillColor;
-    } // Get fillColor
+    }
     set fillColor(v: SColor) {
         this._fillColor = v;
         this.update();
-    } // Set fillColor
+    }
 
     /** 线条宽度 */
     _lineWidth: number = 1;
     get lineWidth(): number {
         return this._lineWidth;
-    } // Get lineWidth
+    }
     set lineWidth(v: number) {
         this._lineWidth = v;
         this.update();
-    } // Set lineWidth
+    }
 
     /** 边框样式 */
     _lineStyle: SLineStyle = SLineStyle.Solid;
     get lineStyle(): SLineStyle {
         return this._lineStyle;
-    } // Get lineStyle
+    }
     set lineStyle(v: SLineStyle) {
         this._lineStyle = v;
         this.update();
-    } // Set lineStyle
+    }
 
     /** 全局灵敏度 */
     dis: number = 10;
@@ -121,7 +121,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param parent    父级
      * @param list      坐标集合
-    */
+     */
     constructor(parent: null | SGraphItem, list: SPoint[]);
 
     /**
@@ -129,7 +129,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param parent    父级
      * @param list      第一个坐标
-    */
+     */
     constructor(parent: null | SGraphItem, list: SPoint);
 
     /**
@@ -137,7 +137,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param parent    父级
      * @param list      第一个坐标|坐标集合
-    */
+     */
     constructor(parent: null | SGraphItem, list: SPoint | SPoint[]) {
         super(parent);
         if (list instanceof SPoint) {
@@ -145,14 +145,14 @@ export class SPolylineItem extends SGraphItem {
         } else {
             this.pointList = list;
         }
-    } // Constructor
+    }
 
     /**
      * 添加点至数组中
      *
      * @param p         添加的点
      * @param index     添加到的索引
-    */
+     */
     private addPoint(p: SPoint, index?: number): void {
         if (index && this.canHandle(index)) {
             this.pointList.splice(index, 0, p);
@@ -167,23 +167,23 @@ export class SPolylineItem extends SGraphItem {
         }
 
         this.update();
-    } // Function addPoint()
+    }
 
     /**
      * 是否可以添加点到数组中
      *
      * @param index     要添加到的索引
      * @return 是否可添加
-    */
+     */
     private canHandle(index: number): boolean {
         return index >= 0 && index <= this.pointList.length;
-    } // Function canHandle()
+    }
 
     /**
      * 根据索引删除点
      *
      * @param index     删除点
-    */
+     */
     deletePoint(index: number): void {
         if (this.canHandle(index) && this.pointList.length > 2) {
             const p = new SPoint(
@@ -200,14 +200,14 @@ export class SPolylineItem extends SGraphItem {
             this.curPoint = null;
             this.update();
         }
-    } // Function deletePoint
+    }
 
     /**
      * 鼠标按下事件
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-    */
+     */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
@@ -222,6 +222,7 @@ export class SPolylineItem extends SGraphItem {
             } else if (this.status == SItemStatus.Edit) {
                 // 查询鼠标最近的索引
                 this.findNearestPoint(new SPoint(event.x, event.y));
+
                 // 增加点
                 if (this.curIndex < 0) {
                     this.findAddPos(new SPoint(event.x, event.y));
@@ -240,14 +241,14 @@ export class SPolylineItem extends SGraphItem {
         }
 
         return super.onMouseDown(event);
-    } // Function onMouseDown()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-    */
+     */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -276,14 +277,14 @@ export class SPolylineItem extends SGraphItem {
         } else {
             return super.onMouseMove(event);
         }
-    } // Function onMouseMove()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-    */
+     */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (this.curIndex > -1) {
@@ -304,22 +305,25 @@ export class SPolylineItem extends SGraphItem {
         }
 
         return true;
-    } // Function onMouseUp()
+    }
 
     /**
      * 鼠标双击事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onDoubleClick(event: SMouseEvent): boolean {
+        // 如果为show状态 双击改对象则需改为编辑状态
         if (this.status == SItemStatus.Normal) {
             this.status = SItemStatus.Edit;
             this.grabItem(this);
         } else if (this.status == SItemStatus.Edit) {
+            // 编辑状态
             this.status = SItemStatus.Normal;
             this.releaseItem();
         } else if (this.status == SItemStatus.Create) {
+            // 创建状态
             if (this.pointList.length > 1) {
                 this.status = SItemStatus.Normal;
                 this.releaseItem();
@@ -329,13 +333,13 @@ export class SPolylineItem extends SGraphItem {
 
         this.$emit("onDoubleClick", event);
         return true;
-    } // Function onDoubleClick()
+    }
 
     /***
      * 键盘按键弹起事件
      *
      * @param event     事件参数
-    */
+     */
     onKeyUp(event: KeyboardEvent): void {
         if (event.keyCode == SKeyCode.Enter) {
             if (this.pointList.length > 1) {
@@ -349,36 +353,35 @@ export class SPolylineItem extends SGraphItem {
         }
 
         // delete删除点
-        if (
-            event.keyCode == SKeyCode.Delete &&
-            this.status == SItemStatus.Edit
-        ) {
+        if (event.keyCode == SKeyCode.Delete && this.status == SItemStatus.Edit) {
             this.deletePoint(this.curIndex);
         }
-    } // Function onKeyUp()
+    }
 
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
      * @param x     x 坐标
      * @param y     y 坐标
-    */
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
-        this.pointList = this.pointList.map(t => {
-            t.x = t.x + x;
-            t.y = t.y + y;
-            return t;
-        });
+        this.pointList = this.pointList.map(
+            (t): SPoint => {
+                t.x = t.x + x;
+                t.y = t.y + y;
+                return t;
+            }
+        );
         this.x = 0;
         this.y = 0;
-    } // Function moveToOrigin()
+    }
 
     /**
      * 获取点击点与点集中距离最近点
      *
      * @param p     鼠标点击点
-    */
+     */
     findNearestPoint(p: SPoint): void {
         let len = this.sceneDis;
         for (let i = 0; i < this.pointList.length; i++) {
@@ -397,17 +400,17 @@ export class SPolylineItem extends SGraphItem {
                 );
             }
         }
-    } // Function findNearestPoint()
+    }
 
     /**
      * 计算增加点的位置
      *
      * @param p     鼠标点击点
-    */
+     */
     findAddPos(p: SPoint): void {
         let len = SMathUtil.pointToLine(
-                p,
-                new SLine(this.pointList[0], this.pointList[1])
+            p,
+            new SLine(this.pointList[0], this.pointList[1])
             ),
             index = 0;
         if (this.pointList.length > 2) {
@@ -426,14 +429,14 @@ export class SPolylineItem extends SGraphItem {
         if (len.MinDis < this.sceneDis && len.Point) {
             this.addPoint(len.Point, index + 1);
         }
-    } // Function findAddPos()
+    }
 
     /**
      * shift 垂直水平创建或编辑
      *
      * @param event     事件
      * @return 事件对象
-    */
+     */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -455,46 +458,51 @@ export class SPolylineItem extends SGraphItem {
         }
 
         return event;
-    } // Function compare()
+    }
 
     /**
      * 记录相关动作并推入栈中
      *
      * @param SGraphCommand     相关命令类
      * @param any               对应传入参数
-    */
+     */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
         const command = new SGraphCommand(this.scene, this, ...any);
         this.undoStack.push(command);
-    } // Function recordAction()
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 外接矩阵
-    */
+     */
     boundingRect(): SRect {
         if (this.pointList.length) {
             this.minX = this.pointList[0].x;
             this.maxX = this.pointList[0].x;
             this.minY = this.pointList[0].y;
             this.maxY = this.pointList[0].y;
-            this.pointList.forEach(it => {
+            this.pointList.forEach((it): void => {
                 let x = it.x,
                     y = it.y;
+
+                // 如果数据 x 坐标小于 x 坐标最小值
                 if (x < this.minX) {
                     this.minX = x;
                 }
 
+                // 如果数据 y 坐标小于 y 坐标最小值
                 if (y < this.minY) {
                     this.minY = y;
                 }
 
+                // 如果数据 x 坐标大于 x 坐标最小值
                 if (x > this.maxX) {
                     this.maxX = x;
                 }
 
+                // 如果数据 y 坐标大于 y 坐标最小值
                 if (y > this.maxY) {
                     this.maxY = y;
                 }
@@ -507,7 +515,7 @@ export class SPolylineItem extends SGraphItem {
             this.maxX - this.minX,
             this.maxY - this.minY
         );
-    } // Function boundingRect()
+    }
 
     /**
      * 判断点是否在区域内
@@ -515,7 +523,7 @@ export class SPolylineItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否在区域内
-    */
+     */
     contains(x: number, y: number): boolean {
         let p = new SPoint(x, y);
         for (let i = 1; i < this.pointList.length; i++) {
@@ -533,29 +541,29 @@ export class SPolylineItem extends SGraphItem {
             }
         }
         return false;
-    } // Function contains()
+    }
 
     /**
      * 撤销操作
-    */
+     */
     undo(): void {
         if (this._status != SItemStatus.Normal) {
             this.undoStack.undo();
         }
-    } // Function undo()
+    }
 
     /**
      * 重做操作
-    */
+     */
     redo(): void {
         if (this._status != SItemStatus.Normal) {
             this.undoStack.redo();
         }
-    } // Function redo()
+    }
 
     /**
      * 取消操作执行
-    */
+     */
     cancelOperate(): void {
         if (this.status == SItemStatus.Create) {
             this.parent = null;
@@ -564,13 +572,13 @@ export class SPolylineItem extends SGraphItem {
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
-    } // Function cancelOperate()
+    }
 
     /**
      * 绘制基本图形
      *
      * @param painter   绘制对象
-    */
+     */
     drawBaseLine(painter: SPainter): void {
         // 绘制基本图形
         if (this.lineStyle == SLineStyle.Dashed) {
@@ -587,13 +595,13 @@ export class SPolylineItem extends SGraphItem {
 
         painter.pen.color = this.strokeColor;
         painter.drawPolyline(this.pointList);
-    } // Function drawBaseLine()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         // 缓存场景长度
         this.sceneDis = painter.toPx(this.dis);
@@ -627,7 +635,7 @@ export class SPolylineItem extends SGraphItem {
                 painter.drawCircle(t.x, t.y, painter.toPx(5));
             });
         } else {
-            // 查看状态
+            // 查看状态,是否选中
             if (this.selected) {
                 painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
                 painter.shadow.shadowBlur = 10;
@@ -639,5 +647,5 @@ export class SPolylineItem extends SGraphItem {
             // 绘制基本图形
             this.drawBaseLine(painter);
         }
-    } // Function onDraw()
-} // Class SPolylineItem
+    }
+}

+ 9 - 9
persagy-web-big/src/items/SRectSelectItem.ts

@@ -45,46 +45,46 @@ export class SRectSelectItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param point     起点数据
-    */
+     */
     constructor(parent: SGraphItem | null, point: SPoint) {
         super(parent);
         this.startPoint = point;
         this.endPoint = new SPoint(point.x, point.y);
         this.update();
         this.zOrder = ItemOrder.rectSelectOrder;
-    } // Constructor
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界区域
-    */
+     */
     boundingRect(): SRect {
         return new SRect(this.startPoint, this.endPoint);
-    } // Function boundingRect()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event     事件参数
      * @return 是否处理
-    */
+     */
     onMouseMove(event: SMouseEvent): boolean {
         this.endPoint.x = event.x;
         this.endPoint.y = event.y;
         this.update();
         return true;
-    } // Function onMouseMove()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         painter.pen.lineWidth = painter.toPx(2);
         painter.pen.color = ItemColor.rectSelectOutColor;
         painter.brush.color = ItemColor.rectSelectInColor;
         painter.drawRect(this.startPoint, this.endPoint);
-    } // Function onDraw()
-} // SRectSelectItem
+    }
+}

+ 1 - 1
persagy-web-big/src/items/STooltipItem.ts

@@ -31,4 +31,4 @@ import { STextItem } from "@persagy-web/graph";
  *
  * @author  郝建龙 <haojianlong@sagacloud.cn>
  */
-export class STooltipItem extends STextItem {} // Class STooltipItem
+export class STooltipItem extends STextItem {}

+ 9 - 8
persagy-web-big/src/items/floor/SBoardItem.ts

@@ -47,11 +47,12 @@ export class SBoardItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      建筑轮廓数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Zone) {
         super(parent);
         this.data = data;
         this.zOrder = 0;
+        // 判断是否有轮廓数据
         if (
             this.data.OutLine.length &&
             this.data.OutLine[0] &&
@@ -75,7 +76,7 @@ export class SBoardItem extends SGraphItem {
                 return tempArr;
             });
         }
-    } // Constructor
+    }
 
     /**
      * 判断点是否在区域内
@@ -83,16 +84,16 @@ export class SBoardItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否在区域内
-    */
+     */
     contains(x: number, y: number): boolean {
         return false;
-    } // Function contains()
+    }
 
     /**
      * Item 绘制操作
      *
-     * @param painter   painter 对象
-    */
+     * @param painter   绘制对象
+     */
     onDraw(painter: SPainter): void {
         painter.pen.lineWidth = painter.toPx(1);
         painter.brush.color = ItemColor.spaceColor;
@@ -100,5 +101,5 @@ export class SBoardItem extends SGraphItem {
         this.pathList.forEach((t): void => {
             painter.drawPath(t);
         });
-    } // Function onDraw()
-} // Class SBoardItem
+    }
+}

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

@@ -42,7 +42,7 @@ export class SColumnItem extends SGraphPolyGroupItem {
      *
      * @param parent    指向父对象
      * @param data      柱子数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Column) {
         const style = {
             default: {
@@ -55,13 +55,13 @@ export class SColumnItem extends SGraphPolyGroupItem {
         let tempArr = data.OutLine;
         let outline: Point[][] = [];
         if (tempArr && tempArr.length) {
-            outline = tempArr.map(t => {
-                return t.map(it => ({x: it.X, y: -it.Y}));
+            outline = tempArr.map((t): any => {
+                return t.map((it): any => ({ x: it.X, y: -it.Y }));
             });
         }
 
         super(parent, { outline: outline, style: style });
         this.data = data;
         this.zOrder = ItemOrder.columnOrder;
-    } // Constructor
-} // Class SColumnItem
+    }
+}

+ 18 - 7
persagy-web-big/src/items/floor/SDoorItem.ts

@@ -62,28 +62,37 @@ export class SDoorItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      门数据
-    */
+     */
     constructor(parent: SGraphItem | 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;
                     let y = -t.Y;
+                    // 如果数据 x 坐标小于 x 坐标最小值
                     if (x < this.minX) {
                         this.minX = x;
                     }
+
+                    // 如果数据 y 坐标小于 y 坐标最小值
                     if (y < this.minY) {
                         this.minY = y;
                     }
+
+                    // 如果数据 x 坐标大于 x 坐标最小值
                     if (x > this.maxX) {
                         this.maxX = x;
                     }
+
+                    // 如果数据 y 坐标大于 y 坐标最小值
                     if (y > this.maxY) {
                         this.maxY = y;
                     }
+
                     return new SPoint(t.X, -t.Y);
                 }
             );
@@ -106,6 +115,7 @@ export class SDoorItem extends SGraphItem {
             ));
             // 向量点乘 => 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;
@@ -118,26 +128,27 @@ export class SDoorItem extends SGraphItem {
             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 边界矩形
-    */
+     */
     boundingRect(): SRect {
         return new SRect(0, 0, this.r, this.r);
-    } // Function boundingRect()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         painter.translate(this.p.x, this.p.y);
         painter.rotate(this.ang);
@@ -154,5 +165,5 @@ export class SDoorItem extends SGraphItem {
         //     this.startAng,
         //     this.startAng + Math.PI / 2
         // );
-    } // Function onDraw()
-} // Class SDoorItem
+    }
+}

+ 11 - 11
persagy-web-big/src/items/floor/SHighlightItem.ts

@@ -43,49 +43,49 @@ export class SHighlightItem extends SGraphItem {
     _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: SGraphItem | null) {
         super(parent);
         this.visible = false;
         this.zOrder = ItemOrder.highLightOrder;
-    } // Constructor
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return	边界矩形
-    */
+     */
     boundingRect(): SRect {
         return new SRect(this.point.x, this.point.y, 10, 10);
-    } // Function boundingRect()
+    }
 
     /**
      * Item绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         if (this.type == 2) {
             painter.pen.color = ItemColor.highLightLineColor;
@@ -96,5 +96,5 @@ export class SHighlightItem extends SGraphItem {
         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
+    }
+}

+ 31 - 23
persagy-web-big/src/items/floor/SSpaceItem.ts

@@ -24,11 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import {
-    SColor,
-    SPainter,
-    STextAlign
-} from "@persagy-web/draw";
+import { SColor, SPainter, STextAlign } from "@persagy-web/draw";
 import { Space } from "../../types/floor/Space";
 import { ItemOrder, ItemColor } from "../..";
 import { SGraphItem, SGraphAreaGroupItem } from "@persagy-web/graph";
@@ -45,62 +41,69 @@ export class SSpaceItem extends SGraphAreaGroupItem {
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
         return this._highLightFlag;
-    } // Get highLightFlag
+    }
+
     set highLightFlag(value: boolean) {
         this._highLightFlag = value;
         this.update();
-    } // Set highLightFlag
+    }
 
     /** 是否显示名字 */
     private _showBaseName: boolean = false;
     get showBaseName(): boolean {
         return this._showBaseName;
-    } // Get showBaseName
+    }
+
     set showBaseName(value: boolean) {
         this._showBaseName = value;
         this.update();
-    } // Set showBaseName
+    }
 
     /** 是否名字大小 */
     private _nameSize: number = 10;
     get nameSize(): number {
         return this._nameSize;
-    } // Get nameSize
+    }
+
     set nameSize(value: number) {
         this._nameSize = value;
         this.update();
-    } // Set nameSize
+    }
 
     /** 名字是否缩放 */
     private _nameTransform: boolean = false;
     get nameTransform(): boolean {
         return this._nameTransform;
-    } // Get nameTransform
+    }
+
     set nameTransform(value: boolean) {
         this._nameTransform = value;
         this.update();
-    } // Set nameTransform
+    }
 
     /** 名字颜色 */
     private _nameColor: string = "#000000";
     get nameColor(): string {
         return this._nameColor;
-    } // Get nameColor
+    }
+
     set nameColor(value: string) {
         this._nameColor = value;
         this.update();
-    } // Set nameColor
+    }
 
     /**
      * 构造函数
      *
      * @param parent    指向父对象
      * @param data      空间数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Space) {
         super(parent, {
             outline: [
-                data.OutLine.map(t => t.map(it => ({ x: it.X, y: -it.Y })))
+                data.OutLine.map((t): any =>
+                    t.map((it): any => ({ x: it.X, y: -it.Y }))
+                )
             ],
             style: {
                 default: {
@@ -133,20 +136,24 @@ export class SSpaceItem extends SGraphAreaGroupItem {
         this.data = data;
         this.zOrder = ItemOrder.spaceOrder;
         this.name = data.Name || "";
-    } // Constructor
+    }
 
     /**
      * 绘制前设置绘制样式
      *
      * @return 当前状态
-    */
+     */
     setStyle(): string {
         let status = "default";
+        // 如果存在样式
         if (this.style) {
+            // 如果处于高亮状态
             if (this.highLightFlag) {
                 status = "highlight";
             } else if (this.enabled) {
+                // 是否可用,true 可用
                 if (this.selected) {
+                    // 是否选中
                     status = "selected";
                 }
             } else {
@@ -154,15 +161,16 @@ export class SSpaceItem extends SGraphAreaGroupItem {
             }
         }
         return status;
-    } // Function setStyle()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         super.onDraw(painter);
+        // 如果显示名字
         if (this.showBaseName) {
             if (this.name && this.name != "null") {
                 painter.brush.color = new SColor(this.nameColor);
@@ -179,5 +187,5 @@ export class SSpaceItem extends SGraphAreaGroupItem {
                 );
             }
         }
-    } // Function onDraw()
-} // Class SSpaceItem
+    }
+}

+ 0 - 253
persagy-web-big/src/items/floor/SSpaceItems.ts

@@ -1,253 +0,0 @@
-/*
- * *********************************************************************************************************************
- *
- *          !!
- *        .F88X
- *        X8888Y
- *      .}888888N;
- *        i888888N;        .:!              .I$WI:
- *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
- *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
- *            +888888N;  .8888888Y                                  "&&8Y.}8,
- *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
- *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
- *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
- *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
- *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
- *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
- *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
- *      .:R888888I
- *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
- *        ~8888'
- *        .!88~                                                                     All rights reserved.
- *
- * *********************************************************************************************************************
- */
-
-import {
-    SColor,
-    SPainter,
-    SPoint,
-    SPolygonUtil,
-    SRect,
-    STextAlign
-} from "@persagy-web/draw";
-import { Space } from "../../types/floor/Space";
-import { ItemOrder, ItemColor } from "../..";
-import { SGraphItem } from "@persagy-web/graph";
-
-/**
- * 模型空间 item
- *
- * @author  郝建龙 <haojianlong@sagacloud.cn>
- * @deprecated 万达
- */
-export class SSpaceItems extends SGraphItem {
-    /** 空间所有数据 */
-    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
-    /** 是否显示名字 */
-    private _showBaseName: boolean = false;
-    get showBaseName(): boolean {
-        return this._showBaseName;
-    } // Get showBaseName
-    set showBaseName(value: boolean) {
-        this._showBaseName = value;
-        this.update();
-    } // Set showBaseName
-    /** 是否名字大小 */
-    private _nameSize: number = 10;
-    get nameSize(): number {
-        return this._nameSize;
-    } // Get nameSize
-    set nameSize(value: number) {
-        this._nameSize = value;
-        this.update();
-    } // Set nameSize
-    /** 名字是否缩放 */
-    private _nameTransform: boolean = false;
-    get nameTransform(): boolean {
-        return this._nameTransform;
-    } // Get nameTransform
-    set nameTransform(value: boolean) {
-        this._nameTransform = value;
-        this.update();
-    } // Set nameTransform
-    /** 名字颜色   */
-    private _nameColor: string = "#000000";
-    get nameColor(): string {
-        return this._nameColor;
-    } // Get nameColor
-    set nameColor(value: string) {
-        this._nameColor = value;
-        this.update();
-    } // Set nameColor
-
-    /**
-     * 构造函数
-     *
-     * @param parent    指向父对象
-     * @param data      空间数据
-    */
-    constructor(parent: SGraphItem | null, data: Space) {
-        super(parent);
-        this.data = data;
-        this.zOrder = ItemOrder.spaceOrder;
-        let tempArr = this.data.OutLine;
-        this.name = data.Name || "";
-        if (tempArr && tempArr.length) {
-            this.minX = tempArr[0][0].X;
-            this.maxX = this.minX;
-            this.minY = -tempArr[0][0].Y;
-            this.maxY = this.minY;
-            this.pointArr = tempArr.map((t): SPoint[] => {
-                let temp = t.map(
-                    (it): SPoint => {
-                        let x = it.X,
-                            y = -it.Y;
-                        if (x < this.minX) {
-                            this.minX = x;
-                        }
-                        if (y < this.minY) {
-                            this.minY = y;
-                        }
-                        if (x > this.maxX) {
-                            this.maxX = x;
-                        }
-                        if (y > this.maxY) {
-                            this.maxY = y;
-                        }
-                        return new SPoint(x, y);
-                    }
-                );
-                // this.path.polygon(temp);
-                return temp;
-            });
-        }
-    } // Constructor
-
-    /**
-     * Item对象边界区域
-     *
-     * @return SRect
-    */
-    boundingRect(): SRect {
-        return new SRect(
-            this.minX,
-            this.minY,
-            this.maxX - this.minX,
-            this.maxY - this.minY
-        );
-    } // Function boundingRect()
-
-    // /**
-    //  * 鼠标单击事件
-    //  *
-    //  * @param	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()
-
-    /**
-     * 判断点是否在区域内
-     *
-     * @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    绘制对象
-    */
-    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);
-        if (this.pointArr.length) {
-            painter.drawPolygon(this.pointArr[0]);
-        }
-
-        if (this.showBaseName) {
-            if (this.name && this.name != "null") {
-                painter.brush.color = new SColor(this.nameColor);
-                if (this.nameTransform) {
-                    painter.font.size = this.nameSize;
-                } else {
-                    painter.font.size = painter.toPx(this.nameSize);
-                }
-                // painter.font.size = 500;
-                painter.font.textAlign = STextAlign.Center;
-                painter.drawText(
-                    this.name,
-                    this.data.Location.Points[0].X,
-                    -this.data.Location.Points[0].Y
-                );
-            }
-        }
-    } // Function onDraw()
-} // Class SSpaceItem

+ 17 - 7
persagy-web-big/src/items/floor/SVirtualWallItem.ts

@@ -53,12 +53,13 @@ export class SVirtualWallItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      虚拟墙数据
-    */
+     */
     constructor(parent: SGraphItem | 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;
@@ -69,30 +70,39 @@ export class SVirtualWallItem extends SGraphItem {
                     (it): SPoint => {
                         let x = it.X,
                             y = -it.Y;
+
+                        // 如果数据 x 坐标小于 x 坐标最小值
                         if (x < this.minX) {
                             this.minX = x;
                         }
+
+                        // 如果数据 y 坐标小于 y 坐标最小值
                         if (y < this.minY) {
                             this.minY = y;
                         }
+
+                        // 如果数据 x 坐标大于 x 坐标最小值
                         if (x > this.maxX) {
                             this.maxX = x;
                         }
+
+                        // 如果数据 y 坐标大于 y 坐标最小值
                         if (y > this.maxY) {
                             this.maxY = y;
                         }
+
                         return new SPoint(x, y);
                     }
                 );
             });
         }
-    } // Constructor
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界矩形
-    */
+     */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -100,13 +110,13 @@ export class SVirtualWallItem extends SGraphItem {
             this.maxX - this.minX,
             this.maxY - this.minY
         );
-    } // Function boundingRect()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         painter.pen.lineWidth = painter.toPx(1);
         painter.pen.color = ItemColor.virtualWallColor;
@@ -114,5 +124,5 @@ export class SVirtualWallItem extends SGraphItem {
         this.pointArr.forEach((t): void => {
             painter.drawPolyline(t);
         });
-    } // Function onDraw()
-} // Class SVirtualWallItem
+    }
+}

+ 7 - 4
persagy-web-big/src/items/floor/SWallItem.ts

@@ -43,7 +43,7 @@ export class SWallItem extends SGraphAreaGroupItem {
      *
      * @param parent    指向父对象
      * @param data      墙数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Wall) {
         const style = {
             default: {
@@ -55,8 +55,11 @@ export class SWallItem extends SGraphAreaGroupItem {
         };
         let tempArr = data.OutLine;
         let outline: Point[][] = [];
+        // 如果数据存在
         if (tempArr && tempArr.length) {
-            outline = tempArr.map(t => t.map(it => ({ x: it.X, y: -it.Y })));
+            outline = tempArr.map((t): any =>
+                t.map((it): any => ({ x: it.X, y: -it.Y }))
+            );
         }
 
         super(parent, {
@@ -66,5 +69,5 @@ export class SWallItem extends SGraphAreaGroupItem {
 
         this.data = data;
         this.zOrder = ItemOrder.wallOrder;
-    } // Constructor
-} // Class SWallItem
+    }
+}

+ 0 - 151
persagy-web-big/src/items/floor/SWallItems.ts

@@ -1,151 +0,0 @@
-/*
- * *********************************************************************************************************************
- *
- *          !!
- *        .F88X
- *        X8888Y
- *      .}888888N;
- *        i888888N;        .:!              .I$WI:
- *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
- *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
- *            +888888N;  .8888888Y                                  "&&8Y.}8,
- *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
- *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
- *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
- *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
- *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
- *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
- *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
- *      .:R888888I
- *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
- *        ~8888'
- *        .!88~                                                                     All rights reserved.
- *
- * *********************************************************************************************************************
- */
-
-import { SPainter, SPath, SPoint, SRect } from "@persagy-web/draw";
-import { Wall } from "../../types/floor/Wall";
-import { ItemOrder, ItemColor } from "../..";
-import { SGraphItem } from "@persagy-web/graph";
-
-/**
- * 墙item
- *
- * @author  郝建龙 <haojianlong@sagacloud.cn>
- * @deprecated 万达
- */
-export class SWallItems 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[][] = [];
-    /** 墙内轮廓线坐标list */
-    private readonly holesArr: SPoint[][] = [];
-    /** path对象 */
-    private path = new SPath();
-
-    /**
-     * 构造函数
-     *
-     * @param parent    指向父对象
-     * @param data      墙数据
-    */
-    constructor(parent: SGraphItem | null, data: Wall) {
-        super(parent);
-        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);
-                        }
-                    );
-                    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()
-
-    /**
-     * Item绘制操作
-     *
-     * @param painter    绘制对象
-    */
-    onDraw(painter: SPainter): void {
-        painter.pen.color = ItemColor.wallColor;
-        painter.pen.lineWidth = painter.toPx(1);
-        painter.brush.color = ItemColor.wallColor;
-        painter.drawPath(this.path);
-    } // Function onDraw()
-} // Class SWallItem

+ 16 - 8
persagy-web-big/src/items/floor/SWindowItem.ts

@@ -1,4 +1,3 @@
-
 /*
  * *********************************************************************************************************************
  *
@@ -54,7 +53,7 @@ export class SWindowItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      窗户数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Casement) {
         super(parent);
         this.data = data;
@@ -64,29 +63,38 @@ export class SWindowItem extends SGraphItem {
                 (t): SPoint => {
                     let x = t.X;
                     let y = -t.Y;
+
+                    // 如果数据 x 坐标小于 x 坐标最小值
                     if (x < this.minX) {
                         this.minX = x;
                     }
+
+                    // 如果数据 y 坐标小于 y 坐标最小值
                     if (y < this.minY) {
                         this.minY = y;
                     }
+
+                    // 如果数据 x 坐标大于 x 坐标最小值
                     if (x > this.maxX) {
                         this.maxX = x;
                     }
+
+                    // 如果数据 y 坐标大于 y 坐标最小值
                     if (y > this.maxY) {
                         this.maxY = y;
                     }
+
                     return new SPoint(x, y);
                 }
             );
         }
-    } // Constructor
+    }
 
     /**
      * Item 对象边界区域
      *
      * @return 边界矩形
-    */
+     */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -94,16 +102,16 @@ export class SWindowItem extends SGraphItem {
             this.maxX - this.minX,
             this.maxY - this.minY
         );
-    } // Function boundingRect()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         painter.pen.color = ItemColor.windowColor;
         painter.pen.lineWidth = painter.toPx(1);
         painter.drawPolyline(this.pointArr);
-    } // Function onDraw()
-} // Class SWindowItem
+    }
+}

+ 28 - 17
persagy-web-big/src/items/floor/ZoneItem.ts

@@ -44,38 +44,41 @@ export class SZoneItem extends SGraphAreaGroupItem {
     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
+    }
 
     /**
      * 构造函数
      *
      * @param parent    指向父对象
      * @param data      空间数据
-    */
+     */
     constructor(parent: SGraphItem | null, data: Zone) {
         super(parent, {
             outline: data.OutLine.map((t): Point[][] => {
@@ -126,53 +129,60 @@ export class SZoneItem extends SGraphAreaGroupItem {
         this.highLightFlag = data.HighLightFlag || false;
         this.transparency = data.Transparency || 20;
         this.isInfected = data.Infected || false;
-    } // Constructor
+    }
 
     /**
      * 鼠标单击事件
      *
      * @param event     事件参数
      * @return 是否处理事件
-    */
+     */
     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 是否处理事件
-    */
+     */
     onMouseUp(event: SMouseEvent): boolean {
         return false;
-    } // Function onMouseUp()
+    }
 
     /**
      * 绘制前设置绘制样式
      *
      * @return 当前状态
-    */
+     */
     setStyle(): string {
         let status = "default";
+        // 是否存在样式
         if (this.style) {
+            // 是否可选中
             if (!this.selectable) {
                 status = "unselect";
             } else {
+                // 是否选中
                 if (this.selected) {
                     status = "selected";
                 } else if (this.highLightFlag) {
+                    // 高亮状态
                     status = "highlight";
                 } else if (this.isInfected) {
+                    // 受影响
                     status = "infected";
                 } else {
                     status = "default";
                     if (this.data.Color) {
+                        // 数据是否存在 color
                         this.style.default.fill = `${this.data.Color}${
                             Transparency[this.transparency]
                         }`;
@@ -181,17 +191,18 @@ export class SZoneItem extends SGraphAreaGroupItem {
             }
         }
         return status;
-    } // Function setStyle()
+    }
 
     /**
      * Item 绘制操作
      *
      * @param painter   绘制对象
-    */
+     */
     onDraw(painter: SPainter): void {
         super.onDraw(painter);
         painter.brush.color = SColor.Black;
         painter.font.size = painter.toPx(10);
+        // 是否点击位置坐标
         if (this.clickPoint) {
             painter.drawText(
                 this.data.RoomLocalName,
@@ -199,5 +210,5 @@ export class SZoneItem extends SGraphAreaGroupItem {
                 this.clickPoint.y
             );
         }
-    } // Function onDraw()
-} // Class ZoneItem
+    }
+}

+ 16 - 15
persagy-web-big/src/parser/SFloorParser.ts

@@ -62,8 +62,9 @@ export class SFloorParser extends SParser {
      * 解析数据
      *
      * @param data  楼层数据
-    */
+     */
     parseData(data: FloorData): void {
+        // 墙数据
         if (data.Walls) {
             data.Walls.forEach((t: Wall): void => {
                 this.addWall(t);
@@ -99,65 +100,65 @@ export class SFloorParser extends SParser {
                 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
+    }
+}

+ 3 - 3
persagy-web-big/src/parser/SParser.ts

@@ -39,10 +39,10 @@ export abstract class SParser {
      * 构造函数
      *
      * @param factory   解析工厂
-    */
+     */
     constructor(factory: SItemFactory | null = null) {
         if (factory) {
             this.factory = factory;
         }
-    } // Constructor
-} // class SParser
+    }
+}

+ 9 - 9
persagy-web-big/src/parser/STopologyParser.ts

@@ -47,7 +47,7 @@ export class STopologyParser extends SParser {
      * 解析数据
      *
      * @param data  楼层数据
-    */
+     */
     parseData(data: TopologyData): void {
         if (data.Marks) {
             data.Marks.forEach((t: MarkerTopo): void => {
@@ -66,20 +66,20 @@ export class STopologyParser extends SParser {
                 this.addRelations(t);
             });
         }
-    } // Function parseData
+    }
 
     /**
      * 添加标识对象
-    */
-    private addMarks(t: MarkerTopo): void {} // Function addMarks
+     */
+    private addMarks(t: MarkerTopo): void {}
 
     /**
      * 添加关系对象
-    */
-    private addRelations(t: Relation): void {} // Function addRelations
+     */
+    private addRelations(t: Relation): void {}
 
     /**
      * 添加节点对象
-    */
-    private addNodes(t: Node): void {} // Function addNodes
-} // class STopologyParser
+     */
+    private addNodes(t: Node): void {}
+}

+ 5 - 5
persagy-web-big/src/parser/SZoneParser.ts

@@ -41,20 +41,20 @@ export class SZoneParser extends SParser {
      * 解析业务空间数据
      *
      * @param data  业务空间数据
-    */
+     */
     parseData(data: Zone[]): void {
         if (data && data.length) {
             data.forEach((z): void => this.addZone(z));
         }
-    } // Function parseData()
+    }
 
     /**
      * 添加业务空间至场景中
      *
      * @param z     业务空间数据
-    */
+     */
     private addZone(z: Zone): void {
         let item = this.factory.createZone(z);
         this.zoneList.push(item);
-    } // Function addZone()
-} // class SZoneParser
+    }
+}

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

@@ -35,4 +35,4 @@ export interface BigPoint {
     Y: number;
     /** z 坐标 */
     Z?: number;
-} // Interface BigPoint
+}

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

@@ -49,4 +49,4 @@ export interface FloorData {
     Walls: Wall[];
     /** 窗户 */
     Windows: Casement[];
-} // Interface FloorData
+}

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

@@ -44,4 +44,4 @@ export interface ImageData {
     width: number;
     /** 绘制图片的高 */
     height: number;
-} // Interface ImageData
+}

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

@@ -38,4 +38,4 @@ export interface Marker {
     x: number;
     /** Y 坐标 */
     y: number;
-} // Interface Marker
+}

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

@@ -36,4 +36,4 @@ export interface MinDis {
     MinDis: number;
     /** 最短距离的点 */
     Point: Point | undefined;
-} // Interface Space
+}

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

@@ -36,4 +36,4 @@ export interface Outline {
     Outer: SPoint[];
     /** 内轮廓 */
     Inner: SPoint[][];
-} // Interface Outline
+}

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

@@ -36,4 +36,4 @@ export interface Place {
     Points: BigPoint[];
     /** 类型 */
     Type: string;
-} // Interface Place
+}

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

@@ -38,4 +38,4 @@ export interface PointToLine {
     Line: SLine | undefined;
     /** 最短距离的点 */
     Point: SPoint | undefined;
-} // Interface Space
+}

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

@@ -34,4 +34,4 @@ export interface Size {
     width: number;
     /** 高 */
     height: number;
-} // Interface Size
+}

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

@@ -50,4 +50,4 @@ export interface TextData {
     textDirection?: STextDirection;
     /** 文本大小 */
     size?: number;
-} // Interface TextData
+}

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

@@ -40,4 +40,4 @@ export interface TopologyData {
     Marks: MarkerTopo[];
     /** 对象关系 */
     Relations: Relation[];
-} // interface TopologyData
+}

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

@@ -52,4 +52,4 @@ export interface Casement {
     WallId: string;
     /** 宽度 */
     Width: string;
-} // interface Casement
+}

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

@@ -46,4 +46,4 @@ export interface Column {
     ModelId?: string;
     /** 对应 Revit 模型 id */
     SourceId?: string;
-} // Interface Column
+}

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

@@ -56,4 +56,4 @@ export interface Door {
     WallId: string;
     /** 宽度 */
     Width: string;
-} // Interface Door
+}

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

@@ -52,4 +52,4 @@ export interface Space {
     Tag?: string;
     /** 类型 */
     TypeId?: string;
-} // Interface Space
+}

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

@@ -43,4 +43,4 @@ export interface VirtualWall {
     OutLine: BigPoint[][];
     /** 对应 Revit 模型 id */
     SourceId?: string;
-} // interface VirtualWall
+}

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

@@ -49,4 +49,4 @@ export interface Wall {
     SourceId?: string;
     /** 厚度 */
     Width?: number;
-} // Interface Wall
+}

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

@@ -48,4 +48,4 @@ export interface Zone {
     Transparency?: number;
     /** 是否受影响 */
     Infected?: boolean;
-} // Interface Zone
+}

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

@@ -36,4 +36,4 @@ export interface Anchor {
     id: string;
     /** 位置 */
     pos: Point;
-} // interface Anchor
+}

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

@@ -49,4 +49,4 @@ export interface MarkerTopo {
     size: Size;
     /** 由应用自己定义 */
     properties: any;
-} // interface MarkerTo
+}

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

@@ -60,4 +60,4 @@ export interface Node {
     outLine: Point[][];
     /** 由应用自己定义 */
     properties: any;
-} // interface Node
+}

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

@@ -55,4 +55,4 @@ export interface Relation {
     pointList: Point[];
     /** 线的绘图样式 */
     style: any;
-} // interface Relation
+}

+ 25 - 24
persagy-web-big/src/utils/SMathUtil.ts

@@ -46,7 +46,7 @@ export class SMathUtil {
      * @param x2    点 2 的 x 坐标
      * @param y2    点 2 的 y 坐标
      * @return 距离
-    */
+     */
     static pointDistance(
         x1: number,
         y1: number,
@@ -54,7 +54,7 @@ export class SMathUtil {
         y2: number
     ): number {
         return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
-    } // Function pointDistance()
+    }
 
     /**
      * 计算点到点集中点最小距离,返回该点和该距离
@@ -62,7 +62,7 @@ export class SMathUtil {
      * @param p     第一个点
      * @param arr   点集
      * @return 距离,点坐标
-    */
+     */
     static getMinDisPoint(p: SPoint, arr: Point[]): MinDis | null {
         if (!arr.length) {
             return null;
@@ -95,7 +95,7 @@ export class SMathUtil {
             }
         }
         return minDis;
-    } // Function getMinDisPoint()
+    }
 
     /**
      * 计算点到线段垂线与线段的交点
@@ -103,7 +103,7 @@ export class SMathUtil {
      * @param p     点
      * @param l     线段
      * @return 距离
-    */
+     */
     static pointToLine(p: SPoint, l: SLine): PointToLine {
         let d = {
             MinDis: Number.MAX_SAFE_INTEGER,
@@ -146,7 +146,7 @@ export class SMathUtil {
         }
 
         return d;
-    } // Function pointDistance()
+    }
 
     /**
      * 计算点到点集中线段最小距离,返回该点和该距离
@@ -154,7 +154,7 @@ export class SMathUtil {
      * @param p     第一个点
      * @param arr   点集
      * @return 距离,点坐标
-    */
+     */
     static getMinDisLine(p: SPoint, arr: Point[]): PointToLine | null {
         if (arr.length < 2) {
             return null;
@@ -192,7 +192,7 @@ export class SMathUtil {
             }
         }
         return PTL;
-    } // Function getMinDisPoint()
+    }
 
     /**
      * 计算矩形是否有交集(外包矩形算法)
@@ -200,7 +200,7 @@ export class SMathUtil {
      * @param rect1     矩形1
      * @param rect2     矩形2
      * @return 是否有交集
-    */
+     */
     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;
@@ -210,7 +210,7 @@ export class SMathUtil {
             rect1.width + rect2.width > maxX - minX &&
             rect1.height + rect2.height > maxY - minY
         );
-    } // Function rectIntersection()
+    }
 
     /**
      * 计算线段交点
@@ -218,7 +218,7 @@ export class SMathUtil {
      * @param line1     线段1
      * @param line2     线段2
      * @return 交点 null 平行但不重合 'repeat' 重合
-    */
+     */
     static lineIntersection(
         line1: SLine,
         line2: SLine
@@ -244,34 +244,34 @@ export class SMathUtil {
         }
 
         return null;
-    } // Function lineIntersection()
+    }
 
     /**
      * 转化数据格式为[][]
      *
      * @param SP    点数组
      * @return 点二维数组
-    */
+     */
     static transferToArray(SP: SPoint[]): number[][] {
-        return SP.map((t): number[] =>([t.x, t.y]));
-    } // Function transferToArray()
+        return SP.map((t): number[] => [t.x, t.y]);
+    }
 
     /**
      * 转化数据格式为 SPoint[]
      *
      * @param arr 点二维数组
      * @return 点数组
-    */
+     */
     static transferToSPoint(arr: number[][]): SPoint[] {
         return arr.map((t): SPoint => new SPoint(t[0], t[1]));
-    } // Function transferToSPoint()
+    }
 
     /**
      * 计算数组中每一项的交集,并返回外轮廓与内轮廓
      *
      * @param array     三维数组描述轮廓
      * @return outline 列表
-    */
+     */
     static getIntersectInArray(array: number[][][]): Outline[] {
         let outlineList: Outline[] = [];
         if (!array.length) {
@@ -323,22 +323,23 @@ export class SMathUtil {
                     Inner: []
                 };
                 outline.Outer = array[indexArr[i + 1]].map(
-                    (t): SPoint =>  new SPoint(t[0], t[1]));
+                    (t): SPoint => new SPoint(t[0], t[1])
+                );
                 outline.Inner = axArr.map((t): SPoint[] =>
-                    t.map((item): SPoint =>  new SPoint(item[0], item[1]))
+                    t.map((item): SPoint => new SPoint(item[0], item[1]))
                 );
                 outlineList.push(outline);
             }
         }
         return outlineList;
-    } // Function getIntersectInArray()
+    }
 
     /**
      * 计算轮廓线面积
      *
      * @param arr   轮廓线
      * @return 面积(毫米)
-    */
+     */
     static calculateArea(arr: SPoint[]): number {
         let sum = 0;
         let n = arr.length;
@@ -348,5 +349,5 @@ export class SMathUtil {
         }
 
         return sum / 2;
-    } // Function calculateArea()
-} // Class SMathUtil
+    }
+}

+ 18 - 12
persagy-web-draw/.eslintrc.js

@@ -26,14 +26,14 @@
 
 module.exports = {
     root: true,
-    parser: '@typescript-eslint/parser',
+    parser: "@typescript-eslint/parser",
     extends: [
-        'plugin:@typescript-eslint/recommended',
+        "plugin:@typescript-eslint/recommended",
         // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
-        'prettier/@typescript-eslint',
+        "prettier/@typescript-eslint",
         // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
         // 此行必须在最后
-        'plugin:prettier/recommended'
+        "plugin:prettier/recommended"
     ],
     env: {
         es6: true,
@@ -42,17 +42,23 @@ module.exports = {
     parserOptions: {
         // 支持最新 JavaScript
         ecmaVersion: 2018,
-        sourceType: 'module'
+        sourceType: "module"
     },
     rules: {
+        // 注释
+        // 文件
+        "max-classes-per-file": ["error", 1],           // 一个文件中只能定义一个类
+        "max-lines-per-function": ["error", 200],       // 一个函数最多200行代码
+        "max-statements-per-line": ["error", {max: 1}], // 一行只允许有一条语句
         // 缩进
-        'indent': ['error', 4, { SwitchCase: 1 }],      // 缩进控制4空格
-        'max-len': ['error', 120],                      // 每行字符不超过120
-        'no-mixed-spaces-and-tabs': 'error',            // 禁止使用空格和tab混合缩进
+        "indent": ["error", 4, { SwitchCase: 1 }],                         // 缩进控制4空格
+        "max-len": ["error", 120],                      // 每行字符不超过120
+        "no-mixed-spaces-and-tabs": "error",            // 禁止使用空格和tab混合缩进
         // 语句
-        'curly': ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
-        'semi': ['error', 'always'],                    //不得省略语句结束的分号
-        '@typescript-eslint/no-unused-vars': 'off',     // 取消未使用变量检查
-        '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }]       // public访问不需加访问修饰符
+        "curly": ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
+        "semi": ["error", "always"],                    // 不得省略语句结束的分号
+        "@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],       // public访问不需加访问修饰符
+        "@typescript-eslint/no-explicit-any": ["off"],
+        "@typescript-eslint/no-unused-vars": ["off"],
     }
 };

+ 11 - 11
persagy-web-draw/src/SBrush.ts

@@ -40,53 +40,53 @@ export class SBrush {
     private _color = SColor.Black;
     get color(): SColor {
         return this._color;
-    } // Get color
+    }
     set color(value: SColor) {
         this.type = SBrushType.Color;
         this._color = value;
-    } // Set color
+    }
 
     /** 画刷渐变 */
     private _gradient: SGradient | null = null;
     get gradient(): SGradient | null {
         return this._gradient;
-    } // Get gradient
+    }
     set gradient(value: SGradient | null) {
         this._gradient = value;
         this.type = SBrushType.Gradient;
-    } // Set gradient
+    }
 
     /**
      * 构造函数
-    */
+     */
     constructor();
 
     /**
      * 构造函数
      *
      * @param brush     画刷
-    */
+     */
     constructor(brush: SBrush);
 
     /**
      * 构造函数
      *
      * @param color     颜色
-    */
+     */
     constructor(color: SColor);
 
     /**
      * 构造函数
      *
      * @param gradient    过渡
-    */
+     */
     constructor(gradient: SGradient);
 
     /**
      * 构造函数(重载实现)
      *
      * @param brush     画笔
-    */
+     */
     constructor(brush?: SColor | SGradient | SBrush) {
         if (brush == undefined) {
             return;
@@ -101,5 +101,5 @@ export class SBrush {
         } else {
             this.color = new SColor(brush);
         }
-    } // Constructor()
-} // Class SBrush
+    }
+}

+ 67 - 66
persagy-web-draw/src/SCanvasView.ts

@@ -47,23 +47,23 @@ export class SCanvasView extends SObject {
     protected readonly canvasView: HTMLCanvasElement;
     get canvas(): CanvasRenderingContext2D | null {
         return this.canvasView.getContext("2d") as CanvasRenderingContext2D;
-    } // Get canvas
+    }
 
     /** 宽度 */
     get width(): number {
         return this.canvasView.width;
-    } // Get width()
+    }
 
     /** 高度 */
     get height(): number {
         return this.canvasView.height;
-    } // Get height()
+    }
 
     /** 原点坐标 */
     private _origin = new SPoint();
     get origin(): SPoint {
         return this._origin;
-    } // Get origin
+    }
     set origin(v: SPoint) {
         if (!this.moveable) {
             return;
@@ -71,7 +71,7 @@ export class SCanvasView extends SObject {
         this._origin.x = v.x;
         this._origin.y = v.y;
         this._needDraw = true;
-    } // Set origin
+    }
 
     /** 可否进行平移操作 */
     moveable = true;
@@ -79,14 +79,14 @@ export class SCanvasView extends SObject {
     private _scale: number = 1;
     get scale(): number {
         return this._scale;
-    } // Get scale
+    }
     set scale(v: number) {
         if (!this.scalable) {
             return;
         }
         this._scale = v;
         this._needDraw = true;
-    } // Set scale
+    }
 
     /** 可否执行绽放操作 */
     scalable = true;
@@ -114,7 +114,7 @@ export class SCanvasView extends SObject {
     /** 鼠标样式 */
     set cursor(v: string) {
         this.canvasView.style.cursor = v;
-    } // Set cursor
+    }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //
@@ -122,65 +122,66 @@ export class SCanvasView extends SObject {
      * 构造函数
      *
      * @param id      画布对象 ID
-    */
+     */
     constructor(id: string) {
         super();
         this.canvasView = document.getElementById(id) as HTMLCanvasElement;
         this.bindEvent(this.canvasView);
 
         this.requestAnimationFrame(this.loop.bind(this));
-    } // Constructor
+    }
 
     /**
      * 更新视图
-    */
+     */
     update(): void {
         this._needDraw = true;
-    } // Function update()
+    }
 
     /**
      * 保存图像
      *
      * @param name    名称
      * @param type    图像类型
-    */
+     */
     saveImage(name: string, type: string): void {
         let url = this.canvasView.toDataURL(`image/${type}`);
         SNetUtil.downLoad(name, url);
-    } // Function saveImage()
+    }
 
     /**
      * 图像的 URL
      *
      * @param type    图像类型
-    */
+     * @return 图像的 URL
+     */
     imageUrl(type: string): string {
         return this.canvasView.toDataURL(`image/${type}`);
-    } // Function imageUrl()
+    }
 
     /**
      * 视图内容保存为 SVG 文件
      *
      * @param name    文件名
-    */
+     */
     saveSvg(name: string): void {
         let url = URL.createObjectURL(
             new Blob([this.svgData()], { type: "text/xml,charset=UTF-8" })
         );
         SNetUtil.downLoad(name, url);
-    } // Function saveSvg()
+    }
 
     /**
      * 视图 SVG 图形的数据
      *
      * @return URL 地址
-    */
+     */
     svgData(): string {
         let engine = new SSvgPaintEngine(this.width, this.height);
         let painter = new SPainter(engine);
         this.onDraw(painter);
         return engine.toSvg();
-    } // Function saveSvg()
+    }
 
     /**
      * 缩放视图时计算视图的位置与缩放比例
@@ -188,7 +189,7 @@ export class SCanvasView extends SObject {
      * @param zoom        缩放比例
      * @param x0          缩放计算的中心点 X 坐标
      * @param y0          缩放计算的中心点 Y 坐标
-    */
+     */
     scaleByPoint(zoom: number, x0: number, y0: number): void {
         if (!this.scalable) {
             return;
@@ -197,7 +198,7 @@ export class SCanvasView extends SObject {
         let z = zoom;
         /**
          * 缩放比例在最小比例和最大比例范围内
-        */
+         */
         if (this.scale * zoom >= this.maxScale) {
             z = this.maxScale / this.scale;
             this.scale = this.maxScale;
@@ -210,13 +211,13 @@ export class SCanvasView extends SObject {
 
         this.origin.x = x0 - (x0 - this.origin.x) * z;
         this.origin.y = y0 - (y0 - this.origin.y) * z;
-    } // Function scaleByPoint()
+    }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //
     /**
      * 循环
-    */
+     */
     protected loop(): void {
         /** painter 对象 */
         let ctx = this.canvas;
@@ -226,47 +227,47 @@ export class SCanvasView extends SObject {
             this.onDraw(painter);
         }
         this.requestAnimationFrame(this.loop.bind(this));
-    } // Function loop()
+    }
 
     /**
      * 绘制视图
      *
      * @param painter     painter 对象
-    */
-    protected onDraw(painter: SPainter): void {} // Function onDraw()
+     */
+    protected onDraw(painter: SPainter): void {}
 
     /**
      * 鼠标单击事件
      *
      * @param event       事件参数
-    */
-    protected onClick(event: MouseEvent): void {} // Function onClick()
+     */
+    protected onClick(event: MouseEvent): void {}
 
     /**
      * 鼠标双击事件
      *
      * @param event       事件参数
-    */
-    protected onDoubleClick(event: MouseEvent): void {} // Function onDoubleClick()
+     */
+    protected onDoubleClick(event: MouseEvent): void {}
 
     /**
      * 鼠标按下事件
      *
      * @param event       事件参数
-    */
+     */
     protected onMouseDown(event: MouseEvent): void {
         let se = new SMouseEvent(event);
         if (se.buttons & SMouseButton.MidButton) {
             this._midKeyPos.x = se.x;
             this._midKeyPos.y = se.y;
         }
-    } // Function onMouseDown()
+    }
 
     /**
      * 鼠标移动事件
      *
      * @param event       事件参数
-    */
+     */
     protected onMouseMove(event: MouseEvent): void {
         // 如果可以移动
         if (this.moveable) {
@@ -281,61 +282,61 @@ export class SCanvasView extends SObject {
                 return;
             }
         }
-    } // Function onMouseMove()
+    }
 
     /**
      * 鼠标松开事件
      *
      * @param event       事件参数
-    */
-    protected onMouseUp(event: MouseEvent): void {} // Function onMouseUp()
+     */
+    protected onMouseUp(event: MouseEvent): void {}
 
     /**
      * 上下文菜单事件
      *
      * @param event       事件参数
-    */
-    protected onContextMenu(event: MouseEvent): void {} // Function onContextMenu()
+     */
+    protected onContextMenu(event: MouseEvent): void {}
 
     /**
      * 鼠标滚轮事件
      *
      * @param event       事件参数
-    */
+     */
     protected onMouseWheel(event: WheelEvent): void {
         if (event.deltaY < 0) {
             this.scaleByPoint(this.wheelZoom, event.offsetX, event.offsetY);
         } else {
             this.scaleByPoint(1 / this.wheelZoom, event.offsetX, event.offsetY);
         }
-    } // Function onMouseWheel()
+    }
 
     /**
      * 按键按下事件
      *
      * @param event       事件参数
-    */
-    protected onKeyDown(event: KeyboardEvent): void {} // Function onKeydown()
+     */
+    protected onKeyDown(event: KeyboardEvent): void {}
 
     /**
      * 按键press事件
      *
      * @param event       事件参数
-    */
-    protected onKeyPress(event: KeyboardEvent): void {} // Function onKeypress()
+     */
+    protected onKeyPress(event: KeyboardEvent): void {}
 
     /**
      * 按键松开事件
      *
      * @param event       事件参数
-    */
-    protected onKeyUp(event: KeyboardEvent): void {} // Function onKeyup()
+     */
+    protected onKeyUp(event: KeyboardEvent): void {}
 
     /**
      * 开始触摸事件
      *
      * @param event       事件参数
-    */
+     */
     protected onTouchStart(event: TouchEvent): void {
         let touches = event.touches;
         if (touches.length == 1) {
@@ -346,13 +347,13 @@ export class SCanvasView extends SObject {
             this._touchState = STouchState.Zoom;
             this._beforeLength = this.getDistance(event);
         }
-    } // Function onTouchStart()
+    }
 
     /**
      * 触摸移动事件
      *
      * @param event       事件参数
-    */
+     */
     protected onTouchMove(event: TouchEvent): void {
         let touches = event.touches;
         if (touches.length == 1) {
@@ -364,29 +365,29 @@ export class SCanvasView extends SObject {
         if (touches.length == 2) {
             this.viewZoom(event);
         }
-    } // Function onTouchMove()
+    }
 
     /**
      * 结束触摸事件
      *
      * @param event       事件参数
-    */
+     */
     protected onTouchEnd(event: TouchEvent): void {
         this._touchState = STouchState.None;
-    } // Function onTouchEnd()
+    }
 
     /**
      * View大小变更事件
      *
      * @param event       事件参数
-    */
-    protected onResize(event: UIEvent): void {} // Function onClick()
+     */
+    protected onResize(event: UIEvent): void {}
 
     /**
      * 绑定事件
      *
      * @param element     要绑定事件的元素
-    */
+     */
     private bindEvent(element: HTMLElement): void {
         // 绑定鼠标事件
         element.onclick = this.onClick.bind(this);
@@ -409,13 +410,13 @@ export class SCanvasView extends SObject {
 
         // 绑定窗口事件
         element.onresize = this.onResize.bind(this);
-    } // Function bindEvent()
+    }
 
     /**
      * 启动动画帧(即指定时间执行回调函数)
      *
      * @param callback        回调函数
-    */
+     */
     private requestAnimationFrame(callback: FrameRequestCallback): number {
         let currTime = new Date().getTime();
         let timeToCall = Math.max(0, 16 - (currTime - this._lastFrameTime));
@@ -424,13 +425,13 @@ export class SCanvasView extends SObject {
         }, timeToCall);
         this._lastFrameTime = currTime + timeToCall;
         return id;
-    } // Function requestAnimationFrame()
+    }
 
     /**
      * 缩放视图
      *
      * @param event       触摸事件
-    */
+     */
     private viewZoom(event: TouchEvent): boolean {
         if (this._touchState == STouchState.Zoom) {
             // 获取两点的距离
@@ -447,14 +448,14 @@ export class SCanvasView extends SObject {
             }
         }
         return true;
-    } // Function onTouchMove()
+    }
 
     /**
      * 获取两手指之间的距离
      *
      * @param event       触摸事件
      * @return 两手指之间的距离
-    */
+     */
     private getDistance(event: TouchEvent): number {
         if (event.touches.length < 2) {
             return 0;
@@ -463,18 +464,18 @@ export class SCanvasView extends SObject {
         let dx = event.touches[0].clientX - event.touches[1].clientX;
         let dy = event.touches[0].clientY - event.touches[1].clientY;
         return Math.sqrt(dx * dx + dy * dy);
-    } // Function getDistance()
+    }
 
     /**
      * 获得两个手指触摸点的中点坐标
      *
      * @param event     触摸事件
      * @return 得到视图的 x 坐标中点
-    */
+     */
     private getMiddlePoint(event: TouchEvent): SPoint {
         return new SPoint(
             (event.touches[0].clientX + event.touches[1].clientX) / 2,
             (event.touches[0].clientY + event.touches[1].clientY) / 2
         );
-    } // Function getMiddlePoint()
-} // Class SCanvasView
+    }
+}

+ 31 - 31
persagy-web-draw/src/SColor.ts

@@ -76,7 +76,7 @@ export class SColor {
      * @param g       绿色分量
      * @param b       蓝色分量
      * @return 颜色
-    */
+     */
     static rgb(r: number, g: number, b: number): SColor {
         return new SColor(r, g, b);
     }
@@ -89,54 +89,54 @@ export class SColor {
      * @param b       蓝色分量
      * @param a       透明度分量
      * @return 颜色
-    */
+     */
     static rgba(r: number, g: number, b: number, a: number): SColor {
         return new SColor(r, g, b, a);
-    } // Function rgb()
+    }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // 属性定义
     /** 红色分量 */
     get red(): number {
         return (this._value >> 24) & 0xff;
-    } // Get red
+    }
     set red(v: number) {
         const r = (Math.floor(v) & 0xff) << 24;
         this._value = (this._value & 0x00ffffff) | r;
-    } // Set red
+    }
 
     /** 绿色分量 */
     get green(): number {
         return (this._value >> 16) & 0xff;
-    } // Get green
+    }
     set green(v: number) {
         const r = (Math.floor(v) & 0xff) << 16;
         this._value = (this._value & 0xff00ffff) | r;
-    } //Set green
+    }
 
     /** 蓝色分量 */
     get blue(): number {
         return (this._value >> 8) & 0xff;
-    } // Get blue
+    }
     set blue(v: number) {
         const r = (Math.floor(v) & 0xff) << 8;
         this._value = (this._value & 0xffff00ff) | r;
-    } // Set blue
+    }
 
     /** 透明度 */
     get alpha(): number {
         return this._value & 0xff;
-    } // Get alpha
+    }
     set alpha(v: number) {
         const r = Math.floor(v) & 0xff;
         this._value = (this._value & 0xffffff00) | r;
-    } // Set alpha
+    }
 
     /** 颜色 */
     private _value = 0xff;
     get value(): string {
         return "#" + SStringUtil.num2Hex(this._value, 8);
-    } // Get value
+    }
     set value(v: string) {
         if (v.substr(0, 1) != "#") {
             return;
@@ -148,13 +148,13 @@ export class SColor {
         if (v.length == 7) {
             this._value = (this._value << 8) + 0xff;
         }
-    } // Set value
+    }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // 构造函数
     /**
      * 构造函数
-    */
+     */
     constructor();
 
     /**
@@ -163,7 +163,7 @@ export class SColor {
      * @param r       红色分量
      * @param g       绿色分量
      * @param b       蓝色分量
-    */
+     */
     constructor(r: number, g: number, b: number);
 
     /**
@@ -173,21 +173,21 @@ export class SColor {
      * @param g       绿色分量
      * @param b       蓝色分量
      * @param a       透明度分量 0 - 255
-    */
+     */
     constructor(r: number, g: number, b: number, a: number);
 
     /**
      * 构造函数
      *
      * @param color   颜色
-    */
+     */
     constructor(color: string);
 
     /**
      * 构造函数
      *
      * @param color   颜色
-    */
+     */
     constructor(color: SColor);
 
     /**
@@ -197,7 +197,7 @@ export class SColor {
      * @param g       绿色分量
      * @param b       蓝色分量
      * @param a       透明度分量 0 - 255
-    */
+     */
     constructor(
         r?: number | string | SColor,
         g?: number,
@@ -215,7 +215,7 @@ export class SColor {
         } else {
             this.setRgba(r as number, g as number, b as number, a as number);
         }
-    } // Constructor
+    }
 
     /**
      * 设置颜色
@@ -223,14 +223,14 @@ export class SColor {
      * @param r       红色分量
      * @param g       绿色分量
      * @param b       蓝色分量
-    */
+     */
     private setRgb(r: number, g: number, b: number): void {
         this._value =
             ((r as number) << 24) +
             ((g as number) << 16) +
             ((b as number) << 8) +
             0xff;
-    } // Function setRgb()
+    }
 
     /**
      * 设置颜色
@@ -239,40 +239,40 @@ export class SColor {
      * @param g       绿色分量
      * @param b       蓝色分量
      * @param a       透明度分量 0 - 255
-    */
+     */
     private setRgba(r: number, g: number, b: number, a: number): void {
         this._value =
             ((r as number) << 24) +
             ((g as number) << 16) +
             ((b as number) << 8) +
             (a as number);
-    } // Function setRgba()
+    }
 
     /**
      * 颜色转 rgb
      *
      * @return rgb 字符串
-    */
+     */
     toRgb(): string {
         return `rgb(${this.red}, ${this.green}, ${this.blue})`;
-    } // Function toRgb()
+    }
 
     /**
      * 颜色转 rgba
      *
      * @return rgba 字符串
-    */
+     */
     toRgba(): string {
         return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha /
             255.0})`;
-    } // Function toRgb()
+    }
 
     /**
      * 颜色转 6 位 16 进制
      *
      * @return 6 位 16 进制颜色
-    */
+     */
     toVal(): string {
         return "#" + SStringUtil.num2Hex(this._value, 6);
-    } // Function toRgb()
-} // Class SColor
+    }
+}

+ 6 - 6
persagy-web-draw/src/SFont.ts

@@ -54,14 +54,14 @@ export class SFont {
     // 构造函数
     /**
      * 构造函数
-    */
+     */
     constructor();
 
     /**
      * 构造函数
      *
      * @param font  FONT
-    */
+     */
     constructor(font: SFont);
 
     /**
@@ -69,14 +69,14 @@ export class SFont {
      *
      * @param name        字体
      * @param size        字号
-    */
+     */
     constructor(name: string, size?: number);
     /**
      * 构造函数
      *
      * @param name        字体 | SFont
      * @param size        字号
-    */
+     */
     constructor(name?: string | SFont, size?: number) {
         if (name == undefined) {
             return;
@@ -91,5 +91,5 @@ export class SFont {
             this.name = name;
             this.size = size != undefined ? size : 16;
         }
-    } // Constructor
-} // Class SFont
+    }
+}

+ 16 - 16
persagy-web-draw/src/SGradient.ts

@@ -43,34 +43,34 @@ export abstract class SGradient {
     /** 起点 X 坐标 */
     get x1(): number {
         return this.start.x;
-    } // Get x1
+    }
     set x1(value: number) {
         this.start.x = value;
-    } // Set x1
+    }
 
     /** 起点 Y 坐标 */
     get y1(): number {
         return this.start.y;
-    } // Get y1
+    }
     set y1(value: number) {
         this.start.y = value;
-    } // Set y1
+    }
 
     /** 终点 X 坐标 */
     get x2(): number {
         return this.end.x;
-    } // Get x2
+    }
     set x2(value: number) {
         this.end.x = value;
-    } // Set x2
+    }
 
     /** 终点 Y 坐标 */
     get y2(): number {
         return this.end.y;
-    } // Get y2
+    }
     set y2(value: number) {
         this.end.y = value;
-    } // Set y2
+    }
 
     /** 渐变颜色节点列表 */
     stopList: SGradientStop[] = [];
@@ -80,37 +80,37 @@ export abstract class SGradient {
      *
      * @param pos     位置[0 - 1]
      * @param color   颜色
-    */
+     */
     addColorStop(pos: number, color: SColor): void {
         this.stopList.push(new SGradientStop(pos, color));
-    } // Function addColorStop()
+    }
 
     /**
      * 设置起点坐标
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-    */
+     */
     setStart(x: number, y: number): void {
         this.start.x = x;
         this.start.y = y;
-    } // Function setStart()
+    }
 
     /**
      * 设置终点坐标
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-    */
+     */
     setEnd(x: number, y: number): void {
         this.end.x = x;
         this.end.y = y;
-    } // Function setEnd()
+    }
 
     /**
      * 转为字符串保存
      *
      * @return 转为字符串保存
-    */
+     */
     abstract value(): string;
-} // Class SGradientStop
+}

+ 5 - 5
persagy-web-draw/src/SGradientStop.ts

@@ -36,7 +36,7 @@ export class SGradientStop {
     private _pos: number = 0;
     get pos(): number {
         return this._pos;
-    } // Get pos
+    }
     set pos(value: number) {
         if (value < 0) {
             value = 0;
@@ -45,7 +45,7 @@ export class SGradientStop {
             value = 1;
         }
         this._pos = value;
-    } // Set pos
+    }
     /** 颜色 */
     color: SColor;
 
@@ -54,9 +54,9 @@ export class SGradientStop {
      *
      * @param pos         节点位置
      * @param color       节点颜色
-    */
+     */
     constructor(pos: number, color: SColor) {
         this.pos = pos;
         this.color = color;
-    } // Constructor()
-} // Class SGradientStop
+    }
+}

+ 8 - 8
persagy-web-draw/src/SLinearGradient.ts

@@ -37,7 +37,7 @@ export class SLinearGradient extends SGradient {
      *
      * @param start   起点坐标
      * @param end     终点坐标
-    */
+     */
     constructor(start: SPoint, end: SPoint);
 
     /**
@@ -47,7 +47,7 @@ export class SLinearGradient extends SGradient {
      * @param y1      起点 Y 坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-    */
+     */
     constructor(x1: number, y1: number, x2: number, y2: number);
 
     /**
@@ -57,7 +57,7 @@ export class SLinearGradient extends SGradient {
      * @param y1      起点 Y 坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-    */
+     */
     constructor(
         x1: number | SPoint,
         y1: number | SPoint,
@@ -72,20 +72,20 @@ export class SLinearGradient extends SGradient {
             this.start = new SPoint(x1 as number, y1 as number);
             this.end = new SPoint(x2 as number, y2 as number);
         }
-    } // Constructor()
+    }
 
     /**
      * 转为字符串保存
      *
      * @return 转为字符串保存
-    */
+     */
     value(): string {
         let str = `SLinearGradient{`;
         str += `${this.x1},${this.y1};`;
         str += `${this.x2},${this.y2};`;
-        this.stopList.forEach(t => {
+        this.stopList.forEach((t): void => {
             str += `${t.pos},${t.color.value};`;
         });
         return `${str}}`;
-    } // Function value()
-} // Class SGradientBrush
+    }
+}

+ 87 - 87
persagy-web-draw/src/SPainter.ts

@@ -57,62 +57,62 @@ export class SPainter extends SObject {
     /** 画笔 */
     get pen(): SPen {
         return this.engine.state.pen;
-    } // Get pen
+    }
     set pen(value: SPen) {
         this.engine.state.pen = value;
-    } // Set pen
+    }
 
     /** 画刷 */
     get brush(): SBrush {
         return this.engine.state.brush;
-    } // Get brush
+    }
     set brush(value: SBrush) {
         this.engine.state.brush = value;
-    } // Set brush
+    }
 
     /** 字体属性 */
     get font(): SFont {
         return this.engine.state.font;
-    } // Get font
+    }
     set font(value: SFont) {
         this.engine.state.font = value;
         this.engine.changeFont(value);
-    } // Set font
+    }
 
     /** 融合属性 */
     get composite(): number {
         return this.engine.state._composite;
-    } // Get composite
+    }
     set composite(value: number) {
         this.engine.state._composite = value;
-    } // Set composite
+    }
 
     /** 阴影设置 */
     get shadow(): SShadow {
         return this.engine.state.shadow;
-    } // Get shadow
+    }
     set shadow(value: SShadow) {
         this.engine.state.shadow = value;
-    } // Set shadow
+    }
 
     /** 裁剪设置 */
     get clip(): SPath | undefined {
         return this.engine.state.clip;
-    } // Get clip
+    }
     set clip(value: SPath | undefined) {
         this.engine.state.clip = value;
-    } // Set clip
+    }
 
     /** 变换矩阵 */
     get worldTransform(): SMatrix {
         return this.engine.state.matrix;
-    } // Get worldTransform
+    }
 
     /**
      * 构造函数
      *
      * @param engine    绘制引擎
-    */
+     */
     constructor(engine: SCanvasView | SPaintEngine) {
         super();
         if (engine instanceof SCanvasView) {
@@ -127,21 +127,21 @@ export class SPainter extends SObject {
         this.font = new SFont();
         this.composite = SCompositeType.SourceOver;
         this.shadow = new SShadow();
-    } // Constructor()
+    }
 
     /**
      * 保存 painter 状态
-    */
+     */
     save(): void {
         this.engine.save();
-    } // Function save()
+    }
 
     /**
      * 恢复 painter 状态
-    */
+     */
     restore(): void {
         this.engine.restore();
-    } // Function restore()
+    }
 
     // =================================================================================================================
     // 变换相关
@@ -150,29 +150,29 @@ export class SPainter extends SObject {
      *
      * @param x       X 轴方向平移
      * @param y       Y 轴方向平移
-    */
+     */
     translate(x: number, y: number): void {
         this.engine.translate(x, y);
-    } // Function translate()
+    }
 
     /**
      * 缩放
      *
      * @param x       X 轴方向缩放
      * @param y       Y 轴方向缩放
-    */
+     */
     scale(x: number, y: number): void {
         this.engine.scale(x, y);
-    } // Function scale()
+    }
 
     /**
      * 旋转
      *
      * @param angle   旋转角度(单位弧度)
-    */
+     */
     rotate(angle: number): void {
         this.engine.rotate(angle);
-    } // Function rotate()
+    }
 
     /**
      * 将当前的变形矩阵乘上一个基于自身参数的矩阵
@@ -183,7 +183,7 @@ export class SPainter extends SObject {
      * @param m22     竖直方向的缩放
      * @param dx      水平方向的移动
      * @param dy      竖直方向的移动
-    */
+     */
     transform(
         m11: number,
         m12: number,
@@ -193,7 +193,7 @@ export class SPainter extends SObject {
         dy: number
     ): void {
         this.engine.transform(m11, m12, m21, m22, dx, dy);
-    } // Function transform()
+    }
 
     /**
      * 将当前的变形矩阵重置为单位矩阵,再将当前的变形矩阵乘上一个基于自身参数的矩阵
@@ -204,7 +204,7 @@ export class SPainter extends SObject {
      * @param m22     竖直方向的缩放
      * @param dx      水平方向的移动
      * @param dy      竖直方向的移动
-    */
+     */
     setTransform(
         m11: number,
         m12: number,
@@ -214,14 +214,14 @@ export class SPainter extends SObject {
         dy: number
     ): void {
         this.engine.setTransform(m11, m12, m21, m22, dx, dy);
-    } // Function transform()
+    }
 
     /**
      * 重置当前变形为单位矩阵。等价于调用 setTransform(1, 0, 0, 1, 0, 0)
-    */
+     */
     resetTransform(): void {
         this.engine.resetTransform();
-    } // Function resetTransform()
+    }
 
     // =================================================================================================================
     // 绘制相关
@@ -230,7 +230,7 @@ export class SPainter extends SObject {
      * 清空矩形区域
      *
      * @param rect  矩形
-    */
+     */
     clearRect(rect: SRect): void;
 
     /**
@@ -238,7 +238,7 @@ export class SPainter extends SObject {
      *
      * @param leftTop         左上角坐标
      * @param rightBottom     右下角坐标
-    */
+     */
     clearRect(leftTop: SPoint, rightBottom: SPoint): void;
 
     /**
@@ -246,7 +246,7 @@ export class SPainter extends SObject {
      *
      * @param leftTop     左上角坐标
      * @param size        大小
-    */
+     */
     clearRect(leftTop: SPoint, size: SSize): void;
 
     /**
@@ -256,7 +256,7 @@ export class SPainter extends SObject {
      * @param y       Y 坐标
      * @param w       宽度
      * @param h       高度
-    */
+     */
     clearRect(x: number, y: number, w: number, h: number): void;
 
     /**
@@ -266,7 +266,7 @@ export class SPainter extends SObject {
      * @param y       Y 坐标 | 右下角坐标 | 大小
      * @param w       宽度
      * @param h       高度
-    */
+     */
     clearRect(
         x: number | SPoint | SRect,
         y?: number | SPoint | SSize,
@@ -284,13 +284,13 @@ export class SPainter extends SObject {
                 new SRect(x as number, y as number, w as number, h as number)
             );
         }
-    } // Function clearRect()
+    }
 
     /**
      * 绘制矩形
      *
      * @param rect        矩形
-    */
+     */
     drawRect(rect: SRect): void;
 
     /**
@@ -298,7 +298,7 @@ export class SPainter extends SObject {
      *
      * @param leftTop         左上角坐标
      * @param rightBottom     右下角坐标
-    */
+     */
     drawRect(leftTop: SPoint, rightBottom: SPoint): void;
 
     /**
@@ -306,7 +306,7 @@ export class SPainter extends SObject {
      *
      * @param leftTop     左上角坐标
      * @param size        大小
-    */
+     */
     drawRect(leftTop: SPoint, size: SSize): void;
 
     /**
@@ -316,7 +316,7 @@ export class SPainter extends SObject {
      * @param y       Y 坐标
      * @param w       宽度
      * @param h       高度
-    */
+     */
     drawRect(x: number, y: number, w: number, h: number): void;
 
     /**
@@ -326,7 +326,7 @@ export class SPainter extends SObject {
      * @param y       Y 坐标 | 右下角坐标 | 大小
      * @param w       宽度
      * @param h       高度
-    */
+     */
     drawRect(
         x: number | SPoint | SRect,
         y?: number | SPoint | SSize,
@@ -350,14 +350,14 @@ export class SPainter extends SObject {
                 new SRect(x as number, y as number, w as number, h as number)
             );
         }
-    } // Function drawRect()
+    }
 
     /**
      * 绘制带导角矩形
      *
      * @param rect        矩形
      * @param r           导角半径
-    */
+     */
     drawRoundRect(rect: SRect, r: number): void;
 
     /**
@@ -366,7 +366,7 @@ export class SPainter extends SObject {
      * @param p1        矩形左上角的点
      * @param p2        矩形右上角的点
      * @param r         导角半径
-    */
+     */
     drawRoundRect(p1: SPoint, p2: SPoint, r: number): void;
 
     /**
@@ -375,7 +375,7 @@ export class SPainter extends SObject {
      * @param pos         左上角位置
      * @param size        大小
      * @param r           导角半径
-    */
+     */
     drawRoundRect(pos: SPoint, size: SSize, r: number): void;
 
     /**
@@ -386,7 +386,7 @@ export class SPainter extends SObject {
      * @param w           宽度
      * @param h           高度
      * @param r           导角半径
-    */
+     */
     drawRoundRect(x: number, y: number, w: number, h: number, r: number): void;
 
     /**
@@ -397,7 +397,7 @@ export class SPainter extends SObject {
      * @param w           宽度
      * @param h           高度
      * @param radius      导角半径
-    */
+     */
     drawRoundRect(
         x: number | SPoint | SRect,
         y: number | SSize | SPoint,
@@ -430,7 +430,7 @@ export class SPainter extends SObject {
         if (rect != null && r != null) {
             this.engine.drawRoundRect(rect, r);
         }
-    } // Function drawRoundRect()
+    }
 
     /**
      * 绘制圆形
@@ -438,10 +438,10 @@ export class SPainter extends SObject {
      * @param cx          圆心 X 坐标
      * @param cy          圆心 Y 坐标
      * @param r           圆半径
-    */
+     */
     drawCircle(cx: number, cy: number, r: number): void {
         this.engine.drawCircle(cx, cy, r);
-    } // Function drawCircle()
+    }
 
     /**
      * 绘制椭圆
@@ -450,16 +450,16 @@ export class SPainter extends SObject {
      * @param cy          圆点 Y 坐标
      * @param rx          水平半径
      * @param ry          垂直半径
-    */
+     */
     drawEllipse(cx: number, cy: number, rx: number, ry: number): void {
         this.engine.drawEllipse(cx, cy, rx, ry);
-    } // Function drawEllipse()
+    }
 
     /**
      * 绘制一条线段
      *
      * @param line    线段
-    */
+     */
     drawLine(line: SLine): void;
 
     /**
@@ -467,7 +467,7 @@ export class SPainter extends SObject {
      *
      * @param p1      启点坐标
      * @param p2      终点坐标
-    */
+     */
     drawLine(p1: SPoint, p2: SPoint): void;
 
     /**
@@ -477,7 +477,7 @@ export class SPainter extends SObject {
      * @param y1      启点 Y 坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-    */
+     */
     drawLine(x1: number, y1: number, x2: number, y2: number): void;
 
     /**
@@ -487,7 +487,7 @@ export class SPainter extends SObject {
      * @param y1      启点 Y 坐标 | 终点坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-    */
+     */
     drawLine(
         x1: number | SPoint | SLine,
         y1?: number | SPoint,
@@ -508,34 +508,34 @@ export class SPainter extends SObject {
                 )
             );
         }
-    } // Function drawLine()
+    }
 
     /**
      * 绘制折线
      *
      * @param points      折线折点
-    */
+     */
     drawPolyline(points: SPoint[]): void {
         this.engine.drawPolyline(points);
-    } // Function drawPolyline()
+    }
 
     /**
      * 绘制多边形
      *
      * @param points      多边形顶点
-    */
+     */
     drawPolygon(points: SPoint[]): void {
         this.engine.drawPolygon(points);
-    } // Function drawPolygon()
+    }
 
     /**
      * 绘制路径
      *
      * @param path        路径
-    */
+     */
     drawPath(path: SPath): void {
         this.engine.drawPath(path);
-    } // Function drawPath()
+    }
 
     /**
      * 绘制文本
@@ -544,10 +544,10 @@ export class SPainter extends SObject {
      * @param x           X 坐标
      * @param y           Y 坐标
      * @param maxWidth    最大宽度
-    */
+     */
     drawText(text: string, x: number, y: number, maxWidth?: number): void {
         this.engine.drawText(text, x, y, maxWidth);
-    } // Function drawText()
+    }
 
     /**
      * 绘制图片
@@ -557,7 +557,7 @@ export class SPainter extends SObject {
      * @param y         Y 坐标
      * @param width     宽度
      * @param height    高度
-    */
+     */
     drawImage(
         img: CanvasImageSource,
         x: number,
@@ -566,23 +566,23 @@ export class SPainter extends SObject {
         height?: number
     ): void {
         this.engine.drawImage(img, x, y, width, height);
-    } // Function drawImage()
+    }
 
     /**
      * painter 转实现 view 象素
      *
      * @param p       绘制坐标
-    */
+     */
     toPx(p: number): number {
         return p / this.engine.state.matrix.a;
-    } // Function painterToView()
+    }
 
     /**
      * 预测量文本宽度
      *
      * @param text    文本字符
      * @return 文本所占长度像素
-    */
+     */
     textWidth(text: string): number {
         return this.engine.textWidth(text);
     }
@@ -592,7 +592,7 @@ export class SPainter extends SObject {
      *
      * @param line    线段
      * @param style   末端样式
-    */
+     */
     drawArrowLine(line: SLine, style?: SArrow): void;
 
     /**
@@ -601,7 +601,7 @@ export class SPainter extends SObject {
      * @param p1      启点坐标
      * @param p2      终点坐标
      * @param style   末端样式
-    */
+     */
     drawArrowLine(p1: SPoint, p2: SPoint, style?: SArrow): void;
 
     /**
@@ -612,7 +612,7 @@ export class SPainter extends SObject {
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
      * @param style   末端样式
-    */
+     */
     drawArrowLine(
         x1: number,
         y1: number,
@@ -629,7 +629,7 @@ export class SPainter extends SObject {
      * @param x2  终点 X 坐标
      * @param y2  终点 Y 坐标
      * @param st  线段两端样式
-    */
+     */
     drawArrowLine(
         x1: number | SPoint | SLine,
         y1?: number | SPoint | SArrow,
@@ -682,14 +682,14 @@ export class SPainter extends SObject {
                 }
             }
         }
-    } // Function drawArrowLine()
+    }
 
     /**
      * 私有计算方法-绘制线段末端标准箭头
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-    */
+     */
     private drawBasicArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(10);
@@ -721,14 +721,14 @@ export class SPainter extends SObject {
             ]);
         }
         this.restore();
-    } // Function drawArrow()
+    }
 
     /**
      * 私有计算方法-绘制线段末端三角形箭头
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-    */
+     */
     private drawTriangleArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(10);
@@ -760,14 +760,14 @@ export class SPainter extends SObject {
             ]);
         }
         this.restore();
-    } // Function drawTriangleArrow()
+    }
 
     /**
      * 私有计算方法-绘制线段末端菱形箭头
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-    */
+     */
     private drawDiamondArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);
@@ -801,14 +801,14 @@ export class SPainter extends SObject {
             ]);
         }
         this.restore();
-    } // Function drawDiamondArrow()
+    }
 
     /**
      * 私有计算方法-绘制线段末端方形箭头
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-    */
+     */
     private drawSquareArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);
@@ -839,14 +839,14 @@ export class SPainter extends SObject {
             ]);
         }
         this.restore();
-    } // Function drawSquareArrow()
+    }
 
     /**
      * 私有计算方法-绘制线段末端圆形箭头
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-    */
+     */
     private drawCircleArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);
@@ -867,5 +867,5 @@ export class SPainter extends SObject {
             this.engine.drawCircle(d / 2, 0, d / 2);
         }
         this.restore();
-    } // Function drawCircleArrow()
-} // Class SPainter
+    }
+}

+ 25 - 25
persagy-web-draw/src/SPath.ts

@@ -41,46 +41,46 @@ export class SPath {
      *
      * @param cmd         命令
      * @param args        命令参数
-    */
+     */
     private addCommand(cmd: string, ...args: number[]): void {
         this.cmdList.push({ command: cmd, args: args });
-    } // Function addCommand()
+    }
 
     /**
      * 添加一条新路径到对当前路径。
      *
      * @param path  路径对象
-    */
+     */
     addPath(path: SPath): void {
         this.cmdList = this.cmdList.concat(path.cmdList);
-    } // Function addPath()
+    }
 
     /**
      * 使笔点返回到当前子路径的起始点。它尝试从当前点到起始点绘制一条直线。 如果图形已经是封闭的或者只有一个点,那么此函数不会做任何操作。
-    */
+     */
     closePath(): void {
         this.addCommand("Z");
-    } // Function closePath()
+    }
 
     /**
      * 移动当前点到指定位置
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-    */
+     */
     moveTo(x: number, y: number): void {
         this.addCommand("M", x, y);
-    } // Function moveTo()
+    }
 
     /**
      * 从当前点向指定点画线
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-    */
+     */
     lineTo(x: number, y: number): void {
         this.addCommand("L", x, y);
-    } // Function lineTo()
+    }
 
     /**
      * 添加一条圆弧路径。
@@ -91,7 +91,7 @@ export class SPath {
      * @param startAngle      开始角度
      * @param endAngle        结束角度
      * @param anticlockwise   是否逆时针绘制( 1 是, 0 不是)
-    */
+     */
     arc(
         x: number,
         y: number,
@@ -109,7 +109,7 @@ export class SPath {
             endAngle,
             anticlockwise
         );
-    } // Function arc()
+    }
 
     /**
      * 根据控制点和半径添加一条圆弧路径,使用直线连接前一个点。
@@ -119,7 +119,7 @@ export class SPath {
      * @param x2        点 2 的 x 坐标
      * @param y2        点 1 的 y 坐标
      * @param radius    半径
-    */
+     */
     arcTo(
         x1: number,
         y1: number,
@@ -128,7 +128,7 @@ export class SPath {
         radius: number
     ): void {
         this.addCommand("ArcTo", x1, y1, x2, y2, radius);
-    } // Function arcTo()
+    }
 
     /**
      * 添加二次贝塞尔曲线
@@ -137,10 +137,10 @@ export class SPath {
      * @param cp1y    控制点 Y 坐标
      * @param x       结束点 X 坐标
      * @param y       结束点 Y 坐标
-    */
+     */
     quadraticCurveTo(cp1x: number, cp1y: number, x: number, y: number): void {
         this.addCommand("Q", cp1x, cp1y, x, y);
-    } // Function quadraticCurveTo()
+    }
 
     /**
      * 添加三次贝塞尔曲线
@@ -151,7 +151,7 @@ export class SPath {
      * @param cp2y    结束点控制点 Y 坐标
      * @param x       结束点 X 坐标
      * @param y       结束点 Y 坐标
-    */
+     */
     bezierCurveTo(
         cp1x: number,
         cp1y: number,
@@ -161,7 +161,7 @@ export class SPath {
         y: number
     ): void {
         this.addCommand("C", cp1x, cp1y, cp2x, cp2y, x, y);
-    } // Function bezierCurveTo()
+    }
 
     /**
      * 添加椭圆
@@ -170,10 +170,10 @@ export class SPath {
      * @param cy          圆点 Y 坐标
      * @param rx          水平半径
      * @param ry          垂直半径
-    */
+     */
     ellipse(cx: number, cy: number, rx: number, ry: number): void {
         this.addCommand("Ellipse", cx, cy, rx, ry);
-    } // Function ellipse()
+    }
 
     /**
      * 添加矩形
@@ -182,20 +182,20 @@ export class SPath {
      * @param y           Y 坐标
      * @param w           宽度
      * @param h           高度
-    */
+     */
     rect(x: number, y: number, w: number, h: number): void {
         this.addCommand("M", x, y);
         this.addCommand("L", x + w, y);
         this.addCommand("L", x + w, y + h);
         this.addCommand("L", x, y + h);
         this.addCommand("Z");
-    } // Function rect()
+    }
 
     /**
      * 添加多边形
      *
      * @param pList   点集数组
-    */
+     */
     polygon(pList: SPoint[]): void {
         if (pList.length > 2) {
             this.addCommand("M", pList[0].x, pList[0].y);
@@ -204,5 +204,5 @@ export class SPath {
             }
             this.addCommand("Z");
         }
-    } // Function polygon()
-} // Class SPath
+    }
+}

+ 6 - 6
persagy-web-draw/src/SPen.ts

@@ -59,14 +59,14 @@ export class SPen {
     // 构造函数
     /**
      * 构造函数
-    */
+     */
     constructor();
 
     /**
      * 构造函数
      *
      * @param pen   画笔
-    */
+     */
     constructor(pen: SPen);
 
     /**
@@ -74,7 +74,7 @@ export class SPen {
      *
      * @param color       颜色
      * @param lineWidth   线宽
-    */
+     */
     constructor(color: SColor, lineWidth?: number);
 
     /**
@@ -82,7 +82,7 @@ export class SPen {
      *
      * @param color       颜色 | 画笔
      * @param lineWidth   线宽
-    */
+     */
     constructor(color?: SColor | SPen, lineWidth?: number) {
         if (color == undefined) {
             return;
@@ -100,5 +100,5 @@ export class SPen {
             this.color = new SColor(color);
             this.lineWidth = lineWidth != undefined ? lineWidth : 1;
         }
-    } // Constructor()
-} // Class SPen
+    }
+}

+ 8 - 8
persagy-web-draw/src/SRadialGradient.ts

@@ -44,7 +44,7 @@ export class SRadialGradient extends SGradient {
      * @param r1      开始圆形半径
      * @param end     结束圆形坐标
      * @param r2      结束圆形半径
-    */
+     */
     constructor(start: SPoint, r1: number, end: SPoint, r2: number);
 
     /**
@@ -56,7 +56,7 @@ export class SRadialGradient extends SGradient {
      * @param x2      结束圆形 X 坐标
      * @param y2      结束圆形 Y 坐标
      * @param r2      结束圆形半径
-    */
+     */
     constructor(
         x1: number,
         y1: number,
@@ -75,7 +75,7 @@ export class SRadialGradient extends SGradient {
      * @param x2      结束圆形 X 坐标 | 结束圆形半径
      * @param y2      结束圆形 Y 坐标
      * @param r2      结束圆形半径
-    */
+     */
     constructor(
         x1: number | SPoint,
         y1: number,
@@ -96,19 +96,19 @@ export class SRadialGradient extends SGradient {
             this.r1 = r1 as number;
             this.r2 = r2 as number;
         }
-    } // Constructor()
+    }
 
     /**
      * 转为字符串保存
      *
-    */
+     */
     value(): string {
         let str = `SRadialGradient{`;
         str += `${this.x1},${this.y1},${this.r1};`;
         str += `${this.x2},${this.y2},${this.r2};`;
-        this.stopList.forEach(t => {
+        this.stopList.forEach((t): void => {
             str += `${t.pos},${t.color.value};`;
         });
         return `${str}}`;
-    } // Function value()
-} // Class SRadialGradient
+    }
+}

+ 0 - 0
persagy-web-draw/src/SShadow.ts


部分文件因文件數量過多而無法顯示