cojack20 - 2013-11-14

Dear all,

I'm currently in the preparation phase for a paper and I need some advice. Maybe you can help me?

My goal is the following:

  • I need to see all nodes of my graph, so the view scale needs to adapt to the layout locations of the nodes. However, they are predetermined and stored in a static layout.
  • Graph nodes come and go (added and removed) -> view scale needs to adapt

The (slightly more detailed) situation is the following:

  1. I have multiple graphs that are added subsequently to the visualization. The graph items of type Datavector store their vis rendering point.
  2. The vis is configured with a Staticlayout and a Transformer, which retrieves the rendering points (from a projection calculation) and renders them to the screen
  3. The primary problem is that I found (by tweaking) the right zoom factor for seeing all nodes. However, my projection data has changed. Earlier I had only points in the range of [-1, 1] now I have everything.

A more detailed description of what I already tried (amongst other things from the forum):

  • SatelliteVisualizationViewer, but here the StaticLayout seems to have no size.
  • Switched to GraphZoomScrollPane, to have at least one chance to find my nodes
  • I manually computed the size of the static layout bounding box and set it
  • vv.scaleToLayout approaches
  • Manual scale tweaking (see below)

One of the primary problems is that I do not understand the interconnections of the components. I don't understand what the main problem is and where my (potentially manually calculated) size data has to be added to have an impact.

PS: This is a very short and imprecise description of the vis. Many more components are in there, but I hope I stated the influencing once?!?

Please help me!

MutableTransformer layout = vis.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

Point2D p = new Point2D.Double(0.0d, 0.0d);
Point2D ctr = vis.getCenter();

double scale = vis.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).getScale();

double deltaX = (ctr.getX() - p.getX())1/scale;
double deltaY = (ctr.getY() - p.getY())
1/scale;

layout.translate(deltaX, deltaY);
layout.scale(scale250, scale250, ctr);