Question

I have a graph laid out in the visualizationViewer. The user is free to reposition the vertices and after he is done I save the coordinates of each vertex and each time I need to draw a vertex I use the coordinates that I have already saved. My problem appears when the user moves (transfroms) the whole graph - the coordinates of the first graph (which I use to get each vertex's coordinates) aren't synchronized with the others.

I set a VisualizationViewer 1000x1000 so when i call getVisbleRect() I get java.awt.Rectangle[x=0,y=0,width=1004,height=1000] but if I transform the graph so that it start from x=-10,t=-10 I need to add this (x,y) to the coordinates of each vertex. How can i get the upper left corner's coordinates that is visible to the user, after the graph is moved?

Was it helpful?

Solution

ok i figured it out i'll post it just in case anyone else finds this post:

MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
modelTransformer.getTranslateX();
modelTransformer.getTranslateY();

cheers! and then just translate the new graph

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