Java Code Examples for guru.nidi.graphviz.engine.Graphviz#useEngine()

The following examples show how to use guru.nidi.graphviz.engine.Graphviz#useEngine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphvizjView.java    From jig with Apache License 2.0 6 votes vote down vote up
@Override
public void render(T model, JigDocumentWriter jigDocumentWriter) {
    DiagramSources diagramSources = editor.edit(model);

    if (diagramSources.noEntity()) {
        jigDocumentWriter.skip();
        return;
    }

    // コマンドラインのみにする
    GraphvizCmdLineEngine graphvizCmdLineEngine = new GraphvizCmdLineEngine();

    confirmInstalledGraphviz(graphvizCmdLineEngine);

    Graphviz.useEngine(graphvizCmdLineEngine);

    diagramSources.each(element -> writeDocument(jigDocumentWriter, element));
}
 
Example 2
Source File: FontTools.java    From graphviz-java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    Graphviz.useEngine(new GraphvizV8Engine());
    System.out.println("Available fonts: " + availableFontNames());
    final String fontShow = "font-show.png";
    System.out.println("Creating image with all fonts '" + fontShow + "'.");
    availableFontNamesGraph(new File(fontShow));
    if (args.length < 2) {
        System.out.println("Usage: FontTools <font name> <font adjust>");
        System.exit(0);
    }
}
 
Example 3
Source File: PerformanceTest.java    From graphviz-java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
        final long a = System.nanoTime();
        Graphviz.useEngine(new GraphvizV8Engine());
//        Graphviz.useEngine(new GraphvizJdkEngine());
        Graphviz.fromString("graph {a--b}").render(SVG).toString();
        final long b = System.nanoTime();
        System.out.printf("init %.0f ms%n", (b - a) / 1e6);

        final PerformanceTest pt = new PerformanceTest();
        print(pt.test());
        for (int k = 0; k < 10; k++) {
            print(pt.test());
        }
        print(pt.test(50));
    }