Hi and welcome on the mailing list,
OutputPolicy is documented in the tutorial :It allows to define when images are produced. For example, settingoutput policy to BY_STEP will produce image at each step of the graph.There are two issues that can lead to your problem :
1. If no image are produced, problem is linked to the output policy. Defaultpolicy is None, so no images are produced. Set it to BY_STEP and insert astep when you want to have an image produced :|| Graph g = ... ;| FileSinkImages img = new FileSinkImages();|| g.addSink(img);| img.setOutputPolicy(OutputPolicy.BY_STEP);|| g.addNode("A");| g.addNode("B");| g.addNode("C");|| g.stepBegins(0); // Produces an image|2. But the previous code will produce blank images and this isthe second issue : nodes do not have any coordinates, so youhave to enable a layout :|| img.setLayoutPolicy(LayoutPolicy.COMPUTED_FULLY_AT_NEW_IMAGE);|If this does not solve your problem, please post the code youare using and I will try to help you more.RegardsGuilhelm2012/5/9 <laoheike AT gmail.com>
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();
}
--
Guilhelm Savin
PhD Student of Computer ScienceLITIS, University of Le Havre
\/\/\/\/\/\/
Archives gérées par MHonArc 2.6.16.