Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gojs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴斌
vue-gojs
Commits
0c3502c8
Commit
0c3502c8
authored
Oct 24, 2023
by
吴斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:路径寻找
parent
112d3fb3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
36 deletions
+38
-36
App.vue
src/App.vue
+31
-30
GOJSKit.ts
src/kit/GOJSKit.ts
+7
-6
No files found.
src/App.vue
View file @
0c3502c8
...
@@ -140,7 +140,7 @@
...
@@ -140,7 +140,7 @@
import
{
onMounted
,
ref
,
triggerRef
}
from
"vue"
;
import
{
onMounted
,
ref
,
triggerRef
}
from
"vue"
;
import
SourceNodeCollection
from
"./components/source/source-node-collection.vue"
;
import
SourceNodeCollection
from
"./components/source/source-node-collection.vue"
;
import
go
from
"gojs"
;
import
go
from
"gojs"
;
import
{
getSelectedNodes
,
GO
}
from
"./kit/GOJSKit.ts"
;
import
{
findNodesAllWayBetween
,
getSelectedNodes
,
GO
}
from
"./kit/GOJSKit.ts"
;
import
{
createRotatingTool
,
makeDiagramNodeTemplate
}
from
"./kit/NodeTemplateKit.ts"
;
import
{
createRotatingTool
,
makeDiagramNodeTemplate
}
from
"./kit/NodeTemplateKit.ts"
;
import
{
GuidedDraggingTool
}
from
"./kit/extensions/GuidedDraggingTool.ts"
;
import
{
GuidedDraggingTool
}
from
"./kit/extensions/GuidedDraggingTool.ts"
;
import
{
PortShiftingTool
}
from
"./kit/extensions/PortShiftingTool.ts"
;
import
{
PortShiftingTool
}
from
"./kit/extensions/PortShiftingTool.ts"
;
...
@@ -190,6 +190,8 @@ const portTypeList =[
...
@@ -190,6 +190,8 @@ const portTypeList =[
{
label
:
'下方'
,
value
:
"0.5 1"
},
{
label
:
'下方'
,
value
:
"0.5 1"
},
]
]
const
analyzePath
=
ref
([])
// 源节点搜索
// 源节点搜索
// let inputSearchNode = ref('')
// let inputSearchNode = ref('')
// 用于计算源区域的滚动条区域高度
// 用于计算源区域的滚动条区域高度
...
@@ -252,27 +254,27 @@ function importData(){
...
@@ -252,27 +254,27 @@ function importData(){
{
"name"
:
"三头"
,
"nodeCollection"
:
"pipe"
,
"geometry"
:
"F1 M0 0 L60 0 60 20 50 20 Q40 20 40 30 L40 40 20 40 20 30 Q20 20 10 20 L0 20z"
,
"fill"
:
"rgba(128, 128, 128, 0.5)"
,
"category"
:
"geometry"
,
"portArray"
:[{
"name"
:
"端口1"
,
"portId"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"alignment"
:
"0 0.25 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"0 0.5 0 0"
,
"toSpot"
:
"0 0.5 0 0"
,
"isHighlighted"
:
false
},{
"name"
:
"端口2"
,
"portId"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"alignment"
:
"1 0.25 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"1 0.5 0 0"
,
"toSpot"
:
"1 0.5 0 0"
,
"isHighlighted"
:
false
},{
"name"
:
"端口3"
,
"portId"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"alignment"
:
"0.5 1 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"0.5 1 0 0"
,
"toSpot"
:
"0.5 1 0 0"
,
"isHighlighted"
:
false
}],
"key"
:
-
15
,
"loc"
:
"357.5 -620"
,
"angle"
:
0
}
{
"name"
:
"三头"
,
"nodeCollection"
:
"pipe"
,
"geometry"
:
"F1 M0 0 L60 0 60 20 50 20 Q40 20 40 30 L40 40 20 40 20 30 Q20 20 10 20 L0 20z"
,
"fill"
:
"rgba(128, 128, 128, 0.5)"
,
"category"
:
"geometry"
,
"portArray"
:[{
"name"
:
"端口1"
,
"portId"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"alignment"
:
"0 0.25 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"0 0.5 0 0"
,
"toSpot"
:
"0 0.5 0 0"
,
"isHighlighted"
:
false
},{
"name"
:
"端口2"
,
"portId"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"alignment"
:
"1 0.25 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"1 0.5 0 0"
,
"toSpot"
:
"1 0.5 0 0"
,
"isHighlighted"
:
false
},{
"name"
:
"端口3"
,
"portId"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"alignment"
:
"0.5 1 0 0"
,
"fromLinkable"
:
true
,
"toLinkable"
:
true
,
"fromMaxLinks"
:
999
,
"toMaxLinks"
:
999
,
"fromSpot"
:
"0.5 1 0 0"
,
"toSpot"
:
"0.5 1 0 0"
,
"isHighlighted"
:
false
}],
"key"
:
-
15
,
"loc"
:
"357.5 -620"
,
"angle"
:
0
}
],
],
"linkDataArray"
:
[
"linkDataArray"
:
[
{
"from"
:
-
5
,
"to"
:
-
1
,
"fromPort"
:
"51b9d16b-8eea-4c4e-92a2-5bb9d99d294f"
,
"toPort"
:
"11c8ba71-e7cc-41ee-b7d3-cd2814e26f0f"
,
"points"
:[
-
301.3888888888889
,
-
330
,
-
311.3888888888889
,
-
330
,
-
311.3888888888889
,
-
330
,
-
311.3888888888889
,
-
401.1228164268244
,
-
408.10975857377355
,
-
401.1228164268244
,
-
418.10975857377355
,
-
401.1228164268244
],
category
:
"Arrow"
},
{
"from"
:
-
5
,
"to"
:
-
1
,
"fromPort"
:
"51b9d16b-8eea-4c4e-92a2-5bb9d99d294f"
,
"toPort"
:
"11c8ba71-e7cc-41ee-b7d3-cd2814e26f0f"
,
"points"
:[
-
301.3888888888889
,
-
330
,
-
311.3888888888889
,
-
330
,
-
311.3888888888889
,
-
330
,
-
311.3888888888889
,
-
401.1228164268244
,
-
408.10975857377355
,
-
401.1228164268244
,
-
418.10975857377355
,
-
401.1228164268244
],
"category"
:
"Arrow"
},
{
"from"
:
-
1
,
"fromPort"
:
"256b782d-5870-4e05-94ff-34f130c5060e"
,
"toPort"
:
""
,
"points"
:[
-
450
,
-
507.47237569060775
,
-
450
,
-
517.4723756906078
,
-
450
,
-
547.6190476190478
,
-
519.0476190476192
,
-
547.6190476190478
,
-
588.0952380952383
,
-
547.6190476190478
,
-
598.0952380952383
,
-
547.6190476190478
],
"from_text"
:
""
,
"middle_text"
:
""
,
"to_text"
:
"燃料气"
,
category
:
"Arrow"
},
{
"from"
:
-
1
,
"fromPort"
:
"256b782d-5870-4e05-94ff-34f130c5060e"
,
"toPort"
:
""
,
"points"
:[
-
450
,
-
507.47237569060775
,
-
450
,
-
517.4723756906078
,
-
450
,
-
547.6190476190478
,
-
519.0476190476192
,
-
547.6190476190478
,
-
588.0952380952383
,
-
547.6190476190478
,
-
598.0952380952383
,
-
547.6190476190478
],
"from_text"
:
""
,
"middle_text"
:
""
,
"to_text"
:
"燃料气"
,
"category"
:
"Arrow"
},
{
"from"
:
-
1
,
"fromPort"
:
"dcd15cc2-ec1b-4a35-b861-377b6f75d0b9"
,
"toPort"
:
""
,
"points"
:[
-
450
,
-
292.5276243093923
,
-
450
,
-
282.5276243093923
,
-
450
,
-
248.57142857142867
,
-
519.0476190476192
,
-
248.57142857142867
,
-
588.0952380952383
,
-
248.57142857142867
,
-
598.0952380952383
,
-
248.57142857142867
],
"from_text"
:
""
,
"middle_text"
:
""
,
"to_text"
:
"氨产品"
,
category
:
"Arrow"
},
{
"from"
:
-
1
,
"fromPort"
:
"dcd15cc2-ec1b-4a35-b861-377b6f75d0b9"
,
"toPort"
:
""
,
"points"
:[
-
450
,
-
292.5276243093923
,
-
450
,
-
282.5276243093923
,
-
450
,
-
248.57142857142867
,
-
519.0476190476192
,
-
248.57142857142867
,
-
588.0952380952383
,
-
248.57142857142867
,
-
598.0952380952383
,
-
248.57142857142867
],
"from_text"
:
""
,
"middle_text"
:
""
,
"to_text"
:
"氨产品"
,
"category"
:
"Arrow"
},
{
"from"
:
-
7
,
"to"
:
-
6
,
"fromPort"
:
"3f0de33c-e4c4-4187-b7bf-d8192b0708d9"
,
"toPort"
:
"0be6a460-df3a-423f-be3d-b38a4adead36"
,
"points"
:[
-
415
,
-
60
,
-
405
,
-
60
,
-
370
,
-
60
,
-
370
,
-
102.8125
,
-
301.14268500612275
,
-
102.8125
,
-
301.14268500612275
,
-
92.8125
],
category
:
"Arrow"
},
{
"from"
:
-
7
,
"to"
:
-
6
,
"fromPort"
:
"3f0de33c-e4c4-4187-b7bf-d8192b0708d9"
,
"toPort"
:
"0be6a460-df3a-423f-be3d-b38a4adead36"
,
"points"
:[
-
415
,
-
60
,
-
405
,
-
60
,
-
370
,
-
60
,
-
370
,
-
102.8125
,
-
301.14268500612275
,
-
102.8125
,
-
301.14268500612275
,
-
92.8125
],
"category"
:
"Arrow"
},
{
"from"
:
-
2
,
"to"
:
-
5
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"a8e9572b-53fb-4791-a173-e272c28bc8af"
,
"points"
:[
-
180
,
-
221.75
,
-
180
,
-
231.75
,
-
180
,
-
330
,
-
184.30555555555557
,
-
330
,
-
188.61111111111114
,
-
330
,
-
198.61111111111114
,
-
330
],
category
:
"Arrow"
},
{
"from"
:
-
2
,
"to"
:
-
5
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"a8e9572b-53fb-4791-a173-e272c28bc8af"
,
"points"
:[
-
180
,
-
221.75
,
-
180
,
-
231.75
,
-
180
,
-
330
,
-
184.30555555555557
,
-
330
,
-
188.61111111111114
,
-
330
,
-
198.61111111111114
,
-
330
],
"category"
:
"Arrow"
},
{
"from"
:
-
2
,
"to"
:
-
7
,
"fromPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"toPort"
:
"4226d10a-0eb2-4c7a-b839-287003f573ff"
,
"points"
:[
-
213
,
-
188.5
,
-
223
,
-
188.5
,
-
455.89285714285734
,
-
188.5
,
-
455.89285714285734
,
-
143.83333333333331
,
-
455.89285714285734
,
-
99.16666666666663
,
-
455.89285714285734
,
-
89.16666666666663
],
category
:
"Arrow"
},
{
"from"
:
-
2
,
"to"
:
-
7
,
"fromPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"toPort"
:
"4226d10a-0eb2-4c7a-b839-287003f573ff"
,
"points"
:[
-
213
,
-
188.5
,
-
223
,
-
188.5
,
-
455.89285714285734
,
-
188.5
,
-
455.89285714285734
,
-
143.83333333333331
,
-
455.89285714285734
,
-
99.16666666666663
,
-
455.89285714285734
,
-
89.16666666666663
],
"category"
:
"Arrow"
},
{
"to"
:
-
7
,
"fromPort"
:
""
,
"toPort"
:
"55950fe5-ebe1-4d75-b6b4-30da5e97af17"
,
"points"
:[
-
599.2109634992121
,
-
61.18966252420353
,
-
589.2109634992121
,
-
61.18966252420353
,
-
550
,
-
61.18966252420353
,
-
550
,
-
60
,
-
510
,
-
60
,
-
500
,
-
60
],
"from_text"
:
"原料气"
,
"middle_text"
:
""
,
"to_text"
:
""
,
category
:
"Arrow"
},
{
"to"
:
-
7
,
"fromPort"
:
""
,
"toPort"
:
"55950fe5-ebe1-4d75-b6b4-30da5e97af17"
,
"points"
:[
-
599.2109634992121
,
-
61.18966252420353
,
-
589.2109634992121
,
-
61.18966252420353
,
-
550
,
-
61.18966252420353
,
-
550
,
-
60
,
-
510
,
-
60
,
-
500
,
-
60
],
"from_text"
:
"原料气"
,
"middle_text"
:
""
,
"to_text"
:
""
,
"category"
:
"Arrow"
},
{
"from"
:
-
6
,
"to"
:
-
9
,
"fromPort"
:
"0d7b8599-993d-4474-9fb7-a1f1425cbe32"
,
"toPort"
:
"d17eb676-1f01-43f1-b658-b16fde8e4159"
,
"points"
:[
-
301.14268500612275
,
-
47.8125
,
-
301.14268500612275
,
-
37.8125
,
-
301.14268500612275
,
100
,
-
64.19634250306137
,
100
,
172.75
,
100
,
182.75
,
100
],
category
:
"Arrow"
},
{
"from"
:
-
6
,
"to"
:
-
9
,
"fromPort"
:
"0d7b8599-993d-4474-9fb7-a1f1425cbe32"
,
"toPort"
:
"d17eb676-1f01-43f1-b658-b16fde8e4159"
,
"points"
:[
-
301.14268500612275
,
-
47.8125
,
-
301.14268500612275
,
-
37.8125
,
-
301.14268500612275
,
100
,
-
64.19634250306137
,
100
,
172.75
,
100
,
182.75
,
100
],
"category"
:
"Arrow"
},
{
"from"
:
-
9
,
"to"
:
-
8
,
"fromPort"
:
"d5501d1f-5fa8-4d71-8a77-37c64482de72"
,
"toPort"
:
"17fac662-e52f-43de-8c27-d24452d9ed2a"
,
"points"
:[
251.25
,
70.5
,
251.25
,
60.5
,
251.25
,
12.155062499999984
,
175.1293103448276
,
12.155062499999984
,
99.00862068965517
,
12.155062499999984
,
89.00862068965517
,
12.155062499999984
],
category
:
"Arrow"
},
{
"from"
:
-
9
,
"to"
:
-
8
,
"fromPort"
:
"d5501d1f-5fa8-4d71-8a77-37c64482de72"
,
"toPort"
:
"17fac662-e52f-43de-8c27-d24452d9ed2a"
,
"points"
:[
251.25
,
70.5
,
251.25
,
60.5
,
251.25
,
12.155062499999984
,
175.1293103448276
,
12.155062499999984
,
99.00862068965517
,
12.155062499999984
,
89.00862068965517
,
12.155062499999984
],
"category"
:
"Arrow"
},
{
"from"
:
-
9
,
"fromPort"
:
"96dee2d1-babb-4b4d-b5cb-0bafad3131d9"
,
"toPort"
:
""
,
"points"
:[
251.25
,
129.5
,
251.25
,
139.5
,
251.25
,
208.17973750000021
,
251.60979375000034
,
208.17973750000021
,
251.60979375000034
,
276.85947500000043
,
251.60979375000034
,
286.85947500000043
],
category
:
"Arrow"
},
{
"from"
:
-
9
,
"fromPort"
:
"96dee2d1-babb-4b4d-b5cb-0bafad3131d9"
,
"toPort"
:
""
,
"points"
:[
251.25
,
129.5
,
251.25
,
139.5
,
251.25
,
208.17973750000021
,
251.60979375000034
,
208.17973750000021
,
251.60979375000034
,
276.85947500000043
,
251.60979375000034
,
286.85947500000043
],
"category"
:
"Arrow"
},
{
"from"
:
-
3
,
"to"
:
-
2
,
"fromPort"
:
"e8cd7aef-9139-480c-ade2-1ef79cc4261d"
,
"toPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"points"
:[
-
50.258620689655174
,
-
100.88701875000004
,
-
60.258620689655174
,
-
100.88701875000004
,
-
98.62931034482759
,
-
100.88701875000004
,
-
98.62931034482759
,
-
188.5
,
-
137
,
-
188.5
,
-
147
,
-
188.5
],
category
:
"Arrow"
},
{
"from"
:
-
3
,
"to"
:
-
2
,
"fromPort"
:
"e8cd7aef-9139-480c-ade2-1ef79cc4261d"
,
"toPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"points"
:[
-
50.258620689655174
,
-
100.88701875000004
,
-
60.258620689655174
,
-
100.88701875000004
,
-
98.62931034482759
,
-
100.88701875000004
,
-
98.62931034482759
,
-
188.5
,
-
137
,
-
188.5
,
-
147
,
-
188.5
],
"category"
:
"Arrow"
},
{
"from"
:
-
8
,
"to"
:
-
3
,
"fromPort"
:
"fdc201ee-d40d-4d87-bd11-df445f3f976d"
,
"toPort"
:
"2b860c7b-eafc-49b2-90ba-d32d007a2e7b"
,
"points"
:[
18.75
,
-
6.25
,
18.75
,
-
16.25
,
18.75
,
-
44.375
,
19
,
-
44.375
,
19
,
-
72.5
,
19
,
-
82.5
],
category
:
"Arrow"
},
{
"from"
:
-
8
,
"to"
:
-
3
,
"fromPort"
:
"fdc201ee-d40d-4d87-bd11-df445f3f976d"
,
"toPort"
:
"2b860c7b-eafc-49b2-90ba-d32d007a2e7b"
,
"points"
:[
18.75
,
-
6.25
,
18.75
,
-
16.25
,
18.75
,
-
44.375
,
19
,
-
44.375
,
19
,
-
72.5
,
19
,
-
82.5
],
"category"
:
"Arrow"
},
{
"from"
:
-
10
,
"to"
:
-
3
,
"fromPort"
:
"16d8e009-b1b1-45c2-a94f-1a90943ee090"
,
"toPort"
:
"fdc201ee-d40d-4d87-bd11-df445f3f976d"
,
"points"
:[
18.75
,
-
316.75
,
18.75
,
-
306.75
,
18.75
,
-
217.125
,
19.786697850832525
,
-
217.125
,
19.786697850832525
,
-
127.5
,
19.786697850832525
,
-
117.5
],
category
:
"Arrow"
},
{
"from"
:
-
10
,
"to"
:
-
3
,
"fromPort"
:
"16d8e009-b1b1-45c2-a94f-1a90943ee090"
,
"toPort"
:
"fdc201ee-d40d-4d87-bd11-df445f3f976d"
,
"points"
:[
18.75
,
-
316.75
,
18.75
,
-
306.75
,
18.75
,
-
217.125
,
19.786697850832525
,
-
217.125
,
19.786697850832525
,
-
127.5
,
19.786697850832525
,
-
117.5
],
"category"
:
"Arrow"
},
{
"from"
:
-
3
,
"to"
:
-
12
,
"fromPort"
:
"17fac662-e52f-43de-8c27-d24452d9ed2a"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
90.25862068965517
,
-
102.10252500000001
,
100.25862068965517
,
-
102.10252500000001
,
263.62931034482756
,
-
102.10252500000001
,
263.62931034482756
,
-
103.0625
,
427
,
-
103.0625
,
437
,
-
103.0625
],
category
:
"Arrow"
},
{
"from"
:
-
3
,
"to"
:
-
12
,
"fromPort"
:
"17fac662-e52f-43de-8c27-d24452d9ed2a"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
90.25862068965517
,
-
102.10252500000001
,
100.25862068965517
,
-
102.10252500000001
,
263.62931034482756
,
-
102.10252500000001
,
263.62931034482756
,
-
103.0625
,
427
,
-
103.0625
,
437
,
-
103.0625
],
"category"
:
"Arrow"
},
{
"from"
:
-
12
,
"to"
:
-
4
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"3a24769a-5f3a-49e6-953d-a5e1fce7e8be"
,
"points"
:[
470
,
-
136.3125
,
470
,
-
146.3125
,
470
,
-
204.65625
,
470
,
-
204.65625
,
470
,
-
263
,
470
,
-
273
],
category
:
"Arrow"
},
{
"from"
:
-
12
,
"to"
:
-
4
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"3a24769a-5f3a-49e6-953d-a5e1fce7e8be"
,
"points"
:[
470
,
-
136.3125
,
470
,
-
146.3125
,
470
,
-
204.65625
,
470
,
-
204.65625
,
470
,
-
263
,
470
,
-
273
],
"category"
:
"Arrow"
},
{
"from"
:
-
12
,
"to"
:
-
13
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
503
,
-
103.0625
,
513
,
-
103.0625
,
691.5
,
-
103.0625
,
691.5
,
-
150.03125
,
691.5
,
-
197
,
691.5
,
-
207
],
category
:
"Arrow"
},
{
"from"
:
-
12
,
"to"
:
-
13
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
503
,
-
103.0625
,
513
,
-
103.0625
,
691.5
,
-
103.0625
,
691.5
,
-
150.03125
,
691.5
,
-
197
,
691.5
,
-
207
],
"category"
:
"Arrow"
},
{
"from"
:
-
13
,
"to"
:
-
11
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"415f271d-1dd7-415f-ab4f-d5a7221b095a"
,
"points"
:[
658.25
,
-
240
,
648.25
,
-
240
,
481.0977750000001
,
-
240
,
481.0977750000001
,
-
238.20473125000035
,
313.94555000000025
,
-
238.20473125000035
,
303.94555000000025
,
-
238.20473125000035
],
category
:
"Arrow"
},
{
"from"
:
-
13
,
"to"
:
-
11
,
"fromPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"toPort"
:
"415f271d-1dd7-415f-ab4f-d5a7221b095a"
,
"points"
:[
658.25
,
-
240
,
648.25
,
-
240
,
481.0977750000001
,
-
240
,
481.0977750000001
,
-
238.20473125000035
,
313.94555000000025
,
-
238.20473125000035
,
303.94555000000025
,
-
238.20473125000035
],
"category"
:
"Arrow"
},
{
"from"
:
-
4
,
"to"
:
-
15
,
"fromPort"
:
"58c1fc66-36b0-4e21-af4f-85e52828ac76"
,
"toPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"points"
:[
419.2806687500005
,
-
498.35756250000065
,
409.2806687500005
,
-
498.35756250000065
,
412
,
-
498.35756250000065
,
412
,
-
498.35756250000065
,
357.5
,
-
498.35756250000065
,
357.5
,
-
588.25
,
357.5
,
-
598.25
],
category
:
"Arrow"
},
{
"from"
:
-
4
,
"to"
:
-
15
,
"fromPort"
:
"58c1fc66-36b0-4e21-af4f-85e52828ac76"
,
"toPort"
:
"d88aaad3-7e10-47ab-81ec-0040f3c21cf7"
,
"points"
:[
419.2806687500005
,
-
498.35756250000065
,
409.2806687500005
,
-
498.35756250000065
,
412
,
-
498.35756250000065
,
412
,
-
498.35756250000065
,
357.5
,
-
498.35756250000065
,
357.5
,
-
588.25
,
357.5
,
-
598.25
],
"category"
:
"Arrow"
},
{
"from"
:
-
15
,
"to"
:
-
11
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"ab215031-702e-4d22-9663-8c4f631c19ed"
,
"points"
:[
324.5
,
-
631.5
,
314.5
,
-
631.5
,
314.5
,
-
631.5
,
314.5
,
-
600
,
295
,
-
600
,
285
,
-
600
],
category
:
"Arrow"
},
{
"from"
:
-
15
,
"to"
:
-
11
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"ab215031-702e-4d22-9663-8c4f631c19ed"
,
"points"
:[
324.5
,
-
631.5
,
314.5
,
-
631.5
,
314.5
,
-
631.5
,
314.5
,
-
600
,
295
,
-
600
,
285
,
-
600
],
"category"
:
"Arrow"
},
{
"from"
:
-
1
0
,
"to"
:
-
11
,
"fromPort"
:
"ba564564-2ac8-48da-a430-3af06ea4997d"
,
"toPort"
:
"ec58dcb4-39fb-400e-bb0e-018ecee51d56"
,
"points"
:[
48.25
,
-
401.25
,
58.25
,
-
401.25
,
92.125
,
-
401.25
,
92.125
,
-
743.25
,
220
,
-
743.25
,
220
,
-
733.25
],
category
:
"Arrow"
},
{
"from"
:
-
1
3
,
"to"
:
-
15
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
691.5
,
-
273
,
691.5
,
-
283
,
691.5
,
-
631.5
,
546
,
-
631.5
,
400.5
,
-
631.5
,
390.5
,
-
631.5
],
"category"
:
"Arrow"
},
{
"from"
:
-
1
3
,
"to"
:
-
15
,
"fromPort"
:
"854f9c8e-0652-44aa-9705-95dc825ad577"
,
"toPort"
:
"9c6c8565-d1f4-46fa-b67b-db673fd127aa"
,
"points"
:[
691.5
,
-
273
,
691.5
,
-
283
,
691.5
,
-
631.5
,
546
,
-
631.5
,
400.5
,
-
631.5
,
390.5
,
-
631.5
],
category
:
"Arrow"
}
{
"from"
:
-
1
1
,
"to"
:
-
10
,
"fromPort"
:
"ec58dcb4-39fb-400e-bb0e-018ecee51d56"
,
"toPort"
:
"ba564564-2ac8-48da-a430-3af06ea4997d"
,
"category"
:
"Arrow"
,
"points"
:[
220
,
-
733.25
,
220
,
-
743.25
,
92.125
,
-
743.25
,
92.125
,
-
401.25
,
58.25
,
-
401.25
,
48.25
,
-
401.25
]
}
]}
]}
myDiagram
.
model
=
go
.
Model
.
fromJson
(
json
)
myDiagram
.
model
=
go
.
Model
.
fromJson
(
json
)
}
}
...
@@ -380,14 +382,6 @@ function listenDiagram(){
...
@@ -380,14 +382,6 @@ function listenDiagram(){
}
}
})
})
});
});
//拖入部件赋予大小
myDiagram
.
addDiagramListener
(
"ExternalObjectsDropped"
,
function
(
e
:
go
.
DiagramEvent
)
{
let
part
=
e
.
subject
.
first
()
if
(
part
instanceof
go
.
Node
){
console
.
log
(
part
.
data
)
console
.
log
(
part
.
width
)
}
});
}
}
function
freshSelectionNode
(){
function
freshSelectionNode
(){
...
@@ -558,6 +552,13 @@ function analyzeData(){
...
@@ -558,6 +552,13 @@ function analyzeData(){
ElMessage
.
error
(
'请选择两个设备节点'
)
ElMessage
.
error
(
'请选择两个设备节点'
)
}
}
console
.
log
(
selectedNodes
)
console
.
log
(
selectedNodes
)
let
startNodeKey
=
selectedNodes
[
0
].
key
let
endNodeKey
=
selectedNodes
[
1
].
key
console
.
log
(
startNodeKey
,
endNodeKey
)
analyzePath
.
value
=
findNodesAllWayBetween
(
startNodeKey
,
endNodeKey
,
myDiagram
)
if
(
analyzePath
.
value
.
length
===
0
){
ElMessage
.
error
(
'选择的两个节点直接不存在可达到的路径'
)
}
}
}
// 浏览器大小变化时
// 浏览器大小变化时
...
...
src/kit/GOJSKit.ts
View file @
0c3502c8
...
@@ -16,6 +16,7 @@ export function getMapData(myDiagram:any) {
...
@@ -16,6 +16,7 @@ export function getMapData(myDiagram:any) {
})
})
linkDataArray
.
forEach
((
item
:
any
)
=>
{
linkDataArray
.
forEach
((
item
:
any
)
=>
{
let
node
=
null
;
let
node
=
null
;
// 只记录双向连接
if
(
item
.
from
&&
item
.
to
){
if
(
item
.
from
&&
item
.
to
){
node
=
nodeMap
[
item
.
from
]
node
=
nodeMap
[
item
.
from
]
node
.
next
.
push
(
item
.
to
)
node
.
next
.
push
(
item
.
to
)
...
@@ -57,12 +58,12 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
...
@@ -57,12 +58,12 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
while
(
!
flag
){
while
(
!
flag
){
// 保存当前路径的节点数量
// 保存当前路径的节点数量
let
beforePathsNode
=
0
;
let
beforePathsNode
Count
=
0
;
// 保存扩展后路径的节点数量
// 保存扩展后路径的节点数量
let
afterPathsNode
=
0
;
let
afterPathsNode
Count
=
0
;
// 计算扩展前的总路径节点数量
// 计算扩展前的总路径节点数量
for
(
let
path
of
paths
){
for
(
let
path
of
paths
){
beforePathsNode
+=
path
.
length
beforePathsNode
Count
+=
path
.
length
}
}
for
(
let
path
of
paths
){
for
(
let
path
of
paths
){
// 获取当前路径的最后一个节点
// 获取当前路径的最后一个节点
...
@@ -85,7 +86,7 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
...
@@ -85,7 +86,7 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
else
{
else
{
for
(
let
nextNodeKey
of
nextNode
){
for
(
let
nextNodeKey
of
nextNode
){
// 如果下一个节点已经在路径中,则跳过,无需扩展,避免循环
// 如果下一个节点已经在路径中,则跳过,无需扩展,避免循环
if
(
nextNodeKey
in
path
){
if
(
path
.
indexOf
(
nextNodeKey
)
!==
-
1
){
continue
continue
}
}
let
newPath
=
path
.
slice
(
0
)
let
newPath
=
path
.
slice
(
0
)
...
@@ -99,10 +100,10 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
...
@@ -99,10 +100,10 @@ export function findNodesAllWayBetween(startKey:number, endKey:number, myDiagram
}
}
// 计算扩展后的总路径节点数量
// 计算扩展后的总路径节点数量
for
(
let
path
of
paths
){
for
(
let
path
of
paths
){
afterPathsNode
+=
path
.
length
afterPathsNode
Count
+=
path
.
length
}
}
// 如果paths内元素数量没有增加,则搜索完成
// 如果paths内元素数量没有增加,则搜索完成
if
(
beforePathsNode
==
afterPathsNode
){
if
(
beforePathsNode
Count
==
afterPathsNodeCount
){
flag
=
true
flag
=
true
// 删除没有找到终点的路径
// 删除没有找到终点的路径
paths
=
paths
.
filter
((
item
:
any
)
=>
item
[
item
.
length
-
1
]
==
endKey
)
paths
=
paths
.
filter
((
item
:
any
)
=>
item
[
item
.
length
-
1
]
==
endKey
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment