YaolongHan 4 năm trước cách đây
mục cha
commit
e5aedc0942

+ 3 - 3
package.json

@@ -9,9 +9,9 @@
   },
   "dependencies": {
     "@persagy-web/base": "2.2.1",
-    "@persagy-web/big": "2.2.10",
-    "@persagy-web/draw": "2.2.7",
-    "@persagy-web/graph": "2.2.14",
+    "@persagy-web/big": "2.2.11",
+    "@persagy-web/draw": "2.2.8",
+    "@persagy-web/graph": "2.2.15",
     "ant-design-vue": "^1.6.5",
     "axios": "^0.20.0",
     "core-js": "^3.6.5",

+ 68 - 0
src/components/editClass/big-edit/items/SBaseArrowEdit.ts

@@ -0,0 +1,68 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/";
+import { SGraphItem } from "@persagy-web/graph";
+import { Marker } from "./../types/Marker";
+import { SMouseEvent } from "@persagy-web/base/lib";
+import { SArrowEdit } from '../../edit/items/SArrowEdit';
+
+/**
+ * 编辑基础箭头类
+ *
+ * * @author  haojianlong
+ */
+export class SBaseArrowEdit extends SArrowEdit {
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //属性
+    /**编辑相关操作的数据 */
+    data: Marker
+
+    constructor(parent: SGraphItem | null, data: Marker) {
+        super(parent);
+        this.data = data;
+        if (data.Style && data.Style.Line) {
+            let setPointList: SPoint[];
+            setPointList = data.Style.Line.map((i:any) => {
+                return new SPoint(i.X, i.Y)
+            });
+            this.line = setPointList;
+        }
+    }
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        super.onMouseDown(event)
+        return true;
+    } // Function onMouseDown()
+
+    toData() {
+        console.log(1230)
+    }
+}

+ 68 - 0
src/components/editClass/big-edit/items/SBaseCircleEdit.ts

@@ -0,0 +1,68 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/";
+import { SGraphItem } from "@persagy-web/graph";
+import { Marker } from "./../types/Marker";
+import { SMouseEvent } from "@persagy-web/base/lib";
+import { SCircleEdit } from '../../edit/items/SCircleEdit';
+
+/**
+ * 编辑基础矩形类
+ *
+ * * @author  haojianlong
+ */
+export class SBaseCircleEdit extends SCircleEdit {
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //属性
+    /**编辑相关操作的数据 */
+    data: Marker
+
+    constructor(parent: SGraphItem | null, data: Marker) {
+        super(parent);
+        this.data = data;
+        if (data.Style && data.Style.Line) {
+            let setPointList: SPoint[];
+            setPointList = data.Style.Line.map((i:any) => {
+                return new SPoint(i.X, i.Y)
+            });
+            this.line = setPointList;
+        }
+    }
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        super.onMouseDown(event)
+        return true;
+    } // Function onMouseDown()
+
+    toData() {
+        console.log(1230)
+    }
+}

+ 2 - 2
src/components/editClass/big-edit/items/SBaseRectEdit.ts

