Browse Source

fix:完善API参考文档

zhangweixin 4 years ago
parent
commit
1da4208884
100 changed files with 2219 additions and 2016 deletions
  1. 18 18
      persagy-web-base/src/SMatrix.ts
  2. 1 1
      persagy-web-base/src/SMouseEvent.ts
  3. 4 4
      persagy-web-base/src/SObject.ts
  4. 3 3
      persagy-web-base/src/SObjectObserver.ts
  5. 6 6
      persagy-web-base/src/undo/SUndoCommand.ts
  6. 9 9
      persagy-web-base/src/undo/SUndoStack.ts
  7. 1 1
      persagy-web-base/src/utils/SNetUtil.ts
  8. 3 3
      persagy-web-base/src/utils/SStringBuilder.ts
  9. 1 1
      persagy-web-base/src/utils/SStringUtil.ts
  10. 1 1
      persagy-web-base/src/utils/SUuid.ts
  11. 37 31
      persagy-web-big-edit/src/BigEditFactory.ts
  12. 69 68
      persagy-web-big-edit/src/SBaseEditScene.ts
  13. 27 17
      persagy-web-big-edit/src/items/SBaseArrow.ts
  14. 15 8
      persagy-web-big-edit/src/items/SBaseEquipment.ts
  15. 64 59
      persagy-web-big-edit/src/items/SBaseExpainEdit.ts
  16. 23 18
      persagy-web-big-edit/src/items/SBasePipe.ts
  17. 26 22
      persagy-web-big-edit/src/items/SBasePipeUninTool.ts
  18. 4 4
      persagy-web-big-edit/src/types/Anchor.ts
  19. 7 4
      persagy-web-big-edit/src/types/ElementData.ts
  20. 14 14
      persagy-web-big-edit/src/types/Legend.ts
  21. 8 8
      persagy-web-big-edit/src/types/Marker.ts
  22. 7 7
      persagy-web-big-edit/src/types/Relation.ts
  23. 8 8
      persagy-web-big/src/factories/SItemFactory.ts
  24. 1 1
      persagy-web-big/src/items/SArrowItem.ts
  25. 7 7
      persagy-web-big/src/items/SIconTextItem.ts
  26. 19 19
      persagy-web-big/src/items/SLineItem.ts
  27. 27 27
      persagy-web-big/src/items/SPolygonItem.ts
  28. 23 23
      persagy-web-big/src/items/SPolylineItem.ts
  29. 4 4
      persagy-web-big/src/items/SRectSelectItem.ts
  30. 3 3
      persagy-web-big/src/items/floor/SBoardItem.ts
  31. 1 1
      persagy-web-big/src/items/floor/SColumnItem.ts
  32. 3 3
      persagy-web-big/src/items/floor/SDoorItem.ts
  33. 3 3
      persagy-web-big/src/items/floor/SHighlightItem.ts
  34. 3 3
      persagy-web-big/src/items/floor/SSpaceItem.ts
  35. 19 19
      persagy-web-big/src/items/floor/SSpaceItems.ts
  36. 4 4
      persagy-web-big/src/items/floor/SVirtualWallItem.ts
  37. 1 1
      persagy-web-big/src/items/floor/SWallItem.ts
  38. 3 3
      persagy-web-big/src/items/floor/SWallItems.ts
  39. 3 3
      persagy-web-big/src/items/floor/SWindowItem.ts
  40. 5 5
      persagy-web-big/src/items/floor/ZoneItem.ts
  41. 7 7
      persagy-web-big/src/parser/SFloorParser.ts
  42. 1 1
      persagy-web-big/src/parser/SParser.ts
  43. 4 4
      persagy-web-big/src/parser/STopologyParser.ts
  44. 2 2
      persagy-web-big/src/parser/SZoneParser.ts
  45. 10 10
      persagy-web-big/src/utils/SMathUtil.ts
  46. 5 5
      persagy-web-draw/src/SBrush.ts
  47. 29 29
      persagy-web-draw/src/SCanvasView.ts
  48. 13 13
      persagy-web-draw/src/SColor.ts
  49. 4 4
      persagy-web-draw/src/SFont.ts
  50. 4 4
      persagy-web-draw/src/SGradient.ts
  51. 1 1
      persagy-web-draw/src/SGradientStop.ts
  52. 4 4
      persagy-web-draw/src/SLinearGradient.ts
  53. 46 46
      persagy-web-draw/src/SPainter.ts
  54. 12 12
      persagy-web-draw/src/SPath.ts
  55. 4 4
      persagy-web-draw/src/SPen.ts
  56. 4 4
      persagy-web-draw/src/SRadialGradient.ts
  57. 4 4
      persagy-web-draw/src/SShadow.ts
  58. 30 30
      persagy-web-draw/src/engines/SCanvasPaintEngine.ts
  59. 21 21
      persagy-web-draw/src/engines/SPaintEngine.ts
  60. 1 1
      persagy-web-draw/src/engines/SPaintState.ts
  61. 18 18
      persagy-web-draw/src/engines/SSvgPaintEngine.ts
  62. 9 9
      persagy-web-draw/src/types/SLine.ts
  63. 10 10
      persagy-web-draw/src/types/SPoint.ts
  64. 19 19
      persagy-web-draw/src/types/SRect.ts
  65. 11 11
      persagy-web-draw/src/types/SSize.ts
  66. 2 2
      persagy-web-draw/src/utils/SPolygonUtil.ts
  67. 1 1
      persagy-web-edit/package.json
  68. 22 16
      persagy-web-edit/src/SGraphEdit.ts
  69. 95 83
      persagy-web-edit/src/SGraphEditScene.ts
  70. 14 16
      persagy-web-edit/src/commands/SGraphAddCommand.ts
  71. 4 4
      persagy-web-edit/src/commands/SGraphCommand.ts
  72. 20 21
      persagy-web-edit/src/commands/SGraphMoveCommand.ts
  73. 18 13
      persagy-web-edit/src/commands/SGraphPointListDelete.ts
  74. 15 13
      persagy-web-edit/src/commands/SGraphPointListInsert.ts
  75. 17 15
      persagy-web-edit/src/commands/SGraphPointListUpdate.ts
  76. 15 14
      persagy-web-edit/src/commands/SGraphPropertyCommand.ts
  77. 5 5
      persagy-web-edit/src/enums/SGraphLayoutType.ts
  78. 3 3
      persagy-web-edit/src/enums/SImageShowType.ts
  79. 5 5
      persagy-web-edit/src/enums/SLineStyle.ts
  80. 5 5
      persagy-web-edit/src/enums/SOrderSetType.ts
  81. 4 4
      persagy-web-edit/src/enums/STextOrigin.ts
  82. 2 0
      persagy-web-edit/src/index.ts
  83. 34 31
      persagy-web-edit/src/items/SBaseArrowEdit.ts
  84. 36 31
      persagy-web-edit/src/items/SBaseCircleEdit.ts
  85. 35 30
      persagy-web-edit/src/items/SBaseIconTextEdit.ts
  86. 60 38
      persagy-web-edit/src/items/SBaseImageEdit.ts
  87. 80 66
      persagy-web-edit/src/items/SBaseLineEdit.ts
  88. 97 74
      persagy-web-edit/src/items/SBasePolygonEdit.ts
  89. 108 82
      persagy-web-edit/src/items/SBasePolylineEdit.ts
  90. 328 306
      persagy-web-edit/src/items/SBaseRectEdit.ts
  91. 37 35
      persagy-web-edit/src/items/SBaseTextEdit.ts
  92. 311 294
      persagy-web-edit/src/items/SBaseTriangleEdit.ts
  93. 4 6
      persagy-web-edit/src/type/Anchor.ts
  94. 4 3
      persagy-web-edit/src/type/ElementData.ts
  95. 14 15
      persagy-web-edit/src/type/Legend.ts
  96. 8 8
      persagy-web-edit/src/type/Marker.ts
  97. 6 8
      persagy-web-edit/src/type/Relation.ts
  98. 18 18
      persagy-web-fengmap/src/parser/SFengParser.ts
  99. 34 34
      persagy-web-graph/src/SGraphItem.ts
  100. 0 0
      persagy-web-graph/src/SGraphScene.ts

+ 18 - 18
persagy-web-base/src/SMatrix.ts

@@ -59,35 +59,35 @@ export class SMatrix {
     set a(v: number) {
         this.m11 = v;
     } // Set a
-    /** x 轴方向斜切  */
+    /** x 轴方向斜切 */
     get b(): number {
         return this.m12;
     } // Get b
     set b(v: number) {
         this.m12 = v;
     } // Set b
-    /** y轴方向斜切  */
+    /** y轴方向斜切 */
     get c(): number {
         return this.m21;
     } // Get c
     set c(v: number) {
         this.m21 = v;
     } // Set c
-    /** y轴方向缩放比例    */
+    /** y轴方向缩放比例   */
     get d(): number {
         return this.m22;
     } // Get d
     set d(v: number) {
         this.m22 = v;
     } // Set d
-    /** x轴方向平移  */
+    /** x轴方向平移 */
     get e(): number {
         return this.m41;
     } // Get e
     set e(v: number) {
         this.m41 = v;
     } // Set e
-    /** y轴方向平移  */
+    /** y轴方向平移 */
     get f(): number {
         return this.m42;
     } // Get f
@@ -97,14 +97,14 @@ export class SMatrix {
 
     /**
      * 是否为 2D 矩阵
-     */
+    */
     get is2D(): boolean {
         return true;
     } // Get is2D
 
     /**
      * 是否为单位矩阵
-     */
+    */
     get isIdentity(): boolean {
         return (
             this.m11 == 1 &&
@@ -130,7 +130,7 @@ export class SMatrix {
      * 重置变换矩阵
      *
      * @return 返回自身
-     */
+    */
     reset(): SMatrix {
         this.m11 = 1;
         this.m21 = 0;
@@ -159,7 +159,7 @@ export class SMatrix {
      *
      * @param mat   给定的变换矩阵
      * @return 返回自身
-     */
+    */
     multiply(mat: SMatrix): SMatrix {
         [
             this.m11,
@@ -260,7 +260,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;
@@ -276,7 +276,7 @@ export class SMatrix {
      * @param sx    X 轴缩放比例
      * @param sy    Y 轴缩放比例
      * @return 返回自身
-     */
+    */
     scale(sx: number, sy: number): SMatrix {
         const mat = new SMatrix();
         mat.m11 = sx;
@@ -290,7 +290,7 @@ export class SMatrix {
      *
      * @param angle     绕 Z 轴旋转角度(单位角度度)
      * @return 返回自身
-     */
+    */
     rotate(angle: number): SMatrix;
 
     /**
@@ -300,7 +300,7 @@ export class SMatrix {
      * @param rotY  绕 X 轴旋转角度(单位角度 度)
      * @param rotZ  绕 X 轴旋转角度(单位角度 度)
      * @return 返回自身
-     */
+    */
     rotate(rotX: number, rotY: number, rotZ: number): SMatrix;
 
     /**
@@ -310,7 +310,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) {
@@ -348,7 +348,7 @@ export class SMatrix {
      * 转置当前矩阵
      *
      * @return 返回自身
-     */
+    */
     transpose(): SMatrix {
         [this.m12, this.m21] = [this.m21, this.m12];
         [this.m13, this.m31] = [this.m31, this.m13];
@@ -365,7 +365,7 @@ export class SMatrix {
      * 返回当前矩阵的逆矩阵
      *
      * @return 当前矩阵的逆矩阵
-     */
+    */
     inversed(): SMatrix {
         const detMat = this.det();
         const d = this.value();
@@ -396,7 +396,7 @@ export class SMatrix {
      * 返回当前矩阵的伴随矩阵
      *
      * @return 当前矩阵的伴随矩阵
-     */
+    */
     det(): SMatrix {
         const m = new SMatrix();
         m.m11 =
@@ -529,7 +529,7 @@ export class SMatrix {
      * 返回当前矩阵的值
      *
      * @return 当前矩阵的值
-     */
+    */
     value(): number {
         return (
             this.m11 *

+ 1 - 1
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;

+ 4 - 4
persagy-web-base/src/SObject.ts

@@ -36,7 +36,7 @@ export class SObject {
     name: string = "";
     /** 监听数组 */
     private listeners = {};
-    /** 对象id    */
+    /** 对象id   */
     id: string = "";
 
     /**
@@ -45,7 +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
@@ -71,7 +71,7 @@ export class SObject {
      *
      * @param name        信息名称
      * @param receiver    信号接收者
-     */
+    */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     disconnect(name: string, receiver: any): void {
         // @ts-ignore
@@ -99,7 +99,7 @@ export class SObject {
      *
      * @param name    事件名称
      * @param args    参数
-     */
+    */
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     $emit(name: string, ...args: any): void {
         // @ts-ignore

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

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

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

@@ -39,17 +39,17 @@ export abstract class SUndoCommand {
      * 构造函数
      *
      * @param  parent   指向父命令
-     */
+    */
     protected constructor(parent: SUndoCommand | null = null) {} // Constructor
 
     /**
      * undo回调
-     */
+    */
     abstract undo(): void;
 
     /**
      * redo回调
-     */
+    */
     abstract redo(): void;
 
     /**
@@ -57,21 +57,21 @@ 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()

+ 9 - 9
persagy-web-base/src/undo/SUndoStack.ts

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

+ 1 - 1
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;

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

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

+ 1 - 1
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[] = [

+ 1 - 1
persagy-web-base/src/utils/SUuid.ts

@@ -34,7 +34,7 @@ export class SUuid {
      *
      * @param len       要生成的 uuid 的长度
      * @param radix     生成 uuid 的基数
-     */
+    */
     static uuid(len: number, radix: number): string {
         const chars = "0123456789abcdef".split("");
         let uuid = [],

+ 37 - 31
persagy-web-big-edit/src/BigEditFactory.ts

@@ -24,20 +24,26 @@
  * *********************************************************************************************************************
  */
 
-import { SBaseLineEdit, SBaseTextEdit, SBaseImageEdit, SBaseRectEdit, SBasePolygonEdit, SBaseCircleEdit } from "./../edit";
-import { Marker, SBaseExpainEdit, SBaseArrow } from "./"
-import { SItemFactory } from "@persagy-web/big"
+import {
+    SBaseCircleEdit,
+    SBaseImageEdit,
+    SBaseLineEdit,
+    SBasePolygonEdit,
+    SBaseRectEdit,
+    SBaseTextEdit
+} from "./../edit";
+import {Marker, SBaseArrow, SBaseExpainEdit} from "./"
+import {SItemFactory} from "@persagy-web/big"
 
 /**
- * item创建工厂
+ * item 创建工厂
  *
- * @author han_yao_long@163.com
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class BigEditFactory extends SItemFactory {
     /**
      * 构造函数
-     *
-     * */
+     */
     constructor() {
         super()
     } // Constructor
@@ -45,9 +51,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础直线
      *
-     * @param   data    Marker数据
-     * @return  线item
-     * */
+     * @param data  数据
+     * @return  线
+     */
     createBaseLineEdit(data: Marker): SBaseLineEdit {
         return new SBaseLineEdit(null, data);
     } // Function createBaseLineEdit()
@@ -55,9 +61,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础文本
      *
-     * @param   data    Marker数据
-     * @return  文本item
-     * */
+     * @param data  数据
+     * @return  文本
+     */
     createBaseTextEdit(data: Marker): SBaseTextEdit {
         return new SBaseTextEdit(null, data);
     } // Function createBaseTextEdit()
@@ -65,9 +71,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础图片
      *
-     * @param   data    Marker数据
-     * @return  图片item
-     * */
+     * @param data  数据
+     * @return  图片
+     */
     createBaseImageEdit(data: Marker): SBaseImageEdit {
         return new SBaseImageEdit(null, data);
     } // Function createBaseImageEdit()
@@ -75,9 +81,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础矩形
      *
-     * @param   data    Marker数据
-     * @return  矩形item
-     * */
+     * @param data  数据
+     * @return  矩形
+     */
     createBaseRectEdit(data: Marker): SBaseRectEdit {
         return new SBaseRectEdit(null, data);
     } // Function createBaseRectEdit()
@@ -85,9 +91,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础圆
      *
-     * @param   data    Marker数据
-     * @return  圆item
-     * */
+     * @param data  数据
+     * @return  圆
+     */
     createBaseCircleEdit(data: Marker): SBaseCircleEdit {
         return new SBaseCircleEdit(null, data);
     } // Function createBaseRectEdit()
@@ -95,9 +101,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础注释
      *
-     * @param   data    Marker数据
-     * @return  注释item
-     * */
+     * @param data     数据
+     * @return  注释
+     */
     createBaseExpainEdit(data: Marker): SBaseExpainEdit {
         return new SBaseExpainEdit(null, data);
     } // Function createBaseExpainEdit()
@@ -105,9 +111,9 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础多边形
      *
-     * @param   data    Marker数据
-     * @return  注释item
-     * */
+     * @param data     数据
+     * @return  注释
+     */
     createBasePolygonEdit(data: Marker): SBasePolygonEdit {
         return new SBasePolygonEdit(null, data);
     } // Function createBasePolygonEdit()
@@ -115,11 +121,11 @@ export class BigEditFactory extends SItemFactory {
     /**
      * 创建基础基础箭头(折线)
      *
-     * @param   data    Marker数据
-     * @return  注释item
+     * @param data     数据
+     * @return  注释
      */
     createBaseArrow(data: Marker): SBaseArrow {
         return new SBaseArrow(null, data);
     } // Function createBasePolygonEdit()
 
-} // Class SItemFactory
+} // Class BigEditFactory

+ 69 - 68
persagy-web-big-edit/src/SBaseEditScene.ts

@@ -24,13 +24,13 @@
  * *********************************************************************************************************************
  */
 
-import { SGraphEditScene, SGraphAddCommand } from "../edit"
-import { SMouseEvent } from "@persagy-web/base/lib";
-import { SPoint, SFont, SColor, SRect, SArrowStyleType } from '@persagy-web/draw/lib';
-import { SRectSelectItem, SItemStatus } from '@persagy-web/big/lib';
-import { SGraphItem, SGraphSelectContainer } from "@persagy-web/graph/";
-import { uuid } from "./until";
-import { SBaseExpainEdit, SBaseArrow, SBaseEquipment, SBasePipeUninTool } from "./"
+import {SGraphAddCommand, SGraphEditScene} from "../edit"
+import {SMouseEvent} from "@persagy-web/base/lib";
+import {SArrowStyleType, SPoint, SRect} from '@persagy-web/draw/lib';
+import {SItemStatus, SRectSelectItem} from '@persagy-web/big/lib';
+import {SGraphItem, SGraphSelectContainer} from "@persagy-web/graph/";
+import {uuid} from "./until";
+import {SBaseArrow, SBaseEquipment, SBaseExpainEdit, SBasePipeUninTool} from "./"
 
 /**
  * big-edit 场景
@@ -38,34 +38,37 @@ import { SBaseExpainEdit, SBaseArrow, SBaseEquipment, SBasePipeUninTool } from "
  * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseEditScene extends SGraphEditScene {
-
-    /**图例节点 */
+    /** 图例节点 */
     Nodes: any = [];  // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
-    /**图例节点 */  // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
+    /** 图例节点 */  // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
     Markers: any = [];
-    /**  管线对象 */
+    /** 管线对象 */
     Relations: any = [];
+    /** 复制的对象 */
+    copyString: any[] = [];
 
-    copyString: any[] = []
-
+    /**
+     * 构造函数
+     *
+     */
     constructor() {
         super()
-    }
+    } // Constructor
 
     /**
      * 新增基础类注释
      *
-     * @param   event   鼠标事件参数
+     * @param event   鼠标事件参数
      */
     addExplainItem(event: SMouseEvent): void {
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础注释文本',
             /** 图标 */
             type: "Text",
-            /** 位置  */
+            /** 位置 */
             pos: { x: event.x, y: event.y },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "BaseExplain",
             },
@@ -77,7 +80,7 @@ export class SBaseEditScene extends SGraphEditScene {
                     backgroundcolor: "#f7f9facc",
                 }
             }
-        }
+        };
         const item = new SBaseExpainEdit(null, data);
         item.moveTo(event.x, event.y);
         item.selectable = true;
@@ -86,7 +89,7 @@ export class SBaseEditScene extends SGraphEditScene {
         this.undoStack.push(new SGraphAddCommand(this, item));
         this.grabItem = null;
         this.finishCreated(item);
-    }
+    } // Function addExplainItem()
 
     /**
      * 新增基础箭头(折线)
@@ -102,14 +105,13 @@ export class SBaseEditScene extends SGraphEditScene {
                 type: "BaseArrow",
             },
             style: {
-                outLine: [{ x: event.x, y: event.y }],
+                outLine: [{x: event.x, y: event.y}],
                 begin: SArrowStyleType.None,  //开端箭头样式
                 end: SArrowStyleType.None,    //结尾箭头样式
                 isMove: true,                 //是否可以移动
-                default: {
-                }
+                default: {}
             }
-        }
+        };
         const item = new SBaseArrow(null, data);
         item.status = SItemStatus.Create;
         item.selectable = true;
@@ -121,25 +123,25 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addPolyLineArrow()
 
     /**
-     * 添加基本设备item
+     * 添加基本设备 item
      *
-     * @param event 鼠标事件
+     * @param event     鼠标事件
      * @param legendObj 图例样式
      */
     addEuqipment(event: SMouseEvent, legendObj: any): void {
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础设备',
             num: 1,
             size: { width: 50, height: 50 },
-            /** 图标(Image),线类型(Line) */
+            /** 图标 (Image),线类型 (Line) */
             type: "Image",
-            /** 位置  */
+            /** 位置 */
             pos: { x: event.x, y: event.y },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "baseEquipment",
             },
@@ -165,10 +167,10 @@ export class SBaseEditScene extends SGraphEditScene {
     } // Function addEuqipment()
 
     /**
-    * 新增管道
-    *
-    * @param event 鼠标事件
-    */
+     * 新增管道
+     *
+     * @param event 鼠标事件
+     */
     addBasePipe(event: SMouseEvent) {
         const data = {
             name: '管道',
@@ -182,7 +184,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 default: {
                 }
             }
-        }
+        };
         const item = new SBasePipe(null, data);
         item.status = SItemStatus.Create;
         item.selectable = true;
@@ -194,13 +196,13 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addBasePipe()
 
     /**
      * 添加基本管道联通器
      *
-     * @param event 鼠标事件
-     * @param cmd 命令
+     * @param event     鼠标事件
+     * @param cmd       命令
      */
     addPipeUninTool(event: SMouseEvent, cmd: string): void {
         const cmdList = {
@@ -209,13 +211,13 @@ export class SBaseEditScene extends SGraphEditScene {
             'sitong': 4,
         }
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础管道接头',
-            /** 图标(Image),线类型(Line) */
+            /** 图标 (Image),线类型 (Line) */
             type: "Image",
-            /** 位置  */
+            /** 位置 */
             pos: { x: event.x, y: event.y },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "BasePipeUninTool",
             },
@@ -225,7 +227,7 @@ export class SBaseEditScene extends SGraphEditScene {
                     strokecolor: "#c0ccda",
                 }
             }
-        }
+        };
         const item = new SBasePipeUninTool(null, data);
         item.status = SItemStatus.Create;
         item.selectable = true;
@@ -238,12 +240,10 @@ export class SBaseEditScene extends SGraphEditScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addPipeUninTool()
 
     /**
      * 重做
-     *
-     * @return any
      */
     redo(): void {
         if (this.grabItem && this.grabItem.redo) {
@@ -251,12 +251,10 @@ export class SBaseEditScene extends SGraphEditScene {
         } else {
             this.undoStack.redo();
         }
-    }
+    } // Function redo()
 
     /**
      * 撤销
-     *
-     * @return any
      */
     undo(): void {
         if (this.grabItem && this.grabItem.undo) {
@@ -264,12 +262,12 @@ export class SBaseEditScene extends SGraphEditScene {
         } else {
             this.undoStack.undo();
         }
-    }
+    } // Function undo()
 
     /**
      * 删除
      *
-     * @return item[]
+     * @return 删除的图例
      */
     deleteItem(): any {
         if (this.selectContainer.count == 0) {
@@ -283,21 +281,22 @@ export class SBaseEditScene extends SGraphEditScene {
             this.view.update()
         }
         return itemList
-    }
+    } // Function deleteItem()
 
     /**
      * 框选
-     *
      */
     addRectSelect(event: SMouseEvent): void {
         let point = new SPoint(event.x, event.y);
         let rect = new SRectSelectItem(null, point);
         this.addItem(rect);
         this.grabItem = rect;
-    }
+    } // Function addRectSelect()
 
     /**
      * 计算框选交集
+     *
+     * @param ctrl  是否点击ctrl
      */
     groupSelect(ctrl: boolean) {
         // if (!ctrl) {
@@ -307,10 +306,13 @@ export class SBaseEditScene extends SGraphEditScene {
             const rect = this.grabItem.boundingRect();
             this.arrToSelect(this.root.children, rect)
         }
-    }
+    } // Function groupSelect()
 
     /**
      * 选中item:框选
+     *
+     * @param arr   实例数组
+     * @param rect  框选矩形区域
      */
     private arrToSelect(arr: SGraphItem[], rect: SRect) {
         if (Array.isArray(arr) && arr.length) {
@@ -326,7 +328,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 }
             })
         }
-    }
+    } // Function arrToSelect()
 
     /////////////////////////////////////////////////////////////////////
     // 鼠标事件
@@ -334,18 +336,18 @@ export class SBaseEditScene extends SGraphEditScene {
     /**
      * 鼠标左键按下
      *
-     * @param   event   鼠标事件参数
+     * @param event   鼠标事件参数
      */
     onMouseDown(event: SMouseEvent): any {
         if (!super.onMouseDown(event) && 1 == event.buttons) {
             this.addRectSelect(event);
         }
-    }
+    } // Function onMouseDown()
 
     /**
      * 鼠标抬起
      *
-     * @param   event   鼠标事件参数
+     * @param event   鼠标事件参数
      */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.grabItem) {
@@ -363,13 +365,12 @@ export class SBaseEditScene extends SGraphEditScene {
             return this.grabItem.onMouseUp(event);
         }
         return super.onMouseUp(event)
-    }
+    } // Function onMouseUp()
 
     /**
      * 复制
-     *
      */
-    copy() {
+    copy():void {
         const itemList = this.selectContainer.itemList
         if (itemList.length) {
             itemList.forEach(t => {
@@ -392,24 +393,24 @@ export class SBaseEditScene extends SGraphEditScene {
             console.log(input.value, Date.now());
             document.body.removeChild(input)
         }
-    }
+    } // Function copy()
 
     /**
      * 粘贴
-     *
      */
-    paste() {
+    paste(): void {
         const copyList = JSON.parse(JSON.stringify(this.copyString));
         copyList.forEach((t: any) => {
             if (this.view) {
                 t.Pos.X += 10,
                     t.Pos.Y += 10
             }
+
             t.moveable = true;
             console.log('t', t)
             this.addItem(t)
         });
         this.view ? this.view.update() : ''
         console.log(this.view)
-    }
-}
+    } // Function paste()
+} // Class SBaseEditScene

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

@@ -34,7 +34,7 @@ import { ItemOrder } from '@persagy-web/big/lib';
 /**
  * 编辑箭头(折线)
  *
- * @author  韩耀龙(han_yao_long#163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseArrow extends SBasePolylineEdit {
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -43,20 +43,28 @@ 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
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      数据
+     */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent, data);
         this.data = data;
@@ -65,12 +73,13 @@ 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
+
     /**
      * 鼠标按下事件
      *
-     * @param   event   保存事件参数
-     * @return  boolean
+     * @param event   保存事件参数
+     * @return  事件是否处理
      */
     onMouseDown(event: SMouseEvent): boolean {
         super.onMouseDown(event)
@@ -80,8 +89,8 @@ export class SBaseArrow extends SBasePolylineEdit {
     /**
      * 绘制基本图形
      *
-     * @param   painter painter对象
-     * */
+     * @param painter   绘制对象
+     */
     drawBaseLine(painter: SPainter): void {
         // 绘制基本图形
         if (this.lineStyle == SLineStyle.Dashed) {
@@ -95,6 +104,7 @@ export class SBaseArrow extends SBasePolylineEdit {
                 painter.toPx(this.lineWidth)
             ];
         }
+
         painter.pen.color = this.strokeColor;
         painter.drawArrowLine(this.pointList[0], this.pointList[1], {
             begin: this.begin,
@@ -112,13 +122,13 @@ export class SBaseArrow extends SBasePolylineEdit {
     } // Function drawBaseLine()
 
     /**
-    * 返回对象储存的相关数据
-    *
-    * @return	formData
-    */
+     * 返回对象储存的相关数据
+     *
+     * @return 对象储存的相关数据
+     */
     toData(): any {
         this.data.style.begin = this.begin;
         this.data.style.end = this.end;
-        return super.toData()
-    }
-}
+        return super.toData();
+    } // Function toData()
+} // Class SBaseArrow

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

@@ -33,19 +33,26 @@ import { SBaseImageEdit } from './../../edit';
 /**
  * 编辑基础设备类
  *
- * @author han_yao_long@163.com
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseEquipment extends SBaseImageEdit {
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      数据
+     */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent, data);
-    }
+    } // Constructor
 
     /**
-    * 返回对象储存的相关数据
-    *
-    * @return	formData
-    */
+     * 返回对象储存的相关数据
+     *
+     * @return	对象储存的相关数据
+     */
     toData(): any {
         return super.toData()
-    }
-} // Class SGraphSvgItem
+    } // Function toData
+} // Class SBaseEquipment

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

@@ -1,64 +1,69 @@
 /*
- * *********************************************************************************************************************
- *
- *          !!
- *        .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) 2016-2020.  博锐尚格科技股份有限公司
- *        ~8888'
- *        .!88~                                                                     All rights reserved.
- *
- * *********************************************************************************************************************
- */
+* *********************************************************************************************************************
+*
+*          !!
+*        .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) 2016-2020.  博锐尚格科技股份有限公司
+*        ~8888'
+*        .!88~                                                                     All rights reserved.
+*
+* *********************************************************************************************************************
+*/
 
-import { SColor, SFont } from "@persagy-web/draw/";
-import { SBaseTextEdit } from './../../edit';
-import { SGraphItem } from "@persagy-web/graph";
-import { Marker } from "./../types/Marker";
-import { SMouseEvent } from "@persagy-web/base/lib";
-import { ItemOrder } from '@persagy-web/big/lib';
+import {SBaseTextEdit} from './../../edit';
+import {SGraphItem} from "@persagy-web/graph";
+import {Marker} from "./../types/Marker";
+import {SMouseEvent} from "@persagy-web/base/lib";
 
 /**
- * 编辑基础注释类
- *
- * @author  韩耀龙(han_yao_long#163.com)
- */
-export class SBaseExpainEdit extends SBaseTextEdit {
-    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    //属性
-    constructor(parent: SGraphItem | null, data: Marker) {
-        super(parent, data);
-    }
-    /**
-     * 鼠标按下事件
-     *
-     * @param   event   保存事件参数
-     * @return  boolean
-     */
-    onMouseDown(event: SMouseEvent): boolean {
-        super.onMouseDown(event)
-        return true;
-    } // Function onMouseDown()
+  * 编辑基础注释类
+  *
+  * @author 韩耀龙 <han_yao_long@163.com>
+  */
+ export class SBaseExpainEdit extends SBaseTextEdit {
+     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+     //属性
+     /**
+      * 构造函数
+      *
+      * @param parent    指向父对象
+      * @param data      数据
+      */
+     constructor(parent: SGraphItem | null, data: Marker) {
+         super(parent, data);
+     } // Constructor
 
-    /**
-    * 返回对象储存的相关数据
-    *
-    * @return	formData
-    */
-    toData(): any {
-        return super.toData()
-    }
-}
+     /**
+      * 鼠标按下事件
+      *
+      * @param event   保存事件参数
+      * @return 是否处理该事件
+      */
+     onMouseDown(event: SMouseEvent): boolean {
+         super.onMouseDown(event);
+         return true;
+     } // Function onMouseDown()
+
+     /**
+      * 返回对象储存的相关数据
+      *
+      * @return 相关数据
+      */
+     toData(): any {
+         return super.toData()
+     } // Function toData()
+ } // Class SBaseExpainEdit

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

@@ -24,41 +24,46 @@
  * *********************************************************************************************************************
  */
 
-import { SColor, SFont } from "@persagy-web/draw/";
-import { SBasePolylineEdit } from './../../edit';
-import { SGraphItem } from "@persagy-web/graph";
-import { Marker } from "./../types/Marker";
-import { SMouseEvent } from "@persagy-web/base/lib";
-import { ItemOrder } from '@persagy-web/big/lib';
+import {SBasePolylineEdit} from './../../edit';
+import {SGraphItem} from "@persagy-web/graph";
+import {Marker} from "./../types/Marker";
+import {SMouseEvent} from "@persagy-web/base/lib";
 
 /**
  * 编辑基础管道
  *
- * @author  韩耀龙(han_yao_long#163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBasePipe extends SBasePolylineEdit {
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      数据
+     */
     constructor(parent: SGraphItem | null, data: Marker) {
-        super(parent,data);
-    }
+        super(parent, data);
+    } // Constructor
+
     /**
      * 鼠标按下事件
      *
-     * @param   event   保存事件参数
-     * @return  boolean
+     * @param event   保存事件参数
+     * @return 是否处理该事件
      */
     onMouseDown(event: SMouseEvent): boolean {
-        super.onMouseDown(event)
+        super.onMouseDown(event);
         return true;
     } // Function onMouseDown()
 
     /**
-    * 返回对象储存的相关数据
-    *
-    * @return	formData
-    */
+     * 返回对象储存的相关数据
+     *
+     * @return 相关数据
+     */
     toData(): any {
         return super.toData()
-    }
-}
+    } // Function toData()
+} // Class SBasePipe

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

