Question

I'm using a CircleLayout for my graph using Jung2. I overrode the initiate() method so that the vertices are drawn on a certain position in the circle depending on its id. This means that vertices are spread irregular on the circle.

Now I have a problem: because of how the edges are painted, the graph doesn't look like a circle anymore.

http://imageshack.us/a/img560/9763/circlef.jpg

is there a way to make the edges look like a circle again?

Was it helpful?

Solution

You need to supply a different (custom) edge renderer; see the code in jung.visualization.renderers for guidance. You supply it to the visualization system as follows:

VisualizationServer.getRenderer().setEdgeRenderer(yourCustomEdgeRenderer);

Alternatively, if you really just want it to look like a circle, you can do this:
(0) Draw a circle using a pre-render Paintable. (Demos show how this works.)
(1) Supply an edge rendering predicate that always returns false, i.e., ensure that none of the edges are rendered.

That will be much easier and simpler than drawing the appropriate arc of a circle in between each pair of connected vertices.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top