@@ -30,9 +30,9 @@ import { SMouseEvent } from "@persagy-web/base/lib";
 import { SRectEdit } from '../../edit/items/SRectEdit';
 
 /**
- * 编辑基础直线
+ * 编辑基础矩形
  *
- * * @author  韩耀龙(han_yao_long#163.com)
+ * * @author  haojianlong
  */
 export class SBaseRectEdit extends SRectEdit {
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

+ 68 - 0
src/components/editClass/big-edit/items/SBaseTriangleEdit.ts

@@ -0,0 +1,68 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/";
+import { SGraphItem } from "@persagy-web/graph";
+import { Marker } from "./../types/Marker";
+import { SMouseEvent } from "@persagy-web/base/lib";
+import { STriangleEdit } from '../../edit/items/STriangleEdit';
+
+/**
+ * 编辑基础三角形类
+ *
+ * * @author  haojianlong
+ */
+export class SBaseTriangelEdit extends STriangleEdit {
+    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    //属性
+    /**编辑相关操作的数据 */
+    data: Marker
+
+    constructor(parent: SGraphItem | null, data: Marker) {
+        super(parent);
+        this.data = data;
+        if (data.Style && data.Style.Line) {
+            let setPointList: SPoint[];
+            setPointList = data.Style.Line.map((i:any) => {
+                return new SPoint(i.X, i.Y)
+            });
+            this.line = setPointList;
+        }
+    }
+    /**
+     * 鼠标按下事件
+     *
+     * @param   event   保存事件参数
+     * @return  boolean
+     */
+    onMouseDown(event: SMouseEvent): boolean {
+        super.onMouseDown(event)
+        return true;
+    } // Function onMouseDown()
+
+    toData() {
+        console.log(1230)
+    }
+}

+ 345 - 0
src/components/editClass/edit/items/SArrowEdit.ts

@@ -0,0 +1,345 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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 { SArrowStyleType, SColor, SLine, 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
+} from "@persagy-web/graph/";
+import { SGraphEdit } from "..";
+import { SMathUtil } from '@persagy-web/big/lib/utils/SMathUtil';
+
+/**
+ * 折线编辑类
+ *
+ * @author  haojianlong
+ */
+export class SArrowEdit extends SGraphEdit {
+  /** 是否绘制完成  */
+  _status: SItemStatus = SItemStatus.Normal;
+  get status(): SItemStatus {
+    return this._status;
+  }
+  set status(v: SItemStatus) {
+    this._status = v;
+    this.undoStack.clear();
+    this.update();
+  }
+  /** 矩形两个对角 */
+  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();
+  /** 拖动灵敏度   */
+  dis: number = 5;
+  /** 拖动灵敏度   */
+  private sceneDis: number = 5;
+  /** 线条颜色    */
+  _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, l?: SPoint | SPoint[]) {
+    super(parent);
+    if (l) {
+      if (l instanceof SPoint) {
+        this.line.push(l);
+        this._leftTop = l;
+        this._rightBottom = l;
+      } else {
+        this.line = l;
+        this.calRect()
+      }
+    } else {
+      this.line = [];
+    }
+  } // 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()
+  }
+
+  /**
+     * 鼠标按下事件
+     *
+     * @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()
+
+  /**
+     * 鼠标移动事件
+     *
+     * @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
+     */
+  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)
+    }
+  } // 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.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()
+
+  /**
+       * 判断点是否在区域内
+       *
+       * @param   x
+       * @param   y
+       * @return  true-是
+       */
+  contains(x: number, y: number): boolean {
+    if (this.line.length == 2) {
+      let p = new SPoint(x, y);
+      if (
+        SMathUtil.pointToLine(p, new SLine(this.line[0], this.line[1]))
+          .MinDis < this.dis
+      ) {
+        return true;
+      }
+    }
+    return false;
+  } // Function contains()
+
+  /**
+   * 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.drawArrowLine(this.line[0], this.line[1], { begin: SArrowStyleType.None, end: SArrowStyleType.Basic });
+    }
+  } // Function onDraw()
+} // Class SArrowEdit

+ 337 - 0
src/components/editClass/edit/items/SCircleEdit.ts

@@ -0,0 +1,337 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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, 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
+} from "@persagy-web/graph/";
+import { SGraphEdit } from "..";
+
+/**
+ * 折线编辑类
+ *
+ * @author  haojianlong
+ */
+export class SCircleEdit extends SGraphEdit {
+  /** 是否绘制完成  */
+  _status: SItemStatus = SItemStatus.Normal;
+  get status(): SItemStatus {
+    return this._status;
+  }
+  set status(v: SItemStatus) {
+    this._status = v;
+    this.undoStack.clear();
+    this.update();
+  }
+  /** 矩形两个对角 */
+  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;
+  }
+  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, l?: SPoint | SPoint[]) {
+    super(parent);
+    if (l) {
+      if (l instanceof SPoint) {
+        this.line.push(l);
+        this._leftTop = l;
+        this._rightBottom = l;
+      } else {
+        this.line = l;
+        this.calRect()
+      }
+    } else {
+      this.line = [];
+    }
+  } // 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()
+  }
+
+  /**
+     * 鼠标按下事件
+     *
+     * @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()
+
+  /**
+     * 鼠标移动事件
+     *
+     * @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
+     */
+  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)
+    }
+  } // 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.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.drawEllipse(
+        (this._leftTop.x + this._rightBottom.x) / 2,
+        (this._leftTop.y + this._rightBottom.y) / 2,
+        (this._rightBottom.x - this._leftTop.x) / 2,
+        (this._rightBottom.y - this._leftTop.y) / 2
+      );
+    }
+  } // Function onDraw()
+} // Class SCircleEdit

+ 2 - 2
src/components/editClass/edit/items/SLineEdit.ts

