|
@@ -24,6 +24,7 @@ import { SMathUtil } from '@saga-web/big/lib/utils/SMathUtil';
|
|
|
import { MinDis } from '@saga-web/big/lib/types/MinDis';
|
|
|
import { HighlightItem } from '@/lib/items/HighlightItem';
|
|
|
import { TimeSelect } from 'element-ui';
|
|
|
+import { STopologyParser } from '@/lib/parsers/STopologyParser';
|
|
|
/**
|
|
|
* 在线绘图
|
|
|
*
|
|
@@ -80,6 +81,14 @@ export class EditScence extends SGraphScene {
|
|
|
get isEditStatus(): Boolean {
|
|
|
return this._isEditStatus
|
|
|
}
|
|
|
+
|
|
|
+ //复制粘贴
|
|
|
+ copyString = {
|
|
|
+ Nodes: [],
|
|
|
+ Markers: [],
|
|
|
+ Relations: []
|
|
|
+ };
|
|
|
+
|
|
|
constructor() {
|
|
|
super();
|
|
|
// // 选择绑定选额item事件
|
|
@@ -454,6 +463,7 @@ export class EditScence extends SGraphScene {
|
|
|
InfoLocal: this._legend.InfoLocal.length ? this._legend.InfoLocal : []
|
|
|
},
|
|
|
}
|
|
|
+ const cmd = this.cmd;
|
|
|
const item = new SImageLegendItem(null, LegendData);
|
|
|
this.cmd = 'choice';
|
|
|
item.selectable = true;
|
|
@@ -464,6 +474,9 @@ export class EditScence extends SGraphScene {
|
|
|
this.focusItem = item;
|
|
|
this.finishCreated(item);
|
|
|
this.scenceUpdate(this);
|
|
|
+ if (event.ctrlKey) {
|
|
|
+ this.cmd = cmd;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1068,9 +1081,136 @@ export class EditScence extends SGraphScene {
|
|
|
if (event.code == 'Delete') {
|
|
|
this.deleiteItem()
|
|
|
}
|
|
|
+ // 复制粘贴
|
|
|
+ if (event.ctrlKey && !event.repeat) {
|
|
|
+ if (event.code == 'KeyC') {
|
|
|
+ console.log('ctrl c')
|
|
|
+ this.copy()
|
|
|
+ } else if (event.code == 'KeyV') {
|
|
|
+ console.log('ctrl v')
|
|
|
+ this.paste()
|
|
|
+ }
|
|
|
+ }
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 复制
|
|
|
+ *
|
|
|
+ */
|
|
|
+ copy(){
|
|
|
+ // const input = document.createElement('input');
|
|
|
+ // console.log(1111111111111111111)
|
|
|
+ // input.value = 'sfsfsfsf'
|
|
|
+ // document.body.appendChild(input);
|
|
|
+ // input.select()
|
|
|
+ // document.execCommand('copy');
|
|
|
+ // input.style.display='none';
|
|
|
+ if (this.selectContainer.itemList.length) {
|
|
|
+ this.copyString = {
|
|
|
+ Nodes: [],
|
|
|
+ Markers: [],
|
|
|
+ Relations: []
|
|
|
+ };
|
|
|
+ this.selectContainer.itemList.forEach(t => {
|
|
|
+ const type = this.itemToType(t);
|
|
|
+ if (type) {
|
|
|
+ const data = JSON.parse(JSON.stringify(t.toData()))
|
|
|
+ data.ID = ''
|
|
|
+ if (data.Type == 'Image') {
|
|
|
+ data.AnchorList = []
|
|
|
+ }
|
|
|
+ this.copyString[type].push(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(this.copyString)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 粘贴
|
|
|
+ *
|
|
|
+ */
|
|
|
+ paste(){
|
|
|
+ const parserData = new STopologyParser(null);
|
|
|
+ // 需要深拷贝
|
|
|
+ parserData.parseData(JSON.parse(JSON.stringify(this.copyString)))
|
|
|
+ // 不需要复制区域
|
|
|
+ // parserData.zoneLegendList.forEach(t => {
|
|
|
+ // if (this.view) {
|
|
|
+ // t.pos.x += 10 / this.view.scale
|
|
|
+ // t.pos.y += 10 / this.view.scale
|
|
|
+ // }
|
|
|
+ // this.addItem(t)
|
|
|
+ // // 加到node
|
|
|
+ // // 加命令
|
|
|
+ // })
|
|
|
+ parserData.imageLegendList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ this.addItem(t)
|
|
|
+ this.Nodes.push(t);
|
|
|
+ })
|
|
|
+ parserData.imageMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ })
|
|
|
+ parserData.lineMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ })
|
|
|
+ parserData.textMarkerList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ }
|
|
|
+ this.addItem(t)
|
|
|
+ this.Markers.push(t);
|
|
|
+ })
|
|
|
+ parserData.relationList.forEach(t => {
|
|
|
+ if (this.view) {
|
|
|
+ t.pos.x += 10 / this.view.scale
|
|
|
+ t.pos.y += 10 / this.view.scale
|
|
|
+ t.moveToOrigin(t.pos.x, t.pos.y)
|
|
|
+ }
|
|
|
+ this.addItem(t)
|
|
|
+ this.Relations.push(t);
|
|
|
+ })
|
|
|
+ this.scenceUpdate(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 类型转换 */
|
|
|
+ itemToType(obj:SGraphItem):String{
|
|
|
+ if (obj instanceof STextMarkerItem) {
|
|
|
+ return 'Markers'
|
|
|
+ } else if (obj instanceof SImageMarkerItem) {
|
|
|
+ return 'Markers'
|
|
|
+ } else if (obj instanceof SLineMarkerItem) {
|
|
|
+ return 'Markers'
|
|
|
+ } else if (obj instanceof SZoneLegendItem) {
|
|
|
+ return 'Nodes'
|
|
|
+ } else if (obj instanceof SFHFQZoneLegendItem) {
|
|
|
+ return 'Nodes'
|
|
|
+ } else if (obj instanceof SSCPZZoneLegendItem) {
|
|
|
+ return 'Nodes'
|
|
|
+ } else if (obj instanceof SImageLegendItem) {
|
|
|
+ return 'Nodes'
|
|
|
+ } else if (obj instanceof TipelineItem) {
|
|
|
+ return 'Relations'
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 鼠标双击事件
|