|
@@ -1,3 +1,28 @@
|
|
|
+
|
|
|
+ * *********************************************************************************************************************
|
|
|
+ *
|
|
|
+ * !!
|
|
|
+ * .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) 2009-2020. 博锐尚格科技股份有限公司
|
|
|
+ * ~8888'
|
|
|
+ * .!88~ All rights reserved.
|
|
|
+ *
|
|
|
+ * ****/
|
|
|
+
|
|
|
import { SBaseEditScene, SBasePipe, SBaseEquipment } from "./../big-edit";
|
|
|
import { SGraphEdit, SGraphPropertyCommand, } from "./../edit";
|
|
|
import { SMouseEvent } from "@persagy-web/base/lib";
|
|
@@ -7,20 +32,26 @@ import { rgbaNum } from "./../big-edit/until";
|
|
|
|
|
|
import { SGraphAddCommand } from "./../edit/commands/SGraphAddCommand"
|
|
|
import { SColor, SFont, SArrowStyleType } from '@persagy-web/draw/lib';
|
|
|
+
|
|
|
+
|
|
|
+ * 拓扑图场景类
|
|
|
+ *
|
|
|
+ * @author 韩耀龙 <han_yao_long@163.com>
|
|
|
+ */
|
|
|
export class PTopoScene extends SBaseEditScene {
|
|
|
|
|
|
legendObj: any = null;
|
|
|
constructor() {
|
|
|
super()
|
|
|
-
|
|
|
+
|
|
|
this.selectContainer.connect("listChange", this, this.listChange);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- * 选中返回的选中item回调方法
|
|
|
+ * 选中返回的选中 item 回调方法
|
|
|
*
|
|
|
- * @param event 鼠标事件参数
|
|
|
+ * @param event 鼠标事件参数
|
|
|
*/
|
|
|
listChange(list: any): void {
|
|
|
const itemList: any = []
|
|
@@ -29,21 +60,22 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
itemList.push(item)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
this.emitChoice(itemList);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- * 选中返回的选中item回调方法(用于场景的外部调用)
|
|
|
+ * 选中返回的选中 item 回调方法(用于场景的外部调用)
|
|
|
*
|
|
|
- * @param list 选中的item数组
|
|
|
- */
|
|
|
+ * @param list 选中的 item 数组
|
|
|
+ */
|
|
|
emitChoice(list: any) {
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 鼠标左键按下
|
|
|
*
|
|
|
- * @param event 鼠标事件参数
|
|
|
+ * @param event 鼠标事件参数
|
|
|
*/
|
|
|
onMouseDown(event: SMouseEvent): any {
|
|
|
this.vueOnMouseDown(event)
|
|
@@ -52,8 +84,10 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
this.setTipeEndanchor(event)
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
return this.grabItem.onMouseDown(event);
|
|
|
}
|
|
|
+
|
|
|
if (this.editCmd == "EditBaseLine") {
|
|
|
this.addPolyLineArrow(event);
|
|
|
this.clearCmdStatus();
|
|
@@ -95,33 +129,32 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
else if (this.editCmd == "EditBasePipe") {
|
|
|
this.addBasePipe(event, this.legendObj);
|
|
|
this.clearCmdStatus();
|
|
|
- } else if (this.editCmd == "EditEuqipment") {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
else if (this.editCmd == "") {
|
|
|
super.onMouseDown(event);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 鼠标右键事件
|
|
|
*
|
|
|
* @param event 鼠标事件参数
|
|
|
+ * @returns 是否点击右键
|
|
|
*/
|
|
|
onContextMenu(event: SMouseEvent): boolean {
|
|
|
if (!super.onContextMenu(event)) {
|
|
|
this.getItem(null, [event])
|
|
|
}
|
|
|
+
|
|
|
return true
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 修改 item 样式,数据等方法
|
|
|
- * @param styletype string 修改样式类型
|
|
|
- * @param changeStyle 更改样式数据
|
|
|
- * @param itemList? SGraphEdit[] 如果不传入默认使用选择器中选中得item
|
|
|
+ *
|
|
|
+ * @param styletype string 修改样式类型
|
|
|
+ * @param changeStyle 更改样式数据
|
|
|
+ * @param itemList ? SGraphEdit[] 如果不传入默认使用选择器中选中得item
|
|
|
*/
|
|
|
updateStyle(styletype: string, changestyle: any, itemList?: SGraphEdit[]): void {
|
|
|
|
|
@@ -131,6 +164,7 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
} else {
|
|
|
List = this.selectContainer.itemList;
|
|
|
};
|
|
|
+
|
|
|
let styleValue: any
|
|
|
if (styletype == "strokeColor" || styletype == "backgroundColor" || styletype == "fillColor") {
|
|
|
const colorlist = rgbaNum(changestyle)
|
|
@@ -144,6 +178,7 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
} else {
|
|
|
styleValue = changestyle
|
|
|
}
|
|
|
+
|
|
|
List.forEach((item: SGraphEdit, index: number) => {
|
|
|
if (item instanceof SGraphSelectContainer) {
|
|
|
return
|
|
@@ -153,12 +188,12 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
this.undoStack.push(new SGraphPropertyCommand(this, item, styletype, oldMsg, newMsg));
|
|
|
item[styletype] = styleValue;
|
|
|
})
|
|
|
-
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 修改指定设备得信息点
|
|
|
- * @param obj Object 信息点
|
|
|
+ *
|
|
|
+ * @param obj Object 信息点
|
|
|
*/
|
|
|
changeEquipMsgPoint(obj: any): void {
|
|
|
const List = this.selectContainer.itemList.length ? this.selectContainer.itemList[0] : null;
|
|
@@ -178,33 +213,34 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
this.undoStack.push(new SGraphAddCommand(this, item));
|
|
|
this.selectContainer.clear();
|
|
|
this.selectContainer.toggleItem(item);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 修改 cmdstatus 函数;常在在业务中调用
|
|
|
- *
|
|
|
*/
|
|
|
clearCmdStatus() {
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 获取item (常用与场景外的调用F)
|
|
|
- * @param event SMouseEvent 鼠标事件
|
|
|
- * @param item SGraphEdit|null 返回item
|
|
|
+ * @param event SMouseEvent 鼠标事件
|
|
|
+ * @param item SGraphEdit|null 返回item
|
|
|
*
|
|
|
*/
|
|
|
- getItem(item: SGraphEdit | null, event: SMouseEvent[]) {
|
|
|
-
|
|
|
- }
|
|
|
+ getItem(item: SGraphEdit | null, event: SMouseEvent[]): void {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 获取item (常用与场景外的调用F)
|
|
|
- * @param event SMouseEvent 鼠标事件
|
|
|
- * @param item SGraphEdit|null 返回item
|
|
|
+ * @param event SMouseEvent 鼠标事件
|
|
|
+ * @param item SGraphEdit|null 返回item
|
|
|
*
|
|
|
*/
|
|
|
vueOnMouseDown(event: SMouseEvent) {
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 设置 item 状态
|
|
@@ -219,14 +255,15 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
List.status = SItemStatus.Normal;
|
|
|
this.grabItem = null
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 获取item (常用与场景外的调用F)
|
|
|
*
|
|
|
- * @params isAll 是否为全部item数据
|
|
|
- * @return obj 返回保存的数据接口
|
|
|
+ * @params isAll 是否为全部item数据
|
|
|
+ * @return obj 返回保存的数据接口
|
|
|
*/
|
|
|
save(isAll: boolean = true) {
|
|
|
if (!this.view) return;
|
|
@@ -242,24 +279,30 @@ export class PTopoScene extends SBaseEditScene {
|
|
|
} else {
|
|
|
nodeList = this.selectContainer.itemList;
|
|
|
};
|
|
|
+
|
|
|
nodeList.forEach(item => {
|
|
|
if ((item instanceof SGraphEdit) && !(item instanceof SGraphSelectContainer)) {
|
|
|
|
|
|
if (item.data && Marktype.includes(item.data.properties.type)) {
|
|
|
markers.push(item.toData())
|
|
|
}
|
|
|
+
|
|
|
if (item.legendData && NodeType.includes(item.legendData.properties.type)) {
|
|
|
nodes.push(item.toData())
|
|
|
}
|
|
|
+
|
|
|
if (item.relationData && RelationType.includes(item.relationData.properties.type)) {
|
|
|
relations.push(item.toData())
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
+
|
|
|
return {
|
|
|
markers,
|
|
|
nodes,
|
|
|
relations
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|