I am trying to allocate fixed coordinate positions for vertices using static layout. Normally we can get vertex coordinate as Point2D object using layout.transform(Vertex);
Now i wanted to initialize a layout and set the vertices at specified positions but somehow i am stuck. I read here on StackOverflow if i implement Transformer<Vertex, Point2D>
interface:
Transformer<Vertex, Point2D> locationTransformer =
new Transformer<Vertex, Point2D>() {
@Override
public Point2D transform(Vertex) {
Point2D p2d = //here i calculate the position
return p2D;
}
};
I have tried this. On fixed graph it works but i have an editable graph and on it nothing happens. I was expecting if i have fixed the position in above, then whichever node i add by mouse click, it should go to the fixed position irrespective where i put it?
can you please give me some idea what could be the reason? Or with editable graph, is it Overriding the position again somewhere?
UPDATE:
If i remove e.g these implementations from visualizaton viewer:
vv.getRenderContext().setVertexFontTransformer(fontTransfoer);
vv.getRenderContext().setVertexFillPaintTransformer(colorTransformer);
vv.getRenderContext().setVertexShapeTransformer(shapeTransformer);
It starts working, but then the nodes have default shape circular red ones. I want to completely redraw the structure that i had drawn last time. So is there something that can be done with this problem?