|
@@ -147,7 +147,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
*/
|
|
|
constructor(parent: SGraphItem | null) {
|
|
|
super(parent);
|
|
|
- }
|
|
|
+ } // Constructor
|
|
|
|
|
|
//////////////////
|
|
|
// 以下为对pointList 数组的操作方法
|
|
@@ -169,7 +169,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
}
|
|
|
this.update();
|
|
|
return point;
|
|
|
- }
|
|
|
+ } // Function insertPoint()
|
|
|
|
|
|
/**
|
|
|
* 删除点位
|
|
@@ -198,7 +198,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
this.curPoint = null;
|
|
|
this.update();
|
|
|
return point;
|
|
|
- }
|
|
|
+ } // Function deletePoint()
|
|
|
|
|
|
/**
|
|
|
* 多边形顶点的移动位置
|
|
@@ -219,16 +219,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
}
|
|
|
point = this.pointList[i];
|
|
|
return point;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 打印出多边形数组
|
|
|
- *
|
|
|
- * @return 顶点数组
|
|
|
- */
|
|
|
- PrintPointList(): SPoint[] {
|
|
|
- return this.pointList;
|
|
|
- }
|
|
|
+ } // Function movePoint()
|
|
|
|
|
|
////////////
|
|
|
// 以下为三种状态下的绘制多边形方法
|
|
@@ -266,7 +257,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
}
|
|
|
painter.drawPolygon([...pointList]);
|
|
|
painter.restore();
|
|
|
- }
|
|
|
+ } // Function drawShowPolygon()
|
|
|
|
|
|
/**
|
|
|
* 创建状态 --绘制多边形数组
|
|
@@ -322,7 +313,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
} else {
|
|
|
painter.drawPolygon(pointList);
|
|
|
}
|
|
|
- }
|
|
|
+ } // Function drawCreatePolygon()
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -348,7 +339,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
}
|
|
|
painter.drawCircle(item.x, item.y, painter.toPx(this.len / 2));
|
|
|
});
|
|
|
- }
|
|
|
+ } // Function drawCreatePolygon()
|
|
|
|
|
|
/**
|
|
|
* 编辑状态操作多边形数组
|
|
@@ -462,7 +453,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
// 刷新视图
|
|
|
this.update();
|
|
|
}
|
|
|
- }
|
|
|
+ } // Function editPolygonPoint()
|
|
|
|
|
|
/////////////////////
|
|
|
// undo、redo相关操作
|
|
@@ -476,7 +467,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
// 记录相关命令并推入堆栈中
|
|
|
const sgraphcommand = new SGraphCommand(this.scene, this, ...any);
|
|
|
this.undoStack.push(sgraphcommand);
|
|
|
- }
|
|
|
+ } // Function recordAction()
|
|
|
|
|
|
/**
|
|
|
* 执行取消操作执行
|
|
@@ -486,7 +477,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
return;
|
|
|
}
|
|
|
this.undoStack.undo();
|
|
|
- }
|
|
|
+ } // Function undo()
|
|
|
|
|
|
/**
|
|
|
* 执行重做操作执行
|
|
@@ -496,7 +487,7 @@ export class SPolygonItem extends SGraphItem {
|
|
|
return;
|
|
|
}
|
|
|
this.undoStack.redo();
|
|
|
- }
|
|
|
+ } // Function redo()
|
|
|
|
|
|
///////////////////////////////
|
|
|
// 以下为鼠标事件
|
|
@@ -829,4 +820,4 @@ export class SPolygonItem extends SGraphItem {
|
|
|
this.drawEditPolygon(painter, this.pointList);
|
|
|
}
|
|
|
} // Function onDraw()
|
|
|
-}
|
|
|
+} // Class SPolygonItem
|