소스 검색

格式以及注释规范

YaolongHan 4 년 전
부모
커밋
499c9da200

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

@@ -52,7 +52,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础直线
      *
      * @param data  数据
-     * @return 线
+     * @return 线实例
      */
     createBaseLineEdit(data: Marker): SBaseLineEdit {
         return new SBaseLineEdit(null, data);
@@ -62,7 +62,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础文本
      *
      * @param data  数据
-     * @return 文本
+     * @return 文本实例
      */
     createBaseTextEdit(data: Marker): SBaseTextEdit {
         return new SBaseTextEdit(null, data);
@@ -72,7 +72,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础图片
      *
      * @param data  数据
-     * @return 图片
+     * @return 图片实例
      */
     createBaseImageEdit(data: Marker): SBaseImageEdit {
         return new SBaseImageEdit(null, data);
@@ -82,7 +82,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础矩形
      *
      * @param data  数据
-     * @return 矩形
+     * @return 矩形实例
      */
     createBaseRectEdit(data: Marker): SBaseRectEdit {
         return new SBaseRectEdit(null, data);
@@ -92,7 +92,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础圆
      *
      * @param data  数据
-     * @return 圆
+     * @return 圆实例
      */
     createBaseCircleEdit(data: Marker): SBaseCircleEdit {
         return new SBaseCircleEdit(null, data);
@@ -102,7 +102,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础注释
      *
      * @param data     数据
-     * @return 注释
+     * @return 注释实例
      */
     createBaseExpainEdit(data: Marker): SBaseExpainEdit {
         return new SBaseExpainEdit(null, data);
@@ -112,7 +112,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础多边形
      *
      * @param data     数据
-     * @return 注释
+     * @return 多边形实例
      */
     createBasePolygonEdit(data: Marker): SBasePolygonEdit {
         return new SBasePolygonEdit(null, data);
@@ -122,7 +122,7 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础基础箭头(折线)
      *
      * @param data     数据
-     * @return  注释
+     * @return  基础箭头实例
      */
     createBaseArrow(data: Marker): SBaseArrow {
         return new SBaseArrow(null, data);
@@ -132,28 +132,28 @@ export class BigEditFactory extends SItemFactory {
      * 创建基础基础箭头(折线)
      *
      * @param data     数据
-     * @return  注释
+     * @return  基础箭头实例
      */
     createBasePolygonArrowEdit(data: Marker): SBaseArrowPolyEdit {
         return new SBaseArrowPolyEdit(null, data);
     }
 
-    /*
-    * 创建基础设备
-    *
-    * @param data     数据
-    * @return 注释
-    */
+    /**
+     * 创建基础设备
+     *
+     * @param data     数据
+     * @return 基础设备实例
+     */
     createBaseEquipment(data: Legend): SBaseEquipment {
         return new SBaseEquipment(null, data);
     }
 
-    /*
-     * 创建基础管道
-     *
-     * @param data     数据
-     * @return 注释
-     */
+    /**
+      * 创建基础管道
+      *
+      * @param data     数据
+      * @return 基础管道实例
+      */
     createBasePipe(data: Relation): SBasePipe {
         return new SBasePipe(null, data);
     }

+ 33 - 10
persagy-web-big-edit/src/SBaseEditScene.ts

@@ -57,7 +57,7 @@ export class SBaseEditScene extends SGraphEditScene {
      */
     constructor() {
         super()
-    } // Constructor
+    }
 
     /**
      * 新增基础类注释
@@ -128,6 +128,7 @@ export class SBaseEditScene extends SGraphEditScene {
         this.grabItem = item;
         item.connect("finishCreated", this, this.finishCreated);
         item.connect("onContextMenu", this, this.getItem);
+        // view 必须存在
         if (this.view) {
             this.view.update();
         }
@@ -169,10 +170,13 @@ export class SBaseEditScene extends SGraphEditScene {
         this.grabItem = item;
         item.connect("finishCreated", this, this.finishCreated);
         item.connect("onContextMenu", this, this.getItem);
+
+        // view 必须存在
         if (this.view) {
             // 视图存在缩放比例,箭头宽度随缩放比例改变
-            if (this.view?.scale)
-            item.arrowWidth = item.arrowWidth / this.view.scale;
+            if (this.view?.scale) {
+                item.arrowWidth = item.arrowWidth / this.view.scale;
+            }
 
             this.view.update();
         }
@@ -232,12 +236,15 @@ export class SBaseEditScene extends SGraphEditScene {
      */
     addBasePipe(event: SMouseEvent, legendObj: any): SBasePipe {
         const anc = this.clickIsAnchor(event);
+
+        // 锚点时否存在
         if (anc) {
             const p = anc.mapToScene(0, 0)
             anc.isConnected = true;
             event.x = p.x;
             event.y = p.y;
         };
+
         const data = {
             name: legendObj.name,
             graphElementId: legendObj.id,
@@ -264,13 +271,14 @@ export class SBaseEditScene extends SGraphEditScene {
         this.grabItem = item;
         // 起始锚点
         item.startAnchor = anc;
+
+        // 锚点事件绑定
         if (anc) {
             anc.parent?.connect('changePos', item, item.changePos)
             item.anchor1Id = anc.id;
             item.node1Id = anc.parent ? anc.parent.nodeId : '';
         }
 
-        console.log('anc', anc)
         item.connect("finishCreated", this, this.finishCreated);
         item.connect("onContextMenu", this, this.getItem);
         if (this.view) {
@@ -321,6 +329,8 @@ export class SBaseEditScene extends SGraphEditScene {
         itemList.forEach((element: any) => {
             this.removeItem(element)
         });
+
+        // view 必须存在
         if (this.view) {
             this.view.update()
         }
@@ -343,6 +353,8 @@ export class SBaseEditScene extends SGraphEditScene {
      * @param ctrl  是否点击ctrl
      */
     groupSelect(ctrl: boolean) {
+
+        // 判断当前图例是否为选中框
         if (this.grabItem instanceof SRectSelectItem) {
             const rect = this.grabItem.boundingRect();
             this.arrToSelect(this.root.children, rect)
@@ -356,7 +368,9 @@ export class SBaseEditScene extends SGraphEditScene {
      * @param rect      框选矩形区域
      */
     private arrToSelect(arr: SGraphItem[], rect: SRect) {
+        // 数组不为空
         if (Array.isArray(arr) && arr.length) {
+            // 对框选范围内的对象高亮显示
             arr.forEach(t => {
                 if (!(t instanceof SGraphSelectContainer) && t.parent) {
                     if (t.visible) {
@@ -392,16 +406,18 @@ export class SBaseEditScene extends SGraphEditScene {
      * @param event   鼠标事件参数
      */
     onMouseUp(event: SMouseEvent): boolean {
+        // grabItem 不为 null
         if (this.grabItem) {
             // 鼠标抬起时,如果grabItem为框选则删除框选item
             if (this.grabItem instanceof SRectSelectItem) {
                 this.removeItem(this.grabItem);
                 this.groupSelect(false);
                 this.grabItem = null;
-
+                // view 不为空
                 if (this.view) {
                     this.view.update()
                 }
+
                 return true;
             }
 
@@ -416,6 +432,8 @@ export class SBaseEditScene extends SGraphEditScene {
      */
     copy(): void {
         const itemList = this.save(false);
+
+        // itemList 复制数据不为空
         if (itemList) {
             // 删除对应得id
             itemList.markers.map((item: any) => {
@@ -425,6 +443,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 return item
             });
 
+            // 删除对应得id
             itemList.nodes.map((item: any) => {
                 delete item.id;
                 delete item.graphId;
@@ -432,6 +451,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 return item
             });
 
+            // 删除对应得id
             itemList.relations.map((item: any) => {
                 delete item.id;
                 delete item.graphId;
@@ -468,15 +488,15 @@ export class SBaseEditScene extends SGraphEditScene {
     /**
      * 图例置顶、置底
      *
-     * @parm type   设置类型
+     * @param type   设置类型
      */
     setOrder(type: string) {
         this.selectContainer.setOrder(SOrderSetType[type])
     }
 
     /**
-   * 设置管线结束锚点
-   */
+     * 设置管线结束锚点
+     */
     setTipeEndanchor(event: SMouseEvent): void {
         if (this.grabItem instanceof SBasePipe) {
             const anc = this.clickIsAnchor(event);
@@ -485,7 +505,10 @@ export class SBaseEditScene extends SGraphEditScene {
                 anc.isConnected = true;
                 event.x = p.x;
                 event.y = p.y;
+
+                // 判断当前是否为编辑状态
                 if (this.grabItem.status == SItemStatus.Create) {
+                    // pointList 长度不能为空
                     if (this.grabItem.pointList.length) {
                         this.grabItem.endAnchor = anc;
                         anc.parent?.connect('changePos', this.grabItem, this.grabItem.changePos)
@@ -507,8 +530,8 @@ export class SBaseEditScene extends SGraphEditScene {
     /**
      * 获取item (常用与场景外的调用F)
      *
-     * @params isAll    是否为全部item数据
-     * @return obj      返回保存的数据接口
+     * @param isAll    是否为全部item数据
+     * @returns   返回保存的数据接口
      */
     save(isAll: boolean = true): any {
     }

+ 26 - 0
persagy-web-big-edit/src/index.ts

@@ -1,3 +1,29 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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 { SBaseEditScene } from "./SBaseEditScene"
 import { SBaseExpainEdit } from "./items/SBaseExpainEdit"
 import { SBasePipe } from "./items/SBasePipe"

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

@@ -30,39 +30,36 @@ import { SGraphItem, SLineStyle } from "@persagy-web/graph/lib";
 import { Marker } from "./../types/Marker";
 import { SMouseEvent } from "@persagy-web/base/lib";
 
-
 /**
  * 编辑箭头(折线)
  *
  * @author 韩耀龙 <han_yao_long@163.com>
  */
 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 parent    指向父 Item
      * @param data      数据
      */
     constructor(parent: SGraphItem | null, data: Marker) {
@@ -92,7 +89,7 @@ export class SBaseArrow extends SBasePolylineEdit {
      * @param painter   绘制对象
      */
     drawBaseLine(painter: SPainter): void {
-        // 绘制基本图形
+        // 绘制基本图形 针对不同的线样式
         if (this.lineStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
@@ -106,10 +103,12 @@ export class SBaseArrow extends SBasePolylineEdit {
         }
 
         painter.pen.color = this.strokeColor;
+        // 设置开头样式
         painter.drawArrowLine(this.pointList[0], this.pointList[1], {
             begin: this.begin,
             end: SArrowStyleType.None
         });
+        // 设置尾部样式
         painter.drawArrowLine(
             this.pointList[this.pointList.length - 2],
             this.pointList[this.pointList.length - 1],
@@ -127,6 +126,7 @@ export class SBaseArrow extends SBasePolylineEdit {
      * @return 对象储存的相关数据
      */
     toData(): any {
+        // this.data 必须存在
         if (!this.data) return;
         this.data.style.begin = this.begin;
         this.data.style.end = this.end;

+ 16 - 7
persagy-web-big-edit/src/items/SBaseArrowPolyEdit.ts

@@ -48,16 +48,16 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 	_isSingle: boolean = true;
 	get isSingle(): boolean {
 		return this._isSingle;
-	} // Get isSingle
+	}
 	set isSingle(v: boolean) {
 		this._isSingle = v;
 		this.update();
-	} // Set isSingle
+	}
 
 	/**
 	 * 构造函数
 	 *
-	 * @param parent    父级
+	 * @param parent    指向父 Item
 	 * @param data      坐标集合|第一个点坐标
 	 */
 	constructor(parent: SGraphItem | null, data: Marker): void {
@@ -65,7 +65,9 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
         // 箭头宽度
         if (data?.style?.default?.arrowWidth) {
             this.arrowWidth = data.style.default.arrowWidth;
-        }
+		}
+
+		// 设置罗阔
 		this.pointChange();
 	}
 
@@ -73,21 +75,24 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 	 * 根据两个顶点生成多边形数组
 	 */
 	pointChange(): void {
+		// 轮廓箭头数组数量必须大于两位
 		if (this.line.length > 1) {
 			const line = new SLine(this.line[0], this.line[1]);
+			// 获取两点之间的距离
 			const dis = SMathUtil.pointDistance(
 				this.line[0].x,
 				this.line[0].y,
 				this.line[1].x,
 				this.line[1].y
 			);
+            // 根据dx dy 获取对应直线的角度
 			if (line.dx != 0) {
 				const tempFo = Math.atan(line.dy / line.dx);
 				this._ang = line.dx > 0 ? tempFo : tempFo + Math.PI;
 			} else {
 				this._ang = line.dy > 0 ? Math.PI / 2 : (3 * Math.PI) / 2;
 			}
-
+            // 根据是否是单箭头设置对应的轮廓
 			if (this.isSingle) {
 				this.pointList = [
 					new SPoint(0, this.arrowWidth / 2),
@@ -114,7 +119,7 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 			}
 		}
     }
-    
+
     /**
      * 返回对象储存的相关数据
      *
@@ -132,6 +137,7 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 	 * @param painter   绘制对象
 	 */
 	onDraw(painter: SPainter): void {
+		// line数量不能为0
 		if (this.line.length) {
 			painter.save();
 
@@ -143,7 +149,7 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 			painter.rotate((this._ang * 180) / Math.PI);
 			painter.pen.color = this.strokeColor;
 			painter.brush.color = this.fillColor;
-
+            // 如果为选中状态且编辑状态为正常则设置阴影
 			if (this.selected && this.status == SItemStatus.Normal) {
 				painter.pen.lineWidth = 2 * lw;
 				painter.shadow.shadowBlur = 10;
@@ -152,13 +158,16 @@ export class SBaseArrowPolyEdit extends SBaseLineEdit {
 				painter.shadow.shadowOffsetY = 5;
 			}
 
+            // 绘制多边形
 			painter.drawPolygon(this.pointList);
 			painter.restore();
 
+			// 如果状态为编辑态则设置对应节点效果
 			if (this.status == SItemStatus.Edit) {
                 painter.pen.lineWidth = lw;
 				this.line.forEach((p, i) => {
 					painter.brush.color = SColor.White;
+					// 如果选中节点则高亮
 					if (i == this.curIndex) {
 						painter.brush.color = this.activeFillColor;
 					}

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

@@ -29,6 +29,7 @@ import { Legend } from "./../types/Legend";
 import { SBaseIconTextEdit, SBaseTextEdit } from "@persagy-web/edit";
 import { SColor } from '@persagy-web/draw/lib';
 import { svgTobase64, uuid } from "./../until"
+
 /**
  * 编辑基础设备类
  *
@@ -37,24 +38,25 @@ import { svgTobase64, uuid } from "./../until"
 export class SBaseEquipment extends SBaseIconTextEdit {
     /** 图例节点 id */
     nodeId: string | null = null;
+
     /** 设备图例 */
     _legendData: Legend | null = null;
     set legendData(val) {
         this._legendData = val;
         this.initData()
-    } // set legendData()
+    }
     get legendData(): Legend | null {
         return this._legendData
-    } // get legendData()
+    }
 
     /** 信息点存储 */
     _infoPointList: any[] = []
     set infoPointList(val) {
         this._infoPointList = val;
-    } // set infoPointList()
+    }
     get infoPointList(): any[] {
         return this._infoPointList
-    } // get infoPointList()
+    }
 
     defaultUrl: string = '';
     /** 图得url */
@@ -62,64 +64,78 @@ export class SBaseEquipment extends SBaseIconTextEdit {
     set url(val) {
         this._url = val;
         this.initUrl()
-    } // set infoPointList()
+    }
     get url(): string {
         return this._url
-    } // get infoPointList()
+    }
 
-    //  设备附加数据
+    /** 设备附加数据 */
     anotherMsg: string = ''
 
     /**
      * 构造函数
      *
-     * @param parent    指向父对象
+     * @param parent    指向父 Item
      * @param data      数据
      */
     constructor(parent: SGraphItem | null, data: Legend) {
         super(parent);
         this.legendData = data;
-    } // Constructor
+    }
 
     /**
      * 设置 legendData 时对 item 做设置
      */
     initData() {
+        // this.legendData 不能为空
         if (!this.legendData) return;
 
-        this.nodeId = this.legendData?.nodeId
+        this.nodeId = this.legendData?.nodeId;
+        // 判断 size 是否存在
         if (this.legendData.size) {
             this.sWidth = this.legendData.size.width;
             this.sHeight = this.legendData.size.height;
         }
 
         this.img.connect("onMove", this, this.changeAnchorPoint.bind(this));
+
+        // 判断是否有锚点数据
         if (this.legendData.anchorList && this.legendData.anchorList.length) {
+            // 对锚点数据遍历生成对应的锚点
             this.anchorList = this.legendData.anchorList.map(t => {
                 let item = new SAnchorItem(this);
+
+                // 是否存在 anchorId
                 if (t.anchorId) {
                     item.id = t.anchorId;
                 }
+
                 item.moveTo(t.pos.x, t.pos.y);
                 return item;
             });
+
         } else {
             const anchorPoint = [
                 { x: this.img.x, y: this.img.y, anchorId: uuid() },
             ];
+
+            // 没锚点则默认中心点为锚点
             this.anchorList = anchorPoint.map(t => {
                 let item = new SAnchorItem(this);
+                // 是否存在 anchorId
                 if (t.anchorId) {
                     item.id = t.anchorId;
                 }
+
                 item.moveTo(t.x, t.y);
                 return item;
             });
         }
 
-        // 存储信息点
+        // 该设备是否有信息点
         if (this.legendData.properties && this.legendData.properties.infoPointList) {
             const infoPointList = this.legendData.properties.infoPointList;
+            // 将信息点数据转换为实例
             if (infoPointList.length) {
                 this.infoPointList = infoPointList;
                 this.infoPointList.forEach((obj, i) => {
@@ -128,6 +144,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
             } else {
                 this.infoPointList = []
             }
+
         } else {
             this.infoPointList = []
         }
@@ -141,7 +158,11 @@ export class SBaseEquipment extends SBaseIconTextEdit {
         this.selectable = true;
     }
 
+    /**
+     * 根据 url 获取图片
+     */
     initUrl() {
+        // 获取图数据转换为 base64
         svgTobase64(this.url).then((res) => {
             this.img.url = res ? res : '';
         }).catch((res) => {
@@ -161,10 +182,15 @@ export class SBaseEquipment extends SBaseIconTextEdit {
             this.setTextItem(val, (this._infoPointList.length - 1))
         } else {
             let deleteItemIndex: number = -1;
+
+            // 遍历信息点数组删除 checked 为 false 的信息点
             this._infoPointList.forEach((item, index) => {
+
+                // 通过 id 对比定位对象
                 if (val.id == item.id) {
                     deleteItemIndex = index;
                 }
+
             });
             this._infoPointList.splice(deleteItemIndex, 1);
             this.setTextItem(val, deleteItemIndex)
@@ -178,10 +204,13 @@ export class SBaseEquipment extends SBaseIconTextEdit {
      * @params index 文本索引
      */
     setTextItem(val: any, index: number): void {
+        // 该状态时否选中如果选中生成实例并维护
         if (val.checked) {
             let item = new SBaseTextEdit(this, null);
             item.propertyData = val;
             item.text = val.name;
+
+            // 是否存在pos
             if (val.pos) {
                 item.moveTo(val.pos.x, val.pos.y)
             } else {
@@ -204,6 +233,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
             this.textItemList.splice(index, 1)
             this.update()
         }
+
     }
 
     /**
@@ -212,7 +242,10 @@ export class SBaseEquipment extends SBaseIconTextEdit {
      * @return	对象储存的相关数据
      */
     toData(): any {
+
+        // this.legendData 必须存在
         if (this.legendData) {
+            // 遍历锚点获取需要存储的数据格式
             const list = this.anchorList.map((item) => {
                 return {
                     anchorId: item.id,
@@ -222,6 +255,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
                     }
                 }
             })
+
             this.legendData.anchorList = list;
             // 反馈大小
             if (this.legendData.size) {
@@ -239,8 +273,10 @@ export class SBaseEquipment extends SBaseIconTextEdit {
                 x: this.x,
                 y: this.y
             };
+
             // 存储信息点
-            const infoPoinList: any[] = []
+            const infoPoinList: any[] = [];
+            // 获取信息点对应参数
             this.textItemList.forEach(item => {
                 let obj = Object.assign(item.propertyData, {
                     pos: { x: item.x, y: item.y },
@@ -256,6 +292,8 @@ export class SBaseEquipment extends SBaseIconTextEdit {
             this.legendData.properties.infoPointList = infoPoinList;
             this.legendData.properties.anotherMsg = this.anotherMsg;
             this.legendData.style.default.base64Url = "";
+
+            // 判断 defaultUrl 是否存在
             if (this.defaultUrl) {
                 this.legendData.style.default.url = this.defaultUrl;
             }

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

@@ -29,18 +29,17 @@ import {SGraphItem} from "@persagy-web/graph/lib";
 import {Marker} from "./../types/Marker";
 import {SMouseEvent} from "@persagy-web/base/lib";
 
-/**
+ /**
   * 编辑基础注释类
   *
   * @author 韩耀龙 <han_yao_long@163.com>
   */
  export class SBaseExpainEdit extends SBaseTextEdit {
-     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-     //属性
+
      /**
       * 构造函数
       *
-      * @param parent    指向父对象
+      * @param parent    指向父对象 Item
       * @param data      数据
       */
      constructor(parent: SGraphItem | null, data: Marker) {

+ 13 - 10
persagy-web-big-edit/src/items/SBaseObjectRelation.ts

@@ -43,41 +43,44 @@ export class SBaseObjectRelation extends SGraphItem {
   private _strokeColor: SColor = SColor.Black;
   get strokeColor(): SColor {
     return this._strokeColor;
-  } // Get strokeColor
+  }
   set strokeColor(v: SColor) {
     this._strokeColor = v;
     this.update();
-  }// Get strokeColor
+  }
 
   /** 线条样式 */
   private _lineStyle: SLineStyle = SLineStyle.Solid;
   get lineStyle(): SLineStyle {
     return this._lineStyle;
-  } // Get lineStyle
+  }
   set lineStyle(v: SLineStyle) {
     this._lineStyle = v;
     this.update();
-  } // Set lineStyle
+  }
 
   /** 线条宽度 */
   private _lineWidth: number = 1;
   get lineWidth(): number {
     return this._lineWidth;
-  } //Get lineWidth
+  }
   set lineWidth(v: number) {
     this._lineWidth = v;
     this.update();
-  } //Set lineWidth
+  }
 
   /**
-    * 绘制
-    *
-    * @param painter   绘制对象
-    */
+   * 绘制
+   *
+   * @param painter   绘制对象
+   */
   onDraw(painter: SPainter): void {
+    // 判断时否存在开头结尾
     if (this.startPoint && this.endPoint) {
       painter.pen.lineWidth = painter.toPx(this.lineWidth);
       painter.pen.color = this.strokeColor;
+
+      // 设置线样式
       if (this.lineStyle == SLineStyle.Dashed) {
         painter.pen.lineDash = [
           painter.toPx(this.lineWidth * 3),

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

@@ -38,68 +38,72 @@ import { SBaseCirclePolylineEdit } from "@persagy-web/edit/lib";
  * @author 韩耀龙 <han_yao_long@163.com>
  */
 export class SBasePipe extends SBaseCirclePolylineEdit {
-    //属性
     /** 关系型数据 */
     _relationData: Relation | null = null;
     set relationData(val) {
         this._relationData = val;
         this.initData();
-    } // set legendData()
+    }
     get relationData(): Relation | null {
         return this._relationData;
-    } // get legendData()
+    }
 
     /** 起始锚点  */
     startAnchor: SAnchorItem | null = null;
     /** 结束锚点  */
     endAnchor: SAnchorItem | null = null;
+
     /** 关联锚点1ID  */
     _anchor1Id: string = "";
     get anchor1Id(): string {
         return this._anchor1Id;
-    } // get anchor1Id()
+    }
     set anchor1Id(v: string) {
         this._anchor1Id = v;
+        // 判断 this.relationData 存在
         if (this.relationData) {
             this.relationData.anchor1Id = this._anchor1Id;
         }
-    } // set anchor1Id()
+    }
 
     /** 关联锚点2ID  */
     _anchor2Id: string = "";
     get anchor2Id(): string {
         return this._anchor2Id;
-    } // get anchor2Id()
+    }
     set anchor2Id(v: string) {
         this._anchor2Id = v;
+        // 判断 this.relationData 存在
         if (this.relationData) {
             this.relationData.anchor2Id = this._anchor2Id;
         }
-    } // set anchor2Id()
+    }
 
     /** 关联节点1ID */
     _node1Id: string = "";
     get node1Id(): string {
         return this._node1Id;
-    } // get node1Id()
+    }
     set node1Id(v: string) {
         this._node1Id = v;
+        // 判断 this.relationData 存在
         if (this.relationData) {
             this.relationData.node1Id = this._node1Id;
         }
-    } // set node1Id()
+    }
 
     /** 关联节点2ID */
     _node2Id: string = "";
     get node2Id(): string {
         return this._node2Id;
-    } // get node2Id()
+    }
     set node2Id(v: string) {
         this._node2Id = v;
+        // 判断 this.relationData 存在
         if (this.relationData) {
             this.relationData.node2Id = this._node2Id;
         }
-    } // set node2Id()
+    }
 
     /**
      * 构造函数
@@ -120,13 +124,15 @@ export class SBasePipe extends SBaseCirclePolylineEdit {
      */
     initData() {
         const data = this.relationData;
+        // data 不能为空
         if (!data) return;
+
         // 名称
         this.name = data.name;
         // 线样式
         this.lineStyle = data.style.default.lineStyle
             ? data.style.default.lineStyle
-            : SLineStyle.Solid;;
+            : SLineStyle.Solid;
         // 折线点
         if (data.pointList) {
             let setPointList: SPoint[];
@@ -141,14 +147,17 @@ export class SBasePipe extends SBaseCirclePolylineEdit {
             this._node1Id = data.node1Id;
         }
 
+        //锚点
         if (data.node2Id) {
             this._node2Id = data.node2Id;
         }
 
+        //锚点
         if (data.anchor1Id) {
             this._anchor1Id = data.anchor1Id;
         }
 
+        //锚点
         if (data.anchor2Id) {
             this._anchor2Id = data.anchor2Id;
         }
@@ -182,16 +191,18 @@ export class SBasePipe extends SBaseCirclePolylineEdit {
      * 接收事件作出修改
      */
     changePos() {
+        // 开始锚点不能为空
         if (this.startAnchor) {
-            // 判断删除equip后,不移动
+            // 获取变化锚点的坐标
             if (this.startAnchor.parent && this.startAnchor.parent.parent) {
                 let p = this.startAnchor.mapToScene(0, 0);
                 this.pointList[0] = new SPoint(p.x - this.x, p.y - this.y);
             }
         }
 
+        // 结束锚点不能为空
         if (this.endAnchor) {
-            // 删除equip后
+            // 获取变化锚点的坐标
             if (this.endAnchor.parent && this.endAnchor.parent.parent) {
                 let p = this.endAnchor.mapToScene(0, 0);
                 this.pointList[this.pointList.length - 1] = new SPoint(
@@ -210,8 +221,10 @@ export class SBasePipe extends SBaseCirclePolylineEdit {
     toData(): any {
         this.moveToOrigin();
         const data = this.relationData;
+        // data 不能为空
         if (!data) return;
 
+        // 获取轮廓线数据
         if (this.pointList.length) {
             const Line = this.pointList.map(pos => {
                 return {

+ 7 - 1
persagy-web-big-edit/src/until.ts

@@ -35,6 +35,7 @@ export function rgbaNum(rgba: string) {
  */
 export function svgTobase64(url: string) {
   let baseUrl: string = ''
+  // 请求svg图
   return new Promise((relve, res) => {
     if (url.includes(".svg")) {
       axios.get(url).then((res) => {
@@ -65,6 +66,12 @@ export function svgTobase64(url: string) {
   })
 
 }
+
+/**
+ * svg格式转换为 base64
+ *
+ * @param str svg数据
+ */
 export function svgUrlTobase64(str) {
   var div = document.createElement("div");
   div.appendChild(str);
@@ -72,5 +79,4 @@ export function svgUrlTobase64(str) {
   const baseUrl =
     "data:image/svg+xml;base64," + crypto.default.enc.Base64.stringify(svgUrl);
   return baseUrl
-
 }