|
@@ -60,19 +60,20 @@ export class EditScence extends SGraphScene {
|
|
|
|
|
|
/** 当前选中焦点Item */
|
|
/** 当前选中焦点Item */
|
|
focusItem: SGraphItem | null = null;
|
|
focusItem: SGraphItem | null = null;
|
|
-
|
|
|
|
|
|
+ /** 当前选中焦点ItemList */
|
|
|
|
+ focusItemList:SGraphItem[] | null = null;
|
|
/**图例节点 */
|
|
/**图例节点 */
|
|
Nodes: any = []; // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
|
|
Nodes: any = []; // 图例节点,所有与工程信息化相关的图例(图标类型与区域)
|
|
/**图例节点 */ // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
|
|
/**图例节点 */ // 与工程信息无关的标识对象(增加文本注释,图上的图片说明)
|
|
Markers: any = [];
|
|
Markers: any = [];
|
|
/** 管线对象 */
|
|
/** 管线对象 */
|
|
Relations: any = [];
|
|
Relations: any = [];
|
|
- _isEditStatus:Boolean = true; // 是否可编辑
|
|
|
|
- set isEditStatus(bol:Boolean):void{
|
|
|
|
- this._isEditStatus = bol;
|
|
|
|
|
|
+ _isEditStatus: Boolean = true; // 是否可编辑
|
|
|
|
+ set isEditStatus(bol: Boolean): void {
|
|
|
|
+ this._isEditStatus = bol;
|
|
}
|
|
}
|
|
- get isEditStatus():Boolean{
|
|
|
|
- return this._isEditStatus
|
|
|
|
|
|
+ get isEditStatus(): Boolean {
|
|
|
|
+ return this._isEditStatus
|
|
}
|
|
}
|
|
constructor() {
|
|
constructor() {
|
|
super();
|
|
super();
|
|
@@ -103,7 +104,7 @@ export class EditScence extends SGraphScene {
|
|
*/
|
|
*/
|
|
listChange(obj: any) {
|
|
listChange(obj: any) {
|
|
let itemType: string = 'equipment';
|
|
let itemType: string = 'equipment';
|
|
-
|
|
|
|
|
|
+ this.focusItemList = obj.itemList;
|
|
if (obj.itemList[0] instanceof STextMarkerItem) {
|
|
if (obj.itemList[0] instanceof STextMarkerItem) {
|
|
itemType = 'baseText'
|
|
itemType = 'baseText'
|
|
} else if (obj.itemList[0] instanceof SImageMarkerItem) {
|
|
} else if (obj.itemList[0] instanceof SImageMarkerItem) {
|
|
@@ -129,6 +130,8 @@ export class EditScence extends SGraphScene {
|
|
if (obj.itemList.length == 1) {
|
|
if (obj.itemList.length == 1) {
|
|
// 获取聚焦item
|
|
// 获取聚焦item
|
|
this.focusItem = obj.itemList[0]
|
|
this.focusItem = obj.itemList[0]
|
|
|
|
+ }else{
|
|
|
|
+ this.focusItem = null
|
|
}
|
|
}
|
|
let msg = {
|
|
let msg = {
|
|
itemList: obj.itemList,
|
|
itemList: obj.itemList,
|
|
@@ -239,7 +242,7 @@ export class EditScence extends SGraphScene {
|
|
// 起始锚点
|
|
// 起始锚点
|
|
item.startAnchor = anc;
|
|
item.startAnchor = anc;
|
|
if (anc) {
|
|
if (anc) {
|
|
- anc.parent?.connect('changePos', item, item.changePos)
|
|
|
|
|
|
+ anc.parent ?.connect('changePos', item, item.changePos)
|
|
item.anchor1ID = anc.id;
|
|
item.anchor1ID = anc.id;
|
|
item.node1Id = anc.parent.id;
|
|
item.node1Id = anc.parent.id;
|
|
}
|
|
}
|
|
@@ -420,7 +423,7 @@ export class EditScence extends SGraphScene {
|
|
* 增加图标lenged图标
|
|
* 增加图标lenged图标
|
|
*/
|
|
*/
|
|
addIconItem(event: SMouseEvent): void {
|
|
addIconItem(event: SMouseEvent): void {
|
|
- //获取信息工程化相关参数
|
|
|
|
|
|
+ //获取信息工程化相关参数
|
|
const LegendData: Legend = {
|
|
const LegendData: Legend = {
|
|
ID: uuid(),
|
|
ID: uuid(),
|
|
Name: this._legend.Name,
|
|
Name: this._legend.Name,
|
|
@@ -440,7 +443,7 @@ export class EditScence extends SGraphScene {
|
|
sHeight: 24, //icon 的高
|
|
sHeight: 24, //icon 的高
|
|
font: 12, //font
|
|
font: 12, //font
|
|
color: '', //字体颜色
|
|
color: '', //字体颜色
|
|
- GraphCategoryId:this._legend.GraphCategoryId
|
|
|
|
|
|
+ GraphCategoryId: this._legend.GraphCategoryId
|
|
},
|
|
},
|
|
}
|
|
}
|
|
const item = new SImageLegendItem(null, LegendData);
|
|
const item = new SImageLegendItem(null, LegendData);
|
|
@@ -660,10 +663,10 @@ export class EditScence extends SGraphScene {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 更新工程信息化的相关数据
|
|
|
|
- * @param AttachObjectIds Array
|
|
|
|
- */
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 更新工程信息化的相关数据
|
|
|
|
+ * @param AttachObjectIds Array
|
|
|
|
+ */
|
|
upadatAttachObjectIds(AttachObjectIds: []): void {
|
|
upadatAttachObjectIds(AttachObjectIds: []): void {
|
|
if (this.focusItem) {
|
|
if (this.focusItem) {
|
|
this.focusItem.data.AttachObjectIds = AttachObjectIds;
|
|
this.focusItem.data.AttachObjectIds = AttachObjectIds;
|
|
@@ -717,6 +720,46 @@ export class EditScence extends SGraphScene {
|
|
}
|
|
}
|
|
this.scenceUpdate(this);
|
|
this.scenceUpdate(this);
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ //批量删除
|
|
|
|
+ if(!this.focusItemList){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.focusItemList.forEach((focusItem)=>{
|
|
|
|
+ this.removeItem(focusItem);
|
|
|
|
+ let a = -1
|
|
|
|
+ this.Nodes.forEach((item: any, index: number) => {
|
|
|
|
+ if (item.id == focusItem.id) {
|
|
|
|
+ a = index
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (a > -1) {
|
|
|
|
+ this.Nodes.splice(a, 1);
|
|
|
|
+ }
|
|
|
|
+ let b = -1;
|
|
|
|
+ this.Markers.forEach((item: any, index: number) => {
|
|
|
|
+ if (item.id == focusItem.id) {
|
|
|
|
+ b = index
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (b > -1) {
|
|
|
|
+ this.Markers.splice(b, 1);
|
|
|
|
+ }
|
|
|
|
+ let c = -1;
|
|
|
|
+ this.Relations.forEach((item: any, index: number) => {
|
|
|
|
+ if (item.id == focusItem.id) {
|
|
|
|
+ c = index
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if (c > -1) {
|
|
|
|
+ this.Relations.splice(c, 1);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.focusItemList = [];
|
|
|
|
+ if (this.view) {
|
|
|
|
+ this.view.update();
|
|
|
|
+ }
|
|
|
|
+ this.scenceUpdate(this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scenceUpdate(scence: any) { }
|
|
scenceUpdate(scence: any) { }
|
|
@@ -787,6 +830,9 @@ export class EditScence extends SGraphScene {
|
|
////////////////////////
|
|
////////////////////////
|
|
// 以下为鼠标键盘操作事件
|
|
// 以下为鼠标键盘操作事件
|
|
onMouseDown(event: SMouseEvent): any {
|
|
onMouseDown(event: SMouseEvent): any {
|
|
|
|
+ if (!this.isEditStatus) {
|
|
|
|
+ return super.onMouseDown(event);
|
|
|
|
+ }
|
|
// 判断是否开启吸附,并且有吸附的点
|
|
// 判断是否开启吸附,并且有吸附的点
|
|
if (
|
|
if (
|
|
this.isAbsorbing &&
|
|
this.isAbsorbing &&
|
|
@@ -833,6 +879,9 @@ export class EditScence extends SGraphScene {
|
|
}
|
|
}
|
|
|
|
|
|
onMouseMove(event: SMouseEvent): boolean {
|
|
onMouseMove(event: SMouseEvent): boolean {
|
|
|
|
+ if (!this.isEditStatus) {
|
|
|
|
+ return super.onMouseMove(event);
|
|
|
|
+ }
|
|
if (this.isAbsorbing) {
|
|
if (this.isAbsorbing) {
|
|
if (!this.highLight) {
|
|
if (!this.highLight) {
|
|
this.highLight = new HighlightItem(null);
|
|
this.highLight = new HighlightItem(null);
|
|
@@ -851,16 +900,19 @@ export class EditScence extends SGraphScene {
|
|
* @return boolean
|
|
* @return boolean
|
|
*/
|
|
*/
|
|
onKeyDown(event: KeyboardEvent): any {
|
|
onKeyDown(event: KeyboardEvent): any {
|
|
|
|
+ if (!this.isEditStatus) {
|
|
|
|
+ return super.onKeyDown(event);
|
|
|
|
+ }
|
|
if (this.grabItem) {
|
|
if (this.grabItem) {
|
|
this.grabItem.onKeyDown(event);
|
|
this.grabItem.onKeyDown(event);
|
|
- if(event.code == "Escape"){
|
|
|
|
- const item = this.grabItem;
|
|
|
|
- this.grabItem = null
|
|
|
|
- this.removeItem(item);
|
|
|
|
- if(this.view){
|
|
|
|
- this.view.update()
|
|
|
|
- }
|
|
|
|
- this.setCmd = 'choice'
|
|
|
|
|
|
+ if (event.code == "Escape") {
|
|
|
|
+ const item = this.grabItem;
|
|
|
|
+ this.grabItem = null
|
|
|
|
+ this.removeItem(item);
|
|
|
|
+ if (this.view) {
|
|
|
|
+ this.view.update()
|
|
|
|
+ }
|
|
|
|
+ this.setCmd = 'choice'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// if (event.key == "Enter") {
|
|
// if (event.key == "Enter") {
|
|
@@ -869,6 +921,22 @@ export class EditScence extends SGraphScene {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 鼠标双击事件
|
|
|
|
+ *
|
|
|
|
+ * @param event 事件参数
|
|
|
|
+ * @return boolean
|
|
|
|
+ */
|
|
|
|
+ onDoubleClick(event: SMouseEvent): boolean {
|
|
|
|
+ if (!this.isEditStatus) {
|
|
|
|
+ return true
|
|
|
|
+ }else{
|
|
|
|
+ return super.onDoubleClick(event);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } // Function onDoubleClick()
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置结束锚点
|
|
* 设置结束锚点
|
|
*
|
|
*
|
|
@@ -884,7 +952,7 @@ export class EditScence extends SGraphScene {
|
|
event.y = p.y;
|
|
event.y = p.y;
|
|
if (this.grabItem.pointList.length) {
|
|
if (this.grabItem.pointList.length) {
|
|
this.grabItem.endAnchor = anc;
|
|
this.grabItem.endAnchor = anc;
|
|
- anc.parent?.connect('changePos', this.grabItem, this.grabItem.changePos)
|
|
|
|
|
|
+ anc.parent ?.connect('changePos', this.grabItem, this.grabItem.changePos)
|
|
}
|
|
}
|
|
this.grabItem.anchor2ID = anc.id
|
|
this.grabItem.anchor2ID = anc.id
|
|
this.grabItem.node2Id = anc.parent.id
|
|
this.grabItem.node2Id = anc.parent.id
|
|
@@ -946,7 +1014,7 @@ export class EditScence extends SGraphScene {
|
|
let itemList = this.Nodes.concat(this.Markers);
|
|
let itemList = this.Nodes.concat(this.Markers);
|
|
itemList.forEach(item => {
|
|
itemList.forEach(item => {
|
|
if (
|
|
if (
|
|
- item instanceof STextMarkerItem ||
|
|
|
|
|
|
+ item instanceof STextMarkerItem ||
|
|
item instanceof SImageMarkerItem ||
|
|
item instanceof SImageMarkerItem ||
|
|
item instanceof SZoneLegendItem ||
|
|
item instanceof SZoneLegendItem ||
|
|
item instanceof SFHFQZoneLegendItem ||
|
|
item instanceof SFHFQZoneLegendItem ||
|