我有一个非常大的 zest(1.5.0) graphViewer,因为结果滚动条出现在复合材料中。现在,当我尝试将此图形导出为 png 时,我只得到图形的可见部分。超出滚动条的区域在图像中不可用。
Image image = new Image(PlatformUI.getWorkbench().getDisplay(),composite.getBounds().width,composite.getBounds().height); ImageLoader 加载器 = 新 ImageLoader();
GC gc = new GC(image);
composite.print(gc);
gc.dispose();
loader.data = new ImageData[]{image.getImageData()};
loader.save("c:/raja/graph.png", SWT.IMAGE_PNG);
如果我使用 graphViewer 对象,它会使节点折叠在左上角
GC gc = new GC(viewer.getGraphControl());
Rectangle bounds = viewer.getGraphControl().getBounds();
Image image = new Image(viewer.getGraphControl().getDisplay(), bounds);
**<Rest same as above code>**
我需要获得一张包含完整图表的图像。有没有办法实现这一点。我认为动画可能会导致第二种方法中的节点聚集。有没有办法将其关闭(我尝试将 nodeStyle 设置为 ZestStyle.No_Animation_Layout 但它没有帮助)。