diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src/hu/bme/mit/inf/dslreasoner/visualisation/pi2graphviz/PartialInterpretation2Graphviz.xtend | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src/hu/bme/mit/inf/dslreasoner/visualisation/pi2graphviz/PartialInterpretation2Graphviz.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src/hu/bme/mit/inf/dslreasoner/visualisation/pi2graphviz/PartialInterpretation2Graphviz.xtend index 81dd97b1..77646fdd 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src/hu/bme/mit/inf/dslreasoner/visualisation/pi2graphviz/PartialInterpretation2Graphviz.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.visualisation/src/hu/bme/mit/inf/dslreasoner/visualisation/pi2graphviz/PartialInterpretation2Graphviz.xtend | |||
@@ -1,11 +1,10 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz | 1 | package hu.bme.mit.inf.dslreasoner.visualisation.pi2graphviz |
2 | 2 | ||
3 | import guru.nidi.graphviz.attribute.Arrow | ||
4 | import guru.nidi.graphviz.attribute.Color | ||
5 | import guru.nidi.graphviz.attribute.Shape | 3 | import guru.nidi.graphviz.attribute.Shape |
6 | import guru.nidi.graphviz.attribute.Style | 4 | import guru.nidi.graphviz.attribute.Style |
7 | import guru.nidi.graphviz.engine.Format | 5 | import guru.nidi.graphviz.engine.Format |
8 | import guru.nidi.graphviz.engine.Graphviz | 6 | import guru.nidi.graphviz.engine.Graphviz |
7 | import guru.nidi.graphviz.engine.GraphvizV8Engine | ||
9 | import guru.nidi.graphviz.model.Graph | 8 | import guru.nidi.graphviz.model.Graph |
10 | import guru.nidi.graphviz.model.Label | 9 | import guru.nidi.graphviz.model.Label |
11 | import guru.nidi.graphviz.model.Node | 10 | import guru.nidi.graphviz.model.Node |
@@ -22,19 +21,14 @@ import java.io.File | |||
22 | import java.util.HashMap | 21 | import java.util.HashMap |
23 | import java.util.HashSet | 22 | import java.util.HashSet |
24 | import java.util.LinkedList | 23 | import java.util.LinkedList |
24 | import java.util.List | ||
25 | import java.util.Random | 25 | import java.util.Random |
26 | import java.util.Set | 26 | import java.util.Set |
27 | 27 | ||
28 | import static guru.nidi.graphviz.model.Factory.* | 28 | import static guru.nidi.graphviz.model.Factory.* |
29 | import static guru.nidi.graphviz.attribute.Records.*; | ||
30 | 29 | ||
31 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 30 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
32 | import guru.nidi.graphviz.engine.Engine | 31 | import java.awt.image.BufferedImage |
33 | import guru.nidi.graphviz.attribute.Records | ||
34 | import guru.nidi.graphviz.attribute.Attributes | ||
35 | import java.util.List | ||
36 | import guru.nidi.graphviz.engine.GraphvizEngine | ||
37 | import guru.nidi.graphviz.engine.GraphvizV8Engine | ||
38 | 32 | ||
39 | class GraphvizVisualisation implements PartialInterpretationVisualiser { | 33 | class GraphvizVisualisation implements PartialInterpretationVisualiser { |
40 | 34 | ||
@@ -142,8 +136,10 @@ class GraphvizVisualisation implements PartialInterpretationVisualiser { | |||
142 | '''</TABLE>''') | 136 | '''</TABLE>''') |
143 | 137 | ||
144 | val node = node(ID).with(label).with( | 138 | val node = node(ID).with(label).with( |
145 | Shape.NONE, | 139 | Shape.NONE |
146 | Attributes.attr("margin","0") | 140 | //, |
141 | //Attributes::attr("margin","0") | ||
142 | //new MapAttributes() => [add("margin", "0")] | ||
147 | ) | 143 | ) |
148 | return node | 144 | return node |
149 | } | 145 | } |
@@ -233,10 +229,11 @@ class GraphvisVisualisation implements PartialInterpretationVisualisation { | |||
233 | } | 229 | } |
234 | 230 | ||
235 | override writeToFile(ReasonerWorkspace workspace, String name) { | 231 | override writeToFile(ReasonerWorkspace workspace, String name) { |
236 | val path = '''«workspace.workspaceURI.toFileString»/«name».png''' | 232 | val file = workspace.getFile('''«name».png''') |
233 | //val bufferedImage = new BufferedImage | ||
237 | Graphviz.useEngine(new GraphvizV8Engine()); | 234 | Graphviz.useEngine(new GraphvizV8Engine()); |
238 | Graphviz.fromGraph(graph)//.engine(Engine::NEATO) | 235 | Graphviz.fromGraph(graph)//.engine(Engine::NEATO) |
239 | .render(Format.PNG).toFile(new File(path)); | 236 | .render(Format.PNG).toFile(file) |
237 | workspace.refreshFile('''«name».png''') | ||
240 | } | 238 | } |
241 | |||
242 | } | 239 | } |