LaTeX+TikZ Writer. More...
#include <ogdf/fileformats/TikzWriter.h>
Public Types | |
enum class | LengthUnit { PT , MM , CM , IN , EX , EM , 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. | |
TikzWriter (const GraphAttributes &attr, LengthUnit unit=LengthUnit::MM) | |
Construct a new writer for drawing graphs using graph attributes. | |
bool | draw (std::ostream &os) |
Output the member graph to an output stream in LaTeX+TikZ format. | |
Private Member Functions | |
double | calcArrowSize () const |
Calculates the arrow size to be used for TikZ arrows. | |
void | drawAllClusters (std::ostream &os) |
Draws a rectangle for each cluster in the ogdf::ClusterGraph. | |
void | drawAllEdges (std::ostream &os) |
Draws a sequence of lines for each edge in the graph. | |
void | drawAllNodes (std::ostream &os, bool uniformStyle, bool uniformWidth, bool uniformHeight) |
Draws each node of the graph. | |
void | drawCluster (std::ostream &os, cluster c) |
Draws a cluster as a rectangle, using its size and style properties. | |
void | drawEdge (std::ostream &os, edge e) |
Draws a sequence of lines for each edge in the graph. | |
void | drawNode (std::ostream &os, node v, bool uniformStyle, bool uniformWidth, bool uniformHeight) |
Draws a node using its shape, size and style properties. | |
std::string | getClusterStyle (cluster c) const |
Get the style of a cluster in TikZ syntax. | |
std::string | getEdgeArrows (edge e) const |
Get the arrows of an edge in TikZ syntax. | |
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. | |
std::string | getEdgeStyle (edge e) const |
Get the style of an edge in TikZ syntax. | |
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. | |
std::string | getNodeLabel (node v) const |
Get the label of a node in TikZ syntax. | |
std::string | getNodeShape (node v) const |
Get the shape of a node in TikZ syntax. | |
std::string | getNodeStyle (node v) const |
Get the style of a node in TikZ syntax. | |
double | getTextWidth (node v) const |
Get the total width the node text may occupy. | |
bool | isCoveredBy (const DPoint &p, node v) const |
Check whether a point (e.g. | |
std::string | texLength (double f) const |
Mainly avoid scientific notation (not handled by LaTeX) and add length unit mm. | |
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. | |
Static Private Member Functions | |
static std::string | getColorString (Color c) |
Convert an ogdf::Color to a string in TikZ syntax. | |
Private Attributes | |
const GraphAttributes & | m_attr |
attributes of the graph to be visualized | |
const ClusterGraphAttributes * | m_clsAttr |
attributes of the cluster graph (nullptr if no cluster graph given) | |
std::vector< std::string > | m_edgeStyles |
to avoid as much redundancy as possible, any occurring edge style will be predefined and reused | |
std::vector< std::string > | m_nodeStyles |
to avoid as much redundancy as possible, any occurring node style will be predefined and reused | |
LengthUnit | m_unit |
The LaTeX unit to use for all ocurring lengths. | |
LaTeX+TikZ Writer.
Generates and outputs standalone LaTeX documents/graphics using Tikz.
Definition at line 43 of file TikzWriter.h.
Units of length available in LaTeX.
Definition at line 48 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 64 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 73 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 |
Draws a cluster as a rectangle, using its size and style properties.
os | output stream |
c | cluster to draw |
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 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 Get the total width the node text may occupy.
v | node |
v
Check whether a point (e.g.
edge bend point) lies within a node (using node shapes with same size and aspect as in TikZ).
p | point to check |
v | node to check |
lies
within the border of 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 258 of file TikzWriter.h.
|
private |
attributes of the cluster graph (nullptr
if no cluster graph given)
Definition at line 261 of file TikzWriter.h.
|
private |
to avoid as much redundancy as possible, any occurring edge style will be predefined and reused
Definition at line 270 of file TikzWriter.h.
|
private |
to avoid as much redundancy as possible, any occurring node style will be predefined and reused
Definition at line 267 of file TikzWriter.h.
|
private |
The LaTeX unit to use for all ocurring lengths.
Definition at line 264 of file TikzWriter.h.