public class DotGraph extends java.lang.Object implements Renderable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOT_EXTENSION
The extension added to output files, exported so that
clients can search for the filenames.
|
Constructor and Description |
---|
DotGraph(java.lang.String graphname)
Creates a new graph for drawing.
|
Modifier and Type | Method and Description |
---|---|
DotGraph |
createSubGraph(java.lang.String label)
creates a sub graph.
|
DotGraphEdge |
drawEdge(java.lang.String from,
java.lang.String to)
Draws a directed edge (including the source and end nodes,
if they have not already been drawn).
|
DotGraphNode |
drawNode(java.lang.String name)
Draws a node.
|
void |
drawUndirectedEdge(java.lang.String label1,
java.lang.String label2)
draws an undirected edge
|
DotGraphNode |
getNode(java.lang.String name)
Gets the graph node by name.
|
void |
plot(java.lang.String filename)
Generates the drawing on canvas to the dot file.
|
void |
render(java.io.OutputStream out,
int indent) |
void |
setGraphAttribute(DotGraphAttribute attr)
sets any general attributes
|
void |
setGraphAttribute(java.lang.String id,
java.lang.String value)
sets any general attributes
|
void |
setGraphLabel(java.lang.String label)
sets the graph label
|
void |
setGraphName(java.lang.String name)
sets the graph name
|
void |
setGraphSize(double width,
double height)
sets the size of drawing area, in inches
|
void |
setNodeShape(java.lang.String shape)
Sets all node shapes, see the list of node shapes in DotGraphConstants.
|
void |
setNodeStyle(java.lang.String style)
Sets all node styles
|
void |
setOrientation(java.lang.String orientation)
sets the graph rotation angles
|
void |
setPageSize(double width,
double height)
sets the pages size, once this is set, the generated graph
will be broken into several pages.
|
public static final java.lang.String DOT_EXTENSION
public DotGraph(java.lang.String graphname)
graphname,
- the name used to identify the graph in the dot source.public void plot(java.lang.String filename)
filename
- the name for the output file. By convention, it should
end with DOT_EXTENSION, but this is not enforced.public DotGraphEdge drawEdge(java.lang.String from, java.lang.String to)
from,
- the source nodeto,
- the end nodepublic DotGraphNode drawNode(java.lang.String name)
name,
- the node to draw.DotGraphNode
corresponding to the
specified name.public DotGraphNode getNode(java.lang.String name)
name,
- unique name of the node.public void setNodeShape(java.lang.String shape)
shape,
- the node shapepublic void setNodeStyle(java.lang.String style)
style,
- the node stylepublic void setGraphSize(double width, double height)
public void setPageSize(double width, double height)
public void setOrientation(java.lang.String orientation)
public void setGraphName(java.lang.String name)
public void setGraphLabel(java.lang.String label)
public void setGraphAttribute(java.lang.String id, java.lang.String value)
id
- is the attribute name.value
- is the attribute value.public void setGraphAttribute(DotGraphAttribute attr)
attr
- a DotGraphAttribute
specifying the
attribute name and value.public void drawUndirectedEdge(java.lang.String label1, java.lang.String label2)
label1,
- label2public DotGraph createSubGraph(java.lang.String label)
public void render(java.io.OutputStream out, int indent) throws java.io.IOException
render
in interface Renderable
java.io.IOException