|
@@ -1,5 +1,5 @@
|
|
-import { SBaseEditScene, SBaseExpainEdit, SBaseEquipment, SBasePipeUninTool } from "./../big-edit";
|
|
|
|
-import { SBaseRectEdit, SBaseLineEdit, SBaseTextEdit, SGraphEdit, SBaseArrowEdit, SBaseCircleEdit, SBaseTriangleEdit, SBasePolygonEdit } from "./../edit";
|
|
|
|
|
|
+import { SBaseEditScene, SBaseExpainEdit, SBaseEquipment, SBasePipeUninTool, SBasePipe } from "./../big-edit";
|
|
|
|
+import { SBasePolylineEdit, SBaseRectEdit, SBaseLineEdit, SBaseTextEdit, SGraphEdit, SBaseArrowEdit, SBaseCircleEdit, SBaseTriangleEdit, SBasePolygonEdit } from "./../edit";
|
|
import { SPersagyImageEdit } from "./"
|
|
import { SPersagyImageEdit } from "./"
|
|
import { SMouseEvent } from "@persagy-web/base/lib";
|
|
import { SMouseEvent } from "@persagy-web/base/lib";
|
|
import { SGraphSelectContainer, SLineStyle } from "@persagy-web/graph";
|
|
import { SGraphSelectContainer, SLineStyle } from "@persagy-web/graph";
|
|
@@ -48,9 +48,14 @@ export class PTopoScene extends SBaseEditScene {
|
|
onMouseDown(event: SMouseEvent): any {
|
|
onMouseDown(event: SMouseEvent): any {
|
|
this.vueOnMouseDown(event) //外部调用
|
|
this.vueOnMouseDown(event) //外部调用
|
|
if (this.editCmd == "EditBaseLine") {
|
|
if (this.editCmd == "EditBaseLine") {
|
|
- this.addLine(event)
|
|
|
|
|
|
+ // this.addLine(event)
|
|
|
|
+ this.addPolyLine(event);
|
|
this.clearCmdStatus();
|
|
this.clearCmdStatus();
|
|
- } else if (this.editCmd == "EditBasetext") {
|
|
|
|
|
|
+ } else if (this.editCmd == "EditBasePolyLine") {
|
|
|
|
+ this.addPolyLine(event);
|
|
|
|
+ this.clearCmdStatus();
|
|
|
|
+ }
|
|
|
|
+ else if (this.editCmd == "EditBasetext") {
|
|
this.addTextItem(event);
|
|
this.addTextItem(event);
|
|
this.clearCmdStatus();
|
|
this.clearCmdStatus();
|
|
}
|
|
}
|
|
@@ -82,6 +87,10 @@ export class PTopoScene extends SBaseEditScene {
|
|
this.addPipeUninTool(event, this.editCmd)
|
|
this.addPipeUninTool(event, this.editCmd)
|
|
this.clearCmdStatus();
|
|
this.clearCmdStatus();
|
|
}
|
|
}
|
|
|
|
+ else if (this.editCmd == "EditBasePipe") {
|
|
|
|
+ this.addBasePipe(event);
|
|
|
|
+ this.clearCmdStatus();
|
|
|
|
+ }
|
|
// else if (this.editCmd == "EditEuqipment") {
|
|
// else if (this.editCmd == "EditEuqipment") {
|
|
// this.addEuqipment(event)
|
|
// this.addEuqipment(event)
|
|
// this.clearCmdStatus();
|
|
// this.clearCmdStatus();
|
|
@@ -252,6 +261,7 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加基本矩形item
|
|
* 添加基本矩形item
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addRectItem(event: SMouseEvent): void {
|
|
addRectItem(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -286,6 +296,8 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加基本三角形item
|
|
* 添加基本三角形item
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addTriangleItem(event: SMouseEvent): void {
|
|
addTriangleItem(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -317,6 +329,8 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加基本箭头item
|
|
* 添加基本箭头item
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addArrowsItem(event: SMouseEvent): void {
|
|
addArrowsItem(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -348,6 +362,8 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加基本圆
|
|
* 添加基本圆
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addCircleItem(event: SMouseEvent): void {
|
|
addCircleItem(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -378,6 +394,8 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 添加基本多边形
|
|
* 添加基本多边形
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addPolygonItem(event: SMouseEvent): void {
|
|
addPolygonItem(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -407,7 +425,40 @@ export class PTopoScene extends SBaseEditScene {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 新增折线
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
|
|
+ */
|
|
|
|
+ addPolyLine(event: SMouseEvent): void {
|
|
|
|
+ const data = {
|
|
|
|
+ name: '管道',
|
|
|
|
+ type: "line",
|
|
|
|
+ pos: { x: 0, y: 0 },
|
|
|
|
+ properties: {
|
|
|
|
+ type: "BasePolyline",
|
|
|
|
+ },
|
|
|
|
+ style: {
|
|
|
|
+ outLine: [{ x: event.x, y: event.y }],
|
|
|
|
+ default: {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const item = new SBasePolylineEdit(null, data);
|
|
|
|
+ item.status = SItemStatus.Create;
|
|
|
|
+ item.selectable = true;
|
|
|
|
+ this.addItem(item);
|
|
|
|
+ this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
|
+ this.grabItem = item;
|
|
|
|
+ item.connect("finishCreated", this, this.finishCreated);
|
|
|
|
+ item.connect("onContextMenu", this, this.getItem);
|
|
|
|
+ if (this.view) {
|
|
|
|
+ this.view.update();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* 添加基本设备item
|
|
* 添加基本设备item
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
*/
|
|
*/
|
|
addEuqipment(event: SMouseEvent): void {
|
|
addEuqipment(event: SMouseEvent): void {
|
|
const data = {
|
|
const data = {
|
|
@@ -445,6 +496,8 @@ export class PTopoScene extends SBaseEditScene {
|
|
/**
|
|
/**
|
|
* 添加基本管道联通器
|
|
* 添加基本管道联通器
|
|
*
|
|
*
|
|
|
|
+ * @param event 鼠标事件
|
|
|
|
+ * @param cmd 命令
|
|
*/
|
|
*/
|
|
addPipeUninTool(event: SMouseEvent, cmd: string): void {
|
|
addPipeUninTool(event: SMouseEvent, cmd: string): void {
|
|
const cmdList = {
|
|
const cmdList = {
|
|
@@ -485,6 +538,38 @@ export class PTopoScene extends SBaseEditScene {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 新增管道
|
|
|
|
+ *
|
|
|
|
+ * @param event 鼠标事件
|
|
|
|
+ */
|
|
|
|
+ addBasePipe(event: SMouseEvent) {
|
|
|
|
+ const data = {
|
|
|
|
+ name: '管道',
|
|
|
|
+ type: "line",
|
|
|
|
+ pos: { x: 0, y: 0 },
|
|
|
|
+ properties: {
|
|
|
|
+ type: "BasePolyline",
|
|
|
|
+ },
|
|
|
|
+ style: {
|
|
|
|
+ outLine: [{ x: event.x, y: event.y }],
|
|
|
|
+ default: {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ const item = new SBasePipe(null, data);
|
|
|
|
+ item.status = SItemStatus.Create;
|
|
|
|
+ item.selectable = true;
|
|
|
|
+ this.addItem(item);
|
|
|
|
+ this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
|
+ this.grabItem = item;
|
|
|
|
+ item.connect("finishCreated", this, this.finishCreated);
|
|
|
|
+ item.connect("onContextMenu", this, this.getItem);
|
|
|
|
+ if (this.view) {
|
|
|
|
+ this.view.update();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 修改 item 样式,数据等方法
|
|
* 修改 item 样式,数据等方法
|
|
* @param styletype string 修改样式类型
|
|
* @param styletype string 修改样式类型
|
|
* @param changeStyle 更改样式数据
|
|
* @param changeStyle 更改样式数据
|