![](/img/trans.png)
[英]Prefuse. When hovering over a node, how can I change the connected edges' visualization?
[英]How to show rectangle shape for a node through PREFUSE visualization toolkit for JAVA?
我已經編碼以下代碼(代碼的某些摘錄)以將節點顯示為矩形,但它不起作用。 它只是顯示一個簡單的節點。
代碼摘錄:
...
ShapeAction nodeShape = new NodeShapeAction(treeNodes); // treeNodes is a datagroup representing the tree nodes
m_vis.putAction("nodeShape", nodeShape); // m_vis is referring the visualization object
m_vis.run(nodeShape);
....
/**
* Set node shapes
*/
public static class NodeShapeAction extends ShapeAction {
public NodeShapeAction(String group) {
super(group);
add("type == 'APPLICATION'", Constants.SHAPE_RECTANGLE);
add("type == 'DATABASE'", Constants.SHAPE_STAR);
add("type == 'INTERFACE'", Constants.SHAPE_ELLIPSE);
}
} // end of inner class NodeShapeAction
我得到了答案,所以我在這里回答。
在prefuse
,將Action
(在我們的示例中為ShapeAction
)添加到可視化中只是設置VisualItem
的顯示屬性。
要顯示反映這些顯示屬性的VisualItem
,我們需要為Visualization
設置適當的renderers
。
ShapeRenderer m_nodeRenderer = new ShapeRenderer();
DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
m_vis.setRendererFactory(rf);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.