@@ -24,58 +24,62 @@
  * *********************************************************************************************************************
  */
 
-import { SColor, SFont } from "@persagy-web/draw/";
-import { SBaseImageEdit } from './../../edit';
-import { SGraphItem } from "@persagy-web/graph";
-import { Marker } from "./../types/Marker";
-import { SMouseEvent } from "@persagy-web/base/lib";
-import { ItemOrder } from '@persagy-web/big/lib';
+import {SBaseImageEdit} from './../../edit';
+import {SGraphItem} from "@persagy-web/graph";
+import {Marker} from "./../types/Marker";
+import {SMouseEvent} from "@persagy-web/base/lib";
 
 /**
  * 编辑基础管道接头类
  *
- * @author  韩耀龙(han_yao_long#163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
-
 export class SBasePipeUninTool extends SBaseImageEdit {
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      数据
+     */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent, data);
         if (data && data.style) {
             switch (data.style.uninToolType) {
                 case 2:
                     this.url = require('./../../../../assets/images/leftImgs/wantou.png');
-                    break
+                    break;
                 case 3:
                     this.url = require('./../../../../assets/images/leftImgs/santong.png');
-                    break
+                    break;
                 case 4:
                     this.url = require('./../../../../assets/images/leftImgs/sitong.png');
-                    break
+                    break;
                 default:
                     this.url = require('./../../../../assets/images/leftImgs/wantou.png');
-                    break
+                    break;
             }
         }
-    }
+    } // Constructor
+
     /**
      * 鼠标按下事件
      *
-     * @param   event   保存事件参数
-     * @return  boolean
+     * @param event   保存事件参数
+     * @return 是否处理该事件
      */
     onMouseDown(event: SMouseEvent): boolean {
-        super.onMouseDown(event)
+        super.onMouseDown(event);
         return true;
     } // Function onMouseDown()
 
     /**
-    * 返回对象储存的相关数据
-    *
-    * @return	formData
-    */
+     * 返回对象储存的相关数据
+     *
+     * @return 相关数据
+     */
     toData(): any {
         return super.toData()
-    }
-}
+    } // Function toData()
+} // Class SBasePipeUninTool

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

@@ -27,13 +27,13 @@
 import { Point } from "@persagy-web/big/lib/types/Point";
 
 /**
- * 锚点item接口
+ * 锚点 item 接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Anchor {
-    /** 锚点ID */
+    /** 锚点 ID */
     ID: string;
-    /** 锚点的坐标  */
+    /** 锚点的坐标 */
     Pos: Point;
 } // Interface Anchor

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

@@ -31,10 +31,13 @@ import { Relation } from "./Relation";
 /**
  * 系统图数据接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface ElementData {
-    nodes: Legend[];
-    markers: Marker[];
-    relations: Relation[];
+    /** 在数据中台有数据的节点 */
+    Nodes: Legend[];
+    /** 说明型节点 */
+s: Marker[];
+    /** 关系类节点 */
+    Relations: Relation[];
 } // Interface ElementData

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

@@ -32,37 +32,37 @@ import { SPoint } from '@persagy-web/draw/lib';
 /**
  * 图例节点接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Legend {
     /** ID */
     ID: string;
-    /** 名称  */
+    /** 名称 */
     Name: string;
     /** 返回工程信息化对象 ID 列表 */
     AttachObjectIds?: any[];
-    /** 图标,区域类型  */
+    /** 图标,区域类型 */
     GraphElementType: string;
-    /** 对应的图例ID  */
+    /** 对应的图例 ID */
     GraphElementId: string;
-    /** 图例数量  */
+    /** 图例数量 */
     Num?: number;
-    /** 位置  */
+    /** 位置 */
     Pos: Point;
-    /** item类型 */
+    /** item 类型 */
     Type: string
-    /** 缩放  */
+    /** 缩放 */
     Scale?: Point;
-    /** 旋转  */
+    /** 旋转 */
     Rolate?: Point;
-    /** 大小  */
+    /** 大小 */
     Size?: Size;
-    /** 锚点List  */
+    /** 锚点 List */
     AnchorList?: Anchor[];
-    /** 轮廓线  */
+    /** 轮廓线 */
     OutLine?: Point[] | SPoint[];
-    /** 由应用自己定义  */
+    /** 由应用自己定义 */
     Properties?: any;
-     /** zone 区分防火分区和石材铺装  */
+     /** zone 区分防火分区和石材铺装 */
     SubType?:string
 } // Interface Legend

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

@@ -30,25 +30,25 @@ import { Size } from "@persagy-web/big/lib/types/Size";
 /**
  * 标识对象接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Marker {
     /** ID */
     iD?: string;
-    /** 名称  */
+    /** 名称 */
     name: string;
-    /** 图标(Image),线类型(Line) */
+    /** 图标 (Image),线类型 (Line) */
     type: string;
-    /** 位置  */
+    /** 位置 */
     pos: Point;
-    /** 缩放  */
+    /** 缩放 */
     scale?: Point;
-    /** 旋转  */
+    /** 旋转 */
     rolate?: Point;
-    /** 大小  */
+    /** 大小 */
     size?: Size;
     /** 绘制时得数据以及样式 */
     style: any;
-    /** 由应用自己定义  */
+    /** 由应用自己定义 */
     properties?: any;
 } // Interface Marker

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

@@ -30,24 +30,24 @@ import { Point } from "@persagy-web/big/lib/types/Point";
 /**
  * 管线对象关系接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Relation {
     /** ID */
     ID: string;
     /** 名称 */
     Name: string;
-    /** 对应的图例ID */
+    /** 对应的图例 ID */
     GraphElementId: string;
-    /** 关联节点1_id */
+    /** 关联节点 1_id */
     Node1ID?: string;
-    /** 关联节点2_id */
+    /** 关联节点 2_id */
     Node2ID?: string;
-    /** 关联锚点1_id  */
+    /** 关联锚点 1_id */
     Anchor1ID?: string;
-    /** 关联锚点2_id */
+    /** 关联锚点 2_id */
     Anchor2ID?: string;
-    /** 方向(0:无向,1:节点1到节点2,2:节点2到节点1) */
+    /** 方向(0:无向,1:节点 1 到节点2,2:节点 2 到节点 1) */
     Dir?: SRelationDir;
     /** 线类型(0:直线,1:水平/垂直线,2:曲线) */
     LineType: string;

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

