问题描述
我正在尝试使用 XMl 文件显示 svg 图像。 这是我的代码,我使用蜡染库和 Canvas 类:
JFrame mainFrame = new JFrame("Task Graph.svg");
mainFrame.setSize(800,600);
mainFrame.setDefaultCloSEOperation(JFrame.disPOSE_ON_CLOSE);
mainFrame.setVisible(true);
Container pane = mainFrame.getContentPane();
pane.setLayout(new BorderLayout());
JSVGCanvas canvas = new JSVGCanvas();
canvas.setURI(workdir+"/"+"output.xml");
pane.add(canvas,BorderLayout.CENTER);
pane.setVisible(true);
我认为问题出在这一行:
<g id="a_node1"><a xlink:href="/home/maknI/Output.hello.c#178" </g>
我不知道是否可以使用 xlink:href 从使用 svg 的 c 代码中获取节点??
这里是xml文件:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="1967pt" height="76pt" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 72)">
<title>G</title>
<polygon fill="#ffffff" stroke="#000000" points="-4,4 -4,-72 1963.045,4"/>
<g id="clust1" class="cluster">
<title>cluster_0</title>
<polygon fill="none" stroke="#000000" points="8,-8 8,-60 1951.045,-8"/>
</g>
<!-- task_36 -->
<g id="node1" class="node">
<title>task_36</title>
<g id="a_node1"><a xlink:href="/home/makni/hello.c#178"
xlink:title="non_linear_memset_regression_based">
<ellipse fill="#aaaaaa" stroke="#000000" cx="161.5871" cy="-34" rx="145.6742" ry="18"/>
<text text-anchor="middle" x="161.5871" y="-30.3" font-family="Times,serif" font-size="14.00"
fill="#000000">non_linear_memset_regression_based</text>
</a>
</g>
</g>
</g>
</svg>
你能帮我吗?
先谢谢你
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)