diff options
Diffstat (limited to 'subprojects/frontend/src/graph/dotSource.ts')
-rw-r--r-- | subprojects/frontend/src/graph/dotSource.ts | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts index 2d6b57de..701453f4 100644 --- a/subprojects/frontend/src/graph/dotSource.ts +++ b/subprojects/frontend/src/graph/dotSource.ts | |||
@@ -15,25 +15,28 @@ const EDGE_WEIGHT = 1; | |||
15 | const CONTAINMENT_WEIGHT = 5; | 15 | const CONTAINMENT_WEIGHT = 5; |
16 | const UNKNOWN_WEIGHT_FACTOR = 0.5; | 16 | const UNKNOWN_WEIGHT_FACTOR = 0.5; |
17 | 17 | ||
18 | function nodeName({ simpleName, kind }: NodeMetadata): string { | 18 | function nodeName(graph: GraphStore, metadata: NodeMetadata): string { |
19 | switch (kind) { | 19 | const name = graph.getName(metadata); |
20 | switch (metadata.kind) { | ||
20 | case 'INDIVIDUAL': | 21 | case 'INDIVIDUAL': |
21 | return `<b>${simpleName}</b>`; | 22 | return `<b>${name}</b>`; |
22 | case 'NEW': | 23 | case 'NEW': |
23 | return `<i>${simpleName}</i>`; | 24 | return `<i>${name}</i>`; |
24 | default: | 25 | default: |
25 | return simpleName; | 26 | return name; |
26 | } | 27 | } |
27 | } | 28 | } |
28 | 29 | ||
29 | function relationName({ simpleName, detail }: RelationMetadata): string { | 30 | function relationName(graph: GraphStore, metadata: RelationMetadata): string { |
31 | const name = graph.getName(metadata); | ||
32 | const { detail } = metadata; | ||
30 | if (detail.type === 'class' && detail.abstractClass) { | 33 | if (detail.type === 'class' && detail.abstractClass) { |
31 | return `<i>${simpleName}</i>`; | 34 | return `<i>${name}</i>`; |
32 | } | 35 | } |
33 | if (detail.type === 'reference' && detail.containment) { | 36 | if (detail.type === 'reference' && detail.containment) { |
34 | return `<b>${simpleName}</b>`; | 37 | return `<b>${name}</b>`; |
35 | } | 38 | } |
36 | return simpleName; | 39 | return name; |
37 | } | 40 | } |
38 | 41 | ||
39 | interface NodeData { | 42 | interface NodeData { |
@@ -57,7 +60,7 @@ function computeNodeData(graph: GraphStore): NodeData[] { | |||
57 | if (relation.arity !== 1) { | 60 | if (relation.arity !== 1) { |
58 | return; | 61 | return; |
59 | } | 62 | } |
60 | const visibility = graph.getVisiblity(relation.name); | 63 | const visibility = graph.getVisibility(relation.name); |
61 | if (visibility === 'none') { | 64 | if (visibility === 'none') { |
62 | return; | 65 | return; |
63 | } | 66 | } |
@@ -112,7 +115,7 @@ function createNodes(graph: GraphStore, lines: string[]): void { | |||
112 | const classes = [ | 115 | const classes = [ |
113 | `node-${node.kind} node-exists-${data.exists} node-equalsSelf-${data.equalsSelf}`, | 116 | `node-${node.kind} node-exists-${data.exists} node-equalsSelf-${data.equalsSelf}`, |
114 | ].join(' '); | 117 | ].join(' '); |
115 | const name = nodeName(node); | 118 | const name = nodeName(graph, node); |
116 | const border = node.kind === 'INDIVIDUAL' ? 2 : 1; | 119 | const border = node.kind === 'INDIVIDUAL' ? 2 : 1; |
117 | lines.push(`n${i} [id="${node.name}", class="${classes}", label=< | 120 | lines.push(`n${i} [id="${node.name}", class="${classes}", label=< |
118 | <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white"> | 121 | <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white"> |
@@ -128,7 +131,7 @@ function createNodes(graph: GraphStore, lines: string[]): void { | |||
128 | <td width="1.5"></td> | 131 | <td width="1.5"></td> |
129 | <td align="left" href="#${value}" id="${node.name},${ | 132 | <td align="left" href="#${value}" id="${node.name},${ |
130 | relation.name | 133 | relation.name |
131 | },label">${relationName(relation)}</td> | 134 | },label">${relationName(graph, relation)}</td> |
132 | </tr>`, | 135 | </tr>`, |
133 | ); | 136 | ); |
134 | }); | 137 | }); |
@@ -205,14 +208,15 @@ function createRelationEdges( | |||
205 | let constraint: 'true' | 'false' = 'true'; | 208 | let constraint: 'true' | 'false' = 'true'; |
206 | let weight = EDGE_WEIGHT; | 209 | let weight = EDGE_WEIGHT; |
207 | let penwidth = 1; | 210 | let penwidth = 1; |
208 | let label = `"${relation.simpleName}"`; | 211 | const name = graph.getName(relation); |
212 | let label = `"${name}"`; | ||
209 | if (detail.type === 'reference' && detail.containment) { | 213 | if (detail.type === 'reference' && detail.containment) { |
210 | weight = CONTAINMENT_WEIGHT; | 214 | weight = CONTAINMENT_WEIGHT; |
211 | label = `<<b>${relation.simpleName}</b>>`; | 215 | label = `<<b>${name}</b>>`; |
212 | penwidth = 2; | 216 | penwidth = 2; |
213 | } else if ( | 217 | } else if ( |
214 | detail.type === 'opposite' && | 218 | detail.type === 'opposite' && |
215 | graph.getVisiblity(detail.opposite) !== 'none' | 219 | graph.getVisibility(detail.opposite) !== 'none' |
216 | ) { | 220 | ) { |
217 | constraint = 'false'; | 221 | constraint = 'false'; |
218 | weight = 0; | 222 | weight = 0; |
@@ -284,7 +288,7 @@ function createEdges(graph: GraphStore, lines: string[]): void { | |||
284 | if (relation.arity !== 2) { | 288 | if (relation.arity !== 2) { |
285 | return; | 289 | return; |
286 | } | 290 | } |
287 | const visibility = graph.getVisiblity(relation.name); | 291 | const visibility = graph.getVisibility(relation.name); |
288 | if (visibility !== 'none') { | 292 | if (visibility !== 'none') { |
289 | createRelationEdges(graph, relation, visibility === 'all', lines); | 293 | createRelationEdges(graph, relation, visibility === 'all', lines); |
290 | } | 294 | } |