@@ -47,7 +47,7 @@ import { Zone } from "../types/floor/Zone";
 export class SItemFactory {
     /**
      * 构造函数
-     */
+    */
     constructor() {} // Constructor
 
     /**
@@ -55,7 +55,7 @@ export class SItemFactory {
      *
      * @param data    柱子数据
      * @return 柱子 item
-     */
+    */
     createColumn(data: Column): SColumnItem {
         return new SColumnItem(null, data);
     } // Function createColumn()
@@ -65,7 +65,7 @@ export class SItemFactory {
      *
      * @param data    墙数据
      * @return 墙 item
-     */
+    */
     createWall(data: Wall): SWallItem {
         return new SWallItem(null, data);
     } // Function createWall()
@@ -75,7 +75,7 @@ export class SItemFactory {
      *
      * @param data    虚拟墙数据
      * @return 虚拟墙 item
-     */
+    */
     createVirtualWall(data: VirtualWall): SVirtualWallItem {
         return new SVirtualWallItem(null, data);
     } // Function createVirtualWall()
@@ -85,7 +85,7 @@ export class SItemFactory {
      *
      * @param data    空间数据
      * @return 空间 item
-     */
+    */
     createSpace(data: Space): SSpaceItem {
         return new SSpaceItem(null, data);
     } // Function createSpace()
@@ -95,7 +95,7 @@ export class SItemFactory {
      *
      * @param data    门数据
      * @return 门item
-     */
+    */
     createDoor(data: Door): SDoorItem {
         return new SDoorItem(null, data);
     } // Function createDoor()
@@ -105,7 +105,7 @@ export class SItemFactory {
      *
      * @param data    窗户数据
      * @return 窗户 item
-     */
+    */
     createWindow(data: Casement): SWindowItem {
         return new SWindowItem(null, data);
     } // Function createWindow()
@@ -115,7 +115,7 @@ export class SItemFactory {
      *
      * @param data    业务空间数据
      * @return 业务空间 item
-     */
+    */
     createZone(data: Zone): SZoneItem {
         return new SZoneItem(null, data);
     } // Function createZone()

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

@@ -58,7 +58,7 @@ export class SArrowItem extends SPolylineItem {
      * 绘制基本图形
      *
      * @param painter   绘制对象
-     */
+    */
     drawBaseLine(painter: SPainter): void {
         // 绘制基本图形
         if (this.lineStyle == SLineStyle.Dashed) {

+ 7 - 7
persagy-web-big/src/items/SIconTextItem.ts

@@ -236,7 +236,7 @@ export class SIconTextItem extends SObjectItem {
      *
      * @param parent  父类
      * @param data    锚点数据
-     */
+    */
     constructor(parent: SGraphItem | null, data?: Anchor[]) {
         super(parent);
         this.img.width = 32;
@@ -289,7 +289,7 @@ export class SIconTextItem extends SObjectItem {
 
     /**
      * 计算并移动锚点的位置
-     */
+    */
     private changeAnchorPoint(): void {
         // 判断是否有锚点
         if (this.anchorList.length) {
@@ -314,7 +314,7 @@ export class SIconTextItem extends SObjectItem {
      *
      * @param event   事件对象
      * @return 是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
             return super.onMouseDown(event);
@@ -329,7 +329,7 @@ export class SIconTextItem extends SObjectItem {
      *
      * @param oldSize 改之前的大小
      * @param newSize 改之后大小
-     */
+    */
     onResize(oldSize: SSize, newSize: SSize): void {
         console.log(arguments);
     } // Function onResize()
@@ -339,7 +339,7 @@ export class SIconTextItem extends SObjectItem {
      *
      * @param event   鼠标事件
      * @return 是否处理事件
-     */
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         // 如果位show状态 双击改对象则需改为编辑状态
         if (SItemStatus.Normal == this.status) {
@@ -357,7 +357,7 @@ export class SIconTextItem extends SObjectItem {
      * Item 对象边界区域
      *
      * @return 边界矩阵
-     */
+    */
     boundingRect(): SRect {
         let rect = this.img
             .boundingRect()
@@ -377,7 +377,7 @@ export class SIconTextItem extends SObjectItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         if (this.status == SItemStatus.Edit) {
             painter.pen.lineWidth = painter.toPx(1);

+ 19 - 19
persagy-web-big/src/items/SLineItem.ts

@@ -140,7 +140,7 @@ export class SLineItem extends SGraphItem {
      * 构造函数
      *
      * @param parent  父级
-     */
+    */
     constructor(parent: SGraphItem | null);
 
     /**
@@ -148,7 +148,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent  父级
      * @param line    坐标集合
-     */
+    */
     constructor(parent: SGraphItem | null, line: SPoint[]);
 
     /**
@@ -156,7 +156,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent  父级
      * @param point   第一个点坐标
-     */
+    */
     constructor(parent: SGraphItem | null, point: SPoint);
 
     /**
@@ -164,7 +164,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param parent    父级
      * @param line      坐标集合|第一个点坐标
-     */
+    */
     constructor(parent: SGraphItem | null, line?: SPoint | SPoint[]) {
         super(parent);
         if (line) {
@@ -182,7 +182,7 @@ export class SLineItem extends SGraphItem {
      * 添加点至数组中
      *
      * @param p 添加的点
-     */
+    */
     private addPoint(p: SPoint): void {
         if (this.line.length < 2) {
             this.line.push(p);
@@ -202,7 +202,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
             this.status = SItemStatus.Edit;
@@ -220,7 +220,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
@@ -247,7 +247,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (this.curIndex > -1) {
@@ -277,7 +277,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -304,7 +304,7 @@ export class SLineItem extends SGraphItem {
      * 获取点击点与 Point[] 中的点距离最近点
      *
      * @param p     鼠标点击点
-     */
+    */
     findNearestPoint(p: SPoint): void {
         let len = this.sceneDis;
         for (let i = 0; i < this.line.length; i++) {
@@ -327,7 +327,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param SGraphCommand 相关命令类
      * @param any           对应传入参数
-     */
+    */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中 todo
         const command = new SGraphCommand(this.scene, this, ...any);
@@ -339,7 +339,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param x     x 坐标
      * @param y     y 坐标
-     */
+    */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.line = this.line.map(t => {
@@ -356,7 +356,7 @@ export class SLineItem extends SGraphItem {
      *
      * @param event     事件
      * @return 处理后的事件对象
-     */
+    */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.line.length) {
             let last = new SPoint(event.x, event.y);
@@ -387,7 +387,7 @@ export class SLineItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否包含
-     */
+    */
     contains(x: number, y: number): boolean {
         if (this.line.length == 2) {
             let p = new SPoint(x, y);
@@ -404,7 +404,7 @@ export class SLineItem extends SGraphItem {
 
     /**
      * 撤销操作
-     */
+    */
     undo(): void {
         if (this.status != SItemStatus.Normal) {
             this.undoStack.undo();
@@ -413,7 +413,7 @@ export class SLineItem extends SGraphItem {
 
     /**
      * 重做操作
-     */
+    */
     redo(): void {
         if (this.status != SItemStatus.Normal) {
             this.undoStack.redo();
@@ -422,7 +422,7 @@ export class SLineItem extends SGraphItem {
 
     /**
      * 取消操作 item 事件
-     */
+    */
     cancelOperate(): void {
         if (this.status == SItemStatus.Create) {
             this.parent = null;
@@ -437,7 +437,7 @@ export class SLineItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 边界区域
-     */
+    */
     boundingRect(): SRect {
         if (this.line.length) {
             this.minX = this.line[0].x;
@@ -474,7 +474,7 @@ export class SLineItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         this.sceneDis = painter.toPx(this.dis);
         painter.pen.lineWidth = painter.toPx(this.lineWidth);

+ 27 - 27
persagy-web-big/src/items/SPolygonItem.ts

@@ -82,7 +82,7 @@ export class SPolygonItem extends SGraphItem {
 
     /** 边框颜色 */
     _strokeColor: SColor = new SColor("#0091FF");
-    /**  画笔颜色 */
+    /** 画笔颜色 */
     get strokeColor(): SColor {
         return this._strokeColor;
     } // Get strokeColor
@@ -142,7 +142,7 @@ export class SPolygonItem extends SGraphItem {
      * 构造函数
      *
      * @param parent    指向父对象
-     */
+    */
     constructor(parent: SGraphItem | null) {
         super(parent);
     } // Constructor
@@ -157,7 +157,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) {
@@ -174,7 +174,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param i   删除点所在的索引
      * @return 索引不在数组范围则返回 null
-     */
+    */
     deletePoint(i: number | null = null): SPoint | null {
         let point = null;
         if (i != null) {
@@ -205,7 +205,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) {
@@ -229,7 +229,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
-     */
+    */
     protected drawShowPolygon(painter: SPainter, pointList: SPoint[]): void {
         painter.save();
         painter.pen.lineCapStyle = SLineCapStyle.Square;
@@ -266,7 +266,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
-     */
+    */
     protected drawCreatePolygon(painter: SPainter, pointList: SPoint[]): void {
         painter.pen.lineCapStyle = SLineCapStyle.Square;
         painter.pen.color = this.strokeColor;
@@ -323,7 +323,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param painter       绘制类
      * @param pointList    绘制多边形数组
-     */
+    */
     protected drawEditPolygon(painter: SPainter, pointList: SPoint[]): void {
         // 展示多边形
         painter.pen.lineCapStyle = SLineCapStyle.Square;
@@ -348,7 +348,7 @@ export class SPolygonItem extends SGraphItem {
      * 编辑状态操作多边形数组
      *
      * @param event    鼠标事件
-     */
+    */
     protected editPolygonPoint(event: SMouseEvent): void {
         //  判断是否为删除状态 isAlt = true为删除状态
         if (this.isAlt) {
@@ -467,7 +467,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param	SGraphCommand   相关命令类
      * @param	any             对应传入参数
-     */
+    */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
         const sgraphcommand = new SGraphCommand(this.scene, this, ...any);
@@ -476,7 +476,7 @@ export class SPolygonItem extends SGraphItem {
 
     /**
      * 执行取消操作执行
-     */
+    */
     undo(): void {
         if (this.status == SItemStatus.Normal) {
             return;
@@ -486,7 +486,7 @@ export class SPolygonItem extends SGraphItem {
 
     /**
      * 执行重做操作执行
-     */
+    */
     redo(): void {
         if (this.status == SItemStatus.Normal) {
             return;
@@ -502,7 +502,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event   事件参数
      * @return 是否处理
-     */
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         // 如果位show状态 双击改对象则需改为编辑状态
         if (SItemStatus.Normal == this.status) {
@@ -522,7 +522,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
 
     onKeyDown(event: KeyboardEvent): boolean {
         if (this.status == SItemStatus.Normal) {
@@ -553,7 +553,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onKeyUp(event: KeyboardEvent): void {
         if (this.status == SItemStatus.Edit) {
             if (event.key == "Alt") {
@@ -574,7 +574,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -620,7 +620,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onMouseEnter(event: SMouseEvent): boolean {
         return true;
     } // Function onMouseEnter()
@@ -630,7 +630,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onMouseLeave(event: SMouseEvent): boolean {
         return true;
     } // Function onMouseLeave()
@@ -640,7 +640,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -672,7 +672,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件
      * @return 处理后的事件
-     */
+    */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -701,7 +701,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (-1 != this.curIndex) {
@@ -729,7 +729,7 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param x   x 坐标
      * @param y   y 坐标
-     */
+    */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.pointList = this.pointList.map(t => {
@@ -746,14 +746,14 @@ export class SPolygonItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onResize(event: SMouseEvent): boolean {
         return true;
     } // Function onResize()
 
     /**
      * 取消操作
-     */
+    */
     cancelOperate(): void {
         // 当状态为展示状态
         if (this.status == SItemStatus.Create) {
@@ -771,7 +771,7 @@ export class SPolygonItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 边界区域
-     */
+    */
     boundingRect(): SRect {
         if (this.pointList.length) {
             this.minX = this.pointList[0].x;
@@ -814,7 +814,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)) {
@@ -828,7 +828,7 @@ export class SPolygonItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         this.scenceLen = painter.toPx(this.len);
         // 当状态为展示状态

+ 23 - 23
persagy-web-big/src/items/SPolylineItem.ts

@@ -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) {
@@ -152,7 +152,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param p         添加的点
      * @param index     添加到的索引
-     */
+    */
     private addPoint(p: SPoint, index?: number): void {
         if (index && this.canHandle(index)) {
             this.pointList.splice(index, 0, p);
@@ -174,7 +174,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param index     要添加到的索引
      * @return 是否可添加
-     */
+    */
     private canHandle(index: number): boolean {
         return index >= 0 && index <= this.pointList.length;
     } // Function canHandle()
@@ -183,7 +183,7 @@ export class SPolylineItem extends SGraphItem {
      * 根据索引删除点
      *
      * @param index     删除点
-     */
+    */
     deletePoint(index: number): void {
         if (this.canHandle(index) && this.pointList.length > 2) {
             const p = new SPoint(
@@ -207,7 +207,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
@@ -247,7 +247,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-     */
+    */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
@@ -283,7 +283,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param event     鼠标事件
      * @return 是否处理事件
-     */
+    */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (this.curIndex > -1) {
@@ -311,7 +311,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param event     事件参数
      * @return 是否处理
-     */
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
             this.status = SItemStatus.Edit;
@@ -335,7 +335,7 @@ export class SPolylineItem extends SGraphItem {
      * 键盘按键弹起事件
      *
      * @param event     事件参数
-     */
+    */
     onKeyUp(event: KeyboardEvent): void {
         if (event.keyCode == SKeyCode.Enter) {
             if (this.pointList.length > 1) {
@@ -362,7 +362,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param x     x 坐标
      * @param y     y 坐标
-     */
+    */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.pointList = this.pointList.map(t => {
@@ -378,7 +378,7 @@ export class SPolylineItem extends SGraphItem {
      * 获取点击点与点集中距离最近点
      *
      * @param p     鼠标点击点
-     */
+    */
     findNearestPoint(p: SPoint): void {
         let len = this.sceneDis;
         for (let i = 0; i < this.pointList.length; i++) {
@@ -403,7 +403,7 @@ export class SPolylineItem extends SGraphItem {
      * 计算增加点的位置
      *
      * @param p     鼠标点击点
-     */
+    */
     findAddPos(p: SPoint): void {
         let len = SMathUtil.pointToLine(
                 p,
@@ -433,7 +433,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param event     事件
      * @return 事件对象
-     */
+    */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -462,7 +462,7 @@ export class SPolylineItem extends SGraphItem {
      *
      * @param SGraphCommand     相关命令类
      * @param any               对应传入参数
-     */
+    */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
         const command = new SGraphCommand(this.scene, this, ...any);
@@ -473,7 +473,7 @@ export class SPolylineItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 外接矩阵
-     */
+    */
     boundingRect(): SRect {
         if (this.pointList.length) {
             this.minX = this.pointList[0].x;
@@ -515,7 +515,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++) {
@@ -537,7 +537,7 @@ export class SPolylineItem extends SGraphItem {
 
     /**
      * 撤销操作
-     */
+    */
     undo(): void {
         if (this._status != SItemStatus.Normal) {
             this.undoStack.undo();
@@ -546,7 +546,7 @@ export class SPolylineItem extends SGraphItem {
 
     /**
      * 重做操作
-     */
+    */
     redo(): void {
         if (this._status != SItemStatus.Normal) {
             this.undoStack.redo();
@@ -555,7 +555,7 @@ export class SPolylineItem extends SGraphItem {
 
     /**
      * 取消操作执行
-     */
+    */
     cancelOperate(): void {
         if (this.status == SItemStatus.Create) {
             this.parent = null;
@@ -570,7 +570,7 @@ export class SPolylineItem extends SGraphItem {
      * 绘制基本图形
      *
      * @param painter   绘制对象
-     */
+    */
     drawBaseLine(painter: SPainter): void {
         // 绘制基本图形
         if (this.lineStyle == SLineStyle.Dashed) {
@@ -593,7 +593,7 @@ export class SPolylineItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         // 缓存场景长度
         this.sceneDis = painter.toPx(this.dis);

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

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

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

@@ -47,7 +47,7 @@ export class SBoardItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      建筑轮廓数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Zone) {
         super(parent);
         this.data = data;
@@ -83,7 +83,7 @@ export class SBoardItem extends SGraphItem {
      * @param x     x 坐标
      * @param y     y 坐标
      * @return 是否在区域内
-     */
+    */
     contains(x: number, y: number): boolean {
         return false;
     } // Function contains()
@@ -92,7 +92,7 @@ export class SBoardItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   painter 对象
-     */
+    */
     onDraw(painter: SPainter): void {
         painter.pen.lineWidth = painter.toPx(1);
         painter.brush.color = ItemColor.spaceColor;

+ 1 - 1
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: {

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

@@ -62,7 +62,7 @@ export class SDoorItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      门数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Door) {
         super(parent);
         this.data = data;
@@ -128,7 +128,7 @@ export class SDoorItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 边界矩形
-     */
+    */
     boundingRect(): SRect {
         return new SRect(0, 0, this.r, this.r);
     } // Function boundingRect()
@@ -137,7 +137,7 @@ export class SDoorItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         painter.translate(this.p.x, this.p.y);
         painter.rotate(this.ang);

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

@@ -65,7 +65,7 @@ export class SHighlightItem extends SGraphItem {
      * 构造函数
      *
      * @param parent  指向父对象
-     */
+    */
     constructor(parent: SGraphItem | null) {
         super(parent);
         this.visible = false;
@@ -76,7 +76,7 @@ export class SHighlightItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return	边界矩形
-     */
+    */
     boundingRect(): SRect {
         return new SRect(this.point.x, this.point.y, 10, 10);
     } // Function boundingRect()
@@ -85,7 +85,7 @@ export class SHighlightItem extends SGraphItem {
      * Item绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         if (this.type == 2) {
             painter.pen.color = ItemColor.highLightLineColor;

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

@@ -96,7 +96,7 @@ export class SSpaceItem extends SGraphAreaGroupItem {
      *
      * @param parent    指向父对象
      * @param data      空间数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Space) {
         super(parent, {
             outline: [
@@ -139,7 +139,7 @@ export class SSpaceItem extends SGraphAreaGroupItem {
      * 绘制前设置绘制样式
      *
      * @return 当前状态
-     */
+    */
     setStyle(): string {
         let status = "default";
         if (this.style) {
@@ -160,7 +160,7 @@ export class SSpaceItem extends SGraphAreaGroupItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         super.onDraw(painter);
         if (this.showBaseName) {

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

@@ -43,21 +43,21 @@ import { SGraphItem } from "@persagy-web/graph";
  * @deprecated 万达
  */
 export class SSpaceItems extends SGraphItem {
-    /** 空间所有数据  */
+    /** 空间所有数据 */
     data: Space;
-    /** 空间轮廓线坐标list  */
+    /** 空间轮廓线坐标list */
     readonly pointArr: SPoint[][] = [];
-    /** X坐标最小值  */
+    /** X坐标最小值 */
     minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值  */
+    /** X坐标最大值 */
     maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值  */
+    /** Y坐标最小值 */
     minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值  */
+    /** Y坐标最大值 */
     maxY = Number.MIN_SAFE_INTEGER;
-    /** path对象      */
+    /** path对象     */
     // private path = new SPath2D();
-    /** 高亮状态    */
+    /** 高亮状态   */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
         return this._highLightFlag;
@@ -66,7 +66,7 @@ export class SSpaceItems extends SGraphItem {
         this._highLightFlag = value;
         this.update();
     } // Set highLightFlag
-    /** 是否显示名字  */
+    /** 是否显示名字 */
     private _showBaseName: boolean = false;
     get showBaseName(): boolean {
         return this._showBaseName;
@@ -75,7 +75,7 @@ export class SSpaceItems extends SGraphItem {
         this._showBaseName = value;
         this.update();
     } // Set showBaseName
-    /** 是否名字大小  */
+    /** 是否名字大小 */
     private _nameSize: number = 10;
     get nameSize(): number {
         return this._nameSize;
@@ -84,7 +84,7 @@ export class SSpaceItems extends SGraphItem {
         this._nameSize = value;
         this.update();
     } // Set nameSize
-    /** 名字是否缩放  */
+    /** 名字是否缩放 */
     private _nameTransform: boolean = false;
     get nameTransform(): boolean {
         return this._nameTransform;
@@ -93,7 +93,7 @@ export class SSpaceItems extends SGraphItem {
         this._nameTransform = value;
         this.update();
     } // Set nameTransform
-    /** 名字颜色    */
+    /** 名字颜色   */
     private _nameColor: string = "#000000";
     get nameColor(): string {
         return this._nameColor;
@@ -108,7 +108,7 @@ export class SSpaceItems extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      空间数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Space) {
         super(parent);
         this.data = data;
@@ -150,7 +150,7 @@ export class SSpaceItems extends SGraphItem {
      * Item对象边界区域
      *
      * @return SRect
-     */
+    */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -165,7 +165,7 @@ export class SSpaceItems extends SGraphItem {
     //  *
     //  * @param	event         事件参数
     //  * @return	boolean
-    //  */
+    // */
     // onMouseDown(event: SMouseEvent): boolean {
     //     console.log("spaceDown");
     //     this.$emit("click", event);
@@ -176,7 +176,7 @@ export class SSpaceItems extends SGraphItem {
     //  * 鼠标移动事件
     //  *
     //  * @param event 事件参数
-    //  */
+    // */
     // onMouseMove(event: SMouseEvent): boolean {
     //     return false;
     // } // Function onMouseMove()
@@ -186,7 +186,7 @@ export class SSpaceItems extends SGraphItem {
     //  *
     //  * @param	event         事件参数
     //  * @return	boolean
-    //  */
+    // */
     // onMouseUp(event: SMouseEvent): boolean {
     //     console.log("spaceUp");
     //     return false;
@@ -197,7 +197,7 @@ export class SSpaceItems extends SGraphItem {
      *
      * @param x
      * @param y
-     */
+    */
     contains(x: number, y: number): boolean {
         let arr = this.pointArr;
         if (arr.length < 1 || !SPolygonUtil.pointIn(x, y, arr[0])) {
@@ -216,7 +216,7 @@ export class SSpaceItems extends SGraphItem {
      * Item绘制操作
      *
      * @param painter    绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         painter.pen.color = ItemColor.spaceBorderColor;
         if (this.selected) {

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

@@ -53,7 +53,7 @@ export class SVirtualWallItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      虚拟墙数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: VirtualWall) {
         super(parent);
         this.data = data;
@@ -92,7 +92,7 @@ export class SVirtualWallItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 边界矩形
-     */
+    */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -105,8 +105,8 @@ export class SVirtualWallItem extends SGraphItem {
     /**
      * Item 绘制操作
      *
-     * @param painter   painter对象
-     */
+     * @param painter   绘制对象
+    */
     onDraw(painter: SPainter): void {
         painter.pen.lineWidth = painter.toPx(1);
         painter.pen.color = ItemColor.virtualWallColor;

+ 1 - 1
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: {

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

@@ -58,7 +58,7 @@ export class SWallItems extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      墙数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Wall) {
         super(parent);
         this.data = data;
@@ -127,7 +127,7 @@ export class SWallItems extends SGraphItem {
      * Item对象边界区域
      *
      * @return SRect
-     */
+    */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -141,7 +141,7 @@ export class SWallItems extends SGraphItem {
      * Item绘制操作
      *
      * @param painter    绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         painter.pen.color = ItemColor.wallColor;
         painter.pen.lineWidth = painter.toPx(1);

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

@@ -54,7 +54,7 @@ export class SWindowItem extends SGraphItem {
      *
      * @param parent    指向父对象
      * @param data      窗户数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Casement) {
         super(parent);
         this.data = data;
@@ -86,7 +86,7 @@ export class SWindowItem extends SGraphItem {
      * Item 对象边界区域
      *
      * @return 边界矩形
-     */
+    */
     boundingRect(): SRect {
         return new SRect(
             this.minX,
@@ -100,7 +100,7 @@ export class SWindowItem extends SGraphItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         painter.pen.color = ItemColor.windowColor;
         painter.pen.lineWidth = painter.toPx(1);

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

@@ -75,7 +75,7 @@ export class SZoneItem extends SGraphAreaGroupItem {
      *
      * @param parent    指向父对象
      * @param data      空间数据
-     */
+    */
     constructor(parent: SGraphItem | null, data: Zone) {
         super(parent, {
             outline: data.OutLine.map((t): Point[][] => {
@@ -133,7 +133,7 @@ export class SZoneItem extends SGraphAreaGroupItem {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         if (this.selectable) {
             this.selected = !this.selected;
@@ -148,7 +148,7 @@ export class SZoneItem extends SGraphAreaGroupItem {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseUp(event: SMouseEvent): boolean {
         return false;
     } // Function onMouseUp()
@@ -157,7 +157,7 @@ export class SZoneItem extends SGraphAreaGroupItem {
      * 绘制前设置绘制样式
      *
      * @return 当前状态
-     */
+    */
     setStyle(): string {
         let status = "default";
         if (this.style) {
@@ -187,7 +187,7 @@ export class SZoneItem extends SGraphAreaGroupItem {
      * Item 绘制操作
      *
      * @param painter   绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {
         super.onDraw(painter);
         painter.brush.color = SColor.Black;

+ 7 - 7
persagy-web-big/src/parser/SFloorParser.ts

@@ -62,7 +62,7 @@ export class SFloorParser extends SParser {
      * 解析数据
      *
      * @param data  楼层数据
-     */
+    */
     parseData(data: FloorData): void {
         if (data.Walls) {
             data.Walls.forEach((t: Wall): void => {
@@ -105,7 +105,7 @@ export class SFloorParser extends SParser {
      * 添加墙至场景中
      *
      * @param t     墙数据
-     */
+    */
     private addWall(t: Wall): void {
         let item = this.factory.createWall(t);
         this.wallList.push(item);
@@ -115,7 +115,7 @@ export class SFloorParser extends SParser {
      * 添加柱子至场景中
      *
      * @param t   柱子数据
-     */
+    */
     private addColumn(t: Column): void {
         let item = this.factory.createColumn(t);
         this.columnList.push(item);
@@ -125,7 +125,7 @@ export class SFloorParser extends SParser {
      * 添加窗户至场景中
      *
      * @param t     窗户数据
-     */
+    */
     private addCasement(t: Casement): void {
         let item = this.factory.createWindow(t);
         this.casementList.push(item);
@@ -135,7 +135,7 @@ export class SFloorParser extends SParser {
      * 添加虚拟墙至场景中
      *
      * @param t     虚拟墙数据
-     */
+    */
     private addVirtualWall(t: VirtualWall): void {
         let item = this.factory.createVirtualWall(t);
         this.virtualWallList.push(item);
@@ -145,7 +145,7 @@ export class SFloorParser extends SParser {
      * 添加门至场景中
      *
      * @param t     门数据
-     */
+    */
     private addDoor(t: Door): void {
         let item = this.factory.createDoor(t);
         this.doorList.push(item);
@@ -155,7 +155,7 @@ export class SFloorParser extends SParser {
      * 添加空间至场景中
      *
      * @param t     空间数据
-     */
+    */
     private addSpace(t: Space): void {
         let item = this.factory.createSpace(t);
         this.spaceList.push(item);

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

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

+ 4 - 4
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 => {
@@ -70,16 +70,16 @@ export class STopologyParser extends SParser {
 
     /**
      * 添加标识对象
-     */
+    */
     private addMarks(t: MarkerTopo): void {} // Function addMarks
 
     /**
      * 添加关系对象
-     */
+    */
     private addRelations(t: Relation): void {} // Function addRelations
 
     /**
      * 添加节点对象
-     */
+    */
     private addNodes(t: Node): void {} // Function addNodes
 } // class STopologyParser

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

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

+ 10 - 10
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,
@@ -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;
@@ -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,
@@ -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;
@@ -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;
@@ -218,7 +218,7 @@ export class SMathUtil {
      * @param line1     线段1
      * @param line2     线段2
      * @return 交点 null 平行但不重合 'repeat' 重合
-     */
+    */
     static lineIntersection(
         line1: SLine,
         line2: SLine
@@ -251,7 +251,7 @@ export class SMathUtil {
      *
      * @param SP    点数组
      * @return 点二维数组
-     */
+    */
     static transferToArray(SP: SPoint[]): number[][] {
         return SP.map((t): number[] =>([t.x, t.y]));
     } // Function transferToArray()
@@ -261,7 +261,7 @@ export class SMathUtil {
      *
      * @param arr 点二维数组
      * @return 点数组
-     */
+    */
     static transferToSPoint(arr: number[][]): SPoint[] {
         return arr.map((t): SPoint => new SPoint(t[0], t[1]));
     } // Function transferToSPoint()
@@ -271,7 +271,7 @@ export class SMathUtil {
      *
      * @param array     三维数组描述轮廓
      * @return outline 列表
-     */
+    */
     static getIntersectInArray(array: number[][][]): Outline[] {
         let outlineList: Outline[] = [];
         if (!array.length) {
@@ -338,7 +338,7 @@ export class SMathUtil {
      *
      * @param arr   轮廓线
      * @return 面积(毫米)
-     */
+    */
     static calculateArea(arr: SPoint[]): number {
         let sum = 0;
         let n = arr.length;

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

@@ -58,35 +58,35 @@ export class SBrush {
 
     /**
      * 构造函数
-     */
+    */
     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;

+ 29 - 29
persagy-web-draw/src/SCanvasView.ts

@@ -122,7 +122,7 @@ export class SCanvasView extends SObject {
      * 构造函数
      *
      * @param id      画布对象 ID
-     */
+    */
     constructor(id: string) {
         super();
         this.canvasView = document.getElementById(id) as HTMLCanvasElement;
@@ -133,7 +133,7 @@ export class SCanvasView extends SObject {
 
     /**
      * 更新视图
-     */
+    */
     update(): void {
         this._needDraw = true;
     } // Function update()
@@ -143,7 +143,7 @@ export class SCanvasView extends SObject {
      *
      * @param name    名称
      * @param type    图像类型
-     */
+    */
     saveImage(name: string, type: string): void {
         let url = this.canvasView.toDataURL(`image/${type}`);
         SNetUtil.downLoad(name, url);
@@ -153,7 +153,7 @@ export class SCanvasView extends SObject {
      * 图像的 URL
      *
      * @param type    图像类型
-     */
+    */
     imageUrl(type: string): string {
         return this.canvasView.toDataURL(`image/${type}`);
     } // Function imageUrl()
@@ -162,7 +162,7 @@ export class SCanvasView extends SObject {
      * 视图内容保存为 SVG 文件
      *
      * @param name    文件名
-     */
+    */
     saveSvg(name: string): void {
         let url = URL.createObjectURL(
             new Blob([this.svgData()], { type: "text/xml,charset=UTF-8" })
@@ -174,7 +174,7 @@ export class SCanvasView extends SObject {
      * 视图 SVG 图形的数据
      *
      * @return URL 地址
-     */
+    */
     svgData(): string {
         let engine = new SSvgPaintEngine(this.width, this.height);
         let painter = new SPainter(engine);
@@ -188,7 +188,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 +197,7 @@ export class SCanvasView extends SObject {
         let z = zoom;
         /**
          * 缩放比例在最小比例和最大比例范围内
-         */
+        */
         if (this.scale * zoom >= this.maxScale) {
             z = this.maxScale / this.scale;
             this.scale = this.maxScale;
@@ -216,7 +216,7 @@ export class SCanvasView extends SObject {
     //
     /**
      * 循环
-     */
+    */
     protected loop(): void {
         /** painter 对象 */
         let ctx = this.canvas;
@@ -232,28 +232,28 @@ export class SCanvasView extends SObject {
      * 绘制视图
      *
      * @param painter     painter 对象
-     */
+    */
     protected onDraw(painter: SPainter): void {} // Function onDraw()
 
     /**
      * 鼠标单击事件
      *
      * @param event       事件参数
-     */
+    */
     protected onClick(event: MouseEvent): void {} // Function onClick()
 
     /**
      * 鼠标双击事件
      *
      * @param event       事件参数
-     */
+    */
     protected onDoubleClick(event: MouseEvent): void {} // Function onDoubleClick()
 
     /**
      * 鼠标按下事件
      *
      * @param event       事件参数
-     */
+    */
     protected onMouseDown(event: MouseEvent): void {
         let se = new SMouseEvent(event);
         if (se.buttons & SMouseButton.MidButton) {
@@ -266,7 +266,7 @@ export class SCanvasView extends SObject {
      * 鼠标移动事件
      *
      * @param event       事件参数
-     */
+    */
     protected onMouseMove(event: MouseEvent): void {
         // 如果可以移动
         if (this.moveable) {
@@ -287,21 +287,21 @@ export class SCanvasView extends SObject {
      * 鼠标松开事件
      *
      * @param event       事件参数
-     */
+    */
     protected onMouseUp(event: MouseEvent): void {} // Function onMouseUp()
 
     /**
      * 上下文菜单事件
      *
      * @param event       事件参数
-     */
+    */
     protected onContextMenu(event: MouseEvent): void {} // Function onContextMenu()
 
     /**
      * 鼠标滚轮事件
      *
      * @param event       事件参数
-     */
+    */
     protected onMouseWheel(event: WheelEvent): void {
         if (event.deltaY < 0) {
             this.scaleByPoint(this.wheelZoom, event.offsetX, event.offsetY);
@@ -314,28 +314,28 @@ export class SCanvasView extends SObject {
      * 按键按下事件
      *
      * @param event       事件参数
-     */
+    */
     protected onKeyDown(event: KeyboardEvent): void {} // Function onKeydown()
 
     /**
      * 按键press事件
      *
      * @param event       事件参数
-     */
+    */
     protected onKeyPress(event: KeyboardEvent): void {} // Function onKeypress()
 
     /**
      * 按键松开事件
      *
      * @param event       事件参数
-     */
+    */
     protected onKeyUp(event: KeyboardEvent): void {} // Function onKeyup()
 
     /**
      * 开始触摸事件
      *
      * @param event       事件参数
-     */
+    */
     protected onTouchStart(event: TouchEvent): void {
         let touches = event.touches;
         if (touches.length == 1) {
@@ -352,7 +352,7 @@ export class SCanvasView extends SObject {
      * 触摸移动事件
      *
      * @param event       事件参数
-     */
+    */
     protected onTouchMove(event: TouchEvent): void {
         let touches = event.touches;
         if (touches.length == 1) {
@@ -370,7 +370,7 @@ export class SCanvasView extends SObject {
      * 结束触摸事件
      *
      * @param event       事件参数
-     */
+    */
     protected onTouchEnd(event: TouchEvent): void {
         this._touchState = STouchState.None;
     } // Function onTouchEnd()
@@ -379,14 +379,14 @@ export class SCanvasView extends SObject {
      * View大小变更事件
      *
      * @param event       事件参数
-     */
+    */
     protected onResize(event: UIEvent): void {} // Function onClick()
 
     /**
      * 绑定事件
      *
      * @param element     要绑定事件的元素
-     */
+    */
     private bindEvent(element: HTMLElement): void {
         // 绑定鼠标事件
         element.onclick = this.onClick.bind(this);
@@ -415,7 +415,7 @@ export class SCanvasView extends SObject {
      * 启动动画帧(即指定时间执行回调函数)
      *
      * @param callback        回调函数
-     */
+    */
     private requestAnimationFrame(callback: FrameRequestCallback): number {
         let currTime = new Date().getTime();
         let timeToCall = Math.max(0, 16 - (currTime - this._lastFrameTime));
@@ -430,7 +430,7 @@ export class SCanvasView extends SObject {
      * 缩放视图
      *
      * @param event       触摸事件
-     */
+    */
     private viewZoom(event: TouchEvent): boolean {
         if (this._touchState == STouchState.Zoom) {
             // 获取两点的距离
@@ -454,7 +454,7 @@ export class SCanvasView extends SObject {
      *
      * @param event       触摸事件
      * @return 两手指之间的距离
-     */
+    */
     private getDistance(event: TouchEvent): number {
         if (event.touches.length < 2) {
             return 0;
@@ -470,7 +470,7 @@ export class SCanvasView extends SObject {
      *
      * @param event     触摸事件
      * @return 得到视图的 x 坐标中点
-     */
+    */
     private getMiddlePoint(event: TouchEvent): SPoint {
         return new SPoint(
             (event.touches[0].clientX + event.touches[1].clientX) / 2,

+ 13 - 13
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,7 +89,7 @@ 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()
@@ -154,7 +154,7 @@ export class SColor {
     // 构造函数
     /**
      * 构造函数
-     */
+    */
     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,
@@ -223,7 +223,7 @@ export class SColor {
      * @param r       红色分量
      * @param g       绿色分量
      * @param b       蓝色分量
-     */
+    */
     private setRgb(r: number, g: number, b: number): void {
         this._value =
             ((r as number) << 24) +
@@ -239,7 +239,7 @@ 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) +
@@ -252,7 +252,7 @@ export class SColor {
      * 颜色转 rgb
      *
      * @return rgb 字符串
-     */
+    */
     toRgb(): string {
         return `rgb(${this.red}, ${this.green}, ${this.blue})`;
     } // Function toRgb()
@@ -261,7 +261,7 @@ export class SColor {
      * 颜色转 rgba
      *
      * @return rgba 字符串
-     */
+    */
     toRgba(): string {
         return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha /
             255.0})`;
@@ -271,7 +271,7 @@ export class SColor {
      * 颜色转 6 位 16 进制
      *
      * @return 6 位 16 进制颜色
-     */
+    */
     toVal(): string {
         return "#" + SStringUtil.num2Hex(this._value, 6);
     } // Function toRgb()

+ 4 - 4
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;

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

@@ -80,7 +80,7 @@ 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()
@@ -90,7 +90,7 @@ export abstract class SGradient {
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-     */
+    */
     setStart(x: number, y: number): void {
         this.start.x = x;
         this.start.y = y;
@@ -101,7 +101,7 @@ export abstract class SGradient {
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-     */
+    */
     setEnd(x: number, y: number): void {
         this.end.x = x;
         this.end.y = y;
@@ -111,6 +111,6 @@ export abstract class SGradient {
      * 转为字符串保存
      *
      * @return 转为字符串保存
-     */
+    */
     abstract value(): string;
 } // Class SGradientStop

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

@@ -54,7 +54,7 @@ export class SGradientStop {
      *
      * @param pos         节点位置
      * @param color       节点颜色
-     */
+    */
     constructor(pos: number, color: SColor) {
         this.pos = pos;
         this.color = color;

+ 4 - 4
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,
@@ -78,7 +78,7 @@ export class SLinearGradient extends SGradient {
      * 转为字符串保存
      *
      * @return 转为字符串保存
-     */
+    */
     value(): string {
         let str = `SLinearGradient{`;
         str += `${this.x1},${this.y1};`;

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

@@ -112,7 +112,7 @@ export class SPainter extends SObject {
      * 构造函数
      *
      * @param engine    绘制引擎
-     */
+    */
     constructor(engine: SCanvasView | SPaintEngine) {
         super();
         if (engine instanceof SCanvasView) {
@@ -131,14 +131,14 @@ export class SPainter extends SObject {
 
     /**
      * 保存 painter 状态
-     */
+    */
     save(): void {
         this.engine.save();
     } // Function save()
 
     /**
      * 恢复 painter 状态
-     */
+    */
     restore(): void {
         this.engine.restore();
     } // Function restore()
@@ -150,7 +150,7 @@ export class SPainter extends SObject {
      *
      * @param x       X 轴方向平移
      * @param y       Y 轴方向平移
-     */
+    */
     translate(x: number, y: number): void {
         this.engine.translate(x, y);
     } // Function translate()
@@ -160,7 +160,7 @@ export class SPainter extends SObject {
      *
      * @param x       X 轴方向缩放
      * @param y       Y 轴方向缩放
-     */
+    */
     scale(x: number, y: number): void {
         this.engine.scale(x, y);
     } // Function scale()
@@ -169,7 +169,7 @@ export class SPainter extends SObject {
      * 旋转
      *
      * @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,
@@ -204,7 +204,7 @@ export class SPainter extends SObject {
      * @param m22     竖直方向的缩放
      * @param dx      水平方向的移动
      * @param dy      竖直方向的移动
-     */
+    */
     setTransform(
         m11: number,
         m12: number,
@@ -218,7 +218,7 @@ export class SPainter extends SObject {
 
     /**
      * 重置当前变形为单位矩阵。等价于调用 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,
@@ -290,7 +290,7 @@ export class SPainter extends SObject {
      * 绘制矩形
      *
      * @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,
@@ -357,7 +357,7 @@ export class SPainter extends SObject {
      *
      * @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,
@@ -438,7 +438,7 @@ 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,7 +450,7 @@ 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()
@@ -459,7 +459,7 @@ export class SPainter extends SObject {
      * 绘制一条线段
      *
      * @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,
@@ -514,7 +514,7 @@ export class SPainter extends SObject {
      * 绘制折线
      *
      * @param points      折线折点
-     */
+    */
     drawPolyline(points: SPoint[]): void {
         this.engine.drawPolyline(points);
     } // Function drawPolyline()
@@ -523,7 +523,7 @@ export class SPainter extends SObject {
      * 绘制多边形
      *
      * @param points      多边形顶点
-     */
+    */
     drawPolygon(points: SPoint[]): void {
         this.engine.drawPolygon(points);
     } // Function drawPolygon()
@@ -532,7 +532,7 @@ export class SPainter extends SObject {
      * 绘制路径
      *
      * @param path        路径
-     */
+    */
     drawPath(path: SPath): void {
         this.engine.drawPath(path);
     } // Function drawPath()
@@ -544,7 +544,7 @@ 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,
@@ -572,7 +572,7 @@ export class SPainter extends SObject {
      * painter 转实现 view 象素
      *
      * @param p       绘制坐标
-     */
+    */
     toPx(p: number): number {
         return p / this.engine.state.matrix.a;
     } // Function painterToView()
@@ -582,7 +582,7 @@ export class SPainter extends SObject {
      *
      * @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,
@@ -689,7 +689,7 @@ export class SPainter extends SObject {
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-     */
+    */
     private drawBasicArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(10);
@@ -728,7 +728,7 @@ export class SPainter extends SObject {
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-     */
+    */
     private drawTriangleArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(10);
@@ -767,7 +767,7 @@ export class SPainter extends SObject {
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-     */
+    */
     private drawDiamondArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);
@@ -808,7 +808,7 @@ export class SPainter extends SObject {
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-     */
+    */
     private drawSquareArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);
@@ -846,7 +846,7 @@ export class SPainter extends SObject {
      *
      * @param line    要加末端样式的线段
      * @param isEnd   是否为结束位置
-     */
+    */
     private drawCircleArrow(line: SLine, isEnd: boolean = true): void {
         // 定义箭头长度
         const d = this.toPx(5);

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

@@ -41,7 +41,7 @@ export class SPath {
      *
      * @param cmd         命令
      * @param args        命令参数
-     */
+    */
     private addCommand(cmd: string, ...args: number[]): void {
         this.cmdList.push({ command: cmd, args: args });
     } // Function addCommand()
@@ -50,14 +50,14 @@ export class SPath {
      * 添加一条新路径到对当前路径。
      *
      * @param path  路径对象
-     */
+    */
     addPath(path: SPath): void {
         this.cmdList = this.cmdList.concat(path.cmdList);
     } // Function addPath()
 
     /**
      * 使笔点返回到当前子路径的起始点。它尝试从当前点到起始点绘制一条直线。 如果图形已经是封闭的或者只有一个点,那么此函数不会做任何操作。
-     */
+    */
     closePath(): void {
         this.addCommand("Z");
     } // Function closePath()
@@ -67,7 +67,7 @@ export class SPath {
      *
      * @param x       X 坐标
      * @param y       Y 坐标
-     */
+    */
     moveTo(x: number, y: number): void {
         this.addCommand("M", x, y);
     } // Function moveTo()
@@ -77,7 +77,7 @@ export class SPath {
      *
      * @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,
@@ -119,7 +119,7 @@ export class SPath {
      * @param x2        点 2 的 x 坐标
      * @param y2        点 1 的 y 坐标
      * @param radius    半径
-     */
+    */
     arcTo(
         x1: number,
         y1: number,
@@ -137,7 +137,7 @@ 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,
@@ -170,7 +170,7 @@ 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,7 +182,7 @@ 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);
@@ -195,7 +195,7 @@ export class SPath {
      * 添加多边形
      *
      * @param pList   点集数组
-     */
+    */
     polygon(pList: SPoint[]): void {
         if (pList.length > 2) {
             this.addCommand("M", pList[0].x, pList[0].y);

+ 4 - 4
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;

+ 4 - 4
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,
@@ -101,7 +101,7 @@ export class SRadialGradient extends SGradient {
     /**
      * 转为字符串保存
      *
-     */
+    */
     value(): string {
         let str = `SRadialGradient{`;
         str += `${this.x1},${this.y1},${this.r1};`;

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

@@ -43,14 +43,14 @@ export class SShadow {
 
     /**
      * 构造函数
-     */
+    */
     constructor();
 
     /**
      * 构造函数
      *
      * @param shadow    阴影画刷
-     */
+    */
     constructor(shadow: SShadow);
 
     /**
@@ -58,7 +58,7 @@ export class SShadow {
      *
      * @param blur    扩散距离
      * @param color   颜色
-     */
+    */
     constructor(blur: number, color: SColor);
 
     /**
@@ -66,7 +66,7 @@ export class SShadow {
      *
      * @param blur    阴影|扩散距离
      * @param color   阴影颜色
-     */
+    */
     constructor(blur?: number | SShadow, color?: SColor) {
         if (blur == undefined) {
             return;

+ 30 - 30
persagy-web-draw/src/engines/SCanvasPaintEngine.ts

@@ -70,7 +70,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制引擎类型
      *
      * @return 返回 Canvas 绘制引擎类型
-     */
+    */
     get type(): SPaintEngineType {
         return SPaintEngineType.Canvas;
     } // Get type
@@ -81,7 +81,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 构造函数
      *
      * @param canvas    canvas对象
-     */
+    */
     constructor(canvas: CanvasRenderingContext2D) {
         super();
         this._canvas = canvas;
@@ -96,7 +96,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 清空矩形区域
      *
      * @param rect  矩形
-     */
+    */
     clearRect(rect: SRect): void {
         this.setMatrix();
         this._canvas.clearRect(rect.x, rect.y, rect.width, rect.height);
@@ -106,7 +106,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制矩形
      *
      * @param rect  矩形
-     */
+    */
     drawRect(rect: SRect): void {
         this.init(() => {
             this._canvas.beginPath();
@@ -122,7 +122,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param cx    圆心 x 坐标
      * @param cy    圆心 y 坐标
      * @param r     圆半径
-     */
+    */
     drawCircle(cx: number, cy: number, r: number): void {
         this.init(() => {
             this._canvas.beginPath();
@@ -139,7 +139,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param cy    圆点 Y 坐标
      * @param rx    水平半径
      * @param ry    垂直半径
-     */
+    */
     drawEllipse(cx: number, cy: number, rx: number, ry: number): void {
         this.init(() => {
             this._canvas.beginPath();
@@ -153,7 +153,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制线段
      *
      * @param line  线段
-     */
+    */
     drawLine(line: SLine): void {
         this.init(() => {
             this._canvas.beginPath();
@@ -167,7 +167,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制折线
      *
      * @param points    折线折点
-     */
+    */
     drawPolyline(points: SPoint[]): void {
         // 折线至少要有2个节点
         if (points.length < 2) {
@@ -188,7 +188,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制多边形
      *
      * @param points    多边形顶点
-     */
+    */
     drawPolygon(points: SPoint[]): void {
         // 多边形至少要有3个节点
         if (points.length < 3) {
@@ -212,7 +212,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 绘制路径
      *
      * @param path  路径
-     */
+    */
     drawPath(path: SPath): void {
         this.init(() => {
             this.drawWay(path);
@@ -226,7 +226,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param x         X 坐标
      * @param y         Y 坐标
      * @param maxWidth  最大宽度
-     */
+    */
     drawText(text: string, x: number, y: number, maxWidth?: number): void {
         this.init(() => {
             this.setFont();
@@ -246,7 +246,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param y         Y 坐标
      * @param width     宽度
      * @param height    高度
-     */
+    */
     drawImage(
         img: CanvasImageSource,
         x: number,
@@ -272,7 +272,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      *
      * @param text  预测的文本
      * @return 文本长度像素
-     */
+    */
     textWidth(text: string): number {
         return this._canvas.measureText(text).width;
     } // Function textWidth()
@@ -284,7 +284,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param cp1y    控制点 Y 坐标
      * @param x       结束点 X 坐标
      * @param y       结束点 Y 坐标
-     */
+    */
     quadraticCurveTo(cp1x: number, cp1y: number, x: number, y: number): void {
         this._canvas.quadraticCurveTo(cp1x, cp1y, x, y);
     } // Function quadraticCurveTo()
@@ -298,7 +298,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * @param cp2y    结束点控制点 Y 坐标
      * @param x       结束点X坐标
      * @param y       结束点Y坐标
-     */
+    */
     bezierCurveTo(
         cp1x: number,
         cp1y: number,
@@ -315,7 +315,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      *
      * @param rect    矩形
      * @param r       导角半径
-     */
+    */
     drawRoundRect(rect: SRect, r: number): void {
         this.init(() => {
             this._canvas.beginPath();
@@ -352,7 +352,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 设置字体
      *
      * @param font  字体
-     */
+    */
     changeFont(font: SFont): void {
         this._canvas.font = `${font.size}px ${font.name}`;
         this.setTextAlign(font.textAlign);
@@ -367,7 +367,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 设置整体绘制状态
      *
      * @param fn    绘制图形的具体函数
-     */
+    */
     private init(fn: Function): void {
         this.setMatrix();
         this.setPen();
@@ -380,7 +380,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置画笔
-     */
+    */
     private setPen(): void {
         //this._canvas.strokeStyle = this.state.pen.color.value;
         this._canvas.strokeStyle = `rgba(${this.state.pen.color.red}, ${
@@ -406,7 +406,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 线段端点风格
      *
      * @param style     风格
-     */
+    */
     private setLineCapStyle(style: SLineCapStyle): void {
         if (style == undefined) return;
         if (style == SLineCapStyle.Round) {
@@ -420,7 +420,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置画刷
-     */
+    */
     private setBrush(): void {
         // this._canvas.fillStyle = this.state.brush.color.value;
         if (this.state.brush.type == SBrushType.Color) {
@@ -465,7 +465,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置融合
-     */
+    */
     private setComposite(): void {
         this._canvas.globalCompositeOperation =
             SCanvasPaintEngine.gcoList[this.state._composite];
@@ -473,7 +473,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置阴影
-     */
+    */
     private setShadow(): void {
         if (this.state.shadow.shadowBlur > 0 && this.state.shadow.shadowColor) {
             this._canvas.shadowBlur = this.state.shadow.shadowBlur;
@@ -494,7 +494,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置字体
-     */
+    */
     private setFont(): void {
         this._canvas.font = `${this.state.font.size}px ${this.state.font.name}`;
         this.setTextAlign(this.state.font.textAlign);
@@ -506,7 +506,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 文本对齐选项
      *
      * @param value     对齐方式
-     */
+    */
     private setTextAlign(value: STextAlign): void {
         if (value == undefined) {
             return;
@@ -528,7 +528,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 设置文本基线对齐选项
      *
      * @param value     对齐方式
-     */
+    */
     private setBaseLine(value: STextBaseLine): void {
         if (value == undefined) {
             return;
@@ -552,7 +552,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
      * 设置文本方向选项
      *
      * @param value     文本方向
-     */
+    */
     private setTextDirection(value: STextDirection): void {
         if (value == undefined) {
             return;
@@ -568,7 +568,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
 
     /**
      * 设置变型矩阵
-     */
+    */
     private setMatrix(): void {
         this._canvas.setTransform(
             this.state.matrix.a,
@@ -583,7 +583,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
     /**
      * 设置裁剪路径
      *
-     */
+    */
     setClip(): void {
         if (this.state.clip) {
             this.drawWay(this.state.clip);
@@ -594,7 +594,7 @@ export class SCanvasPaintEngine extends SPaintEngine {
     /**
      * 绘制路径
      *
-     */
+    */
     private drawWay(path: SPath): void {
         this._canvas.beginPath();
         path.cmdList.forEach(cmd => {

+ 21 - 21
persagy-web-draw/src/engines/SPaintEngine.ts

@@ -51,7 +51,7 @@ export abstract class SPaintEngine {
 
     /**
      * 保存 painter 状态
-     */
+    */
     save(): void {
         let state = new SPaintState(this.state);
         this.stateStack.push(state);
@@ -59,7 +59,7 @@ export abstract class SPaintEngine {
 
     /**
      * 恢复 painter 状态
-     */
+    */
     restore(): void {
         if (this.stateStack.length > 0) {
             this.state = this.stateStack.pop() as SPaintState;
@@ -73,7 +73,7 @@ export abstract class SPaintEngine {
      *
      * @param x     X 轴方向平移
      * @param y     Y 辆方向平移
-     */
+    */
     translate(x: number, y: number): void {
         this.state.matrix.translate(x, y);
     } // Function translate()
@@ -83,7 +83,7 @@ export abstract class SPaintEngine {
      *
      * @param x     X 轴方向缩放
      * @param y     Y 轴方向缩放
-     */
+    */
     scale(x: number, y: number): void {
         this.state.matrix.scale(x, y);
     } // Function scale()
@@ -92,7 +92,7 @@ export abstract class SPaintEngine {
      * 旋转
      *
      * @param angle     旋转角度(单位弧度)
-     */
+    */
     rotate(angle: number): void {
         this.state.matrix.rotate(0, 0, angle);
     } // Function rotate()
@@ -106,7 +106,7 @@ export abstract class SPaintEngine {
      * @param m22   竖直方向的缩放
      * @param dx    水平方向的移动
      * @param dy    竖直方向的移动
-     */
+    */
     transform(
         m11: number,
         m12: number,
@@ -125,7 +125,7 @@ export abstract class SPaintEngine {
      * @param m22   竖直方向的缩放
      * @param dx    水平方向的移动
      * @param dy    竖直方向的移动
-     */
+    */
     setTransform(
         m11: number,
         m12: number,
@@ -137,7 +137,7 @@ export abstract class SPaintEngine {
 
     /**
      * 重置当前变形为单位矩阵。等价于调用 setTransform(1, 0, 0, 1, 0, 0)
-     */
+    */
     resetTransform(): void {
         this.state.matrix = new SMatrix();
     } // Function resetTransform()
@@ -149,14 +149,14 @@ export abstract class SPaintEngine {
      * 清空矩形区域
      *
      * @param rect  矩形
-     */
+    */
     abstract clearRect(rect: SRect): void;
 
     /**
      * 绘制空心矩形
      *
      * @param rect  矩形
-     */
+    */
     abstract drawRect(rect: SRect): void;
 
     /**
@@ -165,7 +165,7 @@ export abstract class SPaintEngine {
      * @param cx    圆心 X 坐标
      * @param cy    圆心 Y 坐标
      * @param r     圆半径
-     */
+    */
     abstract drawCircle(cx: number, cy: number, r: number): void;
 
     /**
@@ -175,35 +175,35 @@ export abstract class SPaintEngine {
      * @param cy    圆点 Y 坐标
      * @param rx    水平半径
      * @param ry    垂直半径
-     */
+    */
     abstract drawEllipse(cx: number, cy: number, rx: number, ry: number): void;
 
     /**
      * 绘制线段
      *
      * @param line  线段
-     */
+    */
     abstract drawLine(line: SLine): void;
 
     /**
      * 绘制折线
      *
      * @param points    折线折点
-     */
+    */
     abstract drawPolyline(points: SPoint[]): void;
 
     /**
      * 绘制多边形
      *
      * @param points    多边形顶点
-     */
+    */
     abstract drawPolygon(points: SPoint[]): void;
 
     /**
      * 绘制路径
      *
      * @param path  路径
-     */
+    */
     abstract drawPath(path: SPath): void;
 
     /**
@@ -213,7 +213,7 @@ export abstract class SPaintEngine {
      * @param x             X 坐标
      * @param y             Y 坐标
      * @param maxWidth      最大宽度
-     */
+    */
     abstract drawText(
         text: string,
         x: number,
@@ -229,7 +229,7 @@ export abstract class SPaintEngine {
      * @param y         Y 坐标
      * @param width     宽度
      * @param height    高度
-     */
+    */
     abstract drawImage(
         img: CanvasImageSource,
         x: number,
@@ -242,14 +242,14 @@ export abstract class SPaintEngine {
      * 预测量文本宽度
      *
      * @param text  预测的文本
-     */
+    */
     abstract textWidth(text: string): number;
 
     /**
      * 修改字体
      *
      * @param font  字体
-     */
+    */
     abstract changeFont(font: SFont): void;
 
     /**
@@ -257,6 +257,6 @@ export abstract class SPaintEngine {
      *
      * @param rect    矩形
      * @param r       导角半径
-     */
+    */
     abstract drawRoundRect(rect: SRect, r: number): void;
 } // class SPaintEngine

+ 1 - 1
persagy-web-draw/src/engines/SPaintState.ts

@@ -95,7 +95,7 @@ export class SPaintState {
      * 构造函数
      *
      * @param state     绘制状态
-     */
+    */
     constructor(state?: SPaintState) {
         if (state != undefined) {
             this.pen = new SPen(state.pen);

+ 18 - 18
persagy-web-draw/src/engines/SSvgPaintEngine.ts

@@ -57,7 +57,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 绘制引擎类型
      *
      * @return 返回 SVG 绘制引擎类型
-     */
+    */
     get type(): SPaintEngineType {
         return SPaintEngineType.SVG;
     } // Get type
@@ -69,7 +69,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      *
      * @param w     宽度
      * @param h     高度
-     */
+    */
     constructor(w: number, h: number) {
         super();
         this.width = w;
@@ -92,7 +92,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 转 svg 图像
      *
      * @return svg图像
-     */
+    */
     toSvg(): string {
         return this._builder.toString("\n") + "</svg>\n";
     } // Function toSvg()
@@ -104,14 +104,14 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 清空矩形区域
      *
      * @param rect  矩形
-     */
+    */
     clearRect(rect: SRect): void {} // Function clearRect()
 
     /**
      * 绘制空心矩形
      *
      * @param rect  矩形
-     */
+    */
     drawRect(rect: SRect): void {
         this._builder.append(
             // eslint-disable-next-line max-len
@@ -127,7 +127,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * @param cx    圆心 X 坐标
      * @param cy    圆心 Y 坐标
      * @param r     圆半径
-     */
+    */
     drawCircle(cx: number, cy: number, r: number): void {
         this._builder.append(
             `<circle cx="${cx}" cy="${cy}" r="${r}" ${this.getStyle(
@@ -145,7 +145,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * @param cy    圆点 Y 坐标
      * @param rx    水平半径
      * @param ry    垂直半径
-     */
+    */
     drawEllipse(cx: number, cy: number, rx: number, ry: number): void {
         this._builder.append(
             `<ellipse  cx="${cx}" cy="${cy}" rx="${rx}" ry="${ry}" ${this.getStyle(
@@ -160,7 +160,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 绘制线段
      *
      * @param line  线段
-     */
+    */
     drawLine(line: SLine): void {
         this._builder.append(
             `<line x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${
@@ -173,7 +173,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 绘制折线
      *
      * @param points    折线折点
-     */
+    */
     drawPolyline(points: SPoint[]): void {
         this._builder.append(
             `<polyline points="${SSvgPaintEngine.pointsToStr(
@@ -186,7 +186,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 绘制多边形
      *
      * @param points    多边形顶点
-     */
+    */
     drawPolygon(points: SPoint[]): void {
         this._builder.append(
             `<polygon points="${SSvgPaintEngine.pointsToStr(
@@ -199,7 +199,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 绘制路径
      *
      * @param path  路径
-     */
+    */
     drawPath(path: SPath): void {
         // this._builder.append(
         //     `<path d="${path.svgPath()}" ${this.getStyle(
@@ -217,7 +217,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * @param x           X 坐标
      * @param y           Y 坐标
      * @param maxWidth    最大宽度
-     */
+    */
     drawText(text: string, x: number, y: number, maxWidth?: number): void {
         this._builder.append(
             `<text x="${x}" y="${y}" ${this.getStyle(
@@ -236,7 +236,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      * @param y         Y 坐标
      * @param width     宽度
      * @param height    高度
-     */
+    */
     drawImage(
         img: CanvasImageSource,
         x: number,
@@ -252,7 +252,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      *
      * @param text  预测的文本
      * @return 文本长度像素
-     */
+    */
     textWidth(text: string): number {
         return 0;
     } // Function textWidth()
@@ -261,14 +261,14 @@ export class SSvgPaintEngine extends SPaintEngine {
      * 设置字体
      *
      * @param font  字体
-     */
+    */
     changeFont(font: SFont): void {} // Function changeFont()
 
     /**
      * 获得svg需要的变形信息
      *
      * @return 变换信息
-     */
+    */
     private getSvgMatrix(): string {
         // eslint-disable-next-line max-len
         return `transform="matrix(${this.state.matrix.a}, ${this.state.matrix.b}, ${this.state.matrix.c}, ${this.state.matrix.d}, ${this.state.matrix.e}, ${this.state.matrix.f})"`;
@@ -279,7 +279,7 @@ export class SSvgPaintEngine extends SPaintEngine {
      *
      * @param points    被转换的点
      * @return 点列表字符串
-     */
+    */
     private static pointsToStr(points: SPoint[]): string {
         let strBuilder = new SStringBuilder();
         for (let p of points) {
@@ -334,6 +334,6 @@ export class SSvgPaintEngine extends SPaintEngine {
 
     /**
      * 绘制圆角矩形
-     */
+    */
     drawRoundRect(): void {} // Function drawRoundRect()
 } // Class SSvgPaintEngine

+ 9 - 9
persagy-web-draw/src/types/SLine.ts

@@ -84,14 +84,14 @@ export class SLine {
     // 构造函数
     /**
      * 构造函数
-     */
+    */
     constructor();
 
     /**
      * 构造函数
      *
      * @param line    线段
-     */
+    */
     constructor(line: SLine);
 
     /**
@@ -99,7 +99,7 @@ export class SLine {
      *
      * @param p1      启点坐标
      * @param p2      终点坐标
-     */
+    */
     constructor(p1: SPoint, p2: SPoint);
 
     /**
@@ -109,7 +109,7 @@ export class SLine {
      * @param y1      启点 Y 坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-     */
+    */
     constructor(x1: number, y1: number, x2: number, y2: number);
 
     /**
@@ -119,7 +119,7 @@ export class SLine {
      * @param y1      启点 Y 坐标 | 终点坐标
      * @param x2      终点 X 坐标
      * @param y2      终点 Y 坐标
-     */
+    */
     constructor(
         x1?: number | SPoint | SLine,
         y1?: number | SPoint,
@@ -145,7 +145,7 @@ export class SLine {
      * 判断线段是否为空
      *
      * @return 如果线段长度为零,返回 true,否则返回 false。
-     */
+    */
     isNull(): boolean {
         return (
             Math.abs(this.p1.x - this.p2.x) + Math.abs(this.p1.y - this.p2.y) <
@@ -157,7 +157,7 @@ export class SLine {
      * 返回线段的中点
      *
      * @return 线段的中点
-     */
+    */
     center(): SPoint {
         return new SPoint(
             (this.p1.x + this.p2.x) / 2,
@@ -170,7 +170,7 @@ export class SLine {
      *
      * @param dx    X 轴方向平衡量
      * @param dy    Y 轴方向平衡量
-     */
+    */
     translate(dx: number, dy: number): void {
         this.p1.x += dx;
         this.p2.x += dx;
@@ -184,7 +184,7 @@ export class SLine {
      * @param dx    X 轴方向平衡量
      * @param dy    Y 轴方向平衡量
      * @return 平移后的线段
-     */
+    */
     translated(dx: number, dy: number): SLine {
         return new SLine(
             this.p1.x + dx,

+ 10 - 10
persagy-web-draw/src/types/SPoint.ts

@@ -43,14 +43,14 @@ export class SPoint {
     // 构造函数
     /**
      * 构造函数
-     */
+    */
     constructor();
 
     /**
      * 构造函数
      *
      * @param p     点
-     */
+    */
     constructor(p: SPoint);
 
     /**
@@ -58,7 +58,7 @@ export class SPoint {
      *
      * @param x     X 轴坐标
      * @param y     Y 轴坐标
-     */
+    */
     constructor(x: number, y: number);
 
     /**
@@ -66,7 +66,7 @@ export class SPoint {
      *
      * @param x     X 轴坐标 | 点 | undefined
      * @param y     Y 轴坐标
-     */
+    */
     constructor(x?: number | SPoint, y?: number) {
         if (x == undefined) {
             this.x = 0;
@@ -84,7 +84,7 @@ export class SPoint {
      * 设置点
      *
      * @param pos   点
-     */
+    */
     setPoint(pos: SPoint): void;
 
     /**
@@ -92,7 +92,7 @@ export class SPoint {
      *
      * @param x     X 轴坐标
      * @param y     Y 轴坐标
-     */
+    */
     setPoint(x: number, y: number): void;
 
     /**
@@ -100,7 +100,7 @@ export class SPoint {
      *
      * @param x     X 轴坐标 | 点
      * @param y     Y 轴坐标
-     */
+    */
     setPoint(x: number | SPoint, y?: number): void {
         if (x instanceof SPoint) {
             this.x = x.x;
@@ -115,7 +115,7 @@ export class SPoint {
      * 布线长度
      *
      * @return 返回 |X| + |Y|
-     */
+    */
     manhattanLength(): number {
         // noinspection JSSuspiciousNameCombination
         return Math.abs(this.x) + Math.abs(this.y);
@@ -125,7 +125,7 @@ export class SPoint {
      * 返回点矩阵变换后的值
      *
      * @return 变换后的点
-     */
+    */
     matrixTransform(mat: SMatrix): SPoint {
         const p = new SPoint();
         p.x = this.x * mat.a + this.y * mat.b + mat.e;
@@ -138,7 +138,7 @@ export class SPoint {
      *
      * @param dx    X 轴位移
      * @param dy    Y 轴位移
-     */
+    */
     translate(dx: number, dy: number): void {
         this.x += dx;
         this.y += dy;

+ 19 - 19
persagy-web-draw/src/types/SRect.ts

@@ -108,7 +108,7 @@ export class SRect {
     // 构造函数
     /**
      * 构造函数
-     */
+    */
     constructor();
 
     /**
@@ -116,7 +116,7 @@ export class SRect {
      *
      * @param leftTop       左上角坐标
      * @param rightBottom   右下角坐标
-     */
+    */
     constructor(leftTop: SPoint, rightBottom: SPoint);
 
     /**
@@ -124,7 +124,7 @@ export class SRect {
      *
      * @param leftTop   左上角坐标
      * @param size      大小
-     */
+    */
     constructor(leftTop: SPoint, size: SSize);
 
     /**
@@ -134,7 +134,7 @@ export class SRect {
      * @param y         Y 轴坐标
      * @param width     宽度
      * @param height    高度
-     */
+    */
     constructor(x: number, y: number, width: number, height: number);
 
     /**
@@ -144,7 +144,7 @@ export class SRect {
      * @param y         Y 轴坐标 | 右下角坐标 | 大小
      * @param width     宽度
      * @param height    高度
-     */
+    */
     constructor(
         x?: number | SPoint,
         y?: number | SPoint | SSize,
@@ -176,7 +176,7 @@ export class SRect {
      * @return width 或 height 小于等于 0,返回 true,否则返回 false。
      *
      * @see isNull(), isValid()
-     */
+    */
     isEmpty(): boolean {
         return this.size.isEmpty();
     } // Function isEmpty()
@@ -187,7 +187,7 @@ export class SRect {
      * @return width 与 height 都等于 0,返回 true,否则返回 false。
      *
      * @see isEmpty(), isValid()
-     */
+    */
     isNull(): boolean {
         return this.size.isNull();
     } // Function isNull()
@@ -198,7 +198,7 @@ export class SRect {
      * @return width 与 height 都大于 0,返回 true,否则返回 false。
      *
      * @see isEmpty(), isNull()
-     */
+    */
     isValid(): boolean {
         return this.size.isValid();
     } // Function isValid()
@@ -207,7 +207,7 @@ export class SRect {
      * 是否包含另一个矩阵
      *
      * @return true     包含
-     */
+    */
     isIn(rect: SRect): boolean {
         return (
             this.left <= rect.left &&
@@ -223,7 +223,7 @@ export class SRect {
      * @param x       X 坐标
      * @param y       Y 坐标
      * @return 如果包含返回 true, 否则返回 false
-     */
+    */
     contains(x: number, y: number): boolean {
         return (
             x >= this.left &&
@@ -237,7 +237,7 @@ export class SRect {
      * 计算中心点
      *
      * @return 中心点坐标
-     */
+    */
     center(): SPoint {
         return new SPoint(
             this.x + this.width / 2.0,
@@ -250,7 +250,7 @@ export class SRect {
      *
      * @param dx    X 轴位移
      * @param dy    Y 轴位移
-     */
+    */
     translate(dx: number, dy: number): void {
         this.x += dx;
         this.y += dy;
@@ -262,7 +262,7 @@ export class SRect {
      * @param dx    X 轴位移
      * @param dy    Y 轴位移
      * @return 移动后的矩形
-     */
+    */
     translated(dx: number, dy: number): SRect {
         return new SRect(this.x + dx, this.y + dy, this.width, this.height);
     } // Function translated()
@@ -274,7 +274,7 @@ export class SRect {
      * @param dy          Y 轴位移
      * @param dw          宽度调整
      * @param dh          高度调整
-     */
+    */
     adjust(dx: number, dy: number, dw: number, dh: number): void {
         this.x += dx;
         this.y += dy;
@@ -290,7 +290,7 @@ export class SRect {
      * @param dw          宽度调整
      * @param dh          高度调整
      * @return 调整后的矩形
-     */
+    */
     adjusted(dx: number, dy: number, dw: number, dh: number): SRect {
         return new SRect(
             this.x + dx,
@@ -304,7 +304,7 @@ export class SRect {
      * 合并矩形
      *
      * @param rect    合并的矩形
-     */
+    */
     union(rect: SRect): void {
         let r = this.unioned(rect);
         this.x = r.x;
@@ -318,7 +318,7 @@ export class SRect {
      *
      * @param rect    合并的矩形
      * @return 返回合并后的矩形
-     */
+    */
     unioned(rect: SRect): SRect {
         let left = Math.min(this.left, rect.left);
         let top = Math.min(this.top, rect.top);
@@ -332,7 +332,7 @@ export class SRect {
      *
      * @param rect    合并的矩形
      * @return 返回合并后的矩形
-     */
+    */
     intersected(rect: SRect): SRect {
         let minX = this.left < rect.left ? this.left : rect.left;
         let minY = this.top < rect.top ? this.top : rect.top;
@@ -351,7 +351,7 @@ export class SRect {
      * 相交矩形
      *
      * @param rect    合并的矩形
-     */
+    */
     intersect(rect: SRect): SRect {
         let left = Math.min(this.left, rect.left);
         let top = Math.min(this.top, rect.top);

+ 11 - 11
persagy-web-draw/src/types/SSize.ts

@@ -43,14 +43,14 @@ export class SSize {
     // 构造函数
     /**
      * 构造函数
-     */
+    */
     constructor();
 
     /**
      * 构造函数
      *
      * @param size    大小
-     */
+    */
     constructor(size: SSize);
 
     /**
@@ -58,7 +58,7 @@ export class SSize {
      *
      * @param width   宽度
      * @param height  高度
-     */
+    */
     constructor(width: number, height: number);
 
     /**
@@ -66,7 +66,7 @@ export class SSize {
      *
      * @param width   宽度
      * @param height  高度
-     */
+    */
     constructor(width?: number | SSize, height?: number) {
         if (width == undefined) {
             this.width = 0;
@@ -88,7 +88,7 @@ export class SSize {
      * @return width 或 height 小于等于 0,返回 true,否则返回 false。
      *
      * @see isNull(), isValid()
-     */
+    */
     isEmpty(): boolean {
         return this.width <= 0 || this.height <= 0;
     } // Function isEmpty()
@@ -99,7 +99,7 @@ export class SSize {
      * @return width 与 height 都等于 0,返回 true,否则返回 false。
      *
      * @see isEmpty(), isValid()
-     */
+    */
     isNull(): boolean {
         return this.width == 0 && this.height == 0;
     } // Function isNull()
@@ -110,7 +110,7 @@ export class SSize {
      * @return width与 height 都大于 0,返回 true,否则返回 false。
      *
      * @see isEmpty(), isNull()
-     */
+    */
     isValid(): boolean {
         return this.width > 0 && this.height > 0;
     } // Function isValid()
@@ -121,7 +121,7 @@ export class SSize {
      * @param width       宽度
      * @param height      高度
      * @param mode        缩放模式
-     */
+    */
     scale(
         width: number,
         height: number,
@@ -139,7 +139,7 @@ export class SSize {
      * @param height      高度
      * @param mode        缩放模式
      * @return 缩放大小
-     */
+    */
     scaled(
         width: number,
         height: number,
@@ -167,7 +167,7 @@ export class SSize {
      * 互换 width 与 height
      *
      * @see transposed()
-     */
+    */
     transpose(): void {
         let size = this.transposed();
         this.width = size.width;
@@ -180,7 +180,7 @@ export class SSize {
      * @return 返回互换 width 与 height 的 SSize。
      *
      * @see transpose()
-     */
+    */
     transposed(): SSize {
         return new SSize(this.height, this.width);
     } // Function transposed()

+ 2 - 2
persagy-web-draw/src/utils/SPolygonUtil.ts

@@ -38,7 +38,7 @@ export class SPolygonUtil {
      * @param x           点的 x 坐标
      * @param y           点的 y 坐标
      * @param pointList   多边形顶点
-     */
+    */
     static pointIn(x: number, y: number, pointList: SPoint[]): boolean {
         let crossNum = 0;
         for (let i = 0; i < pointList.length; i++) {
@@ -73,7 +73,7 @@ export class SPolygonUtil {
      *
      * @param pointList   多边形顶点
      * @return 为负,顺时针;为正,逆时针;0,点在直线上。
-     */
+    */
     static clockDir(pointList: SPoint[]): number {
         if (pointList.length < 3) {
             return 0;

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

@@ -22,7 +22,7 @@
     "keywords": [
         "graph-edit"
     ],
-    "author": "韩耀龙(han_yao_long@163.com)",
+    "author": "韩耀龙 <han_yao_long@163.com> ",
     "license": "ISC",
     "publishConfig": {
         "registry": "http://dev.dp.sagacloud.cn:8082/repository/npm-hosted/"

+ 22 - 16
persagy-web-edit/src/SGraphEdit.ts

@@ -31,50 +31,56 @@ import { SMouseEvent } from "@persagy-web/base/";
 /**
  * 编辑基类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SGraphEdit extends SGraphItem {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
-    /**编辑状态 */
+    /** 编辑状态 */
     protected _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
-    }
+    } // Get status
     set status(value: SItemStatus) {
         const oldStatus = this._status;
         const newStatus = value;
         this._status = value;
         //状态变更触发事件
-        this.$emit('statusChange', oldStatus, newStatus)
+        this.$emit('statusChange', oldStatus, newStatus);
         this.update();
-    }
+    } // Set status
 
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //函数
-    /*
+    /**
      * 构造函数
      *
-     * @param   parent      指向父对象
+     * @param parent      指向父对象
      */
     constructor(parent: SGraphItem | null) {
         super();
         if (parent) {
             this.parent = parent;
         }
-        this.selectable = true
-    }
+
+        this.selectable = true;
+    } // Constructor
 
     /**
      * 将类中得数据转换为方便存储格式的方法
      *
-     * return   any         针对item类型保持相应的格式
+     * @return 针对 item 类型保持相应的格式
      */
     toData(): any {
-
-    }
+        // do nothing
+    } // Function toData()
+    /**
+     * 将类中得数据转换为方便存储格式的方法
+     *
+     * @return 针对 item 类型保持相应的格式
+     */
     onContextMenu(event: SMouseEvent): boolean {
-        this.$emit('onContextMenu', event)
-        return true
-    }
-}
+        this.$emit('onContextMenu', event);
+        return true;
+    } // Function onContextMenu()
+} // Class SGraphEdit

+ 95 - 83
persagy-web-edit/src/SGraphEditScene.ts

@@ -31,14 +31,14 @@ import { SRectSelectItem, SItemStatus } from "@persagy-web/big";
 import { SBaseArrowEdit, SBasePolygonEdit, SBaseCircleEdit, SBaseLineEdit, SGraphAddCommand, SGraphEdit, SBasePolylineEdit, SBaseTextEdit, SBaseImageEdit, SBaseRectEdit, SBaseTriangleEdit } from './'
 
 /**
- * Graphy图形引擎编辑场景类
+ * Graph 图形引擎编辑场景类
  *
- * @author  韩耀龙(han_yao_long@126.com)
+ * @author 韩耀龙 <han_yao_long@126.com>
  */
 export class SGraphEditScene extends SGraphScene {
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
-    /** undo/redo存储栈 */
+    /** undo/redo 存储栈 */
     protected undoStack = new SUndoStack();
     // get undoStack(): SUndoStack {
     //     return this._undoStack
@@ -46,45 +46,52 @@ export class SGraphEditScene extends SGraphScene {
     // // set undoStack(val: SUndoStack) {
     // //     this._undoStack = val
     // // }
-    /**编辑命令 */
+    /** 编辑命令 */
     _editCmd: string = ""
     get editCmd(): string {
         return this._editCmd
-    }
+    } // Get editCmd
     set editCmd(val: string) {
         this._editCmd = val;
-    }
-    /**是否可编辑 */
-    _isEditStatus: Boolean = true; // 是否可编辑
+    } // Set editCmd
+
+    /** 是否可编辑 */
+    _isEditStatus: Boolean = true;
     set isEditStatus(bol: Boolean) {
         this._isEditStatus = bol;
-    }
+    } // Get isEditStatus
     get isEditStatus(): Boolean {
-        return this._isEditStatus
-    }
+        return this._isEditStatus;
+    } // Set isEditStatus
+
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //函数
+    /**
+     * 构造函数
+     */
     constructor() {
         super()
         // // 选择绑定选额item事件
         this.selectContainer.connect("selectChange", this, this.selectChange);
-    }
+    } // Constructor
 
     /**
-     * 选中item触发方法
+     * 选中 item 触发方法
      *
      * @param obj 变化后的对象
      */
-    selectChange(obj: any) { }
+    selectChange(obj: any) {
+        // do nothing
+    } // Function selectChange
 
     /**
-    * 新增基础类直线
-    *
-    * @param   event   鼠标事件参数
-    */
-    addLine(event: SMouseEvent): void {
+     * 新增基础类直线
+     *
+     * @param event   鼠标事件参数
+     */
+     addLine(event: SMouseEvent): void {
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础直线',
             /** 图标(Image),线类型(Line) */
             type: "Line",
@@ -92,9 +99,9 @@ export class SGraphEditScene extends SGraphScene {
             scale: { x: 1, y: 1, z: 1 },
             /** 缩放比例(Image),线类型(Line) */
             rolate: { x: 0, y: 0, z: 0 },
-            /** 位置  */
+            /** 位置 */
             pos: { x: 0, y: 0 },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "BaseLine"           // 自定义类型用于区分mark与node
             },
@@ -115,7 +122,7 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addLine()
 
     /**
      * 新增折线
@@ -147,23 +154,23 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addPolyLine()
 
     /**
-   * 新增基础类图片
-   *
-   * @param   event   鼠标事件参数
-   */
+     * 新增基础类图片
+     *
+     * @param event   鼠标事件参数
+     */
     addImageItem(event: SMouseEvent): void {
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础图片',
             num: 1,
             /** 图标(Image),线类型(Line) */
             type: "Image",
-            /** 位置  */
+            /** 位置 */
             pos: { x: event.x, y: event.y },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "BaseImage",
             },
@@ -180,23 +187,23 @@ export class SGraphEditScene extends SGraphScene {
         this.addItem(item);
         this.undoStack.push(new SGraphAddCommand(this, item));
         this.finishCreated(item);
-    }
+    } // Function addImageItem()
 
     /**
      * 新增基础类文本
      *
-     * @param   event   鼠标事件参数
+     * @param event   鼠标事件参数
      */
     addTextItem(event: SMouseEvent): void {
         const data = {
-            /** 名称  */
+            /** 名称 */
             name: '基础文本',
             /** 图标 */
             type: "Text",
-            /** 位置  */
+            /** 位置 */
             pos: { x: event.x, y: event.y },
             size: { width: 0, height: 0 },
-            /** 由应用自己定义  */
+            /** 由应用自己定义 */
             properties: {
                 type: "BaseText"           // 自定义类型用于区分mark与node
             },
@@ -208,7 +215,7 @@ export class SGraphEditScene extends SGraphScene {
                     backgroundcolor: "#f7f9facc",
                 }
             }
-        }
+        };
         const item = new SBaseTextEdit(null, data);
         item.moveTo(event.x, event.y);
         item.moveable = true;
@@ -217,9 +224,11 @@ export class SGraphEditScene extends SGraphScene {
         this.grabItem = null;
         item.connect("onContextMenu", this, this.getItem);
         this.finishCreated(item);
-    }
+    } // Function addTextItem()
+
     /**
-     * 添加基本矩形item
+     * 添加基本矩形 item
+     *
      * @param event 鼠标事件
      */
     addRectItem(event: SMouseEvent): void {
@@ -227,7 +236,7 @@ export class SGraphEditScene extends SGraphScene {
             name: '基础矩形',
             /** 图标(Image),线类型(Line) */
             type: "Zone",
-            /** 位置  */
+            /** 位置 */
             pos: { x: 0, y: 0 },
             properties: {
                 type: "BaseRect",
@@ -238,6 +247,7 @@ export class SGraphEditScene extends SGraphScene {
                 }
             }
         }
+
         const rectItem = new SBaseRectEdit(null, data);
         rectItem.status = SItemStatus.Create;
         this.addItem(rectItem);
@@ -251,10 +261,10 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addRectItem()
 
     /**
-     * 添加基本三角形item
+     * 添加基本三角形 item
      *
      * @param event 鼠标事件
      */
@@ -284,7 +294,7 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addTriangleItem()
 
     /**
      * 添加基本圆
@@ -316,13 +326,13 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addCircleItem()
 
     /**
-    * 添加基本多边形
-    *
-    * @param event 鼠标事件
-    */
+     * 添加基本多边形
+     *
+     * @param event     鼠标事件
+     */
     addPolygonItem(event: SMouseEvent): void {
         const data = {
             name: '基础多边形',
@@ -336,7 +346,7 @@ export class SGraphEditScene extends SGraphScene {
                 default: {
                 }
             }
-        }
+        };
         const polygonItem = new SBasePolygonEdit(null, data);
         polygonItem.status = SItemStatus.Create;
         polygonItem.selectable = true;
@@ -347,13 +357,13 @@ export class SGraphEditScene extends SGraphScene {
         polygonItem.connect("onContextMenu", this, this.getItem);
         if (this.view) {
             this.view.update();
-        }
-    }
+        };
+    } // Function addPolygonItem()
 
     /**
-     * 添加基本箭头item(直线类)
+     * 添加基本箭头 item (直线类)
      *
-     * @param event 鼠标事件
+     * @param event     鼠标事件
      */
     addBaseArrowsItem(event: SMouseEvent): void {
         const data = {
@@ -381,69 +391,70 @@ export class SGraphEditScene extends SGraphScene {
         if (this.view) {
             this.view.update();
         }
-    }
+    } // Function addBaseArrowsItem()
 
     /**
-     * 对齐指定item
-     * @param v
+     * 对齐指定 item
+     *
+     * @param v     对齐类型
      */
     changeAlignItem(v: any): void {
         this.selectContainer.layout(v);
-    }
+    } // Function changeAlignItem()
 
     /**
      * 保存数据
      *
-     * @return any 返回需要保存的数据
+     * @return 返回需要保存的数据
      */
     saveMsgItem(): any {
-    }
+        // do nothing
+    } // Function saveMsgItem()
 
     /**
      * 重做
-     *
-     * @return any
      */
     redo(): void {
-    }
+        // do nothing
+    } // Function redo()
 
     /**
      * 撤销
-     *
-     * @return any
      */
     undo(): void {
-    }
+        // do nothing
+    } // Function undo()
 
     /**
      * 完成创建的回调函数
      *
      * @param item 完成创建的item
      */
-    finishCreated(item: SGraphItem) {
-    }
+    finishCreated(item: SGraphItem): void {
+        // do nothing
+    } // Function finishCreated()
 
     /**
-    * 复制
-    *
-    */
-    copy() { }
+     * 复制
+     */
+    copy(): void {
+        // do nothing
+    } // Function copy()
 
     /**
      * 粘贴
-     *
      */
-    paste() { }
+    paste(): void { } // Function paste()
 
     /**
      *  选中状态方法
      *
-     *  @param  item SGraphItem
+     *  @param  item    选中的 item
      */
     toggleItem(item: SGraphItem): void {
         this.selectContainer.clear()
         this.selectContainer.toggleItem(item)
-    }
+    } // Function toggleItem()
 
     /**
      * 框选
@@ -453,15 +464,16 @@ export class SGraphEditScene extends SGraphScene {
         let rect = new SRectSelectItem(null, point);
         this.addItem(rect);
         this.grabItem = rect;
-    }
+    } // Function addRectSelect()
 
     /**
-    * 获取item (常用与场景外的调用F)
-    * @param  event SMouseEvent 鼠标事件
-    * @param  item SGraphEdit|null 返回item
-    *
-    */
+     * 获取 item (常用与场景外的调用)
+     *
+     * @param  event    SMouseEvent 鼠标事件
+     * @param  item     SGraphEdit|null 返回 item
+     *
+     */
     getItem(item: SGraphEdit | null, event: SMouseEvent[]) {
-    }
+    } // Function getItem()
 
-}// Class GraphEditScene
+}// Class SGraphEditScene

+ 14 - 16
persagy-web-edit/src/commands/SGraphAddCommand.ts

@@ -28,26 +28,25 @@ import { SGraphCommand } from "./SGraphCommand";
 import { SGraphItem,SGraphScene } from "@persagy-web/graph/";
 import { SUndoCommand } from "@persagy-web/base";
 
-
 /**
- * 添加item命令
+ * 添加 item 命令
  *
- * @author  panglixiang
- * */
+ * @author 韩耀龙 <han_yao_long@163.com>
+ */
 export class SGraphAddCommand extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /** 命令item对象    */
+    /** 命令 item 对象 */
     item: SGraphItem;
-    /** 命令item的父类   */
+    /** 命令 item 的父类 */
     parent: SGraphItem | null;
 
     /**
      * 构造函数
      *
-     * @param   scene   item所在场景
-     * @param   item    命令item对象
-     * */
+     * @param scene   item 所在场景
+     * @param item    命令 item 对象
+    */
     constructor(scene: SGraphScene, item: SGraphItem) {
         super(scene);
         this.item = item;
@@ -59,16 +58,16 @@ export class SGraphAddCommand extends SGraphCommand {
     /**
      * 合并命令
      *
-     * @return  boolean 是否已执行合并
-     * */
+     * @param command   命令对象
+     * @return 是否已执行合并
+    */
     mergeWith(command: SUndoCommand): boolean {
         return false;
     } // Function mergeWith()
 
     /**
      * 重做
-     *
-     * */
+    */
     redo(): void {
         this.item.parent = this.parent;
         // @ts-ignore
@@ -77,8 +76,7 @@ export class SGraphAddCommand extends SGraphCommand {
 
     /**
      * 撤销
-     *
-     * */
+    */
     undo(): void {
         this.item.parent = null;
         // @ts-ignore

+ 4 - 4
persagy-web-edit/src/commands/SGraphCommand.ts

@@ -28,9 +28,9 @@ import { SUndoCommand } from "@persagy-web/base";
 import { SGraphScene } from "@persagy-web/graph/";
 
 /**
- * Graph命令基类
+ * Graph 命令基类
  *
- * @author  庞利祥(sybotan@126.com)
+ * @author 庞利祥 <sybotan@126.com>
  */
 export abstract class SGraphCommand extends SUndoCommand {
     /** 命令所属的场景类 */
@@ -39,8 +39,8 @@ export abstract class SGraphCommand extends SUndoCommand {
     /**
      * 构造函数
      *
-     * @param   scene       命令所属的场景类
-     */
+     * @param scene   命令所属的场景类
+    */
     protected constructor(scene: SGraphScene | null) {
         super();
         this.scene = scene;

+ 20 - 21
persagy-web-edit/src/commands/SGraphMoveCommand.ts

@@ -31,29 +31,28 @@ import { SUndoCommand } from "@persagy-web/base";
 import { SGraphScene } from "@persagy-web/graph/";
 
 /**
- * item移动命令
+ * item 移动命令
  *
- * @author  panglixiang
- *
- * */
+ * @author 庞利祥 <sybotan@126.com>
+ */
 export class SGraphMoveCommand extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /** 执行命令的item   */
+    /** 执行命令的 item */
     item: SGraphItem;
-    /** 移动前位置    */
+    /** 移动前位置 */
     old: SPoint;
-    /** 移动后位置   */
+    /** 移动后位置 */
     pos: SPoint;
 
     /**
      * 构造函数
      *
-     * @param   scene   当前场景
-     * @param   item    item对象
-     * @param   old     移动前位置
-     * @param   pos     移动后位置
-     * */
+     * @param scene    当前场景
+     * @param item     item 对象
+     * @param old      移动前位置
+     * @param pos      移动后位置
+    */
     constructor(
         scene: SGraphScene,
         item: SGraphItem,
@@ -71,21 +70,21 @@ export class SGraphMoveCommand extends SGraphCommand {
     /**
      * 合并命令
      *
-     * @param   command 命令
-     * @return  boolean 是否已执行合并命令
-     * */
+     * @param command      命令
+     * @return 是否已执行合并命令
+    */
     mergeWith(command: SUndoCommand): boolean {
         if (command instanceof SGraphMoveCommand && command.item == this.item) {
             command.pos = this.pos;
             return true;
         }
+
         return false;
     } // Function mergeWith()
 
     /**
      * 重做
-     *
-     * */
+    */
     redo(): void {
         this.item.pos = new SPoint(this.pos.x, this.pos.y);
         this.item.update();
@@ -93,8 +92,7 @@ export class SGraphMoveCommand extends SGraphCommand {
 
     /**
      * 撤销
-     *
-     * */
+    */
     undo(): void {
         this.item.pos = new SPoint(this.old.x, this.old.y);
         this.item.update();
@@ -103,7 +101,8 @@ export class SGraphMoveCommand extends SGraphCommand {
     /**
      * 命令细节描述
      *
-     * */
+     * @return 字符串类型的数据
+    */
     toString(): string {
         return `oldPos=${JSON.stringify(this.old)};\nnewPos=${JSON.stringify(
             this.pos

+ 18 - 13
persagy-web-edit/src/commands/SGraphPointListDelete.ts

@@ -30,28 +30,29 @@ import { SGraphCommand, SGraphItem, SGraphScene } from "@persagy-web/graph/";
 /**
  * 多边形、折线等相关顶点的位置删除命令
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SGraphPointListDelete extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /**  指向item对象 */
+    /** 指向 item 对象 */
     item: SGraphItem;
     /** 索引 */
     index: number | null;
-    /**  删除位置 */
+    /** 删除位置 */
     pos: SPoint | null;
     /** 顶点数组 */
     pointList: SPoint[];
 
     /**
      * 构造函数
-     * @param   scene       item所在场景
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   pos         删除的点
-     * @param   index       索引
-     */
+     *
+     * @param scene       item所在场景
+     * @param item        指向item对象
+     * @param pointList   顶点数组
+     * @param pos         删除的点
+     * @param index       索引
+    */
     constructor(
         scene: SGraphScene,
         item: SGraphItem,
@@ -70,33 +71,37 @@ export class SGraphPointListDelete extends SGraphCommand {
 
     /**
      * 执行重做操作执行
-     */
+    */
     redo(): void {
         if (this.index == null) {
             this.pointList.pop();
         } else {
             this.pointList.splice(this.index, 1);
         }
+
         this.item.update();
     } // Function redo()
 
     /**
      * 执行取消操作执行
-     */
+    */
     undo(): void {
         if (this.pos == null) return;
+
         if (this.index == null) {
             this.pointList.push(this.pos);
         } else {
             this.pointList.splice(this.index, 0, this.pos);
         }
+
         this.item.update();
     } // Function undo()
 
     /**
      * 命令细节描述
      *
-     * */
+     * @return 字符串类型数据
+    */
     toString(): string {
         const pointList = `pointList=${JSON.stringify(this.pointList)}`;
         const pos = `pos=${JSON.stringify(this.pos)}`;

+ 15 - 13
persagy-web-edit/src/commands/SGraphPointListInsert.ts

@@ -30,14 +30,14 @@ import { SGraphCommand, SGraphItem, SGraphScene } from "@persagy-web/graph/";
 /**
  * 多边形、折线等相关顶点的位置插入命令
  *
- * @author  韩耀龙
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SGraphPointListInsert extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /**  指向item对象 */
+    /** 指向 item 对象 */
     item: SGraphItem;
-    /**  当前位置 */
+    /** 当前位置 */
     pos: SPoint;
     /** 索引 */
     index: number | null;
@@ -46,12 +46,13 @@ export class SGraphPointListInsert extends SGraphCommand {
 
     /**
      * 构造函数
-     * @param   scene       item所在场景
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   pos         当前位置
-     * @param   index       索引
-     */
+     *
+     * @param scene       item 所在场景
+     * @param item        指向 item 对象
+     * @param pointList   顶点数组
+     * @param pos         当前位置
+     * @param index       索引
+    */
     constructor(
         scene: SGraphScene,
         item: SGraphItem,
@@ -70,7 +71,7 @@ export class SGraphPointListInsert extends SGraphCommand {
 
     /**
      * 执行重做操作执行
-     */
+    */
     redo(): void {
         const point = new SPoint(this.pos.x, this.pos.y);
         if (this.index == null) {
@@ -83,7 +84,7 @@ export class SGraphPointListInsert extends SGraphCommand {
 
     /**
      * 执行取消操作执行
-     */
+    */
     undo(): void {
         if (this.index == null) {
             this.pointList.pop();
@@ -96,7 +97,8 @@ export class SGraphPointListInsert extends SGraphCommand {
     /**
      * 命令细节描述
      *
-     * */
+     * @return 字符串类型数据
+    */
     toString(): string {
         const pointList = `pointList=${JSON.stringify(this.pointList)}`;
         const pos = `pos=${JSON.stringify(this.pos)}`;

+ 17 - 15
persagy-web-edit/src/commands/SGraphPointListUpdate.ts

@@ -30,16 +30,16 @@ import { SGraphCommand, SGraphItem, SGraphScene } from "@persagy-web/graph/";
 /**
  * 多边形、折线等相关顶点的位置更新命令
  *
- * @author  韩耀龙
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SGraphPointListUpdate extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /**  指向item对象 */
+    /** 指向 item 对象 */
     item: SGraphItem;
-    /**  原位置 */
+    /** 原位置 */
     old: SPoint;
-    /**  当前位置 */
+    /** 当前位置 */
     pos: SPoint;
     /** 索引 */
     index: number;
@@ -48,13 +48,14 @@ export class SGraphPointListUpdate extends SGraphCommand {
 
     /**
      * 构造函数
-     * @param   scene       item所在场景
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   old         原位置
-     * @param   pos         当前位置
-     * @param   index       索引
-     */
+     *
+     * @param scene       item 所在场景
+     * @param item        指向 item 对象
+     * @param pointList   顶点数组
+     * @param old         原位置
+     * @param pos         当前位置
+     * @param index       索引
+    */
     constructor(
         scene: SGraphScene,
         item: SGraphItem,
@@ -75,7 +76,7 @@ export class SGraphPointListUpdate extends SGraphCommand {
 
     /**
      * 执行重做操作执行
-     */
+    */
     redo(): void {
         this.pointList[this.index].x = this.pos.x;
         this.pointList[this.index].y = this.pos.y;
@@ -84,7 +85,7 @@ export class SGraphPointListUpdate extends SGraphCommand {
 
     /**
      * 执行取消操作执行
-     */
+    */
     undo(): void {
         this.pointList[this.index].x = this.old.x;
         this.pointList[this.index].y = this.old.y;
@@ -94,7 +95,8 @@ export class SGraphPointListUpdate extends SGraphCommand {
     /**
      * 命令细节描述
      *
-     * */
+     * @return 字符串型数据
+    */
     toString(): string {
         const pointList = `pointList=${JSON.stringify(this.pointList)}`;
         const old = `old=${JSON.stringify(this.old)}`;

+ 15 - 14
persagy-web-edit/src/commands/SGraphPropertyCommand.ts

@@ -31,12 +31,12 @@ import { SGraphScene } from "@persagy-web/graph/";
 /**
  * 属性修改命令类
  *
- * @author  张宇(taohuzy@163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SGraphPropertyCommand<T> extends SGraphCommand {
-    /** 命令名称    */
+    /** 命令名称 */
     readonly command: string;
-    /**	指向item对象	*/
+    /**	指向 item 对象 */
     item: SGraphItem;
     /** 属性名称 */
     propName: string;
@@ -48,12 +48,12 @@ export class SGraphPropertyCommand<T> extends SGraphCommand {
     /**
      * 构造函数
      *
-     * @param   scene       命令所属的场景类
-     * @param   item        命令所属的item类
-     * @param   propName    修改的属性名称
-     * @param   oldProp     修改前的属性值
-     * @param   newProp     修改后的属性值
-     */
+     * @param scene       命令所属的场景类
+     * @param item        命令所属的 item 
+     * @param propName    修改的属性名称
+     * @param oldProp     修改前的属性值
+     * @param newProp     修改后的属性值
+    */
     constructor(
         scene: SGraphScene,
         item: SGraphItem,
@@ -71,8 +71,8 @@ export class SGraphPropertyCommand<T> extends SGraphCommand {
     } // Constructor
 
     /**
-     * redo操作
-     */
+     * redo 操作
+    */
     redo(): void {
         // @ts-ignore
         this.item[this.propName] = this.newProp;
@@ -80,8 +80,8 @@ export class SGraphPropertyCommand<T> extends SGraphCommand {
     } // Function redo()
 
     /**
-     * undo操作
-     */
+     * undo 操作
+    */
     undo(): void {
         // @ts-ignore
         this.item[this.propName] = this.oldProp;
@@ -91,7 +91,8 @@ export class SGraphPropertyCommand<T> extends SGraphCommand {
     /**
      * 命令细节描述
      *
-     * */
+     * @return 字符串型数据
+    */
     toString(): string {
         const propName = `propName=${this.propName}`;
         const oldProp = `oldProp=${JSON.stringify(this.oldProp)}`;

+ 5 - 5
persagy-web-edit/src/enums/SGraphLayoutType.ts

@@ -27,12 +27,12 @@
 /**
  * 布局对齐方式
  *
- * @author  郝建龙
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export enum SGraphLayoutType {
-    /** 垂直分布    */
+    /** 垂直分布 */
     Vertical,
-    /** 垂直分布    */
+    /** 垂直分布 */
     Horizontal,
     /** 左对齐 */
     Left,
@@ -42,8 +42,8 @@ export enum SGraphLayoutType {
     Top,
     /** 底对齐 */
     Bottom,
-    /** 水平居中    */
+    /** 水平居中 */
     Center,
-    /** 垂直居中    */
+    /** 垂直居中 */
     Middle
 } // Enum SGraphLayoutType

+ 3 - 3
persagy-web-edit/src/enums/SImageShowType.ts

@@ -25,12 +25,12 @@
  */
 
 /**
- * 图片item展示方式
+ * 图片 item 展示方式
  *
- * @author  haojianlong
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export enum SImageShowType {
-    /** 铺满  */
+    /** 铺满 */
     Full,
     /** 自适应 */
     AutoFit,

+ 5 - 5
persagy-web-edit/src/enums/SLineStyle.ts

@@ -27,15 +27,15 @@
 /**
  * 线样式
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export enum SLineStyle {
-    /** 实线    */
+    /** 实线 */
     Solid,
-    /** 虚线    */
+    /** 虚线 */
     Dashed,
-    /** 点线    */
+    /** 点线 */
     Dotted,
-    /** 无    */
+    /** 无 */
     None
 } // Enum SLineStyle

+ 5 - 5
persagy-web-edit/src/enums/SOrderSetType.ts

@@ -27,15 +27,15 @@
 /**
  * 图层操作
  *
- * @author  郝建龙
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export enum SOrderSetType {
-    /** 置顶  */
+    /** 置顶 */
     Top,
-    /** 置底    */
+    /** 置底 */
     Bottom,
-    /** 上移一层    */
+    /** 上移一层 */
     After,
-    /** 下移一层    */
+    /** 下移一层 */
     Before
 } // Enum SOrderSetType

+ 4 - 4
persagy-web-edit/src/enums/STextOrigin.ts

@@ -27,11 +27,11 @@
 /**
  * 文本原点位置
  *
- * @author  张宇
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export enum STextOrigin {
-  /** 左上点    */
+  /** 左上点 */
   LeftTop,
-  /** 中心点    */
-  Centrum,
+  /** 中心点 */
+  Center,
 } // Enum STextOrigin

+ 2 - 0
persagy-web-edit/src/index.ts

@@ -23,6 +23,7 @@
  *
  * *********************************************************************************************************************
  */
+
 import { SGraphEdit } from "./SGraphEdit";
 import { SGraphEditScene } from "./SGraphEditScene";
 import { SBaseArrowEdit } from "./items/SBaseArrowEdit";
@@ -42,4 +43,5 @@ import { SGraphPointListDelete } from "./commands/SGraphPointListDelete";
 import { SGraphPointListInsert } from "./commands/SGraphPointListInsert";
 import { SGraphPointListUpdate } from "./commands/SGraphPointListUpdate";
 import { SGraphPropertyCommand } from "./commands/SGraphPropertyCommand";
+
 export {SBasePolylineEdit, SBaseIconTextEdit, SBasePolygonEdit, SBaseTextEdit, SBaseImageEdit, SBaseLineEdit, SBaseCircleEdit, SBaseTriangleEdit, SBaseRectEdit, SBaseArrowEdit, SGraphEditScene, SGraphEdit, SGraphCommand, SGraphAddCommand, SGraphMoveCommand, SGraphPointListDelete, SGraphPointListInsert, SGraphPointListUpdate, SGraphPropertyCommand }

+ 34 - 31
persagy-web-edit/src/items/SBaseArrowEdit.ts

@@ -43,9 +43,9 @@ import { Marker } from "./../type/Marker";
 export class SBaseArrowEdit extends SGraphEdit {
   /** 编辑相关操作的数据 */
   data: Marker;
-  /** undo/redo堆栈 */
+  /** undo/redo 堆栈 */
   private undoStack: SUndoStack = new SUndoStack();
-  /** 是否绘制完成  */
+  /** 是否绘制完成 */
   _status: SItemStatus = SItemStatus.Normal;
   get status(): SItemStatus {
     return this._status;
@@ -77,7 +77,7 @@ export class SBaseArrowEdit extends SGraphEdit {
   dis: number = 5;
   /** 拖动灵敏度 */
   private sceneDis: number = 5;
-  /** 是否垂直水平绘制   */
+  /** 是否垂直水平绘制  */
   private _verAndLeve: Boolean = false;
   get verAndLeve(): Boolean {
     return this._verAndLeve;
@@ -145,7 +145,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * 构造函数
    *
    * @param parent    指向父对象
-   * @param data      矩形数据
+   * @param data      数据
    */
   constructor(parent: SGraphItem | null, data: Marker) {
     super(parent);
@@ -160,14 +160,17 @@ export class SBaseArrowEdit extends SGraphEdit {
         });
         this.line = setPointList;
       }
+
       // 颜色
       if (data.style.default.strokeColor) {
         this.strokeColor = new SColor(data.style.default.strokeColor)
       }
+
       // 线宽
       if (data.style.default.LineWidth) {
         this.lineWidth = data.style.default.lineWidth
       }
+
       // 线样式
       if (data.style.default.LineStyle) {
         this.lineStyle = data.style.default.lineStyle
@@ -178,9 +181,9 @@ export class SBaseArrowEdit extends SGraphEdit {
   /**
    * 鼠标双击事件
    *
-   * @param	event         事件参数
-   * @return	是否处理该事件
-   */
+   * @param	event   事件参数
+   * @return 是否处理该事件
+  */
   onDoubleClick(event: SMouseEvent): boolean {
     if (this.status == SItemStatus.Normal) {
       this.status = SItemStatus.Edit;
@@ -197,9 +200,9 @@ export class SBaseArrowEdit extends SGraphEdit {
   /**
    * 鼠标按下事件
    *
-   * @param   event   鼠标事件
+   * @param event   鼠标事件
    * @return  是否处理该事件
-   */
+  */
   onMouseDown(event: SMouseEvent): boolean {
     this.curIndex = -1;
     this.curPoint = null;
@@ -223,11 +226,11 @@ export class SBaseArrowEdit extends SGraphEdit {
   } // Function onMouseDown()
 
   /**
-   * shift垂直水平创建或编辑
+   * shift 垂直水平创建或编辑
    *
-   * @param   event   事件
+   * @param event   事件
    * @return  返回鼠标事件
-   */
+  */
   compare(event: SMouseEvent): SMouseEvent {
     if (this.line.length) {
       let last = new SPoint(event.x, event.y);
@@ -254,10 +257,10 @@ export class SBaseArrowEdit extends SGraphEdit {
   } // Function compare()
 
   /**
-   * 获取点击点与Point[]中的点距离最近点
+   * 获取点击点与 Point[] 中的点距离最近点
    *
-   * @param   p   鼠标点击点
-   */
+   * @param p   鼠标点击点
+  */
   findNearestPoint(p: SPoint): void {
     let len = this.sceneDis;
     for (let i = 0; i < this.line.length; i++) {
@@ -278,9 +281,9 @@ export class SBaseArrowEdit extends SGraphEdit {
   /**
    * 鼠标移动事件
    *
-   * @param   event   鼠标事件
+   * @param event   鼠标事件
    * @return  是否处理事件
-   */
+  */
   onMouseMove(event: SMouseEvent): boolean {
     if (event.shiftKey || this._verAndLeve) {
       event = this.compare(event);
@@ -310,7 +313,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    *
    * @param	event   事件参数
    * @return 是否处理该事件
-   */
+  */
   onMouseUp(event: SMouseEvent): boolean {
     if (this.status == SItemStatus.Edit) {
       if (this.curIndex > -1) {
@@ -337,7 +340,7 @@ export class SBaseArrowEdit extends SGraphEdit {
 
   /**
    * 计算矩形的左上角和右下角
-   */
+  */
   private calRect(): void {
     if (this.line.length > 1) {
       const fi = this.line[0];
@@ -368,7 +371,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * 添加点至数组中
    *
    * @param p   添加的点
-   */
+  */
   private addPoint(p: SPoint): void {
     if (this.line.length < 2) {
       this.line.push(p);
@@ -390,7 +393,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    *
    * @param x   x 坐标
    * @param y   y 坐标
-   */
+  */
   moveToOrigin(x: number, y: number): void {
     super.moveToOrigin(x, y);
     this.line = this.line.map(t => {
@@ -408,7 +411,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    *
    * @param	SGraphCommand   相关命令类
    * @param	any             对应传入参数
-   */
+  */
   protected recordAction(SGraphCommand: any, any: any[]): void {
     // 记录相关命令并推入堆栈中
     const command = new SGraphCommand(this.scene, this, ...any);
@@ -421,7 +424,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * @param x   x 横向坐标
    * @param y   y 纵向坐标
    * @return  在区域内返回 true, 否则 false
-   */
+  */
   contains(x: number, y: number): boolean {
     if (this.line.length == 2) {
       let p = new SPoint(x, y);
@@ -440,7 +443,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * Item 对象边界区域
    *
    * @return 外接矩阵
-   */
+  */
   boundingRect(): SRect {
     if (this.line.length > 1) {
       this.calRect()
@@ -452,7 +455,7 @@ export class SBaseArrowEdit extends SGraphEdit {
 
   /**
    * 撤销操作
-   */
+  */
   undo(): void {
     if (this._status != SItemStatus.Normal) {
       this.undoStack.undo();
@@ -461,7 +464,7 @@ export class SBaseArrowEdit extends SGraphEdit {
 
   /**
    * 重做操作
-   */
+  */
   redo(): void {
     if (this._status != SItemStatus.Normal) {
       this.undoStack.redo();
@@ -470,7 +473,7 @@ export class SBaseArrowEdit extends SGraphEdit {
 
   /**
    * 取消操作执行
-   */
+  */
   cancelOperate(): void {
     if (this.status == SItemStatus.Create) {
       this.parent = null;
@@ -485,7 +488,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * Item绘制操作
    *
    * @param painter   绘制对象
-   */
+  */
   onDraw(painter: SPainter): void {
     painter.pen.color = this.strokeColor;
     if (this.line.length == 2) {
@@ -546,7 +549,7 @@ export class SBaseArrowEdit extends SGraphEdit {
    * 返回对象储存的相关数据
    *
    * @return	实体类保存得数据
-   */
+  */
   toData(): any {
     const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
     this.data.style.default.line = Line;
@@ -554,5 +557,5 @@ export class SBaseArrowEdit extends SGraphEdit {
     this.data.style.default.lineStyle = this.lineStyle;
     this.data.style.default.strokeColor = this.strokeColor;
     return this.data
-  } // Function toData
-} // Class SArrowEdit
+  } // Function toData()
+} // Class SArrowEdit

+ 36 - 31
persagy-web-edit/src/items/SBaseCircleEdit.ts

@@ -60,7 +60,7 @@ export class SBaseCircleEdit extends SGraphEdit {
   set line(arr: SPoint[]) {
     this._line = arr;
     this.update();
-  } // Get line
+  } // Set line
 
   /** 矩形左上角 */
   private _leftTop: SPoint = new SPoint();
@@ -79,7 +79,8 @@ export class SBaseCircleEdit extends SGraphEdit {
     this._radius = v;
     this.update();
   } // Set radius
-  /** 线条颜色    */
+
+  /** 线条颜色 */
   _strokeColor: SColor = SColor.Black;
   get strokeColor(): SColor {
     return this._strokeColor;
@@ -109,7 +110,7 @@ export class SBaseCircleEdit extends SGraphEdit {
     this.update();
   } // Set lineStyle
 
-  /** 线条宽度    */
+  /** 线条宽度 */
   _lineWidth: number = 1;
   get lineWidth(): number {
     return this._lineWidth;
@@ -119,7 +120,7 @@ export class SBaseCircleEdit extends SGraphEdit {
     this.update();
   } // Set lineWidth
 
-  /** undo/redo堆栈 */
+  /** undo/redo 堆栈 */
   private undoStack: SUndoStack = new SUndoStack();
 
   /**
@@ -127,7 +128,7 @@ export class SBaseCircleEdit extends SGraphEdit {
    *
    * @param parent    指向父对象
    * @param data      矩形数据
-   */
+  */
   constructor(parent: SGraphItem | null, data: Marker) {
     super(parent);
     this.data = data;
@@ -165,7 +166,10 @@ export class SBaseCircleEdit extends SGraphEdit {
 
   /**
    * 大小改变
-   */
+   *
+   * @param oldSize  旧数据
+   * @param newSize  新数据
+  */
   resize(oldSize: SRect, newSize: SRect): void {
     const xs = newSize.width / oldSize.width;
     const ys = newSize.height / oldSize.height;
@@ -174,6 +178,7 @@ export class SBaseCircleEdit extends SGraphEdit {
       t.y = t.y * ys;
       return t
     })
+
     this.calRect()
     this.update()
   } // Function resize()
@@ -181,9 +186,9 @@ export class SBaseCircleEdit extends SGraphEdit {
   /**
    * 鼠标按下事件
    *
-   * @param   event   鼠标事件
-   * @return  是否处理事件
-   */
+   * @param event   鼠标事件
+   * @return 是否处理事件
+  */
   onMouseDown(event: SMouseEvent): boolean {
     if (event.buttons == SMouseButton.LeftButton) {
       if (this.status == SItemStatus.Create) {
@@ -200,9 +205,9 @@ export class SBaseCircleEdit extends SGraphEdit {
   /**
    * 鼠标移动事件
    *
-   * @param   event   鼠标事件
-   * @return  是否处理事件
-   */
+   * @param event   鼠标事件
+   * @return 是否处理事件
+  */
   onMouseMove(event: SMouseEvent): boolean {
     if (this.status == SItemStatus.Create) {
       if (this.line[0] instanceof SPoint) {
@@ -220,9 +225,9 @@ export class SBaseCircleEdit extends SGraphEdit {
   /**
    * 鼠标抬起事件
    *
-   * @param	event         事件参数
-   * @return	boolean
-   */
+   * @param	event    事件参数
+   * @return 是否处理该事件
+  */
   onMouseUp(event: SMouseEvent): boolean {
     if (this.status != SItemStatus.Create) {
       super.onMouseUp(event);
@@ -233,7 +238,7 @@ export class SBaseCircleEdit extends SGraphEdit {
 
   /**
    * 计算矩形的左上角和右下角
-   */
+  */
   private calRect(): void {
     if (this.line.length > 1) {
       const fi = this.line[0];
@@ -263,8 +268,8 @@ export class SBaseCircleEdit extends SGraphEdit {
   /**
    * 添加点至数组中
    *
-   * @param   p       添加的点
-   */
+   * @param p   添加的点
+  */
   private addPoint(p: SPoint): void {
     if (this.line.length < 2) {
       this.line.push(p);
@@ -286,7 +291,7 @@ export class SBaseCircleEdit extends SGraphEdit {
    *
    * @param	SGraphCommand   相关命令类
    * @param	any             对应传入参数
-   */
+  */
   protected recordAction(SGraphCommand: any, any: any[]): void {
     // 记录相关命令并推入堆栈中
     const command = new SGraphCommand(this.scene, this, ...any);
@@ -294,10 +299,10 @@ export class SBaseCircleEdit extends SGraphEdit {
   } // Function recordAction()
 
   /**
-   * Item对象边界区域
+   * Item 对象边界区域
    *
-   * @return SRect  外接矩阵
-   */
+   * @return SRect   外接矩阵
+  */
   boundingRect(): SRect {
     if (this.line.length > 1) {
       this.calRect()
@@ -309,7 +314,7 @@ export class SBaseCircleEdit extends SGraphEdit {
 
   /**
    * 撤销操作
-   */
+  */
   undo(): void {
     if (this._status != SItemStatus.Normal) {
       this.undoStack.undo();
@@ -318,7 +323,7 @@ export class SBaseCircleEdit extends SGraphEdit {
 
   /**
    * 重做操作
-   */
+  */
   redo(): void {
     if (this._status != SItemStatus.Normal) {
       this.undoStack.redo();
@@ -327,7 +332,7 @@ export class SBaseCircleEdit extends SGraphEdit {
 
   /**
    * 取消操作执行
-   */
+  */
   cancelOperate(): void {
     if (this.status == SItemStatus.Create) {
       this.parent = null;
@@ -342,7 +347,7 @@ export class SBaseCircleEdit extends SGraphEdit {
    * 返回对象储存的相关数据
    *
    * @return  实体类数据
-   */
+  */
   toData(): any {
     const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
     this.data.style.line = Line;
@@ -351,13 +356,13 @@ export class SBaseCircleEdit extends SGraphEdit {
     this.data.style.default.strokeColor = this.strokeColor.value;
     this.data.style.default.fillColor = this.fillColor.value;
     return this.data
-  }
+  } // Function toData()
 
   /**
-   * Item绘制操作
+   * Item 绘制操作
    *
-   * @param   painter painter对象
-   */
+   * @param painter    绘制对象
+  */
   onDraw(painter: SPainter): void {
     if (this.line.length == 2) {
       this.calRect()
@@ -384,4 +389,4 @@ export class SBaseCircleEdit extends SGraphEdit {
       );
     }
   } // Function onDraw()
-} // Class SCircleEdit
+} // Class SCircleEdit

+ 35 - 30
persagy-web-edit/src/items/SBaseIconTextEdit.ts

@@ -48,13 +48,13 @@ import { SGraphEdit } from "..";
 import { Marker } from "../type/Marker";
 
 /**
- * 图例item  icon
+ * 图
  *
  * @author 韩耀龙 <han_yao_long@163.com>
  */
 
 export class SBaseIconTextEdit extends SGraphEdit {
-    /** item状态 */
+    /** item 状态 */
     _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
@@ -74,10 +74,11 @@ export class SBaseIconTextEdit extends SGraphEdit {
             this.textItem.moveable = false;
             this.img.moveable = false;
         }
+
         this.update();
     } // Set status
 
-    /** 锚点list */
+    /** 锚点 list */
     anchorList: SAnchorItem[] = [];
     /** 是否显示文字 */
     _showText: boolean = true;
@@ -106,6 +107,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
         if (this.selected == value) {
             return;
         }
+
         this._selected = value;
         if (value) {
             this.img.scale = 1.25;
@@ -114,6 +116,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
             this.img.scale = 1;
             this.zOrder = ItemOrder.markOrder;
         }
+
         this.update();
     } // Set selected
 
@@ -133,6 +136,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
             this.textItem.cursor = "auto";
             this.img.cursor = "auto";
         }
+
         this.update();
     } // Set isActive
 
@@ -146,7 +150,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
         this.update();
     } // Set activeColor
 
-    /** X轴坐标 */
+    /** X 轴坐标 */
     get x(): number {
         return this.pos.x;
     } // Get x
@@ -156,7 +160,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
         this.update();
     } // Set x
 
-    /** Y轴坐标 */
+    /** Y 轴坐标 */
     get y(): number {
         return this.pos.y;
     } // Get y
@@ -166,7 +170,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
         this.update();
     } // Set y
 
-    /** icon宽 */
+    /** icon 宽 */
     get sWidth(): number {
         return this.img.width;
     } // Get sWidth
@@ -180,7 +184,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
         this.update();
     } // Set sWidth
 
-    /** icon高 */
+    /** icon 高 */
     get sHeight(): number {
         return this.img.height;
     } // Get sHeight
@@ -232,16 +236,17 @@ export class SBaseIconTextEdit extends SGraphEdit {
         this.textItem.font = v;
         this.update();
     } // Set font
-    /** img Item */
+    /** 图像 */
     img: SImageItem = new SImageItem(this);
-    /** text item */
+    /** 文本 */
     textItem: STextItem = new STextItem(this);
+
     /**
      * 构造体
      *
-     * @param   parent  父类
-     * @param   data    锚点数据
-     */
+     * @param parent  父节点
+     * @param data    锚点数据
+    */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
         this.img.width = 32;
@@ -281,13 +286,14 @@ export class SBaseIconTextEdit extends SGraphEdit {
             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) {
@@ -296,10 +302,6 @@ export class SBaseIconTextEdit extends SGraphEdit {
                 { x: this.img.x, y: this.img.y },
                 { x: this.img.x, y: this.img.y },
                 { x: this.img.x, y: this.img.y }
-                // { x: this.img.x, y: this.img.y + this.img.height / 2 },
-                // { x: this.img.x, y: this.img.y - this.img.height / 2 },
-                // { 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) => {
                 item.moveTo(anchorPoint[index].x, anchorPoint[index].y);
@@ -310,24 +312,25 @@ export class SBaseIconTextEdit extends SGraphEdit {
     /**
      * 鼠标按下事件
      *
-     * @param   event   事件对象
+     * @param event   事件对象
      * @return  是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
             return super.onMouseDown(event);
         } else if (this.status == SItemStatus.Edit) {
             return super.onMouseDown(event);
         }
+
         return true;
     } // Function onMouseDown()
 
     /**
      * 宽高发发生变化
      *
-     * @param   oldSize 改之前的大小
-     * @param   newSize 改之后大小
-     * */
+     * @param oldSize   改之前的大小
+     * @param newSize   改之后大小
+    */
     onResize(oldSize: SSize, newSize: SSize) {
         console.log(arguments);
     } // Function onResize()
@@ -335,9 +338,9 @@ export class SBaseIconTextEdit extends SGraphEdit {
     /**
      * 鼠标双击事件
      *
-     * @param   event   鼠标事件
-     * @return  是否处理事件
-     */
+     * @param event   鼠标事件
+     * @return 是否处理事件
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         // 如果位show状态 双击改对象则需改为编辑状态
         if (SItemStatus.Normal == this.status) {
@@ -347,6 +350,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
+
         this.update();
         return true;
     } // Function onDoubleClick()
@@ -354,8 +358,8 @@ export class SBaseIconTextEdit extends SGraphEdit {
     /**
      * 宽高发生变化
      *
-     * @return  SRect   所有子对象的并集
-     */
+     * @return SRect   所有子对象的并集
+    */
     boundingRect(): SRect {
         let rect = this.img
             .boundingRect()
@@ -367,14 +371,15 @@ export class SBaseIconTextEdit extends SGraphEdit {
                     .adjusted(this.textItem.pos.x, this.textItem.pos.y, 0, 0)
             );
         }
+
         return rect.adjusted(-5, -5, 10, 10);
     } // Function boundingRect()
 
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter painter对象
-     */
+     * @param painter    绘制对象
+    */
     onDraw(painter: SPainter): void {
         if (this.status == SItemStatus.Edit) {
             painter.pen.lineWidth = painter.toPx(1);

+ 60 - 38
persagy-web-edit/src/items/SBaseImageEdit.ts

@@ -35,18 +35,18 @@ import { ItemOrder } from '@persagy-web/big/lib';
 /**
  * 图片编辑类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseImageEdit extends SGraphEdit {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
     /**编辑相关操作的数据 */
     data: Marker
-    /** 起始锚点  */
+    /** 起始锚点 */
     startItem: SGraphItem | null = null;
-    /** 结束锚点  */
+    /** 结束锚点 */
     endItem: SGraphItem | null = null;
-    /** 图片dom */
+    /** 图片 */
     img: CanvasImageSource | undefined;
     /** 展示模式 */
     private _showType: SImageShowType = SImageShowType.Full;
@@ -58,6 +58,7 @@ export class SBaseImageEdit extends SGraphEdit {
         this.computeImgSize();
         this.update();
     } //Set showType
+
     /** 边框色 */
     private _strokeColor: SColor = SColor.Transparent;
     get strokeColor(): SColor {
@@ -77,7 +78,8 @@ export class SBaseImageEdit extends SGraphEdit {
         this._lineWidth = v;
         this.update();
     } //Set lineWidth
-    /** 原点位置    */
+
+    /** 原点位置 */
     private _originPosition: STextOrigin = STextOrigin.LeftTop;
     get originPosition(): STextOrigin {
         return this._originPosition;
@@ -87,7 +89,7 @@ export class SBaseImageEdit extends SGraphEdit {
         this.update();
     } //Set originPosition
 
-    /** 线条样式    */
+    /** 线条样式 */
     private _lineStyle: SLineStyle = SLineStyle.Solid;
     get lineStyle(): SLineStyle {
         return this._lineStyle;
@@ -96,6 +98,7 @@ export class SBaseImageEdit extends SGraphEdit {
         this._lineStyle = v;
         this.update();
     } //Set lineStyle
+
     /** 图片加载是否完成 */
     isLoadOver: boolean = false;
 
@@ -130,8 +133,8 @@ export class SBaseImageEdit extends SGraphEdit {
                     this.update();
                 }
             }
-
         };
+
         this.img.onerror = (e): void => {
             // @ts-ignore
             const imgSrc = e.path[0].src;
@@ -142,13 +145,15 @@ export class SBaseImageEdit extends SGraphEdit {
                 console.log("加载图片错误!", e);
             }
         };
+
         this.img.src = v;
     }  //Set url
-    /** 锚点list  */
+
+    /** 锚点 list */
     anchorList: SAnchorItem[] = [];
-    /** 宽度  */
+    /** 宽度 */
     private _width: number = 64;
-    /** 原点  */
+    /** 原点 */
     origin = new SPoint();
     get width(): number {
         return this._width;
@@ -166,7 +171,7 @@ export class SBaseImageEdit extends SGraphEdit {
         }
     } //Set width
 
-    /** 高度  */
+    /** 高度 */
     private _height: number = 64;
     get height(): number {
         return this._height;
@@ -183,6 +188,7 @@ export class SBaseImageEdit extends SGraphEdit {
             }
         }
     } //Set height
+
     /**编辑状态 */
     protected _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
@@ -198,12 +204,12 @@ export class SBaseImageEdit extends SGraphEdit {
     } //Set status
 
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    //函数
+    // 函数
     /**
      * 构造函数
      *
-     * @param   parent      指向父对象
-     */
+     * @param parent    指向父对象
+    */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
         this.zOrder = ItemOrder.imageOrder;
@@ -216,26 +222,32 @@ export class SBaseImageEdit extends SGraphEdit {
             this.width = data.size.width;
             this.height = data.size.height;
         }
+
         if (data.style && data.style.default) {
             if (data.style.default.zorder) {
                 this.zOrder = data.style.default.zorder;
             }
+
             // 图片url
             if (data.style.default.url) {
                 this.url = data.style.default.url;
             }
+
             // 线宽
             if (data.style.default.lineWidth) {
                 this.lineWidth = data.style.default.lineWidth;
             }
+
             // 线颜色
             if (data.style.default.strokeColor) {
                 this.strokeColor = new SColor(data.style.default.strokeColor)
             }
+
             // 线样式
             if (data.style.default.lineStyle) {
                 this.lineStyle = data.style.default.lineStyle
             }
+
             this.origin = new SPoint(this.width / 2, this.height / 2);
         }
     }
@@ -243,8 +255,8 @@ export class SBaseImageEdit extends SGraphEdit {
     /**
      * 将类中得数据转换为方便存储格式的方法
      *
-     * return   any         针对item类型保持相应的格式
-     */
+     * @return 针对 item 类型保持相应的格式
+    */
     toData(): any {
         if (this.data.size) {
             this.data.size.width = this.width;
@@ -266,18 +278,18 @@ export class SBaseImageEdit extends SGraphEdit {
         this.data.style.default.strokeColor = this.strokeColor.value;
         this.data.style.default.lineStyle = this.lineStyle;
         return this.data
-    }
+    } // Function toData()
 
     /**
      * 根据显示模式计算图片的宽高
-     */
+    */
     computeImgSize(): void {
         if (this.isLoadOver) {
             // 要绘制图片的宽度
             let width = 0;
             // 要绘制图片的宽度
             let height = 0;
-            // 图片item的宽高比
+            // 图片 item 的宽高比
             let itemAspectRatio: number = this.width / this.height;
             // 原始图片的宽高比
             let imgAspectRatio: number =
@@ -309,13 +321,16 @@ export class SBaseImageEdit extends SGraphEdit {
                 width = this.width;
                 height = this.height;
             }
+
             this.imgWidth = width;
             this.imgHeight = height;
             // 设置原点位置(默认左上角)
             if (this.originPosition == STextOrigin.Centrum) {
                 this.origin = new SPoint(this.width / 2, this.height / 2);
             }
+
         }
+
         this.origin = new SPoint(this.width / 2, this.height / 2);
         this.update();
     } // Function computeImgSize()
@@ -323,9 +338,9 @@ export class SBaseImageEdit extends SGraphEdit {
     /**
      * 判断当前地址和回调地址是否相同
      *
-     * @param   imgUrl      图片回调地址
-     * @return  当前地址和回调地址是否相同
-     */
+     * @param imgUrl     图片回调地址
+     * @return 当前地址和回调地址是否相同
+    */
     private isUrlIdentical(imgUrl: string): boolean {
         if (this.url.indexOf("://") == -1) {
             // eslint-disable-next-line max-len
@@ -342,9 +357,10 @@ export class SBaseImageEdit extends SGraphEdit {
 
     /**
      * 截取绝对路径中的相对路径
-     * @param   url      绝对路径
      *
-     */
+     * @param url     绝对路径
+     * @return 相对路径
+    */
     private GetUrlRelativePath(url: string): string {
         const arrUrl = url.split("//");
         const start = arrUrl[1].indexOf("/");
@@ -354,18 +370,21 @@ export class SBaseImageEdit extends SGraphEdit {
 
     /**
      * 大小改变
-     */
+     *
+     * @param oldSize    旧数据
+     * @param newSize    新数据
+    */
     resize(oldSize: SRect, newSize: SRect): void {
         this.width = newSize.width;
         this.height = newSize.height;
         this.update()
-    }
+    } // Function resize()
 
     /**
-     * Item对象边界区域
+     * Item 对象边界区域
      *
-     * @return	SRect
-     */
+     * @return	边界区域
+    */
     boundingRect(): SRect {
         return new SRect(
             -this.origin.x,
@@ -376,27 +395,28 @@ export class SBaseImageEdit extends SGraphEdit {
     } // Function boundingRect()
 
     /**
-   * 宽高发发生变化
-   *
-   * @param   oldSize 改之前的大小
-   * @param   newSize 改之后大小
-   * */
+     * 宽高发发生变化
+     *
+     * @param oldSize   改之前的大小
+     * @param newSize   改之后大小
+    */
     protected onResize(oldSize: SSize, newSize: SSize): void {
         this.computeImgSize();
         this.update();
     } // Function onResize()
 
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter      绘画类
-     */
+     * @param painter    绘画类
+    */
     onDraw(painter: SPainter): void {
         painter.translate(-this.origin.x, -this.origin.y);
         if (this.isLoadOver) {
             // @ts-ignore
             painter.drawImage(this.img, 0, 0, this.imgWidth, this.imgHeight);
         }
+
         if (this.selected) {
             painter.shadow.shadowBlur = 10;
             painter.shadow.shadowColor = new SColor(`#00000033`);
@@ -405,6 +425,7 @@ export class SBaseImageEdit extends SGraphEdit {
         } else {
             painter.shadow.shadowColor = SColor.Transparent;
         }
+
         if (this.lineStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
@@ -416,10 +437,11 @@ export class SBaseImageEdit extends SGraphEdit {
                 painter.toPx(2 * this.lineWidth)
             ];
         }
+
         painter.pen.lineWidth = this.lineWidth;
         painter.pen.color = this.strokeColor;
         painter.brush.color = SColor.Transparent;
         painter.drawRect(0, 0, this.width, this.height);
     } // Function onDraw()
 
-} // Class SImageItem
+} // Class SBaseImageEdit

+ 80 - 66
persagy-web-edit/src/items/SBaseLineEdit.ts

@@ -40,27 +40,27 @@ import { Marker } from "../type/Marker";
 /**
  * 直线编辑类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseLineEdit extends SGraphEdit {
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
 
-    /**编辑相关操作的数据 */
+    /** 编辑相关操作的数据 */
     data: Marker
-    /** 起始锚点  */
+    /** 起始锚点 */
     startItem: SGraphItem | null = null;
-    /** 结束锚点  */
+    /** 结束锚点 */
     endItem: SGraphItem | null = null;
-    /** X坐标最小值  */
+    /** X 坐标最小值 */
     private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值  */
+    /** X 坐标最大值 */
     private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值  */
+    /** Y 坐标最小值 */
     private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值  */
+    /** Y 坐标最大值 */
     private maxY = Number.MIN_SAFE_INTEGER;
-    /** 线段   */
+    /** 线段 */
     private _line: SPoint[] = [];
     get line(): SPoint[] {
         return this._line;
@@ -69,7 +69,8 @@ export class SBaseLineEdit extends SGraphEdit {
         this._line = arr;
         this.update();
     } // Set line
-    /** 是否垂直水平绘制   */
+
+    /** 是否垂直水平绘制 */
     private _verAndLeve: Boolean = false;
     get verAndLeve(): Boolean {
         return this._verAndLeve;
@@ -79,7 +80,7 @@ export class SBaseLineEdit extends SGraphEdit {
         this.update();
     } // Set verAndLeve
 
-    /** 是否完成绘制  */
+    /** 是否完成绘制 */
     protected _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
@@ -90,7 +91,7 @@ export class SBaseLineEdit extends SGraphEdit {
         this.update();
     } // Set status
 
-    /** 线条颜色    */
+    /** 线条颜色 */
     private _strokeColor: SColor = SColor.Black;
     get strokeColor(): SColor {
         return this._strokeColor;
@@ -100,7 +101,7 @@ export class SBaseLineEdit extends SGraphEdit {
         this.update();
     }// Get strokeColor
 
-    /** 线条样式    */
+    /** 线条样式 */
     private _lineStyle: SLineStyle = SLineStyle.Solid;
     get lineStyle(): SLineStyle {
         return this._lineStyle;
@@ -130,7 +131,7 @@ export class SBaseLineEdit extends SGraphEdit {
         this.update();
     } //Set activeFillColor
 
-    /** 线条宽度    */
+    /** 线条宽度 */
     private _lineWidth: number = 1;
     get lineWidth(): number {
         return this._lineWidth;
@@ -140,27 +141,23 @@ export class SBaseLineEdit extends SGraphEdit {
         this.update();
     } //Set lineWidth
 
-    /** 拖动灵敏度   */
+    /** 拖动灵敏度 */
     dis: number = 5;
-
-    /** 拖动灵敏度   */
+    /** 拖动灵敏度 */
     private sceneDis: number = 5;
-
-    /** 当前点索引   */
+    /** 当前点索引 */
     curIndex: number = -1;
-
-    /** 当前点坐标   */
+    /** 当前点坐标 */
     private curPoint: SPoint | null = null;
-
-    /** undo/redo堆栈 */
+    /** undo/redo 堆栈 */
     private undoStack: SUndoStack = new SUndoStack();
 
     /**
      * 构造函数
      *
-     * @param   parent  父级
-     * @param   l       坐标集合|第一个点坐标
-     * */
+     * @param parent    父级
+     * @param data      坐标集合|第一个点坐标
+     */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
         this.showSelect = false;
@@ -175,16 +172,18 @@ export class SBaseLineEdit extends SGraphEdit {
                 this.line = setPointList;
             }
         }
-        if (data.style && data.style.default) {
 
+        if (data.style && data.style.default) {
             // 颜色
             if (data.style.default.strokeColor) {
                 this.strokeColor = new SColor(data.style.default.strokeColor)
             }
+
             // 线宽
             if (data.style.default.lineWidth) {
                 this.lineWidth = data.style.default.lineWidth
             }
+
             // 线样式
             if (data.style.default.lineStyle) {
                 this.lineStyle = data.style.default.lineStyle
@@ -195,8 +194,8 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 添加点至数组中
      *
-     * @param   p       添加的点
-     * */
+     * @param p       添加的点
+     */
     private addPoint(p: SPoint): void {
         if (this.line.length < 2) {
             this.line.push(p);
@@ -208,14 +207,15 @@ export class SBaseLineEdit extends SGraphEdit {
             this.releaseItem();
             this.$emit("finishCreated");
         }
+
         this.update();
     } // Function addPoint()
 
     /**
      * 鼠标双击事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param	event       事件参数
+     * @return	该事件是否被处理
      */
     onDoubleClick(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
@@ -225,6 +225,7 @@ export class SBaseLineEdit extends SGraphEdit {
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
+
         this.update();
         return true;
     } // Function onDoubleClick()
@@ -232,15 +233,16 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 鼠标按下事件
      *
-     * @param   event   鼠标事件
+     * @param event   鼠标事件
      * @return  是否处理事件
-     * */
+     */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
         if (event.shiftKey || this._verAndLeve) {
             event = this.compare(event);
         }
+
         if (event.buttons == SMouseButton.LeftButton) {
             if (this.status == SItemStatus.Normal) {
                 return super.onMouseDown(event);
@@ -252,14 +254,15 @@ export class SBaseLineEdit extends SGraphEdit {
                 return true;
             }
         }
+
         return true;
     } // Function onMouseDown()
 
     /**
      * 鼠标抬起事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param	event     事件参数
+     * @return	 是否处理该事件
      */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
@@ -279,6 +282,7 @@ export class SBaseLineEdit extends SGraphEdit {
             this.moveToOrigin(this.x, this.y);
             return super.onMouseUp(event);
         }
+
         this.curIndex = -1;
         this.curPoint = null;
         return true;
@@ -287,8 +291,8 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
       * 鼠标抬起事件
       *
-      * @param	event         事件参数
-      * @return	boolean
+      * @param event     事件参数
+      * @return	 是否处理该事件
       */
     onKeyUp(event: KeyboardEvent): void {
         // 当 ESC 时
@@ -307,13 +311,14 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 鼠标移动事件
      *
-     * @param   event   鼠标事件
-     * @return  是否处理事件
-     * */
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey || this._verAndLeve) {
             event = this.compare(event);
         }
+
         if (this.status == SItemStatus.Create) {
             if (this.line[0] instanceof SPoint) {
                 this.line[1] = new SPoint(event.x, event.y);
@@ -326,15 +331,16 @@ export class SBaseLineEdit extends SGraphEdit {
         } else {
             return super.onMouseMove(event);
         }
+
         this.update();
         return true;
     } // Function onMouseMove()
 
     /**
-     * 获取点击点与Point[]中的点距离最近点
+     * 获取点击点与 Point[] 中的点距离最近点
      *
-     * @param   p   鼠标点击点
-     * */
+     * @param p   鼠标点击点
+     */
     findNearestPoint(p: SPoint): void {
         let len = this.sceneDis;
         for (let i = 0; i < this.line.length; i++) {
@@ -355,8 +361,8 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 记录相关动作并推入栈中
      *
-     * @param	SGraphCommand   相关命令类
-     * @param	any             对应传入参数
+     * @param SGraphCommand   相关命令类
+     * @param any             对应传入参数
      */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
@@ -367,9 +373,9 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
-     * @param   x   x坐标
-     * @param   y   y坐标
-     * */
+     * @param x   x 坐标
+     * @param y   y 坐标
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.line = this.line.map(t => {
@@ -377,15 +383,17 @@ export class SBaseLineEdit extends SGraphEdit {
             t.y = t.y + y;
             return t;
         });
+
         this.x = 0;
         this.y = 0;
     } // Function moveToOrigin()
 
     /**
-     * shift垂直水平创建或编辑
+     * shift 垂直水平创建或编辑
      *
-     * @param   event   事件
-     * */
+     * @param event   事件
+     * @return 鼠标事件
+     */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.line.length) {
             let last = new SPoint(event.x, event.y);
@@ -398,6 +406,7 @@ export class SBaseLineEdit extends SGraphEdit {
                     last = this.line[1];
                 }
             }
+
             const dx = Math.abs(event.x - last.x);
             const dy = Math.abs(event.y - last.y);
             if (dy > dx) {
@@ -406,15 +415,16 @@ export class SBaseLineEdit extends SGraphEdit {
                 event.y = last.y;
             }
         }
+
         return event;
     } // Function compare()
 
     /**
      * 判断点是否在区域内
      *
-     * @param   x
-     * @param   y
-     * @return  true-
+     * @param x     x 坐标
+     * @param y     y 坐标
+     * @return 是否在区域内
      */
     contains(x: number, y: number): boolean {
         if (this.line.length == 2) {
@@ -426,12 +436,12 @@ export class SBaseLineEdit extends SGraphEdit {
                 return true;
             }
         }
+
         return false;
     } // Function contains()
 
     /**
      * 撤销操作
-     *
      */
     undo(): void {
         if (this.status != SItemStatus.Normal) {
@@ -441,7 +451,6 @@ export class SBaseLineEdit extends SGraphEdit {
 
     /**
      * 重做操作
-     *
      */
     redo(): void {
         if (this.status != SItemStatus.Normal) {
@@ -450,9 +459,8 @@ export class SBaseLineEdit extends SGraphEdit {
     } // Function redo()
 
     /**
-     * 取消操作item事件
-     *
-     * */
+     * 取消操作 item 事件
+     */
     cancelOperate(): void {
         if (this.status == SItemStatus.Create) {
             this.parent = null;
@@ -464,9 +472,9 @@ export class SBaseLineEdit extends SGraphEdit {
     } // Function cancelOperate()
 
     /**
-     * Item对象边界区域
+     * Item 对象边界区域
      *
-     * @return	SRect
+     * @return	边界区域
      */
     boundingRect(): SRect {
         if (this.line.length) {
@@ -480,17 +488,21 @@ export class SBaseLineEdit extends SGraphEdit {
                 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 SRect(
             this.minX,
             this.minY,
@@ -502,9 +514,9 @@ export class SBaseLineEdit extends SGraphEdit {
     /**
      * 返回对象储存的相关数据
      *
-     * @return	formData
+     * @return	对象数据
      */
-    toData() {
+    toData(): any {
         const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
         this.data.style.default.line = Line;
         this.data.style.default.lineWidth = this.lineWidth;
@@ -514,9 +526,9 @@ export class SBaseLineEdit extends SGraphEdit {
     } // Function toData()
 
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter painter对象
+     * @param painter    绘制对象
      */
     onDraw(painter: SPainter): void {
         this.sceneDis = painter.toPx(this.dis);
@@ -536,6 +548,7 @@ export class SBaseLineEdit extends SGraphEdit {
                     painter.toPx(2 * this.lineWidth)
                 ];
             }
+
             if (this.selected && this.status == SItemStatus.Normal) {
                 painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
                 painter.shadow.shadowBlur = 10;
@@ -543,6 +556,7 @@ export class SBaseLineEdit extends SGraphEdit {
                 painter.shadow.shadowOffsetX = 5;
                 painter.shadow.shadowOffsetY = 5;
             }
+
             painter.drawLine(this.line[0], this.line[1]);
             if (
                 this.status == SItemStatus.Edit ||
@@ -572,4 +586,4 @@ export class SBaseLineEdit extends SGraphEdit {
             }
         }
     } // Function onDraw()
-} // Class SLineItem
+} // Class SBaseLineEdit

+ 97 - 74
persagy-web-edit/src/items/SBasePolygonEdit.ts

@@ -49,46 +49,43 @@ import { SGraphEdit } from ".."
 /**
  * 编辑多边形
  *
- * @author  韩耀龙
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBasePolygonEdit extends SGraphEdit {
-    /** X坐标最小值 */
+    /** X 坐标最小值 */
     private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值 */
+    /** X 坐标最大值 */
     private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值 */
+    /** Y 坐标最小值 */
     private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值 */
+    /** Y 坐标最大值 */
     private maxY = Number.MIN_SAFE_INTEGER;
-
     /** 图例节点对象数据 */
     data: Marker;
     /** 轮廓线坐标 */
     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 = SColor.Black;
-    /**  画笔颜色 */
+    /** 画笔颜色 */
     get strokeColor(): SColor {
         return this._strokeColor;
     } // Get strokeColor
@@ -117,7 +114,7 @@ export class SBasePolygonEdit extends SGraphEdit {
         this.update();
     } // Set lineStyle
 
-    /** 边框的宽 只可输入像素宽 */
+    /** 边框的宽只可输入像素宽 */
     _lineWidth: number = 1;
     get lineWidth(): number {
         return this._lineWidth;
@@ -137,11 +134,11 @@ export class SBasePolygonEdit extends SGraphEdit {
     private curPoint: null | SPoint = null;
     /** 灵敏像素 */
     private len: number = 10;
-    /** 场景像素 内部将灵敏像素换算为场景实际距离 */
+    /** 场景像素内部将灵敏像素换算为场景实际距离 */
     private scenceLen: number = 15;
     /** 场景像素 */
     private isAlt: boolean = false;
-    /** undo/redo堆栈 */
+    /** undo/redo 堆栈 */
     protected undoStack: SUndoStack = new SUndoStack();
 
     /**
@@ -172,20 +169,24 @@ export class SBasePolygonEdit extends SGraphEdit {
                     this.setPointList = setPointList;
                 }
             }
+
             // 样式相关
             if (data.style.default) {
                 // 颜色
                 if (data.style.default.strokeColor) {
                     this.strokeColor = new SColor(data.style.default.strokeColor)
                 }
+
                 // 线宽
                 if (data.style.default.lineWidth) {
                     this.lineWidth = data.style.default.lineWidth
                 }
+
                 // 线样式
                 if (data.style.default.lineStyle) {
                     this.lineStyle = data.style.default.lineStyle
                 }
+
                 // 填充色
                 if (data.style.default.fillColor) {
                     this.fillColor = new SColor(data.style.default.fillColor)
@@ -230,10 +231,10 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 储存新的多边形顶点
      *
-     * @param x   点位得x坐标
-     * @param y   点位得y坐标
+     * @param x   点位得 x 坐标
+     * @param y   点位得 y 坐标
      * @param i   储存所在索引
-     * @return SPoint。添加的顶点
+     * @return 添加的顶点
      */
     insertPoint(x: number, y: number, i: number | null = null): SPoint {
         const point = new SPoint(x, y);
@@ -242,6 +243,7 @@ export class SBasePolygonEdit extends SGraphEdit {
         } else {
             this.pointList.splice(i, 0, point);
         }
+
         this.update();
         return point;
     } // Function insertPoint()
@@ -250,7 +252,7 @@ export class SBasePolygonEdit extends SGraphEdit {
      * 删除点位
      *
      * @param i   删除点所在的索引
-     * @return    SPoint|null。索引不在数组范围则返回null
+     * @return   索引不在数组范围则返回 null
      */
     deletePoint(i: number | null = null): SPoint | null {
         let point = null;
@@ -269,6 +271,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                 point = null;
             }
         }
+
         this.curIndex = -1;
         this.curPoint = null;
         this.update();
@@ -278,29 +281,28 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 多边形顶点的移动位置
      *
-     * @param x   点位得x坐标
-     * @param y   点位得y坐标
-     * @param i   点位得i坐标
-     * @return    移动对应得点。如果索引无法找到移动顶点,则返回null
+     * @param x   点位得 x 坐标
+     * @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) {
             return null;
         }
+
         if (this.pointList.length) {
             this.pointList[i].x = x;
             this.pointList[i].y = y;
         }
+
         point = this.pointList[i];
         return point;
     } // Function movePoint()
 
-    ////////////
-    //  以下为三种状态下的绘制多边形方法
-
     /**
-     * 展示状态 --绘制多边形数组
+     * 展示状态 -- 绘制多边形数组
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
@@ -322,6 +324,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                 painter.toPx(this.lineWidth)
             ];
         }
+
         if (this.selected) {
             painter.shadow.shadowBlur = 10;
             painter.shadow.shadowColor = new SColor(`#00000033`);
@@ -330,12 +333,13 @@ export class SBasePolygonEdit extends SGraphEdit {
         } else {
             painter.shadow.shadowColor = SColor.Transparent;
         }
+
         painter.drawPolygon([...pointList]);
         painter.restore();
     } // Function drawShowPolygon()
 
     /**
-     * 创建状态 --绘制多边形数组
+     * 创建状态 -- 绘制多边形数组
      *
      * @param painter      绘制类
      * @param pointList    绘制多边形数组
@@ -352,11 +356,11 @@ export class SBasePolygonEdit extends SGraphEdit {
                 this.lastPoint.y
             );
         }
+
         painter.drawPolyline(pointList);
         painter.pen.color = SColor.Transparent;
         painter.brush.color = new SColor(this.fillColor.value);
         painter.pen.lineWidth = painter.toPx(this.lineWidth);
-
         if (this.lastPoint) {
             painter.drawPolygon([...pointList, this.lastPoint]);
             // 绘制顶点块
@@ -392,9 +396,9 @@ export class SBasePolygonEdit extends SGraphEdit {
 
     /**
      *
-     * 编辑状态 --绘制多边形数组
+     * 编辑状态 -- 绘制多边形数组
      *
-     * @param painter    绘制类
+     * @param painter      绘制类
      * @param pointList    绘制多边形数组
      */
     protected drawEditPolygon(painter: SPainter, pointList: SPoint[]): void {
@@ -412,6 +416,7 @@ export class SBasePolygonEdit extends SGraphEdit {
             if (index == this.curIndex) {
                 painter.brush.color = new SColor("#2196f3");
             }
+
             painter.drawCircle(item.x, item.y, painter.toPx(this.len / 2));
         });
     } // Function drawCreatePolygon()
@@ -420,8 +425,6 @@ export class SBasePolygonEdit extends SGraphEdit {
      * 编辑状态操作多边形数组
      *
      * @param event    鼠标事件
-     *
-     *
      */
     protected editPolygonPoint(event: SMouseEvent): void {
         //  判断是否为删除状态 isAlt = true为删除状态
@@ -441,11 +444,13 @@ export class SBasePolygonEdit extends SGraphEdit {
                     lenIndex = index;
                 }
             });
+
             // 若点击到,对该索引对应的点做删除
             if (lenIndex != -1) {
                 if (this.pointList.length <= 3) {
                     return;
                 }
+
                 const delePoint = new SPoint(
                     this.pointList[lenIndex].x,
                     this.pointList[lenIndex].y
@@ -502,6 +507,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                         }
                     }
                 }
+
                 // 判断是否有点
                 if (len.Point) {
                     // 点在了多边形的边上
@@ -525,6 +531,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                     this.pointList[this.curIndex].y
                 );
             }
+
             // 刷新视图
             this.update();
         }
@@ -532,11 +539,11 @@ export class SBasePolygonEdit extends SGraphEdit {
 
     /////////////////////
     // undo、redo相关操作
-
     /**
      * 记录相关动作并推入栈中
-     * @param	SGraphCommand         相关命令类
-     * @param	any                    对应传入参数
+     *
+     * @param SGraphCommand      相关命令类
+     * @param any                对应传入参数
      */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
@@ -561,6 +568,7 @@ export class SBasePolygonEdit extends SGraphEdit {
         if (this.status == SItemStatus.Normal) {
             return;
         }
+
         this.undoStack.redo();
     } // Function redo()
 
@@ -570,8 +578,8 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 鼠标双击事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
+     * @return  是否处理该事件
      */
     onDoubleClick(event: SMouseEvent): boolean {
         // 如果位show状态 双击改对象则需改为编辑状态
@@ -582,6 +590,7 @@ export class SBasePolygonEdit extends SGraphEdit {
             this.status = SItemStatus.Normal;
             this.releaseItem();
         }
+
         this.update();
         return true;
     } // Function onDoubleClick()
@@ -589,10 +598,9 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 键盘事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
+     * @return  是否处理该事件
      */
-
     onKeyDown(event: KeyboardEvent): boolean {
         if (this.status == SItemStatus.Normal) {
             return false;
@@ -612,6 +620,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                 this.isAlt = true;
             }
         }
+
         this.update();
         return true;
     } // Function onKeyDown()
@@ -619,8 +628,7 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 键盘键抬起事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
      */
     onKeyUp(event: KeyboardEvent): void {
         if (this.status == SItemStatus.Edit) {
@@ -633,19 +641,21 @@ export class SBasePolygonEdit extends SGraphEdit {
                 }
             }
         }
+
         this.update();
     } // Function onKeyUp()
 
     /**
      * 鼠标按下事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param	event      事件参数
+     * @return	 是否处理该事件
      */
     onMouseDown(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
         }
+
         // 如果状态为编辑状态则添加点
         if (this.status == SItemStatus.Create) {
             // 新增顶点
@@ -658,6 +668,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                     this.pointList[0].y
                 );
             }
+
             if (this.pointList.length > 2 && len > 0 && len < this.scenceLen) {
                 this.status = SItemStatus.Normal;
                 //3 传递完成事件状态
@@ -676,14 +687,15 @@ export class SBasePolygonEdit extends SGraphEdit {
         } else {
             return super.onMouseDown(event);
         }
+
         return true;
     } // Function onMouseDown()
 
     /**
      * 鼠标移入事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event   事件参数
+     * @return 是否处理该事件
      */
     onMouseEnter(event: SMouseEvent): boolean {
         return true;
@@ -692,10 +704,9 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 鼠标移出事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
+     * @return 是否处理该事件
      */
-
     onMouseLeave(event: SMouseEvent): boolean {
         return true;
     } // Function onMouseLeave()
@@ -703,14 +714,14 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 鼠标移动事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
+     * @return 是否处理该事件
      */
-
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey) {
             event = this.compare(event);
         }
+
         if (this.status == SItemStatus.Create) {
             this.lastPoint = new SPoint();
             this.lastPoint.x = event.x;
@@ -727,14 +738,15 @@ export class SBasePolygonEdit extends SGraphEdit {
         } else {
             return super.onMouseMove(event);
         }
+
         return true;
     } // Function onMouseMove()
 
     /**
-     * shift垂直水平创建或编辑
+     * shift 垂直水平创建或编辑
      *
-     * @param   event   事件
-     * */
+     * @param event   事件
+     */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -745,6 +757,7 @@ export class SBasePolygonEdit extends SGraphEdit {
                     last = this.pointList[this.curIndex - 1];
                 }
             }
+
             const dx = Math.abs(event.x - last.x);
             const dy = Math.abs(event.y - last.y);
             if (dy > dx) {
@@ -753,14 +766,15 @@ export class SBasePolygonEdit extends SGraphEdit {
                 event.y = last.y;
             }
         }
+
         return event;
     } // Function compare()
 
     /**
      * 鼠标抬起事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event    事件参数
+     * @return 是否处理该事件
      */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
@@ -786,9 +800,9 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
-     * @param   x   x坐标
-     * @param   y   y坐标
-     * */
+     * @param x   x 坐标
+     * @param y   y 坐标
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.pointList = this.pointList.map(t => {
@@ -796,6 +810,7 @@ export class SBasePolygonEdit extends SGraphEdit {
             t.y = t.y + y;
             return t;
         });
+
         this.x = 0;
         this.y = 0;
     } // Function moveToOrigin()
@@ -803,8 +818,8 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 适配事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event     事件参数
+     * @return 是否处理该事件
      */
     onResize(event: SMouseEvent): boolean {
         return true;
@@ -812,7 +827,6 @@ export class SBasePolygonEdit extends SGraphEdit {
 
     /**
      * 取消操作
-     *
      */
     cancelOperate(): void {
         // 当状态为展示状态
@@ -823,13 +837,14 @@ export class SBasePolygonEdit extends SGraphEdit {
             // 编辑状态
             this.status = SItemStatus.Normal;
         }
+
         this.update();
     } // Function cancelOperate()
 
     /**
-     * Item对象边界区域
+     * Item 对象边界区域
      *
-     * @return SRect
+     * @return 边界区域
      */
     boundingRect(): SRect {
         if (this.pointList.length) {
@@ -843,17 +858,22 @@ export class SBasePolygonEdit extends SGraphEdit {
                 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 SRect(
             this.minX,
             this.minY,
@@ -865,29 +885,32 @@ export class SBasePolygonEdit extends SGraphEdit {
     /**
      * 判断点是否在区域内
      *
-     * @param x
-     * @param y
+     * @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)) {
             return false;
         }
+
         return true;
     } // Function contains()
 
     /**
      * 返回对象储存的相关数据
      *
-     * @return	formData
+     * @return	对象参数
      */
-    toData() {
+    toData() : any {
         const Line = this.pointList.map(pos => {
             return {
                 x: pos.x,
                 y: pos.y
             }
         });
+
         this.data.style.outLine = Line;
         this.data.style.default.lineWidth = this.lineWidth;
         this.data.style.default.lineStyle = this.lineStyle;
@@ -897,9 +920,9 @@ export class SBasePolygonEdit extends SGraphEdit {
     } // Function toData()
 
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter       painter对象
+     * @param painter    绘制对象
      */
     onDraw(painter: SPainter): void {
         this.scenceLen = painter.toPx(this.len);
@@ -915,4 +938,4 @@ export class SBasePolygonEdit extends SGraphEdit {
             this.drawEditPolygon(painter, this.pointList);
         }
     } // Function onDraw()
-} // Class SPolygonItem
+} // Class SBasePolygonEdit

+ 108 - 82
persagy-web-edit/src/items/SBasePolylineEdit.ts

@@ -24,7 +24,6 @@
  * *********************************************************************************************************************
  */
 
-
 import { SColor, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw";
 import { SKeyCode, SMouseEvent, SUndoStack } from "@persagy-web/base";
 import { SItemStatus } from "@persagy-web/big";;
@@ -42,95 +41,101 @@ import { Marker } from "../type/Marker";
 /**
  * 折线编辑类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export class SBasePolylineEdit extends SGraphEdit {
     /** 传入数据 */
-    data: Marker
-    /** X坐标最小值  */
+    data: Marker;
+    /** X 坐标最小值 */
     private minX = Number.MAX_SAFE_INTEGER;
-    /** X坐标最大值  */
+    /** X 坐标最大值 */
     private maxX = Number.MIN_SAFE_INTEGER;
-    /** Y坐标最小值  */
+    /** Y 坐标最小值 */
     private minY = Number.MAX_SAFE_INTEGER;
-    /** Y坐标最大值  */
+    /** Y 坐标最大值 */
     private maxY = Number.MIN_SAFE_INTEGER;
-    /** 折点信息    */
+    /** 折点信息 */
     pointList: SPoint[] = [];
-    /** 是否绘制完成  */
+    /** 是否绘制完成 */
     _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 lastPoint: SPoint | null = null;
-    /** 线条颜色    */
+    /** 线条颜色 */
     _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
+
     /** 边框样式 */
     _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 = 1;
     get lineWidth(): number {
         return this._lineWidth;
-    }
+    } // Get lineWidth
     set lineWidth(v: number) {
         this._lineWidth = v;
         this.update();
-    }
-    /** 是否垂直水平绘制   */
+    } // Set lineWidth
+
+    /** 是否垂直水平绘制 */
     private _verAndLeve: Boolean = false;
     get verAndLeve(): Boolean {
         return this._verAndLeve;
-    }
+    } // Get verAndLeve
     set verAndLeve(bool: Boolean) {
         this._verAndLeve = bool;
         this.update();
-    }
-    /** 全局灵敏度   */
+    } // Set verAndLeve
+
+    /** 全局灵敏度 */
     dis: number = 10;
-    /** 灵敏度转换为场景长度  */
+    /** 灵敏度转换为场景长度 */
     private sceneDis: number = 10;
-    /** 当前点索引   */
+    /** 当前点索引 */
     private curIndex: number = -1;
-    /** 当前点索引   */
+    /** 当前点 */
     private curPoint: SPoint | null = null;
-    /** undo/redo堆栈 */
+    /** undo / redo 堆栈 */
     private undoStack: SUndoStack = new SUndoStack();
 
     /**
      * 构造函数
      *
-     * @param   parent  父级
-     * @param   list    第一个坐标|坐标集合
-     * */
+     * @param parent    父级
+     * @param data      折线数据
+     */
     constructor(parent: null | SGraphItem, data: Marker) {
         super(parent);
         this.data = data;
@@ -142,7 +147,7 @@ export class SBasePolylineEdit extends SGraphEdit {
                 let setPointList: SPoint[];
                 setPointList = data.style.outLine.map(i => {
                     return new SPoint(i.x, i.y)
-                })
+                });
                 this.pointList = setPointList;
             }
 
@@ -171,9 +176,9 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 添加点至数组中
      *
-     * @param   p       添加的点
-     * @param   index   添加到的索引
-     * */
+     * @param p       添加的点
+     * @param index   添加到的索引
+     */
     private addPoint(p: SPoint, index?: number): void {
         if (index && this.canHandle(index)) {
             this.pointList.splice(index, 0, p);
@@ -186,15 +191,16 @@ export class SBasePolylineEdit extends SGraphEdit {
             this.pointList.push(p);
             this.recordAction(SGraphPointListInsert, [this.pointList, p]);
         }
+
         this.update();
     } // Function addPoint()
 
     /**
      * 是否可以添加点到数组中
      *
-     * @param   index   要添加到的索引
-     * @return  boolean 是否可添加
-     * */
+     * @param index     要添加到的索引
+     * @return 是否可添加
+     */
     private canHandle(index: number): boolean {
         return index >= 0 && index <= this.pointList.length;
     } // Function canHandle()
@@ -202,8 +208,8 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 根据索引删除点
      *
-     * @param   index   删除点
-     * */
+     * @param index   删除点
+     */
     deletePoint(index: number): void {
         if (this.canHandle(index) && this.pointList.length > 2) {
             const p = new SPoint(
@@ -225,15 +231,16 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 鼠标按下事件
      *
-     * @param   event   鼠标事件
-     * @return  boolean 是否处理事件
-     * */
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
     onMouseDown(event: SMouseEvent): boolean {
         this.curIndex = -1;
         this.curPoint = null;
         if (event.shiftKey || this.verAndLeve) {
             event = this.compare(event);
         }
+
         if (event.buttons == 1) {
             if (this.status == SItemStatus.Create) {
                 this.addPoint(new SPoint(event.x, event.y));
@@ -245,29 +252,33 @@ export class SBasePolylineEdit extends SGraphEdit {
                 if (this.curIndex < 0) {
                     this.findAddPos(new SPoint(event.x, event.y));
                 }
+
                 // 删除点
                 if (event.altKey && this.canHandle(this.curIndex)) {
                     this.deletePoint(this.curIndex);
                 }
+
                 this.update();
                 return true;
             } else {
                 return super.onMouseDown(event);
             }
         }
+
         return super.onMouseDown(event);
     } // Function onMouseDown()
 
     /**
      * 鼠标移动事件
      *
-     * @param   event   鼠标事件
-     * @return  boolean 是否处理事件
-     * */
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
     onMouseMove(event: SMouseEvent): boolean {
         if (event.shiftKey || this.verAndLeve) {
             event = this.compare(event);
         }
+
         if (this.status == SItemStatus.Create) {
             if (this.lastPoint) {
                 this.lastPoint.x = event.x;
@@ -275,6 +286,7 @@ export class SBasePolylineEdit extends SGraphEdit {
             } else {
                 this.lastPoint = new SPoint(event.x, event.y);
             }
+
             this.update();
             return true;
         } else if (this.status == SItemStatus.Edit) {
@@ -284,6 +296,7 @@ export class SBasePolylineEdit extends SGraphEdit {
                     this.pointList[this.curIndex].y = event.y;
                 }
             }
+
             this.update();
             return true;
         } else {
@@ -294,9 +307,9 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 鼠标移动事件
      *
-     * @param   event   鼠标事件
-     * @return  boolean 是否处理事件
-     * */
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
     onMouseUp(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Edit) {
             if (this.curIndex > -1) {
@@ -315,14 +328,15 @@ export class SBasePolylineEdit extends SGraphEdit {
             this.moveToOrigin(this.x, this.y);
             return super.onMouseUp(event);
         }
+
         return true;
     } // Function onMouseUp()
 
     /**
      * 鼠标双击事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event     事件参数
+     * @return 是否处理事件
      */
     onDoubleClick(event: SMouseEvent): boolean {
         if (this.status == SItemStatus.Normal) {
@@ -338,14 +352,15 @@ export class SBasePolylineEdit extends SGraphEdit {
                 this.$emit("finishCreated");
             }
         }
+
         this.$emit("onDoubleClick", event);
         return true;
     } // Function onDoubleClick()
 
-    /***
+    /**
      * 键盘按键弹起事件
      *
-     * @param	event         事件参数
+     * @param event     事件参数
      */
     onKeyUp(event: KeyboardEvent): void {
         if (event.keyCode == SKeyCode.Enter) {
@@ -353,6 +368,7 @@ export class SBasePolylineEdit extends SGraphEdit {
                 if (this.status == SItemStatus.Create) {
                     this.$emit("finishCreated");
                 }
+
                 this.status = SItemStatus.Normal;
                 this.releaseItem();
             }
@@ -369,9 +385,9 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
-     * @param   x   x坐标
-     * @param   y   y坐标
-     * */
+     * @param x   x 坐标
+     * @param y   y 坐标
+     */
     moveToOrigin(x: number, y: number): void {
         super.moveToOrigin(x, y);
         this.pointList = this.pointList.map(t => {
@@ -386,8 +402,8 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 获取点击点与点集中距离最近点
      *
-     * @param   p   鼠标点击点
-     * */
+     * @param p   鼠标点击点
+     */
     findNearestPoint(p: SPoint): void {
         let len = this.sceneDis;
         for (let i = 0; i < this.pointList.length; i++) {
@@ -411,8 +427,8 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 计算增加点的位置
      *
-     * @param   p   鼠标点击点
-     * */
+     * @param p   鼠标点击点
+     */
     findAddPos(p: SPoint): void {
         let len = SMathUtil.pointToLine(
             p,
@@ -431,6 +447,7 @@ export class SBasePolylineEdit extends SGraphEdit {
                 }
             }
         }
+
         if (len.MinDis < this.sceneDis) {
             if (len.Point) {
                 this.addPoint(len.Point, index + 1);
@@ -439,10 +456,11 @@ export class SBasePolylineEdit extends SGraphEdit {
     } // Function findAddPos()
 
     /**
-     * shift垂直水平创建或编辑
+     * shift 垂直水平创建或编辑
      *
-     * @param   event   事件
-     * */
+     * @param event   事件
+     * @return 处理后的鼠标事件
+     */
     compare(event: SMouseEvent): SMouseEvent {
         if (this.pointList.length) {
             let last = new SPoint(event.x, event.y);
@@ -453,6 +471,7 @@ export class SBasePolylineEdit extends SGraphEdit {
                     last = this.pointList[this.curIndex - 1];
                 }
             }
+
             const dx = Math.abs(event.x - last.x);
             const dy = Math.abs(event.y - last.y);
             if (dy > dx) {
@@ -461,14 +480,15 @@ export class SBasePolylineEdit extends SGraphEdit {
                 event.y = last.y;
             }
         }
+
         return event;
     } // Function compare()
 
     /**
      * 记录相关动作并推入栈中
      *
-     * @param	SGraphCommand   相关命令类
-     * @param	any             对应传入参数
+     * @param SGraphCommand     相关命令类
+     * @param any               对应传入参数
      */
     protected recordAction(SGraphCommand: any, any: any[]): void {
         // 记录相关命令并推入堆栈中
@@ -477,10 +497,10 @@ export class SBasePolylineEdit extends SGraphEdit {
     } // Function recordAction()
 
     /**
-     * Item对象边界区域
+     * Item 对象边界区域
      *
-     * @return  SRect   外接矩阵
-     * */
+     * @return 对象边界区域
+     */
     boundingRect(): SRect {
         if (this.pointList.length) {
             this.minX = this.pointList[0].x;
@@ -493,17 +513,21 @@ export class SBasePolylineEdit extends SGraphEdit {
                 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 SRect(
             this.minX,
             this.minY,
@@ -515,9 +539,9 @@ export class SBasePolylineEdit extends SGraphEdit {
     /**
      * 判断点是否在区域内
      *
-     * @param   x
-     * @param   y
-     * @return  true-
+     * @param x     x 坐标
+     * @param y     y 坐标
+     * @return 是否在区域内
      */
     contains(x: number, y: number): boolean {
         let p = new SPoint(x, y);
@@ -535,12 +559,12 @@ export class SBasePolylineEdit extends SGraphEdit {
                 return true;
             }
         }
+
         return false;
     } // Function contains()
 
     /**
      * 撤销操作
-     *
      */
     undo(): void {
         if (this._status != SItemStatus.Normal) {
@@ -550,7 +574,6 @@ export class SBasePolylineEdit extends SGraphEdit {
 
     /**
      * 重做操作
-     *
      */
     redo(): void {
         if (this._status != SItemStatus.Normal) {
@@ -560,8 +583,7 @@ export class SBasePolylineEdit extends SGraphEdit {
 
     /**
      * 取消操作执行
-     *
-     * */
+     */
     cancelOperate(): void {
         if (this.status == SItemStatus.Create) {
             this.parent = null;
@@ -574,7 +596,9 @@ export class SBasePolylineEdit extends SGraphEdit {
 
     /**
      * 绘制基本图形
-     * */
+     *
+     * @param painter   绘制对象
+     */
     drawBaseLine(painter: SPainter): void {
         // 绘制基本图形
         painter.pen.color = this.strokeColor;
@@ -589,15 +613,16 @@ export class SBasePolylineEdit extends SGraphEdit {
                 painter.toPx(this.lineWidth)
             ];
         }
+
         painter.drawPolyline(this.pointList);
     } // Function drawBaseLine()
 
     /**
      * 返回对象储存的相关数据
      *
-     * @return	formData
+     * @return 对象储存的相关数据
      */
-    toData() {
+    toData(): any {
         const Line = this.pointList.map(pos => {
             return {
                 x: pos.x,
@@ -610,10 +635,11 @@ export class SBasePolylineEdit extends SGraphEdit {
         this.data.style.default.strokeColor = this.strokeColor.value;
         return this.data
     } // Function toData()
+
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter painter对象
+     * @param painter 绘制对象
      */
     onDraw(painter: SPainter): void {
         // 缓存场景长度
@@ -659,4 +685,4 @@ export class SBasePolylineEdit extends SGraphEdit {
             this.drawBaseLine(painter);
         }
     } // Function onDraw()
-} // Class SPolylineItem
+} // Class SBasePolylineEdit

+ 328 - 306
persagy-web-edit/src/items/SBaseRectEdit.ts

@@ -27,345 +27,367 @@ import { SColor, SPainter, SPoint, SRect } from "@persagy-web/draw";
 import { SMouseButton, SMouseEvent, SUndoStack } from "@persagy-web/base";
 import { SItemStatus } from "@persagy-web/big";;
 import {
-  SLineStyle,
-  SGraphItem, SGraphPointListInsert
+    SLineStyle,
+    SGraphItem, SGraphPointListInsert
 } from "@persagy-web/graph/";
 import { SGraphEdit } from "..";
 import { Marker } from "../type/Marker";
 
 /**
- * 折线编辑类
+ * 矩形编辑类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseRectEdit extends SGraphEdit {
-  /** 是否绘制完成  */
-  _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
-  width: number = 0;
-  height: number = 0;
-  /** 矩形两个对角 */
-  private _line: SPoint[] = [];
-  get line(): SPoint[] {
-    return this._line;
-  } // Get line
-  set line(arr: SPoint[]) {
-    this._line = arr;
-    this.update();
-  } // Get line
-  /** 矩形左上角 */
-  private _leftTop: SPoint = new SPoint();
-  /** 矩形右下角 */
-  private _rightBottom: SPoint = new SPoint();
-  /** 绘制矩形的圆角半径 */
-  private _radius: number = 0;
-  get radius(): number {
-    return this._radius;
-  } // Get radius
-  set radius(v: number) {
-    if (v == this._radius) {
-      return;
-    }
-    this._radius = v;
-    this.update();
-  } // Set radius
-  /** 线条颜色    */
-  _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
-  /** 边框样式 */
-  _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 = 1;
-  get lineWidth(): number {
-    return this._lineWidth;
-  } // Get lineWidth
-  set lineWidth(v: number) {
-    this._lineWidth = v;
-    this.update();
-  } // Set lineWidth
-  /** undo/redo堆栈 */
-  private undoStack: SUndoStack = new SUndoStack();
-  /** 传入数据 */
-  data: Marker
+    /** 是否绘制完成 */
+    _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
 
-  /**
-   * 构造函数
-   *
-   * @param parent    指向父对象
-   * @param data      矩形数据
-   */
-  constructor(parent: SGraphItem | null, data: Marker) {
-    super(parent);
-    this.data = data;
-    if (data.style && data.style.default) {
-      // 关于顶点
-      if (data.style.default.line) {
-        let setPointList: SPoint[];
-        setPointList = data.style.default.line.map(i => {
-          return new SPoint(i.x, i.y)
+    /** 宽度 */
+    width: number = 0;
+    /** 高度 */
+    height: number = 0;
+    /** 矩形两个对角 */
+    private _line: SPoint[] = [];
+    get line(): SPoint[] {
+        return this._line;
+    } // Get line
+    set line(arr: SPoint[]) {
+        this._line = arr;
+        this.update();
+    } // Get line
+
+    /** 矩形左上角 */
+    private _leftTop: SPoint = new SPoint();
+    /** 矩形右下角 */
+    private _rightBottom: SPoint = new SPoint();
+    /** 绘制矩形的圆角半径 */
+    private _radius: number = 0;
+    get radius(): number {
+        return this._radius;
+    } // Get radius
+    set radius(v: number) {
+        if (v == this._radius) {
+            return;
+        }
+        this._radius = v;
+        this.update();
+    } // Set radius
+
+    /** 线条颜色 */
+    _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
+
+    /** 边框样式 */
+    _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 = 1;
+    get lineWidth(): number {
+        return this._lineWidth;
+    } // Get lineWidth
+    set lineWidth(v: number) {
+        this._lineWidth = v;
+        this.update();
+    } // Set lineWidth
+
+    /** undo/redo 堆栈 */
+    private undoStack: SUndoStack = new SUndoStack();
+    /** 传入数据 */
+    data: Marker;
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      矩形数据
+     */
+    constructor(parent: SGraphItem | null, data: Marker) {
+        super(parent);
+        this.data = data;
+        if (data.style && data.style.default) {
+            // 关于顶点
+            if (data.style.default.line) {
+                let setPointList: SPoint[];
+                setPointList = data.style.default.line.map(i => {
+                    return new SPoint(i.x, i.y)
+                });
+                this.line = setPointList;
+            }
+            // 颜色
+            if (data.style.default.strokeColor) {
+                this.strokeColor = new SColor(data.style.default.strokeColor)
+            }
+            if (data.style.default.fillColor) {
+                this.fillColor = new SColor(data.style.default.fillColor)
+            }
+            // 线宽
+            if (data.style.default.lineWidth) {
+                this.lineWidth = data.style.default.lineWidth
+            }
+            // 线样式
+            if (data.style.default.lineStyle) {
+                this.lineStyle = data.style.default.lineStyle
+            }
+        }
+    } // Constructor
+
+    /**
+     * 大小改变
+     *
+     * @param oldSize   之前的大小
+     * @param newSize   新的大小
+     */
+    resize(oldSize: SRect, newSize: SRect): void {
+        const xs = newSize.width / oldSize.width;
+        const ys = newSize.height / oldSize.height;
+        this.line = this.line.map(t => {
+            t.x = t.x * xs;
+            t.y = t.y * ys;
+            return t;
         });
-        this.line = setPointList;
-      }
-      // 颜色
-      if (data.style.default.strokeColor) {
-        this.strokeColor = new SColor(data.style.default.strokeColor)
-      }
-      if (data.style.default.fillColor) {
-        this.fillColor = new SColor(data.style.default.fillColor)
-      }
-      // 线宽
-      if (data.style.default.lineWidth) {
-        this.lineWidth = data.style.default.lineWidth
-      }
-      // 线样式
-      if (data.style.default.lineStyle) {
-        this.lineStyle = data.style.default.lineStyle
-      }
-    }
-  } // Constructor
+        this.calRect();
+        this.update();
+    } // Function resize()
 
-  /**
-   * 大小改变
-  */
-  resize(oldSize: SRect, newSize: SRect): void {
-    const xs = newSize.width / oldSize.width;
-    const ys = newSize.height / oldSize.height;
-    this.line = this.line.map(t => {
-      t.x = t.x * xs;
-      t.y = t.y * ys;
-      return t
-    })
-    this.calRect()
-    this.update()
-  }
+    /**
+     * 鼠标按下事件
+     *
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == SMouseButton.LeftButton) {
+            if (this.status == SItemStatus.Create) {
+                this.addPoint(new SPoint(event.x, event.y));
+                return true;
+            } else {
+                return super.onMouseDown(event);
+            }
+        }
 
-  /**
-   * 鼠标按下事件
-   *
-   * @param   event   鼠标事件
-   * @return  是否处理事件
-   * */
-  onMouseDown(event: SMouseEvent): boolean {
-    if (event.buttons == SMouseButton.LeftButton) {
-      if (this.status == SItemStatus.Create) {
-        this.addPoint(new SPoint(event.x, event.y));
         return true;
-      } else {
-        return super.onMouseDown(event);
-      }
-    }
-    return true;
-  } // Function onMouseDown()
+    } // Function onMouseDown()
 
-  /**
+    /**
      * 鼠标移动事件
      *
-     * @param   event   鼠标事件
-     * @return  是否处理事件
-     * */
-  onMouseMove(event: SMouseEvent): boolean {
-    if (this.status == SItemStatus.Create) {
-      if (this.line[0] instanceof SPoint) {
-        this.line[1] = new SPoint(event.x, event.y);
-        this.calRect()
-      }
-    } else {
-      return super.onMouseMove(event);
-    }
-    this.update();
-    return true;
-  } // Function onMouseMove()
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
+    onMouseMove(event: SMouseEvent): boolean {
+        if (this.status == SItemStatus.Create) {
+            if (this.line[0] instanceof SPoint) {
+                this.line[1] = new SPoint(event.x, event.y);
+                this.calRect()
+            }
+        } else {
+            return super.onMouseMove(event);
+        }
+
+        this.update();
+        return true;
+    } // Function onMouseMove()
 
-  /**
+    /**
      * 鼠标抬起事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event     事件参数
+     * @return 是否处理事件
+     */
+    onMouseUp(event: SMouseEvent): boolean {
+        if (this.status != SItemStatus.Create) {
+            super.onMouseUp(event);
+        }
+
+        return true;
+    } // Function onMouseUp()
+
+    /**
+     * 计算矩形的左上角和右下角
      */
-  onMouseUp(event: SMouseEvent): boolean {
-    if (this.status != SItemStatus.Create) {
-      super.onMouseUp(event);
-    }
-    return true;
-  } // Function onMouseUp()
+    private calRect(): void {
+        if (this.line.length > 1) {
+            const fi = this.line[0];
+            const se = this.line[1];
+            let minx, maxx, miny, maxy;
+            if (fi.x < se.x) {
+                minx = fi.x;
+                maxx = se.x;
+            } else {
+                minx = se.x;
+                maxx = fi.x;
+            }
 
-  /**
-   * 计算矩形的左上角和右下角
-  */
-  private calRect(): void {
-    if (this.line.length > 1) {
-      const fi = this.line[0];
-      const se = this.line[1];
-      let minx, maxx, miny, maxy;
-      if (fi.x < se.x) {
-        minx = fi.x;
-        maxx = se.x;
-      } else {
-        minx = se.x;
-        maxx = fi.x;
-      }
-      if (fi.y < se.y) {
-        miny = fi.y;
-        maxy = se.y;
-      } else {
-        miny = se.y;
-        maxy = fi.y;
-      }
-      this._leftTop = new SPoint(minx, miny)
-      this._rightBottom = new SPoint(maxx, maxy)
-    }
-  } // Function calRect
+            if (fi.y < se.y) {
+                miny = fi.y;
+                maxy = se.y;
+            } else {
+                miny = se.y;
+                maxy = fi.y;
+            }
 
-  /**
+            this._leftTop = new SPoint(minx, miny);
+            this._rightBottom = new SPoint(maxx, maxy);
+        }
+    } // Function calRect()
+
+    /**
      * 添加点至数组中
      *
-     * @param   p       添加的点
-     * */
-  private addPoint(p: SPoint): void {
-    if (this.line.length < 2) {
-      this.line.push(p);
-      this.recordAction(SGraphPointListInsert, [this.line, p]);
-    } else {
-      this.line[1] = p;
-      this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
-      this.status = SItemStatus.Normal;
-      this.releaseItem();
-      this.$emit("finishCreated");
-      this.width = this.boundingRect().width;
-      this.height = this.boundingRect().height;
-    }
-    this.calRect()
-    this.update();
-  } // Function addPoint()
+     * @param p     添加的点
+     */
+    private addPoint(p: SPoint): void {
+        if (this.line.length < 2) {
+            this.line.push(p);
+            this.recordAction(SGraphPointListInsert, [this.line, p]);
+        } else {
+            this.line[1] = p;
+            this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
+            this.status = SItemStatus.Normal;
+            this.releaseItem();
+            this.$emit("finishCreated");
+            this.width = this.boundingRect().width;
+            this.height = this.boundingRect().height;
+        }
 
-  /**
+        this.calRect();
+        this.update();
+    } // Function addPoint()
+
+    /**
      * 记录相关动作并推入栈中
      *
      * @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()
+    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.line.length > 1) {
+            this.calRect();
+            return new SRect(this._leftTop, this._rightBottom);
+        }
 
-  /**
-   * Item对象边界区域
-   *
-   * @return  SRect   外接矩阵
-   * */
-  boundingRect(): SRect {
-    if (this.line.length > 1) {
-      this.calRect()
-      return new SRect(this._leftTop, this._rightBottom);
-    }
-    return new SRect()
-  } // Function boundingRect()
+        return new SRect();
+    } // Function boundingRect()
 
-  /**
-   * 撤销操作
-   *
-   */
-  undo(): void {
-    if (this._status != SItemStatus.Normal) {
-      this.undoStack.undo();
-    }
-  } // Function undo()
+    /**
+     * 撤销操作
+     */
+    undo(): void {
+        if (this._status != SItemStatus.Normal) {
+            this.undoStack.undo();
+        }
+    } // Function undo()
 
-  /**
-   * 重做操作
-   *
-   */
-  redo(): void {
-    if (this._status != SItemStatus.Normal) {
-      this.undoStack.redo();
-    }
-  } // Function redo()
+    /**
+     * 重做操作
+     */
+    redo(): void {
+        if (this._status != SItemStatus.Normal) {
+            this.undoStack.redo();
+        }
+    } // Function redo()
 
-  /**
-   * 取消操作执行
-   *
-   * */
-  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()
+    /**
+     * 取消操作执行
+     */
+    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()
 
-  toData() {
-    const Line: any = [];
-    this.line.forEach(item => {
-      Line.push({ x: item.x, y: item.y })
-    })
-    this.data.style.default.line = Line;
-    this.data.style.default.lineWidth = this.lineWidth;
-    this.data.style.default.lineStyle = this.lineStyle;
-    this.data.style.default.strokeColor = this.strokeColor.value;
-    this.data.style.default.fillColor = this.fillColor.value;
-    return this.data
-  }
+    /**
+     * 返回对象储存的相关数据
+     *
+     * @return 对象储存的相关数据
+     */
+    toData(): any {
+        const Line: any = [];
+        this.line.forEach(item => {
+            Line.push({ x: item.x, y: item.y })
+        });
+        this.data.style.default.line = Line;
+        this.data.style.default.lineWidth = this.lineWidth;
+        this.data.style.default.lineStyle = this.lineStyle;
+        this.data.style.default.strokeColor = this.strokeColor.value;
+        this.data.style.default.fillColor = this.fillColor.value;
+        return this.data;
+    } // Function toData()
+
+    /**
+     * Item 绘制操作
+     *
+     * @param painter   绘制对象
+     */
+    onDraw(painter: SPainter): void {
+        if (this.line.length == 2) {
+            this.calRect();
+            painter.pen.color = this.strokeColor;
+            painter.brush.color = this.fillColor;
+            painter.pen.lineWidth = this.lineWidth;
+            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 * 2),
+                    painter.toPx(this.lineWidth * 2)
+                ];
+            }
 
-  /**
-   * Item绘制操作
-   *
-   * @param   painter painter对象
-   */
-  onDraw(painter: SPainter): void {
-    if (this.line.length == 2) {
-      this.calRect()
-      painter.pen.color = this.strokeColor;
-      painter.brush.color = this.fillColor;
-      painter.pen.lineWidth = this.lineWidth;
-      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 * 2),
-          painter.toPx(this.lineWidth * 2)
-        ];
-      }
-      if (this.radius != 0) {
-        painter.drawRoundRect(this._leftTop, this._rightBottom, this.radius);
-      } else {
-        painter.drawRect(this._leftTop, this._rightBottom);
-      }
-    }
-  } // Function onDraw()
-} // Class SRectEdit
+            if (this.radius != 0) {
+                painter.drawRoundRect(this._leftTop, this._rightBottom, this.radius);
+            } else {
+                painter.drawRect(this._leftTop, this._rightBottom);
+            }
+        }
+    } // Function onDraw()
+} // Class SBaseRectEdit

+ 37 - 35
persagy-web-edit/src/items/SBaseTextEdit.ts

@@ -33,18 +33,18 @@ import { ItemOrder } from '@persagy-web/big/lib';
 /**
  * 文本编辑类
  *
- * @author  韩耀龙(han_yao_long@163.com)
+ * @author  韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseTextEdit extends SGraphEdit {
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //属性
     /**编辑相关操作的数据 */
-    data: Marker
-    /** 起始锚点  */
+    data: Marker;
+    /** 起始锚点 */
     startItem: SGraphItem | null = null;
-    /** 结束锚点  */
+    /** 结束锚点 */
     endItem: SGraphItem | null = null;
-    /**编辑状态 */
+    /** 编辑状态 */
     protected _status: SItemStatus = SItemStatus.Normal;
     get status(): SItemStatus {
         return this._status;
@@ -57,7 +57,8 @@ export class SBaseTextEdit extends SGraphEdit {
         this.$emit('StatusChange', oldStatus, newStatus)
         this.update();
     } //Set status
-    /** 记录painter */
+
+    /** 记录 painter */
     private _painter: SPainter | null = null;
 
     /** 文本内容 */
@@ -74,9 +75,9 @@ export class SBaseTextEdit extends SGraphEdit {
 
     /** 切割后的文本数组 */
     private _textArr: string[] = [];
-    /** 锚点list  */
+    /** 锚点 list */
     anchorList: SAnchorItem[] = [];
-    /** 宽度  */
+    /** 宽度 */
     private _width: number = 64;
     get width(): number {
         return this._width;
@@ -94,7 +95,7 @@ export class SBaseTextEdit extends SGraphEdit {
         }
     } //Set width
 
-    /** 高度  */
+    /** 高度 */
     private _height: number = 64;
     get height(): number {
         return this._height;
@@ -112,17 +113,9 @@ export class SBaseTextEdit extends SGraphEdit {
         }
     } //Set height
 
-    /** 原点  */
+    /** 原点 */
     origin = new SPoint();
 
-    /**
-     * 宽高发发生变化
-     *
-     * @param   oldSize 改之前的大小
-     * @param   newSize 改之后大小
-     * */
-    protected onResize(oldSize: SSize, newSize: SSize) { } // Function onResize()
-
     /** 文本颜色 */
     private _color: SColor = new SColor("#333333");
     get color(): SColor {
@@ -161,7 +154,6 @@ export class SBaseTextEdit extends SGraphEdit {
     } //Get strokeColor
     set strokeColor(v: SColor) {
         this._strokeColor = v;
-        console.log(this._strokeColor)
         this.update();
     } //Set strokeColor
 
@@ -175,7 +167,7 @@ export class SBaseTextEdit extends SGraphEdit {
         this.update();
     } //Set lineWidth
 
-    /** 边框样式    */
+    /** 边框样式 */
     private _borderStyle: SLineStyle = SLineStyle.None;
     get borderStyle(): SLineStyle {
         return this._borderStyle;
@@ -185,7 +177,7 @@ export class SBaseTextEdit extends SGraphEdit {
         this.update();
     } //Set borderStyle
 
-    /** 原点位置    */
+    /** 原点位置 */
     private _originPosition: STextOrigin = STextOrigin.LeftTop;
     get originPosition(): STextOrigin {
         return this._originPosition;
@@ -201,8 +193,8 @@ export class SBaseTextEdit extends SGraphEdit {
     /**
      * 构造函数
      *
-     * @param   parent      指向父Item
-     * @param   str         文本内容
+     * @param parent    指向父 Item
+     * @param data      文本数据
      */
     constructor(parent: SGraphItem | null, data: Marker) {
         super(parent);
@@ -241,9 +233,17 @@ export class SBaseTextEdit extends SGraphEdit {
     } // Constructor
 
     /**
+     * 宽高发发生变化
+     *
+     * @param oldSize 改之前的大小
+     * @param newSize 改之后大小
+     */
+    protected onResize(oldSize: SSize, newSize: SSize) { } // Function onResize()
+
+    /**
      * 对象边界区域
      *
-     * @return  边界区域
+     * @return 边界区域
      */
     boundingRect(): SRect {
         return new SRect(
@@ -257,15 +257,15 @@ export class SBaseTextEdit extends SGraphEdit {
     /**
      * 移动后处理所有坐标,并肩原点置为场景原点
      *
-     * @param   x   x坐标
-     * @param   y   y坐标
-     * */
+     * @param x   x 坐标
+     * @param y   y 坐标
+     */
     moveToOrigin(x: number, y: number): void {
         this.moveTo(this.x + x, this.y + y);
     } // Function moveToOrigin()
 
     /**
-     * 绘制显示状态文本Item
+     * 绘制显示状态文本 Item
      *
      * @param painter    绘制类
      */
@@ -280,6 +280,7 @@ export class SBaseTextEdit extends SGraphEdit {
         } else {
             painter.shadow.shadowColor = SColor.Transparent;
         }
+
         painter.brush.color = this.backgroundColor;
         painter.pen.lineWidth = this.lineWidth;
         painter.pen.color = this.strokeColor;
@@ -301,7 +302,6 @@ export class SBaseTextEdit extends SGraphEdit {
 
     /**
      * 根据换行切割文本,绘制多行并计算外轮廓宽高
-     *
      */
     protected drawFormatText(): void {
         if (this._painter instanceof SPainter) {
@@ -324,6 +324,7 @@ export class SBaseTextEdit extends SGraphEdit {
             if (this.originPosition == STextOrigin.entrum) {
                 this.origin = new SPoint(this.width / 2, this.height / 2);
             }
+
             this._painter.restore();
         }
     } // Function drawFormatText()
@@ -331,11 +332,11 @@ export class SBaseTextEdit extends SGraphEdit {
     /**
      * 返回对象储存的相关数据
      *
-     * @return	formData
+     * @return 对象储存的相关数据
      */
     toData(): any {
         if (this.data.size) {
-            this.data.size.width = this.width
+            this.data.size.width = this.width;
             this.data.size.height = this.height;
         }
 
@@ -346,19 +347,20 @@ export class SBaseTextEdit extends SGraphEdit {
         this.data.style.default.strokeColor = this.strokeColor.value;
         this.data.style.default.font = this.font.size;
         this.data.style.default.backgroundColor = this.backgroundColor.value;
-        return this.data
+        return this.data;
     } // Function toData()
 
     /**
-     * Item绘制操作
+     * Item 绘制操作
      *
-     * @param   painter      绘画类
+     * @param painter       绘画类
      */
     onDraw(painter: SPainter): void {
         if (!(this._painter instanceof SPainter)) {
             this._painter = painter;
             this.drawFormatText();
         }
+
         this.drawShowText(painter);
     } // Function onDraw()
-} // Class STextItem
+} // Class SBaseTextEdit

+ 311 - 294
persagy-web-edit/src/items/SBaseTriangleEdit.ts

@@ -26,10 +26,10 @@
 
 import { SColor, SPainter, SPoint, SRect } from "@persagy-web/draw";
 import { SMouseButton, SMouseEvent, SUndoStack } from "@persagy-web/base";
-import { SItemStatus } from "@persagy-web/big";;
+import { SItemStatus } from "@persagy-web/big";
 import {
-  SLineStyle,
-  SGraphItem, SGraphPointListInsert
+    SLineStyle,
+    SGraphItem, SGraphPointListInsert
 } from "@persagy-web/graph/";
 import { SGraphEdit } from "..";
 import { Marker } from "../type/Marker";
@@ -37,312 +37,329 @@ import { Marker } from "../type/Marker";
 /**
  * 折线编辑类
  *
- *  @author  韩耀龙(han_yao_long@163.com)
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBaseTriangleEdit extends SGraphEdit {
-  /** 是否绘制完成  */
-  _status: SItemStatus = SItemStatus.Normal;
-  get status(): SItemStatus {
-    return this._status;
-  }
-  set status(v: SItemStatus) {
-    this._status = v;
-    this.undoStack.clear();
-    this.update();
-  }
-  /**编辑相关操作的数据 */
-  data: Marker
-  /** 矩形两个对角 */
-  private _line: SPoint[] = [];
-  get line(): SPoint[] {
-    return this._line;
-  } // Get line
-  set line(arr: SPoint[]) {
-    this._line = arr;
-    this.update();
-  } // Get line
-  // 矩形左上角
-  private _leftTop: SPoint = new SPoint();
-  // 矩形右下角
-  private _rightBottom: SPoint = new SPoint();
-  // 绘制三角形的点数组
-  private pointList: SPoint[] = [];
-  /** 线条颜色    */
-  _strokeColor: SColor = SColor.Black;
-  get strokeColor(): SColor {
-    return this._strokeColor;
-  }
-  set strokeColor(v: SColor) {
-    this._strokeColor = v;
-    this.update();
-  }
-  /** 填充色 */
-  _fillColor: SColor = new SColor("#2196f3");
-  get fillColor(): SColor {
-    return this._fillColor;
-  }
-  set fillColor(v: SColor) {
-    this._fillColor = v;
-    this.update();
-  }
-  /** 边框样式 */
-  _lineStyle: SLineStyle = SLineStyle.Solid;
-  get lineStyle(): SLineStyle {
-    return this._lineStyle;
-  }
-  set lineStyle(v: SLineStyle) {
-    this._lineStyle = v;
-    this.update();
-  }
-  /** 线条宽度    */
-  _lineWidth: number = 1;
-  get lineWidth(): number {
-    return this._lineWidth;
-  }
-  set lineWidth(v: number) {
-    this._lineWidth = v;
-    this.update();
-  }
-  /** undo/redo堆栈 */
-  private undoStack: SUndoStack = new SUndoStack();
-
-  /**
-   * 构造函数
-   *
-   * @param parent    指向父对象
-   * @param data      矩形数据
-   */
-  constructor(parent: SGraphItem | null, data: Marker) {
-    super(parent);
-    this.data = data;
-    if (data.style && data.style.default) {
-      // 关于顶点
-      if (data.style.default.Line) {
-        let setPointList: SPoint[];
-        setPointList = data.style.default.line.map(i => {
-          return new SPoint(i.x, i.y)
+    /** 是否绘制完成 */
+    _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
+
+    /** 编辑相关操作的数据 */
+    data: Marker;
+    /** 矩形两个对角 */
+    private _line: SPoint[] = [];
+    get line(): SPoint[] {
+        return this._line;
+    } // Get line
+    set line(arr: SPoint[]) {
+        this._line = arr;
+        this.update();
+    } // Get line
+
+    /** 矩形左上角 */
+    private _leftTop: SPoint = new SPoint();
+    /** 矩形右下角 */
+    private _rightBottom: SPoint = new SPoint();
+    /** 绘制三角形的点数组 */
+    private pointList: SPoint[] = [];
+    /** 线条颜色 */
+    _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
+
+    /** 边框样式 */
+    _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 = 1;
+    get lineWidth(): number {
+        return this._lineWidth;
+    } // Get lineWidth
+    set lineWidth(v: number) {
+        this._lineWidth = v;
+        this.update();
+    } // Set lineWidth
+
+    /** undo/redo 堆栈 */
+    private undoStack: SUndoStack = new SUndoStack();
+
+    /**
+     * 构造函数
+     *
+     * @param parent    指向父对象
+     * @param data      数据
+     */
+    constructor(parent: SGraphItem | null, data: Marker) {
+        super(parent);
+        this.data = data;
+        if (data.style && data.style.default) {
+            // 关于顶点
+            if (data.style.default.Line) {
+                let setPointList: SPoint[];
+                setPointList = data.style.default.line.map(i => {
+                    return new SPoint(i.x, i.y)
+                });
+                this.line = setPointList;
+            }
+
+            // 颜色
+            if (data.style.default.strokeColor) {
+                this.strokeColor = new SColor(data.style.default.strokeColor)
+            }
+
+            // 线宽
+            if (data.style.default.lineWidth) {
+                this.lineWidth = data.style.default.lineWidth
+            }
+
+            // 线样式
+            if (data.style.default.lineStyle) {
+                this.lineStyle = data.style.default.lineStyle
+            }
+        }
+    } // Constructor
+
+    /**
+     * 宽高发发生变化
+     *
+     * @param oldSize 改之前的大小
+     * @param newSize 改之后大小
+     */
+    resize(oldSize: SRect, newSize: SRect): void {
+        const xs = newSize.width / oldSize.width;
+        const ys = newSize.height / oldSize.height;
+        this.line = this.line.map(t => {
+            t.x = t.x * xs;
+            t.y = t.y * ys;
+            return t;
         });
-        this.line = setPointList;
-      }
-      // 颜色
-      if (data.style.default.strokeColor) {
-        this.strokeColor = new SColor(data.style.default.strokeColor)
-      }
-      // 线宽
-      if (data.style.default.lineWidth) {
-        this.lineWidth = data.style.default.lineWidth
-      }
-      // 线样式
-      if (data.style.default.lineStyle) {
-        this.lineStyle = data.style.default.lineStyle
-      }
-    }
-  } // Constructor
-
-  /**
-   * 大小改变
-  */
-  resize(oldSize: SRect, newSize: SRect): void {
-    const xs = newSize.width / oldSize.width;
-    const ys = newSize.height / oldSize.height;
-    this.line = this.line.map(t => {
-      t.x = t.x * xs;
-      t.y = t.y * ys;
-      return t
-    })
-    this.calRect()
-    this.update()
-  }
-
-  /**
+        this.calRect();
+        this.update();
+    } // Function resize()
+
+    /**
      * 鼠标按下事件
      *
-     * @param   event   鼠标事件
-     * @return  是否处理事件
-     * */
-  onMouseDown(event: SMouseEvent): boolean {
-    if (event.buttons == SMouseButton.LeftButton) {
-      if (this.status == SItemStatus.Create) {
-        this.addPoint(new SPoint(event.x, event.y));
+     * @param event   鼠标事件
+     * @return 是否处理事件
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        if (event.buttons == SMouseButton.LeftButton) {
+            if (this.status == SItemStatus.Create) {
+                this.addPoint(new SPoint(event.x, event.y));
+                return true;
+            } else {
+                return super.onMouseDown(event);
+            }
+        }
+
         return true;
-      } else {
-        return super.onMouseDown(event);
-      }
-    }
-    return true;
-  } // Function onMouseDown()
-
-  /**
+    } // Function onMouseDown()
+
+    /**
      * 鼠标移动事件
      *
-     * @param   event   鼠标事件
-     * @return  是否处理事件
-     * */
-  onMouseMove(event: SMouseEvent): boolean {
-    if (this.status == SItemStatus.Create) {
-      if (this.line[0] instanceof SPoint) {
-        this.line[1] = new SPoint(event.x, event.y);
-        this.calRect()
-      }
-    } else {
-      return super.onMouseMove(event);
-    }
-    this.update();
-    return true;
-  } // Function onMouseMove()
-
-  /**
+     * @param event     事件参数
+     * @return 是否处理事件
+     */
+    onMouseMove(event: SMouseEvent): boolean {
+        if (this.status == SItemStatus.Create) {
+            if (this.line[0] instanceof SPoint) {
+                this.line[1] = new SPoint(event.x, event.y);
+                this.calRect()
+            }
+        } else {
+            return super.onMouseMove(event);
+        }
+
+        this.update();
+        return true;
+    } // Function onMouseMove()
+
+    /**
      * 鼠标抬起事件
      *
-     * @param	event         事件参数
-     * @return	boolean
+     * @param event     事件参数
+     * @return 是否处理事件
      */
-  onMouseUp(event: SMouseEvent): boolean {
-    if (this.status != SItemStatus.Create) {
-      super.onMouseUp(event);
-    }
-    return true;
-  } // Function onMouseUp()
-
-  /**
-   * 计算矩形的左上角和右下角
-  */
-  private calRect(): void {
-    if (this.line.length > 1) {
-      const fi = this.line[0];
-      const se = this.line[1];
-      let minx, maxx, miny, maxy;
-      if (fi.x < se.x) {
-        minx = fi.x;
-        maxx = se.x;
-      } else {
-        minx = se.x;
-        maxx = fi.x;
-      }
-      if (fi.y < se.y) {
-        miny = fi.y;
-        maxy = se.y;
-      } else {
-        miny = se.y;
-        maxy = fi.y;
-      }
-      this._leftTop = new SPoint(minx, miny)
-      this._rightBottom = new SPoint(maxx, maxy)
-      this.calTriangel()
-    }
-  } // Function calRect
-
-  /**
-   * 计算绘制图形的3个点
-  */
-  private calTriangel(): void {
-    this.pointList = [];
-    this.pointList.push(new SPoint(this._leftTop.x, this._rightBottom.y))
-    this.pointList.push(new SPoint((this._leftTop.x + this._rightBottom.x) / 2, this._leftTop.y))
-    this.pointList.push(new SPoint(this._rightBottom.x, this._rightBottom.y))
-  } // Function calRect
-
-  /**
+    onMouseUp(event: SMouseEvent): boolean {
+        if (this.status != SItemStatus.Create) {
+            super.onMouseUp(event);
+        }
+
+        return true;
+    } // Function onMouseUp()
+
+    /**
+     * 计算矩形的左上角和右下角
+     */
+    private calRect(): void {
+        if (this.line.length > 1) {
+            const fi = this.line[0];
+            const se = this.line[1];
+            let minx, maxx, miny, maxy;
+            if (fi.x < se.x) {
+                minx = fi.x;
+                maxx = se.x;
+            } else {
+                minx = se.x;
+                maxx = fi.x;
+            }
+
+            if (fi.y < se.y) {
+                miny = fi.y;
+                maxy = se.y;
+            } else {
+                miny = se.y;
+                maxy = fi.y;
+            }
+
+            this._leftTop = new SPoint(minx, miny);
+            this._rightBottom = new SPoint(maxx, maxy);
+            this.calTriangle()
+        }
+    } // Function calRect()
+
+    /**
+     * 计算绘制图形的 3 个点
+     */
+    private calTriangle(): void {
+        this.pointList = [];
+        this.pointList.push(new SPoint(this._leftTop.x, this._rightBottom.y));
+        this.pointList.push(new SPoint((this._leftTop.x + this._rightBottom.x) / 2, this._leftTop.y));
+        this.pointList.push(new SPoint(this._rightBottom.x, this._rightBottom.y));
+    } // Function calTriangle()
+
+    /**
      * 添加点至数组中
      *
-     * @param   p       添加的点
-     * */
-  private addPoint(p: SPoint): void {
-    if (this.line.length < 2) {
-      this.line.push(p);
-      this.recordAction(SGraphPointListInsert, [this.line, p]);
-    } else {
-      this.line[1] = p;
-      this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
-      this.status = SItemStatus.Normal;
-      this.releaseItem();
-      this.$emit("finishCreated");
-    }
-    this.calRect()
-    this.update();
-  } // Function addPoint()
-
-  /**
+     * @param p     添加的点
+     */
+    private addPoint(p: SPoint): void {
+        if (this.line.length < 2) {
+            this.line.push(p);
+            this.recordAction(SGraphPointListInsert, [this.line, p]);
+        } else {
+            this.line[1] = p;
+            this.recordAction(SGraphPointListInsert, [this.line, p, 1]);
+            this.status = SItemStatus.Normal;
+            this.releaseItem();
+            this.$emit("finishCreated");
+        }
+
+        this.calRect();
+        this.update();
+    } // Function addPoint()
+
+    /**
      * 记录相关动作并推入栈中
      *
      * @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  SRect   外接矩阵
-   * */
-  boundingRect(): SRect {
-    if (this.line.length > 1) {
-      this.calRect()
-      return new SRect(this._leftTop, this._rightBottom);
-    }
-    return new SRect()
-  } // Function boundingRect()
-
-  /**
-   * 撤销操作
-   *
-   */
-  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;
-      this.releaseItem();
-    } else if (this.status == SItemStatus.Edit) {
-      this.status = SItemStatus.Normal;
-      this.releaseItem();
-    }
-  } // Function cancelOperate()
-
-  /**
-   * Item绘制操作
-   *
-   * @param   painter painter对象
-   */
-  onDraw(painter: SPainter): void {
-    if (this.line.length == 2) {
-      painter.pen.color = this.strokeColor;
-      painter.brush.color = this.fillColor;
-      painter.pen.lineWidth = this.lineWidth;
-      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 * 2),
-          painter.toPx(this.lineWidth * 2)
-        ];
-      }
-      painter.drawPolygon(this.pointList);
-    }
-  } // Function onDraw()
-} // Class STriangleEdit
+    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.line.length > 1) {
+            this.calRect();
+            return new SRect(this._leftTop, this._rightBottom);
+        }
+
+        return new SRect()
+    } // Function boundingRect()
+
+    /**
+     * 撤销操作
+     */
+    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;
+            this.releaseItem();
+        } else if (this.status == SItemStatus.Edit) {
+            this.status = SItemStatus.Normal;
+            this.releaseItem();
+        }
+    } // Function cancelOperate()
+
+    /**
+     * Item 绘制操作
+     *
+     * @param painter   绘制对象
+     */
+    onDraw(painter: SPainter): void {
+        if (this.line.length == 2) {
+            painter.pen.color = this.strokeColor;
+            painter.brush.color = this.fillColor;
+            painter.pen.lineWidth = this.lineWidth;
+            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 * 2),
+                    painter.toPx(this.lineWidth * 2)
+                ];
+            }
+
+            painter.drawPolygon(this.pointList);
+        }
+    } // Function onDraw()
+} // Class SBaseTriangleEdit

+ 4 - 6
persagy-web-edit/src/type/Anchor.ts

@@ -24,18 +24,16 @@
  * *********************************************************************************************************************
  */
 
-
-
 import { Point } from "@persagy-web/big/lib/types/Point";
 
 /**
- * 锚点item接口
+ * 锚点 item 接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Anchor {
-    /** 锚点ID */
+    /** 锚点 ID */
     ID: string;
-    /** 锚点的坐标  */
+    /** 锚点的坐标 */
     Pos: Point;
 } // Interface Anchor

+ 4 - 3
persagy-web-edit/src/type/ElementData.ts

@@ -24,8 +24,6 @@
  * *********************************************************************************************************************
  */
 
-
-
 import { Legend } from "./Legend";
 import { Marker } from "./Marker";
 import { Relation } from "./Relation";
@@ -33,10 +31,13 @@ import { Relation } from "./Relation";
 /**
  * 系统图数据接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface ElementData {
+    /** 在数据中台有数据的节点 */
     Nodes: Legend[];
+    /** 说明型节点 */
     Markers: Marker[];
+    /** 关系类节点 */
     Relations: Relation[];
 } // Interface ElementData

+ 14 - 15
persagy-web-edit/src/type/Legend.ts

@@ -24,7 +24,6 @@
  * *********************************************************************************************************************
  */
 
-
 import { Anchor } from "./Anchor";
 import { Point } from "@persagy-web/big/lib/types/Point";
 import { Size } from "@persagy-web/big/lib/types/Size";
@@ -33,37 +32,37 @@ import { SPoint } from '@persagy-web/draw/lib';
 /**
  * 图例节点接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Legend {
     /** ID */
     iD: string;
-    /** 名称  */
+    /** 名称 */
     name: string;
     /** 返回工程信息化对象 ID 列表 */
     attachObjectIds?: any[];
-    /** 图标,区域类型  */
+    /** 图标,区域类型 */
     graphElementType: string;
-    /** 对应的图例ID  */
+    /** 对应的图例 ID */
     graphElementId: string;
-    /** 图例数量  */
+    /** 图例数量 */
     num?: number;
-    /** 位置  */
+    /** 位置 */
     pos: Point;
-    /** item类型 */
+    /** item 类型 */
     type: string
-    /** 缩放  */
+    /** 缩放 */
     scale?: Point;
-    /** 旋转  */
+    /** 旋转 */
     rolate?: Point;
-    /** 大小  */
+    /** 大小 */
     size?: Size;
-    /** 锚点List  */
+    /** 锚点 List */
     anchorList?: Anchor[];
-    /** 轮廓线  */
+    /** 轮廓线 */
     outLine?: Point[] | SPoint[];
-    /** 由应用自己定义  */
+    /** 由应用自己定义 */
     properties?: any;
-     /** zone 区分防火分区和石材铺装  */
+     /** zone 区分防火分区和石材铺装 */
     subType?:string
 } // Interface Legend

+ 8 - 8
persagy-web-edit/src/type/Marker.ts

@@ -30,25 +30,25 @@ import { Size } from "@persagy-web/big/lib/types/Size";
 /**
  * 标识对象接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Marker {
     /** ID */
     iD?: string;
-    /** 名称  */
+    /** 名称 */
     name: string;
-    /** 图标(Image),线类型(Line) */
+    /** 图标(Image),线类型 (Line) */
     type: string;
-    /** 位置  */
+    /** 位置 */
     pos: Point;
-    /** 缩放  */
+    /** 缩放 */
     scale?: Point;
-    /** 旋转  */
+    /** 旋转 */
     rolate?: Point;
-    /** 大小  */
+    /** 大小 */
     size?: Size;
     /** 绘制时得数据以及样式 */
     style:any;
-    /** 由应用自己定义  */
+    /** 由应用自己定义 */
     properties?: any;
 } // Interface Marker

+ 6 - 8
persagy-web-edit/src/type/Relation.ts

@@ -24,30 +24,28 @@
  * *********************************************************************************************************************
  */
 
-
-
 import { SRelationDir } from "@persagy-web/big/lib/enums/SRelationDir";
 import { Point } from "@persagy-web/big/lib/types/Point";
 
 /**
  * 管线对象关系接口
  *
- * @author  张宇
+ * @author 韩耀龙 <han_yao_long@163.com>
  */
 export interface Relation {
     /** ID */
     iD: string;
     /** 名称 */
     name: string;
-    /** 对应的图例ID */
+    /** 对应的图例 ID */
     graphElementId: string;
-    /** 关联节点1_id */
+    /** 关联节点 1_id */
     node1ID?: string;
-    /** 关联节点2_id */
+    /** 关联节点 2_id */
     node2ID?: string;
-    /** 关联锚点1_id  */
+    /** 关联锚点 1_id */
     anchor1ID?: string;
-    /** 关联锚点2_id */
+    /** 关联锚点 2_id */
     anchor2ID?: string;
     /** 方向(0:无向,1:节点1到节点2,2:节点2到节点1) */
     dir?: SRelationDir;

+ 18 - 18
persagy-web-fengmap/src/parser/SFengParser.ts

@@ -130,21 +130,21 @@ export class SFengParser extends SParser {
         200023: "MensBathroom",
         200022: "WomensToilet"
     };
-    /** 蜂鸟:底图应用名称   */
+    /** 蜂鸟:底图应用名称  */
     appName: string = "";
-    /** 当前蜂鸟map的id  */
+    /** 当前蜂鸟map的id */
     mapId: string = "1000423_";
-    /** 蜂鸟map绑定dom的id   */
+    /** 蜂鸟map绑定dom的id  */
     domId: string = "";
-    /** 蜂鸟:底图应用秘钥   */
+    /** 蜂鸟:底图应用秘钥  */
     key: string = "";
     /** 底图服务器地址 */
     serverUrl: string = "./data/";
-    /** 底图主题    */
+    /** 底图主题   */
     mapThemeURL: string = "./";
     /** 蜂鸟图 */
     private fmap: fengmap.FMMap;
-    /** 属于空间类型typeid    */
+    /** 属于空间类型typeid   */
     spaceType: number[] = [
         100000,
         200000,
@@ -210,13 +210,13 @@ export class SFengParser extends SParser {
         200023,
         200022
     ];
-    /** 属于柱子类型的typeid   */
+    /** 属于柱子类型的typeid  */
     columnType: number[] = [300002];
-    /** 属于墙类型的typeid    */
+    /** 属于墙类型的typeid   */
     wallType: number[] = [300000, 300001];
-    /** 属于虚拟墙类型的typeid  */
+    /** 属于虚拟墙类型的typeid */
     virtualWallType: number[] = [200001, 110001, 200010];
-    /** poi类型   */
+    /** poi类型  */
     poiList: number[] = [
         170006,
         170008,
@@ -238,13 +238,13 @@ export class SFengParser extends SParser {
         120009,
         120010
     ];
-    /** 当前地图的楼层list(gname to gid映射关系)   */
+    /** 当前地图的楼层list(gname to gid映射关系)  */
     gnameToGid = {};
     /** 当前地图的楼层list */
     floorList = [];
-    /** 当前底图的主题数据   */
+    /** 当前底图的主题数据  */
     mapTheme: any;
-    /** 底图版本号   */
+    /** 底图版本号  */
     version: number | null = null;
     /** 顶楼地址img */
     frImg: string = "";
@@ -271,7 +271,7 @@ export class SFengParser extends SParser {
      *
      * @param groupId         当前楼层((前台传入为gname))
      * @param _fn             查询成功回调函数(返回参数为FloorData)
-     */
+    */
     parseData(groupId: string, _fn: Function): void {
         let obj = {};
         // 切换至当前楼层才可查询
@@ -381,7 +381,7 @@ export class SFengParser extends SParser {
      *
      * @param mapId   蜂鸟地图id
      * @param _fn     load成功回调
-     */
+    */
     loadMap(mapId: string, _fn: Function): void {
         this.fmap = new fengmap.FMMap({
             container: document.getElementById(this.domId),
@@ -416,7 +416,7 @@ export class SFengParser extends SParser {
      *
      * @param url     主题文件url
      * @return promise promise对象
-     */
+    */
     loadTheme(url: string): Promise<void> {
         return new Promise((resolve, reject): void => {
             Axios({
@@ -441,7 +441,7 @@ export class SFengParser extends SParser {
      *
      * @param groupId
      * @param _fn
-     */
+    */
     loadFloor(groupId: string, _fn: Function): any {
         const minx = this.fmap.minX;
         const maxy = this.fmap.maxY;
@@ -478,7 +478,7 @@ export class SFengParser extends SParser {
      *
      * @param Outline 轮廓线束
      * @return object  {X:X,Y:Y}x的平均值,y的平均值
-     */
+    */
     private getAverageVal(Outline: { X: number; Y: number }[][]): object {
         let X = 0,
             Y = 0,

+ 34 - 34
persagy-web-graph/src/SGraphItem.ts

@@ -207,7 +207,7 @@ export class SGraphItem extends SObject {
      * 构造函数
      *
      * @param parent      指向父对象
-     */
+    */
     constructor(parent: SGraphItem | null = null) {
         super();
         if (parent) {
@@ -220,7 +220,7 @@ export class SGraphItem extends SObject {
      *
      * @param painter   绘制对象
      * @param rect      绘制区域
-     */
+    */
     onPaint(painter: SPainter, rect: SRect): void {
         this.onDraw(painter);
         for (let item of this.children) {
@@ -263,26 +263,26 @@ export class SGraphItem extends SObject {
      * Item 绘制操作
      *
      * @param painter    绘制对象
-     */
+    */
     onDraw(painter: SPainter): void {} // Function onDraw()
 
     /**
      * 隐藏对象
-     */
+    */
     hide(): void {
         this.visible = false;
     } // Function hide()
 
     /**
      * 显示对象
-     */
+    */
     show(): void {
         this.visible = true;
     } // Function show()
 
     /**
      * 更新 Item
-     */
+    */
     update(): void {
         if (null != this.scene) {
             const view = this.scene.view;
@@ -296,7 +296,7 @@ export class SGraphItem extends SObject {
      * Item 对象边界区域
      *
      * @return 对象边界区域
-     */
+    */
     boundingRect(): SRect {
         return new SRect(0, 0, 10, 10);
     } // Function boundingRect()
@@ -306,7 +306,7 @@ export class SGraphItem extends SObject {
      *
      * @param x     新位置的 x 坐标
      * @param y     新位置的 y 坐标
-     */
+    */
     moveTo(x: number, y: number): void {
         this.x = x;
         this.y = y;
@@ -318,7 +318,7 @@ export class SGraphItem extends SObject {
      * @param x     横坐标(当前 item)
      * @param y     纵坐标(当前 item)
      * @return item 是否包含点 x, y
-     */
+    */
     contains(x: number, y: number): boolean {
         return this.boundingRect().contains(x, y);
     } // Function contains()
@@ -327,7 +327,7 @@ export class SGraphItem extends SObject {
      * 获得 item 的路径节点列表。(该节点被加载到场景中,如果未被加载到场景中,计算会出错)
      *
      * @return item 的路径节点列表
-     */
+    */
     itemPath(): SGraphItem[] {
         if (this.parent != null) {
             let list = this.parent.itemPath();
@@ -344,7 +344,7 @@ export class SGraphItem extends SObject {
      * @param x     场景中的横坐标
      * @param y     场景中的纵坐标
      * @return 在 item 中的坐标
-     */
+    */
     mapFromScene(x: number, y: number): SPoint {
         const m = this.scene2itemMattrix();
         return new SPoint(x, y).matrixTransform(m.inversed());
@@ -356,7 +356,7 @@ export class SGraphItem extends SObject {
      * @param x     item 中的横坐标
      * @param y     item 中的纵坐标
      * @return 在场景中的坐标
-     */
+    */
     mapToScene(x: number, y: number): SPoint {
         if (this.parent == null) {
             return new SPoint(x, y);
@@ -371,7 +371,7 @@ export class SGraphItem extends SObject {
      * 场景对象到 item 对象的转换矩阵
      *
      * @return 转换矩阵
-     */
+    */
     scene2itemMattrix(): SMatrix {
         let m = new SMatrix();
         let list = this.itemPath();
@@ -396,7 +396,7 @@ export class SGraphItem extends SObject {
      *
      * @param event     保存事件参数
      * @return 是否处理事件
-     */
+    */
     onClick(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             let item = this.children[i];
@@ -418,7 +418,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onDoubleClick(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             let item = this.children[i];
@@ -440,7 +440,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseDown(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             try {
@@ -475,7 +475,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseMove(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             let item = this.children[i];
@@ -525,7 +525,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseUp(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             let item = this.children[i];
@@ -558,7 +558,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseEnter(event: SMouseEvent): boolean {
         return false;
     } // Function onMouseEnter()
@@ -568,7 +568,7 @@ export class SGraphItem extends SObject {
      *
      * @param event   保存事件参数
      * @return 是否处理事件
-     */
+    */
     onMouseLeave(event: SMouseEvent): boolean {
         return false;
     } // Function onMouseLeave()
@@ -578,7 +578,7 @@ export class SGraphItem extends SObject {
      *
      * @param event       事件参数
      * @return 是否处理事件
-     */
+    */
     onContextMenu(event: SMouseEvent): boolean {
         for (let i = this.children.length - 1; i >= 0; i--) {
             let item = this.children[i];
@@ -598,33 +598,33 @@ export class SGraphItem extends SObject {
      * 按键按下事件
      *
      * @param event       事件参数
-     */
+    */
     onKeyDown(event: KeyboardEvent): void {} // Function onKeyDown()
 
     /**
      * 按键 press 事件
      *
      * @param event       事件参数
-     */
+    */
     onKeyPress(event: KeyboardEvent): void {} // Function onKeyPress()
 
     /**
      * 按键松开事件
      *
      * @param event       事件参数
-     */
+    */
     onKeyUp(event: KeyboardEvent): void {} // Function onKeyUp()
 
     /**
      * 取消操作 item 事件
-     */
+    */
     cancelOperate(): void {} // Function cancelOperate()
 
     /**
      * 返回 item 对应的数据对象
      *
      * @return  item 数据
-     */
+    */
     toData(): any | null {
         return null;
     } // Function toData()
@@ -634,7 +634,7 @@ export class SGraphItem extends SObject {
      *
      * @param x   x 坐标
      * @param y   y 坐标
-     */
+    */
     moveToOrigin(x: number, y: number): void {
         if (this.children && this.children.length) {
             this.children.forEach(it => {
@@ -651,7 +651,7 @@ export class SGraphItem extends SObject {
      * @param a   比较元素 1
      * @param b   比较元素 2
      * @return 2 个元素 zOrder 的差值
-     */
+    */
     private static sortItemZOrder(a: SGraphItem, b: SGraphItem): number {
         return a.zOrder - b.zOrder;
     } // Function sortItemZOrder()
@@ -662,7 +662,7 @@ export class SGraphItem extends SObject {
      * @param child   子对象
      * @param event   事件参数
      * @return 子对象鼠标事件
-     */
+    */
     private static toChildMouseEvent(
         child: SGraphItem,
         event: SMouseEvent
@@ -690,7 +690,7 @@ export class SGraphItem extends SObject {
      * 锁定 item
      *
      * @param item    被锁定的 item
-     */
+    */
     protected grabItem(item: SGraphItem): void {
         if (this.scene != null) {
             this.scene.grabItem = item;
@@ -699,7 +699,7 @@ export class SGraphItem extends SObject {
 
     /**
      * 释放被锁定的 item
-     */
+    */
     protected releaseItem(): void {
         if (this.scene != null) {
             this.scene.grabItem = null;
@@ -712,7 +712,7 @@ export class SGraphItem extends SObject {
      * @param x     X 轴
      * @param y     Y 轴
      * @return 在父节点的位置
-     */
+    */
     protected toParentChange(x: number, y: number): SPoint {
         const m = new SMatrix();
         m.scale(this.scale, this.scale);
@@ -729,7 +729,7 @@ export class SGraphItem extends SObject {
      * 判断是否处理事件
      *
      * @return 是否处理事件
-     */
+    */
     private acceptEvent(): boolean {
         return this.visible && this.enabled;
     } // Function acceptEvent()
@@ -739,7 +739,7 @@ export class SGraphItem extends SObject {
      *
      * @param event     事件参数
      * @return 是否处理事件
-     */
+    */
     private clickSelect(event: SMouseEvent): boolean {
         // 如果 Item 不可被选中,或没有按下鼠标左键,则直接返回
         if (!this.selectable) {

+ 0 - 0
persagy-web-graph/src/SGraphScene.ts


Some files were not shown because too many files changed in this diff