@@ -518,8 +518,8 @@ export class SLineEdit extends SGraphEdit {
                 ];
             } else if (this.lineStyle == SLineStyle.Dotted) {
                 painter.pen.lineDash = [
-                    painter.toPx(this.lineWidth),
-                    painter.toPx(this.lineWidth)
+                    painter.toPx(2 * this.lineWidth),
+                    painter.toPx(2 * this.lineWidth)
                 ];
             }
             if (this.selected && this.status == SItemStatus.Normal) {

+ 19 - 5
src/components/editClass/edit/items/SRectEdit.ts

@@ -57,8 +57,10 @@ export class SRectEdit extends SGraphEdit {
     this._line = arr;
     this.update();
   } // Get line
-  private _leftTop: SPoint = new SPoint;
-  private _rightBottom: SPoint = new SPoint;
+  /** 矩形左上角 */
+  private _leftTop: SPoint = new SPoint();
+  /** 矩形右下角 */ 
+  private _rightBottom: SPoint = new SPoint();
   /** 绘制矩形的圆角半径 */
   private _radius: number = 0;
   get radius(): number {
@@ -309,9 +311,21 @@ export class SRectEdit extends SGraphEdit {
    * @param   painter painter对象
    */
   onDraw(painter: SPainter): void {
-    painter.pen.color = this.strokeColor;
-    painter.brush.color = this.fillColor;
     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)
+          ];
+      }
       if (this.radius != 0) {
         painter.drawRoundRect(this._leftTop, this._rightBottom, this.radius);
       } else {
@@ -319,4 +333,4 @@ export class SRectEdit extends SGraphEdit {
       }
     }
   } // Function onDraw()
-} // Class SPolylineItem
+} // Class SRectEdit

+ 333 - 0
src/components/editClass/edit/items/STriangleEdit.ts

@@ -0,0 +1,333 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .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, 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
+} from "@persagy-web/graph/";
+import { SGraphEdit } from "..";
+
+/**
+ * 折线编辑类
+ *
+ * @author  haojianlong
+ */
+export class STriangleEdit extends SGraphEdit {
+  /** 是否绘制完成  */
+  _status: SItemStatus = SItemStatus.Normal;
+  get status(): SItemStatus {
+    return this._status;
+  }
+  set status(v: SItemStatus) {
+    this._status = v;
+    this.undoStack.clear();
+    this.update();
+  }
+  /** 矩形两个对角 */
+  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, l?: SPoint | SPoint[]) {
+    super(parent);
+    if (l) {
+      if (l instanceof SPoint) {
+        this.line.push(l);
+        this._leftTop = l;
+        this._rightBottom = l;
+      } else {
+        this.line = l;
+        this.calRect()
+      }
+    } else {
+      this.line = [];
+    }
+  } // 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()
+  }
+
+  /**
+     * 鼠标按下事件
+     *
+     * @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()
+
+  /**
+     * 鼠标移动事件
+     *
+     * @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
+     */
+  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
+
+  /**
+     * 添加点至数组中
+     *
+     * @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

+ 15 - 9
src/components/editClass/persagy-edit/PTopoParser.ts

@@ -47,23 +47,29 @@ export class PTopoParser extends SParser {
      * */
     parseData(data: ElementData): void {
         // 生成遍历基本图例
-        data.Markers.forEach((item) => {
-            this.addMarker(item);
-        })
+        if (data.Markers && data.Markers.length) {
+            data.Markers.forEach((item) => {
+                this.addMarker(item);
+            })
+        }
+
         // 生成遍历Node图例
-        data.Nodes.forEach(() => {
+        if (data.Nodes && data.Nodes.length) {
+            data.Nodes.forEach(() => {
 
-        })
+            })
+        }
         // 生成遍历关系图例
-        data.Relations.forEach(() => {
+        if (data.Relations && data.Relations.length) {
+            data.Relations.forEach(() => {
+
+            })
+        }
 
-        })
     } // Function parseData()
     addMarker(data: Marker) {
         if (data.Properties.Type == "BaseLine") {
             this.Markers.push(this.factory.createBaseLineEdit(data))
         }
-
-
     }
 }

+ 76 - 5
src/components/editClass/persagy-edit/PTopoScene.ts

@@ -10,6 +10,9 @@ import { uuid, rgbaNum } from "./../big-edit/until";
 // 引入命令
 import { SGraphAddCommand } from "./../edit/commands/SGraphAddCommand"
 import { SColor } from '@persagy-web/draw/lib';
