Hi,
I would like to create a movie out of a graph. However, I'm a little bit lost.
I'm using version 1.1 and I followed the tutorial
http://graphstream-project.org/doc/Tutorials/Creating-a-movie-with-FileSinkImages_1.0/
with minor fixes for version 1.1.
I start with an empty graph, then instanciate a FileSinkImage and assign it as
a sink to the graph. After that I add nodes and edges to the graph and it is
supposed to output the images. However, I've nothing in the folder... The code
compiles, but I don't know why it's not doing what I want. I tried to look into
the API, but things are not well documented (for instance, what
"FileSinkImages.OutputPolicy.BY_STEP" is for?) So I played around and it seems
the only things working is with .BY_EVENT...
Could you please explain more what are these output policies about?
Thanks for your help,
Hei Ke
Here is my code:
DefaultGraph g = new DefaultGraph("Awesome graph");
// FileSinkImages arguments
OutputPolicy outputPolicy = OutputPolicy.BY_STEP;
String prefix = "images/prefix_";
OutputType type = OutputType.PNG;
Resolution resolution = Resolutions.HD720;
FileSinkImages fsi = new FileSinkImages(type, resolution);
// Optional configuration
fsi.setStyleSheet("graph { padding: 50px; fill-color: black; }"
+ "node { fill-color: #3d5689; }" + "edge { fill-color: white; }");
fsi.setOutputPolicy(outputPolicy);
fsi.setLayoutPolicy(LayoutPolicy.COMPUTED_AT_NEW_IMAGE);
fsi.setQuality(FileSinkImages.Quality.HIGH);
// Images production
g.addSink(fsi);
try {
fsi.begin(prefix);
g.addNode("A");
g.addNode("B");
g.addNode("C");
g.addEdge("AB", "A", "B");
g.addEdge("AC", "A", "C");
g.addEdge("BC", "B", "C");
g.display();
fsi.end();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Archives gérées par MHonArc 2.6.16.