Creating interactive graph - mouse events

Visual manipulations and refinements
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
hueyeng
Posts:1
Joined:24 Nov 2014 08:43
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Creating interactive graph - mouse events

Post by hueyeng » 24 Nov 2014 09:08

Hi,

I'm new to Gephi and is trying to capture mouse events to the preview graph in the PApplet in a java application using the Gephi java toolkit.
The applet is embedded in a panel called interactiveGraphPanel in the java application like this:

ProcessingTarget interactiveTarget = (ProcessingTarget) interactivePreviewController.getRenderTarget(RenderTarget.PROCESSING_TARGET);
PApplet interactiveApplet = interactiveTarget.getApplet();
JPanel interactiveGraphPanel=new JPanel();
interactiveGraphPanel.add(interactiveApplet, BorderLayout.CENTER);
interactiveApplet.init();
interactiveApplet.setPreferredSize(new Dimension(650,650));
interactiveApplet.setSize(new Dimension(650,650));

This is basically what I need to do:
1) Use mouse to select a node in the graph
2) Use mouse to select a portion of the graph (such as those where you left click on the mouse and drag a rectangle and the portion of the graph within the rectangle is selected)

I've manage to get the PApplet to send the mouse event to my java application. But the mouse event x and y position is always different from that of the node x and y position in the graph. Hence, I cannot detect accurately what the user has selected.

Is there some preprocessing needed to get the mouse event's x and y position to scale and match those of the graph's node x (.getNodeData().x()) and y (.getNodeData().y()) position?

Any help would be greatly appreciated.

Thanks in advance!
Huey Eng

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable