gpt4 book ai didi

Java JUNG 图 : Some edges miss arrows

转载 作者:行者123 更新时间:2023-11-30 04:58:11 26 4
gpt4 key购买 nike

我用 StaticLayout 制作了一个图表并更改了顶点的形状\颜色。我没有改变任何与边缘相关的东西。所有边都是有方向的,但有些边没有箭头!怎么会发生这种事?

screenshot

图形可视化代码:

    Layout<Object, String> layout = new StaticLayout<Object, String>(graphProvider.graphFor(market),new MarketVertexLayoutTransformer(market,panel.getMarketGraphPane().getSize() )) ;
layout.setSize(panel.getMarketGraphPane().getSize());
VisualizationViewer<Object,String> graphPanel = new VisualizationViewer<Object,String>(layout);
graphPanel.getRenderContext().setVertexShapeTransformer(new MarketVertexShapeTransformer());
graphPanel.getRenderContext().setVertexFillPaintTransformer(new MarketVertexColorTransformer());
panel.getMarketGraphPane().add(graphPanel, BorderLayout.CENTER);
panel.getMarketGraphPane().revalidate();

图表是

graph = new DirectedSparseGraph<Object, String>();

边是这样创建的

   graph.addEdge(bundle.getGood()+"->"+transformation,bundle.getGood(),transformation);
graph.addEdge(transformation+"->"+bundle.getGood(),transformation,bundle.getGood());

谢谢

最佳答案

箭头的放置是通过分割边缘直到远段包含在顶点形状中,然后向后移动一个来完成的。如果操作开始时远端点不在顶点形状内部,则应该抛出异常。您选择了正确的解决方案,即在将顶点形状平移到位之前将它们以原点为中心。汤姆·纳尔逊

关于Java JUNG 图 : Some edges miss arrows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7824024/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com