I want to write method to autoscale/center the graph. I want to make all vertices visible, even these with large XY coordinates. I'm working with StaticLayout. I was trying to use In other words - i want to display particular piece of cartesian space (ie: 1000x1000) in VisualizationViewer with resolution 500x500. Do you have solution for my problem?
Asked
Active
Viewed 225 times
1 Answers
1
Not sure if you're still looking for a solution for this. Anyway, I had a similar problem and I fixed it by writing this function:
private void scaleToRightAmount(VisualizationViewer<ModelObject, ModelEdge> vv) {
Point2D ivtfrom = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, new Point2D.Double(vv.getWidth(),vv.getHeight()));
MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
modelTransformer.scale(0.9, 0.9, ivtfrom);
vv.repaint();
}

vaisaghvt
- 404
- 1
- 4
- 10