LaTeX+TikZ Writer. More...
#include <ogdf/fileformats/TikzWriter.h>
Public Types | |
enum | LengthUnit { LengthUnit::PT, LengthUnit::MM, LengthUnit::CM, LengthUnit::IN, LengthUnit::EX, LengthUnit::EM, LengthUnit::MU } |
Units of length available in LaTeX. More... | |
Public Member Functions | |
TikzWriter (const ClusterGraphAttributes &attr, LengthUnit unit=LengthUnit::MM) | |
Construct a new writer for drawing cluster graphs using graph attributes. More... | |
TikzWriter (const GraphAttributes &attr, LengthUnit unit=LengthUnit::MM) | |
Construct a new writer for drawing graphs using graph attributes. More... | |
bool | draw (std::ostream &os) |
Output the member graph to an output stream in LaTeX+TikZ format. More... | |
Private Member Functions | |
double | calcArrowSize () const |
Calculates the arrow size to be used for TikZ arrows. More... | |
void | drawAllClusters (std::ostream &os) |
Draws a rectangle for each cluster in the ogdf::ClusterGraph. More... | |
void | drawAllEdges (std::ostream &os) |
Draws a sequence of lines for each edge in the graph. More... | |
void | drawAllNodes (std::ostream &os, bool uniformStyle, bool uniformWidth, bool uniformHeight) |
Draws each node of the graph. More... | |
void | drawCluster (std::ostream &os, cluster c) |
Draws a cluster as a rectangle, using its size and style properties. More... | |
void | drawEdge (std::ostream &os, edge e) |
Draws a sequence of lines for each edge in the graph. More... | |
void | drawNode (std::ostream &os, node v, bool uniformStyle, bool uniformWidth, bool uniformHeight) |
Draws a node using its shape, size and style properties. More... | |
std::string | getClusterStyle (cluster c) const |
Get the style of a cluster in TikZ syntax. More... | |
std::string | getEdgeArrows (edge e) const |
Get the arrows of an edge in TikZ syntax. More... | |
std::string | getEdgeLabel (edge e, const DPoint &previousPoint, const DPoint &labelPoint) const |
Get the label of an edge in TikZ syntax, positioned as a node on the edge path. More... | |
std::string | getEdgeStyle (edge e) const |
Get the style of an edge in TikZ syntax. More... | |
std::string | getLineStyle (StrokeType strokeType, double strokeWidth, Color strokeColor) const |
Convert an ogdf::StrokeType, strokeWidth and ogdf::Color to a a line style string in TikZ syntax. More... | |
std::string | getNodeLabel (node v) const |
Get the label of a node in TikZ syntax. More... | |
std::string | getNodeShape (node v) const |
Get the shape of a node in TikZ syntax. More... | |
std::string | getNodeStyle (node v) const |
Get the style of a node in TikZ syntax. More... | |
double | getTextWidth (node v) const |
Get the total width the node text may occupy. More... | |
std::string | texLength (double f) const |
Mainly avoid scientific notation (not handled by LaTeX) and add length unit mm. More... | |
void | wrapHeaderFooter (std::ostream &os, std::string tikzPic, bool uniformStyle, bool uniformWidth, bool uniformHeight) const |
Wrap LaTeX/TikZ header/footer around a tikzpicture and write to output stream. More... | |
Static Private Member Functions | |
static std::string | getColorString (Color c) |
Convert an ogdf::Color to a string in TikZ syntax. More... | |
Private Attributes | |
const GraphAttributes & | m_attr |
attributes of the graph to be visualized More... | |
const ClusterGraphAttributes * | m_clsAttr |
attributes of the cluster graph (nullptr if no cluster graph given) More... | |
std::vector< std::string > | m_edgeStyles |
to avoid as much redundancy as possible, any occurring edge style will be predefined and reused More... | |
std::vector< std::string > | m_nodeStyles |
to avoid as much redundancy as possible, any occurring node style will be predefined and reused More... | |
LengthUnit | m_unit |
The LaTeX unit to use for all ocurring lengths. More... | |
LaTeX+TikZ Writer.
Generates and outputs standalone LaTeX documents/graphics using Tikz.
Definition at line 52 of file TikzWriter.h.
|
strong |
Units of length available in LaTeX.
Definition at line 57 of file TikzWriter.h.
|
inline |
Construct a new writer for drawing graphs using graph attributes.
attr | the attributes of the graph to draw |
unit | the unit to use for LaTeX lengths |
Definition at line 73 of file TikzWriter.h.
|
inline |
Construct a new writer for drawing cluster graphs using graph attributes.
attr | the attributes of the cluster graph to draw |
unit | the unit to use for LaTeX lengths |
Definition at line 82 of file TikzWriter.h.
|
private |
Calculates the arrow size to be used for TikZ arrows.
bool ogdf::TikzWriter::draw | ( | std::ostream & | os | ) |
Output the member graph to an output stream in LaTeX+TikZ format.
os | output stream |
|
private |
Draws a rectangle for each cluster in the ogdf::ClusterGraph.
os | output stream |
|
private |
Draws a sequence of lines for each edge in the graph.
os | output stream |
|
private |
Draws each node of the graph.
os | output stream |
uniformStyle | whether not to set style per node |
uniformWidth | whether not to set width per node |
uniformHeight | whether not to set height per node |
|
private |
Draws a cluster as a rectangle, using its size and style properties.
os | output stream |
c | cluster to draw |
|
private |
Draws a sequence of lines for each edge in the graph.
os | output stream |
e | edge to draw |
|
private |
Draws a node using its shape, size and style properties.
os | output stream |
v | node to draw |
uniformStyle | whether not to set style per node |
uniformWidth | whether not to set width per node |
uniformHeight | whether not to set height per node |
|
private |
Get the style of a cluster in TikZ syntax.
c | cluster |
c
in TikZ syntax
|
staticprivate |
Convert an ogdf::Color to a string in TikZ syntax.
c | color |
c
in TikZ syntax
|
private |
Get the arrows of an edge in TikZ syntax.
e | edge |
e
in TikZ syntax
|
private |
Get the label of an edge in TikZ syntax, positioned as a node on the edge path.
e | edge |
previousPoint | previous point on edge path |
labelPoint | where to put the edge label |
e
in TikZ syntax
|
private |
Get the style of an edge in TikZ syntax.
e | edge |
e
in TikZ syntax
|
private |
Convert an ogdf::StrokeType, strokeWidth and ogdf::Color to a a line style string in TikZ syntax.
strokeType | stroke type |
strokeWidth | stroke width |
strokeColor | stroke color |
|
private |
Get the label of a node in TikZ syntax.
v | node |
v
in TikZ syntax
|
private |
Get the shape of a node in TikZ syntax.
v | node |
v
in TikZ syntax
|
private |
Get the style of a node in TikZ syntax.
v | node |
v
in TikZ syntax
|
private |
Get the total width the node text may occupy.
v | node |
v
|
private |
Mainly avoid scientific notation (not handled by LaTeX) and add length unit mm.
f | floating point number |
f
in mm as formatted string
|
private |
Wrap LaTeX/TikZ header/footer around a tikzpicture and write to output stream.
os | output stream |
tikzPic | the content of the tikzPicture |
uniformStyle | whether not to set style per node |
uniformWidth | whether not to set width per node |
uniformHeight | whether not to set height per node |
|
private |
attributes of the graph to be visualized
Definition at line 257 of file TikzWriter.h.
|
private |
attributes of the cluster graph (nullptr
if no cluster graph given)
Definition at line 260 of file TikzWriter.h.
|
private |
to avoid as much redundancy as possible, any occurring edge style will be predefined and reused
Definition at line 269 of file TikzWriter.h.
|
private |
to avoid as much redundancy as possible, any occurring node style will be predefined and reused
Definition at line 266 of file TikzWriter.h.
|
private |
The LaTeX unit to use for all ocurring lengths.
Definition at line 263 of file TikzWriter.h.