可视化* .dot文件中的树 [英] Visualize tree from *.dot file

查看:116
本文介绍了可视化* .dot文件中的树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过捕获ANLR点生成器生成的控制台输出,来形象化一棵从ANTLR解析器中获取并写入.dot文件的树.

I need to visualize a tree which I have gotten from an ANTLR parser and written to a .dot file by catching console output that the ANLR dot generator produces.

    MyDOTTreeGenerator generator = new MyDOTTreeGenerator();
    PrintStream old = System.out;
    try {
        System.setOut(new PrintStream(new FileOutputStream(graphFile)));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    System.out.println(generator.toDOT(root));
    System.out.flush();
    System.setOut(old);

问题是:
1.是否可以在我的程序(例如,Swing组件)中可视化.dot文件.
2.我已阅读/尝试使用这种方法 =>有一种方法可以将Graphviz工具包打包到程序中,这样我就可以可视化图,而最终用户不必下载和/或安装某些东西.

Question is:
1. Is there a way to visualize the .dot file in my program, Swing component for example.
2. I have read/tried to visualize with the help of Grappa library + Graphviz toolkit using this approach => is there a way I can pack the Graphviz toolkit in my program, so that I can visualize the graph without the end user having to download and/or install something.

推荐答案

  1. 我将首先搜索类似点文件java之类的东西,实际上似乎有多种解决方案,例如 ZGRViewer
  2. 可以从Java启动外部程序,并且有许多方法可以创建用于安装其他程序的安装程序.

这篇关于可视化* .dot文件中的树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