使用拾取模式时如何用Jung更新布局的大小?
我想知道如何使用 jung 更改与 VisualizationViewer 关联的布局的大小?
我解释一下目的:实际上,当使用SatelliteVisualizationViewer时,我们可以选择一个节点并将其移动到SatelliteVisualizationViewer未覆盖的区域。
我们可以在 JUNG 发行版的 SatelliteViewDemo 类中看到这一点。启动演示,选择一个节点并将其移至布局尺寸之外。该节点在 VisualizationViewer 中显示良好,但在卫星视图中显示不佳。
因此,我尝试在 PickingGraphMousePlugin 的 MouseListener 中添加一些代码,特别是在 mouseReleased(...) 方法中,以便根据包含图形所有节点的矩形的大小来更新布局大小。执行此操作后,应更新 SatelliteView。 但如何做到这一点呢?
编辑:抱歉,不够详细。事实上,更改布局大小不会更改 SatelliteView,因此位于布局外部的顶点(在拾取和移动操作之后)仍然不会被 SatelliteView 覆盖。
也许我错过了一些东西......
实际上真正的问题是:如何更改 SatelliteVisualizationViewer 覆盖的区域? !!!
I wondering how to change the size of the layout associated to a VisualizationViewer with jung?
I explain the purpose: actually, when using a SatelliteVisualizationViewer, we can pick a node and move it in an area that is not covered by the SatelliteVisualisationViewer.
We can see this in the SatelliteViewDemo class in the JUNG distribution. Launch the demo, pick a node and move it outside the layout size. The node is well displayed in the VisualizationViewer but not in the satellite view.
So, I try to add some code in the MouseListener of PickingGraphMousePlugin, specifically in the mouseReleased(...) method in order to update the layout size by the size of the rectangle that contains all the nodes of the graph. Doing this, the SatelliteView should be updated.
But how to do this?
Edit: Sorry to have not detailled enough. In fact, changing the layout size does not change the SatelliteView, so vertex located outside the layout (after a pick and move operation) are still not covered by the SatelliteView.
Maybe I have miss something...
Actually the real question is: how to change the area covered by the SatelliteVisualizationViewer? !!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您似乎很清楚如何继续。你卡在哪一块了?更改布局大小?更新可视化?还有别的事吗?
It sounds like you've got a pretty good idea of how to proceed. What piece are you stuck on? Changing the layout size? Updating the visualization? Something else?
我想相对于启用了选择支持的 VisualizationViewer 自动更新卫星视图。
我最终采用了另一种解决方案:不自动更新卫星视图,而是使用鼠标按钮 2 进行平移,并使用 CTRL+Mouse_Wheel 进行缩放。
这是课程,可能会有所帮助......:
I wanted to automatically update the satellite view relatively to a VisualizationViewer with picking support enabled.
I have finally adopted another solution: no automatic update of the satellite view but a pan using mouse button 2, and a zoom using CTRL+Mouse_Wheel.
Here is the class, it may be helpful... :