MetaDone
metadone.client.grasyla2.functions.GraphViz Class Reference
Collaboration diagram for metadone.client.grasyla2.functions.GraphViz:

List of all members.

Public Member Functions

 GraphViz (Properties p)
byte[] getGraph (byte[] dot_source, String type) throws IOException
byte[] getGraph (File dot, String type) throws IOException
Process convert (String type) throws IOException
Process convert (File source, File dest, String type) throws IOException

Protected Member Functions

String getDotCommand ()

Private Member Functions

byte[] waitAndReadInput (Process p) throws IOException

Private Attributes

final Properties properties

Detailed Description

Purpose: GraphViz Java API

Description:
With this Java class you can simply call dot from your Java programs
Example usage:
    GraphViz gv = new GraphViz(properties);
    String type = "gif";
    File out = new File("out." + type);   // out.gif in this example
    gv.writeGraphToFile( gv.getGraph( gv.getDotSource(), type ), out );
 

Version:
v0.6, 2011/08/30 -- Removing string builder related code
v0.6, 2011/08/15 -- Letting Java figure out where the temporary directory is located and finding the executable
v0.4, 2011/02/05 (February) -- Patch of Keheliya Gallaba is added. Now you can specify the type of the output file: gif, dot, fig, pdf, ps, svg, png, etc.
v0.3, 2010/11/29 (November) -- Windows support + ability to read the graph from a text file
v0.2, 2010/07/22 (July) -- bug fix
v0.1, 2003/12/04 (December) -- first release
Author:
Laszlo Szathmary (jabba.laci@gmail.com)
kma

Constructor & Destructor Documentation

metadone.client.grasyla2.functions.GraphViz.GraphViz ( Properties  p)

Constructor: creates a new GraphViz object that will contain a graph.

References metadone.client.grasyla2.functions.GraphViz.properties.


Member Function Documentation

Process metadone.client.grasyla2.functions.GraphViz.convert ( String  type) throws IOException

Spawns the graphviz process.

Parameters:
typeThe type of the result
Returns:
The process
Exceptions:
IOException

Referenced by metadone.client.grasyla2.functions.GraphViz.getGraph().

Process metadone.client.grasyla2.functions.GraphViz.convert ( File  source,
File  dest,
String  type 
) throws IOException

Spawns the graphviz process.

Parameters:
sourceThe source file or null
destThe destination file or null
typeThe type of the result
Returns:
The process
Exceptions:
IOException

References metadone.client.grasyla2.functions.GraphViz.getDotCommand().

String metadone.client.grasyla2.functions.GraphViz.getDotCommand ( ) [protected]
byte [] metadone.client.grasyla2.functions.GraphViz.getGraph ( byte[]  dot_source,
String  type 
) throws IOException

Returns the graph as an image in binary format.

Parameters:
dot_sourceSource of the graph to be drawn.
typeType of the output image to be produced, e.g.: gif, dot, fig, pdf, ps, svg, png.
Returns:
A byte array containing the image of the graph.

References metadone.client.grasyla2.functions.GraphViz.convert(), and metadone.client.grasyla2.functions.GraphViz.waitAndReadInput().

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.buildGraph().

byte [] metadone.client.grasyla2.functions.GraphViz.getGraph ( File  dot,
String  type 
) throws IOException

It will call the external dot program, and return the image in binary format.

Parameters:
dotSource of the graph (in dot language).
typeType of the output image to be produced, e.g.: gif, dot, fig, pdf, ps, svg, png.
Returns:
The image of the graph in the given format.

References metadone.client.grasyla2.functions.GraphViz.convert(), and metadone.client.grasyla2.functions.GraphViz.waitAndReadInput().

byte [] metadone.client.grasyla2.functions.GraphViz.waitAndReadInput ( Process  p) throws IOException [private]

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations