GraphStream Users

Archives de la liste Aide


Re: creating effects like in your YouTube video


Chronologique Discussions 
  • From: Keith Thompson <kthomps6 AT binghamton.edu>
  • To: graphstream-users AT litislab.fr
  • Subject: Re: creating effects like in your YouTube video
  • Date: Thu, 6 Oct 2011 14:03:56 -0400

Thank you so much!  I will look into the graphic-unit coordinates.

Best regards,
Keith

On Thu, Oct 6, 2011 at 12:08 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:
Sorry there are some words missing in my previous mail !

"We are talking about that and we should provide new features*
to do it soon I hope !"


2011/10/6 guilhelm savin <guilhelm.savin AT gmail.com>
Ok Keith, just add this line :

| Viewer viewer;
| ...
| viewer.enableAutoLayout();

after the creation of your viewer. Else, nodes do not have
any coordinate and the viewer can draw them !

You will have some troubles with your code when clicking on
the graph. This is because you use pixel-coordinate to set the
center of the view while graphic-unit coordinates are needed.

Problem is that there is actually no way to convert pixels to
graphic units. We are talking about that and we should provide
to do it soon I hope !

Regards.


2011/10/6 Keith Thompson <kthomps6 AT binghamton.edu>
Hello Guilhelm,

Thank you so much for taking a look at the code. My Visual class was working to produce the graph, but when I tried to add the View and MouseListener it no longer produced the graph. I don't think I have a good understanding of how the View and Listener type classes work yet.  I just need to put in more time learning.

Best regards,
Keith



On Wed, Oct 5, 2011 at 4:09 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:
Hi Keith, 

Can you send us 'filename.dgs' and the full Visual class
for tests please ?

Thanks

2011/10/5 Keith Thompson <kthomps6 AT binghamton.edu>
Oh I am sorry I should have included this in the last message as well:

public void showDynamicGraph() throws IOException {
g2.addAttribute("ui.quality");
g2.addAttribute("ui.antialias");
g2.addAttribute("ui.stylesheet", "graph {fill-color: #666666;} " +
"node {size: 3px; text-visibility-mode: hidden;} " +
"edge {size: 1px; fill-color: #FFFFFF; text-size: 6;}");
try {
fs.begin("C:/filename.dgs");
while (fs.nextEvents()) {
try {
Thread.sleep(10);
}
catch(Exception e) {
e.printStackTrace();
}
}
} catch( IOException e) {
e.printStackTrace();
}
try {
fs.end();
} catch( IOException e) {
e.printStackTrace();
} finally {
fs.removeSink(g2);
}
}

On Wed, Oct 5, 2011 at 2:18 PM, Keith Thompson <kthomps6 AT binghamton.edu> wrote:
Thank you.  That is very helpful.   I will keep reading and studying.  I tried the following but got a blank graph:

Regards,
Keith

public class Visual implements MouseListener {

// variable declarations
etc ...............
public Visual() {
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
g2 = new DefaultGraph("2");
try {
fs = FileSourceFactory.sourceFor("C:/filename.dgs");
} catch (IOException e) {
e.printStackTrace();
}
fs.addSink(g2);
x = 0;
y = 0;
viewer  = new Viewer(g2, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
view = viewer.addDefaultView(true);
view.addMouseListener(this);
}
@Override
public void mouseClicked(MouseEvent e) {
x = e.getX();
y = e.getY();
view.setViewCenter(x,y,0);
}

etc .......


On Tue, Oct 4, 2011 at 4:04 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:
In fact ViewerListener and swing MouseXListener are
complementary. MouseXListener allow to get pure graphic
events :

- wheel motion ;
- mouse motion ;
- mouse clicks.

Whereas ViewerListener allows to get events related
to the graph :

- there is a click on a node ;
- a view is closed.

You can read this previous thread where we explain
how to use MouseXListener with GraphStream view :


Hope this helps !


2011/10/4 Keith Thompson <kthomps6 AT binghamton.edu>
Hi Guilhelm,

Thank you. I am glad to be a part of the community.  The links you sent were very helpful.  I think I would like to start by getting the graph to center on a spot when clicked and zoom in/out according to the mouse wheel.  I am trying to use the Clicks class from the tutorial as an example but I don't really understand what I need to implement in each of the three methods.  I assume that in the buttonPushed and buttonReleased methods, I specify what happens on a mouse click.  Is this different from using javax.swing.event.MouseInputListener?

Thank you for your help.

Regards,
Keith

On Tue, Oct 4, 2011 at 12:24 PM, guilhelm savin <guilhelm.savin AT gmail.com> wrote:
Hi Keith,

and welcome to the GraphStream community. You should have
a look to the "Graph Visualization" part of the documentation


You can also have a look on the "style" part :


I just post the sources used to generate some frames of the
1.0 video on the web site, in the "Download" section. For example,
the org.graphstream.videos.r10.IMDB could be a good example of
zooming and translating in the view.

If some informations are missing, please ask.

Regards.

Guilhelm


2011/10/4 <kthomps6 AT binghamton.edu>
Hello,

I am new to Graphstream and also new to using the graphical type components of
Java.  I have been able to read in data, create a dgs file and draw the graph
dynamically.  Now I would like to be able to zoom in on individual clusters /
subgraphs.  What topics should I look at (both in graphstream api and in Java)?

Thank you,
Keith



--
Guilhelm Savin
PhD Student of Computer Science




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



--
Guilhelm Savin
PhD Student of Computer Science




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



--
Guilhelm Savin
PhD Student of Computer Science




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



--
Guilhelm Savin
PhD Student of Computer Science




--
Guilhelm Savin
PhD Student of Computer Science




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



Archives gérées par MHonArc 2.6.16.

Top of page