|
@@ -24,7 +24,7 @@
|
|
|
* ****/
|
|
|
|
|
|
import { SBaseEditScene, SBasePipe, SBaseEquipment } from "@persagy-web/big-edit";
|
|
|
-import { SGraphEdit, SGraphPropertyCommand, SBaseImageEdit, SGraphDeleteListCommand } from "@persagy-web/edit";
|
|
|
+import { SGraphEdit, SGraphPropertyCommand, SBaseImageEdit, SGraphDeleteListCommand, SBaseMaskEdit } from "@persagy-web/edit";
|
|
|
import { SMouseEvent } from "@persagy-web/base";
|
|
|
import { SGraphItem, SGraphSelectContainer, SLineStyle } from "@persagy-web/graph";
|
|
|
import { SItemStatus, ItemColor } from "@persagy-web/big";
|
|
@@ -35,7 +35,6 @@ import { SColor, SFont, SArrowStyleType } from "@persagy-web/draw";
|
|
|
import { SPlanEquipment, SPlanParser, SPlanZone } from "./";
|
|
|
import { SPlanBackgroundImage } from "@/lib/item/SPlanBackgroundImage";
|
|
|
import { imgBaseUrl } from "@/api/imageservice";
|
|
|
-
|
|
|
/**
|
|
|
* 平面图场景类
|
|
|
*
|
|
@@ -151,6 +150,9 @@ export class SPlanScene extends SBaseEditScene {
|
|
|
item = this.addBasePipe(event, this.legendObj);
|
|
|
item.zOrder = 9600;
|
|
|
this.clearCmdStatus();
|
|
|
+ } else if (this.editCmd == "Editoutline") {
|
|
|
+ item = this.addMaskItem(event);
|
|
|
+ this.clearCmdStatus();
|
|
|
} else if (this.editCmd == "") {
|
|
|
super.onMouseDown(event);
|
|
|
}
|
|
@@ -173,7 +175,83 @@ export class SPlanScene extends SBaseEditScene {
|
|
|
item.zOrder = 9800;
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 添加蒙板(区域显示使用)
|
|
|
+ *
|
|
|
+ * @param event
|
|
|
+ */
|
|
|
+ addMaskItem(event: SMouseEvent) {
|
|
|
+ const data = {
|
|
|
+ name: "蒙板",
|
|
|
+ num: 1,
|
|
|
+ type: "Mask",
|
|
|
+ // /** 位置 */
|
|
|
+ // pos: { x: 0, y: 0 },
|
|
|
+ properties: {
|
|
|
+ type: "BaseMaskItem",
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ default: {
|
|
|
+ line: [{ x: event.x, y: event.y }],
|
|
|
+ fillColor: new SColor("#00000099"),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ const item = new SBaseMaskEdit(null, data);
|
|
|
+ // window.zzz = item
|
|
|
+ item.zOrder = 9999;
|
|
|
+ item.status = SItemStatus.Create;
|
|
|
+ this.addItem(item);
|
|
|
+ item.selectable = true;
|
|
|
+ this.grabItem = item;
|
|
|
+ item.isTransform = true;
|
|
|
+ item.showSelect = true;
|
|
|
+ // item.moveable = true;
|
|
|
+ item.connect("finishCreated", this, this.maskFinishCreated);
|
|
|
+ item.connect("onContextMenu", this, this.getItem);
|
|
|
+ this.view?.update();
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 添加蒙板结束事件
|
|
|
+ */
|
|
|
+ maskFinishCreated(){
|
|
|
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 读图时生成区域显示蒙板对象
|
|
|
+ *
|
|
|
+ * @param outline
|
|
|
+ */
|
|
|
+ initMaskItem(outline: any[]) {
|
|
|
+ const data = {
|
|
|
+ name: "蒙板",
|
|
|
+ num: 1,
|
|
|
+ type: "Mask",
|
|
|
+ // /** 位置 */
|
|
|
+ // pos: { x: 0, y: 0 },
|
|
|
+ properties: {
|
|
|
+ type: "BaseMaskItem",
|
|
|
+ },
|
|
|
+ style: {
|
|
|
+ default: {
|
|
|
+ line: outline,
|
|
|
+ fillColor: new SColor("#00000099"),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ const item = new SBaseMaskEdit(null, data);
|
|
|
+ item.zOrder = 9999;
|
|
|
+ // item.status = SItemStatus.Create;
|
|
|
+ this.addItem(item);
|
|
|
+ item.selectable = true;
|
|
|
+ item.isTransform = true;
|
|
|
+ item.showSelect = true;
|
|
|
+ item.connect("finishCreated", this, this.finishCreated);
|
|
|
+ item.connect("onContextMenu", this, this.getItem);
|
|
|
+ this.view?.update();
|
|
|
+ return item;
|
|
|
+ }
|
|
|
/**
|
|
|
* 重载添加图片-可以根据底图缩放的图片
|
|
|
* @param event
|
|
@@ -397,6 +475,7 @@ export class SPlanScene extends SBaseEditScene {
|
|
|
const markers: any = []; /**图例节点 */ // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
|
|
|
const objExtInfo: any = []; /**图例节点 */ // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
|
|
|
const relations: any = []; /**图例节点 */ // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
|
|
|
+ let outline: null | array = null; /**区域显示 */
|
|
|
let nodeList;
|
|
|
if (isAll) {
|
|
|
nodeList = this.root.children;
|
|
@@ -421,13 +500,20 @@ export class SPlanScene extends SBaseEditScene {
|
|
|
if (item.relationData && RelationType.includes(item.relationData.properties.type)) {
|
|
|
relations.push(item.toData());
|
|
|
}
|
|
|
+ //
|
|
|
+ if (item.data && ["BaseMaskItem"].includes(item.data.properties.type)) {
|
|
|
+ const itemData = item.toData();
|
|
|
+ outline = itemData.style.default.line;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
return {
|
|
|
- markers,
|
|
|
- objExtInfo,
|
|
|
- relations,
|
|
|
+ elements: {
|
|
|
+ markers,
|
|
|
+ objExtInfo,
|
|
|
+ relations,
|
|
|
+ },
|
|
|
+ outline,
|
|
|
};
|
|
|
}
|
|
|
/**
|