如何通过PREFUSE visualization toolkit for JAVA显示节点的矩形形状?
我已经编写了以下代码(代码的一些摘录)以将节点显示为矩形,但它不起作用。它只是显示一个简单的节点 代码摘录:如何通过PREFUSE visualization toolkit for JAVA显示节点的矩形形状?,java,prefuse,Java,Prefuse,我已经编写了以下代码(代码的一些摘录)以将节点显示为矩形,但它不起作用。它只是显示一个简单的节点 代码摘录: ... ShapeAction nodeShape = new NodeShapeAction(treeNodes); // treeNodes is a datagroup representing the tree nodes m_vis.putAction("nodeShape", nodeShape); // m_vis is referring the visualizatio
...
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
中,将操作
s(在我们的例子中是ShapeAction
)添加到可视化中,只需设置VisualItem
的显示属性
要显示反映这些显示属性的VisualItem
s,我们需要将适当的renders
设置为Visualization
ShapeRenderer m_nodeRenderer = new ShapeRenderer();
DefaultRendererFactory rf = new DefaultRendererFactory(m_nodeRenderer);
m_vis.setRendererFactory(rf);