diff options
Diffstat (limited to 'subprojects/frontend/src/graph/dotSource.ts')
-rw-r--r-- | subprojects/frontend/src/graph/dotSource.ts | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts index 5e0b44c8..bd358dfa 100644 --- a/subprojects/frontend/src/graph/dotSource.ts +++ b/subprojects/frontend/src/graph/dotSource.ts | |||
@@ -119,8 +119,11 @@ function computeNodeData(graph: GraphStore): NodeData[] { | |||
119 | return nodeData; | 119 | return nodeData; |
120 | } | 120 | } |
121 | 121 | ||
122 | function createNodes(graph: GraphStore, lines: string[]): void { | 122 | function createNodes( |
123 | const nodeData = computeNodeData(graph); | 123 | graph: GraphStore, |
124 | nodeData: NodeData[], | ||
125 | lines: string[], | ||
126 | ): void { | ||
124 | const { | 127 | const { |
125 | semantics: { nodes }, | 128 | semantics: { nodes }, |
126 | scopes, | 129 | scopes, |
@@ -128,7 +131,7 @@ function createNodes(graph: GraphStore, lines: string[]): void { | |||
128 | 131 | ||
129 | nodes.forEach((node, i) => { | 132 | nodes.forEach((node, i) => { |
130 | const data = nodeData[i]; | 133 | const data = nodeData[i]; |
131 | if (data === undefined || data.isolated) { | 134 | if (data === undefined || data.isolated || data.exists === 'FALSE') { |
132 | return; | 135 | return; |
133 | } | 136 | } |
134 | const classList = [ | 137 | const classList = [ |
@@ -222,6 +225,7 @@ function binarySerach( | |||
222 | 225 | ||
223 | function createRelationEdges( | 226 | function createRelationEdges( |
224 | graph: GraphStore, | 227 | graph: GraphStore, |
228 | nodeData: NodeData[], | ||
225 | relation: RelationMetadata, | 229 | relation: RelationMetadata, |
226 | showUnknown: boolean, | 230 | showUnknown: boolean, |
227 | lines: string[], | 231 | lines: string[], |
@@ -266,6 +270,17 @@ function createRelationEdges( | |||
266 | return; | 270 | return; |
267 | } | 271 | } |
268 | 272 | ||
273 | const fromData = nodeData[from]; | ||
274 | const toData = nodeData[to]; | ||
275 | if ( | ||
276 | fromData === undefined || | ||
277 | fromData.exists === 'FALSE' || | ||
278 | toData === undefined || | ||
279 | toData.exists === 'FALSE' | ||
280 | ) { | ||
281 | return; | ||
282 | } | ||
283 | |||
269 | let dir = 'forward'; | 284 | let dir = 'forward'; |
270 | let edgeConstraint = constraint; | 285 | let edgeConstraint = constraint; |
271 | let edgeWeight = weight; | 286 | let edgeWeight = weight; |
@@ -306,7 +321,11 @@ function createRelationEdges( | |||
306 | }); | 321 | }); |
307 | } | 322 | } |
308 | 323 | ||
309 | function createEdges(graph: GraphStore, lines: string[]): void { | 324 | function createEdges( |
325 | graph: GraphStore, | ||
326 | nodeData: NodeData[], | ||
327 | lines: string[], | ||
328 | ): void { | ||
310 | const { | 329 | const { |
311 | semantics: { relations }, | 330 | semantics: { relations }, |
312 | } = graph; | 331 | } = graph; |
@@ -316,7 +335,13 @@ function createEdges(graph: GraphStore, lines: string[]): void { | |||
316 | } | 335 | } |
317 | const visibility = graph.getVisibility(relation.name); | 336 | const visibility = graph.getVisibility(relation.name); |
318 | if (visibility !== 'none') { | 337 | if (visibility !== 'none') { |
319 | createRelationEdges(graph, relation, visibility === 'all', lines); | 338 | createRelationEdges( |
339 | graph, | ||
340 | nodeData, | ||
341 | relation, | ||
342 | visibility === 'all', | ||
343 | lines, | ||
344 | ); | ||
320 | } | 345 | } |
321 | }); | 346 | }); |
322 | } | 347 | } |
@@ -333,8 +358,9 @@ export default function dotSource( | |||
333 | `node [fontsize=12, shape=plain, fontname="OpenSans"];`, | 358 | `node [fontsize=12, shape=plain, fontname="OpenSans"];`, |
334 | 'edge [fontsize=10.5, color=black, fontname="OpenSans"];', | 359 | 'edge [fontsize=10.5, color=black, fontname="OpenSans"];', |
335 | ]; | 360 | ]; |
336 | createNodes(graph, lines); | 361 | const nodeData = computeNodeData(graph); |
337 | createEdges(graph, lines); | 362 | createNodes(graph, nodeData, lines); |
363 | createEdges(graph, nodeData, lines); | ||
338 | lines.push('}'); | 364 | lines.push('}'); |
339 | return [lines.join('\n'), lines.length]; | 365 | return [lines.join('\n'), lines.length]; |
340 | } | 366 | } |