+import { SBaseTriangelEdit } from '../big-edit/items/SBaseTriangleEdit';
+import { SBaseArrowEdit } from '../big-edit/items/SBaseArrowEdit';
+import { SBaseCircleEdit } from '../big-edit/items/SBaseCircleEdit';
 export class PTopoScene extends SBaseEditScene {
     constructor() {
         super()
@@ -62,7 +65,8 @@ export class PTopoScene extends SBaseEditScene {
             this.addTriangleItem(event)
             this.clearCmdStatus();
         } else if (this.editCmd == "EditBaseCircle") {
-            console.log('编辑圆')
+            this.addCircleItem(event)
+            this.clearCmdStatus();
         } else if (this.editCmd == "EditBaseArrows") {
             this.addArrowsItem(event)
             this.clearCmdStatus();
@@ -241,15 +245,12 @@ export class PTopoScene extends SBaseEditScene {
      */
     addRectItem(event: SMouseEvent): void {
         const data = {
-            /** ID */
             ID: uuid(),
-            /** 名称  */
             Name: '基础矩形',
             /** 图标(Image),线类型(Line) */
             Type: "Zone",
             /** 位置  */
             Pos: { X: 0, Y: 0 },
-            /** 由应用自己定义  */
             Properties: {
                 Type: "BaseRect",
             },
@@ -274,14 +275,84 @@ export class PTopoScene extends SBaseEditScene {
      * 添加基本三角形item
      */
     addTriangleItem(event: SMouseEvent): void {
-
+        const data = {
+            ID: uuid(),
+            Name: '基础三角形',
+            Type: "BaseTriangle",
+            Pos: { X: 0, Y: 0 },
+            Properties: {
+            },
+            Style: {
+                Line: [{ X: event.x, Y: event.y }],
+            }
+        }
+        const triangleItem = new SBaseTriangelEdit(null, data);
+        triangleItem.status = SItemStatus.Create;
+        this.addItem(triangleItem);
+        this.undoStack.push(new SGraphAddCommand(this, triangleItem));
+        triangleItem.selectable = true;
+        this.grabItem = triangleItem;
+        triangleItem.connect("finishCreated", this, this.finishCreated);
+        triangleItem.connect("onContextMenu", this, this.getItem);
+        if (this.view) {
+            this.view.update();
+        }
     }
 
     /**
      * 添加基本箭头item
      */
     addArrowsItem(event: SMouseEvent): void {
+        const data = {
+            ID: uuid(),
+            Name: '基础箭头',
+            Type: "BaseArrow",
+            Pos: { X: 0, Y: 0 },
+            Properties: {
+            },
+            Style: {
+                Line: [{ X: event.x, Y: event.y }],
+            }
+        }
+        const arrowItem = new SBaseArrowEdit(null, data);
+        arrowItem.status = SItemStatus.Create;
+        this.addItem(arrowItem);
+        this.undoStack.push(new SGraphAddCommand(this, arrowItem));
+        arrowItem.selectable = true;
+        this.grabItem = arrowItem;
+        arrowItem.connect("finishCreated", this, this.finishCreated);
+        arrowItem.connect("onContextMenu", this, this.getItem);
+        if (this.view) {
+            this.view.update();
+        }
+    }
 
+    /**
+     * 添加基本箭头item
+     */
+    addCircleItem(event: SMouseEvent): void {
+        const data = {
+            ID: uuid(),
+            Name: '基础圆形',
+            Type: "BaseCircle",
+            Pos: { X: 0, Y: 0 },
+            Properties: {
+            },
+            Style: {
+                Line: [{ X: event.x, Y: event.y }],
+            }
+        }
+        const circleItem = new SBaseCircleEdit(null, data);
+        circleItem.status = SItemStatus.Create;
+        this.addItem(circleItem);
+        this.undoStack.push(new SGraphAddCommand(this, circleItem));
+        circleItem.selectable = true;
+        this.grabItem = circleItem;
+        circleItem.connect("finishCreated", this, this.finishCreated);
+        circleItem.connect("onContextMenu", this, this.getItem);
+        if (this.view) {
+            this.view.update();
+        }
     }
 
     /**

+ 3 - 2
src/components/editview/baseTopoEditer.vue

@@ -139,10 +139,11 @@ export default {
       };
       readGroup(obj).then((res) => {
         console.log("resssssss", res);
-        const parse = new PTopoParser().parseData(res.Content.Elements);
+        const parse = new PTopoParser();
+        parse.parseData(res.Content.Elements);
         console.log(parse.Markers);
         parse.Markers.forEach((item) => {
-          this.addItem.addItem(item);
+          this.scene.addItem(item);
         });
       });
     },