SVG Writer. More...
#include <ogdf/fileformats/SvgPrinter.h>
Public Member Functions | |
SvgPrinter (const ClusterGraphAttributes &attr, const GraphIO::SVGSettings &settings) | |
Creates a new SVG Printer for a ogdf::ClusterGraph. More... | |
SvgPrinter (const GraphAttributes &attr, const GraphIO::SVGSettings &settings) | |
Creates a new SVG Printer for a ogdf::Graph. More... | |
bool | draw (std::ostream &os) |
Prints the graph and attributes of this printer to the given output stream. More... | |
Private Member Functions | |
void | appendLineStyle (pugi::xml_node line, edge e, bool isArrowHead=false) |
Writes the requested line style to the line's XML-node. More... | |
void | drawArrowHead (pugi::xml_node xmlNode, const DPoint &start, DPoint &end, adjEntry adj) |
Draws an arrow head at the end of the edge. More... | |
void | drawBezier (std::stringstream &ss, const DPoint &p1, const DPoint &p2, const DPoint &c1, const DPoint &c2) |
Draws a cubic Bezíer path. More... | |
void | drawBezierPath (std::stringstream &ss, List< DPoint > &points) |
Draws a list of points using cubic Bézier interpolation. More... | |
void | drawCluster (pugi::xml_node xmlNode, cluster c) |
Draws a single cluster as a rectangle. More... | |
void | drawClusters (pugi::xml_node xmlNode) |
Draws a rectangle for each cluster in the ogdf::ClusterGraph. More... | |
pugi::xml_node | drawCurve (pugi::xml_node xmlNode, edge e, List< DPoint > &points) |
Draws the curve depicting a particular edge. More... | |
void | drawEdge (pugi::xml_node xmlNode, edge e) |
Draws a sequence of lines for an edge. More... | |
void | drawEdges (pugi::xml_node xmlNode) |
Draws a sequence of lines for each edge in the graph. More... | |
void | drawLine (std::stringstream &ss, const DPoint &p1, const DPoint &p2) |
Draws the path corresponding to a single line to the stream. More... | |
void | drawLines (std::stringstream &ss, List< DPoint > &points) |
Draws a list of points as straight lines. More... | |
void | drawNode (pugi::xml_node xmlNode, node v) |
Draws a single node. More... | |
void | drawNodes (pugi::xml_node xmlNode) |
Draws all nodes of the graph. More... | |
pugi::xml_node | drawPolygon (pugi::xml_node xmlNode, const std::list< double > points) |
Draws a polygon with the respective points. More... | |
void | drawRoundPath (std::stringstream &ss, List< DPoint > &points) |
Draws a list of points as straight lines connected by circular arcs. More... | |
double | getArrowSize (adjEntry adj) |
Returns the size of the arrow. More... | |
bool | isArrowEnabled (adjEntry adj) |
Returns whether an edge arrow is to be drawn. More... | |
bool | isCoveredBy (const DPoint &point, adjEntry adj) const |
Determines whether a candidate arrow tip lies inside the rectangle of the node. More... | |
void | writeDashArray (pugi::xml_node xmlNode, StrokeType lineStyle, double lineWidth) |
Generates a string that describes the requested dash type. More... | |
pugi::xml_node | writeHeader (pugi::xml_document &doc) |
Writes the header including the bounding box as the viewport. More... | |
Private Attributes | |
const GraphAttributes & | m_attr |
attributes of the graph to be visualized More... | |
DRect | m_bbox |
cached bounding box of the graph to be visualized More... | |
const ClusterGraphAttributes * | m_clsAttr |
attributes of the cluster graph (nullptr if no cluster graph) More... | |
const GraphIO::SVGSettings & | m_settings |
SVG configuration. More... | |
SVG Writer.
Generates and outputs XML-based SVG files depicting the layout of a (cluster-)graph.
Curved edges will be drawn if specified by ogdf::GraphIO::SVGSettings. Set the curviness to a value greater than 0 to obtain curved edges. There are two modes for drawing curved edges: Bézier curves and circular arcs.
Definition at line 60 of file SvgPrinter.h.
|
inline |
Creates a new SVG Printer for a ogdf::Graph.
attr | The attributes of the graph |
settings | The SVG configuration |
Definition at line 68 of file SvgPrinter.h.
|
inline |
Creates a new SVG Printer for a ogdf::ClusterGraph.
attr | The attributes of the graph |
settings | The SVG configuration |
Definition at line 77 of file SvgPrinter.h.
|
private |
Writes the requested line style to the line's XML-node.
line | the XML-node depicting the line |
e | the edge associated with that line |
isArrowHead | whether line is an arrow head polygon |
bool ogdf::SvgPrinter::draw | ( | std::ostream & | os | ) |
Prints the graph and attributes of this printer to the given output stream.
os | The stream to print to |
|
private |
Draws an arrow head at the end of the edge.
Sets the end point of the respective edge segment to the arrow head's tip.
xmlNode | the XML-node to print to |
start | the start point of the edge segment the arrow head will be placed on |
end | the end point of the edge segment the arrow head will be placed on, this will usually be modified |
adj | the adjacency entry |
|
private |
Draws a cubic Bezíer path.
ss | the output stream |
p1 | the first point of the line |
p2 | the second point of the line |
c1 | the first control point of the line |
c2 | the second control point of the line |
Draws a list of points using cubic Bézier interpolation.
ss | the output stream |
points | the points to be connected by lines |
|
private |
Draws a single cluster as a rectangle.
xmlNode | the XML-node to print to |
c | the cluster to be printed |
|
private |
Draws a rectangle for each cluster in the ogdf::ClusterGraph.
xmlNode | the XML-node to print to |
|
private |
Draws the curve depicting a particular edge.
Draws a sequence of cubic Bézier curves if requested. Falls back to straight lines if there are exactly two points or the curviness is set to 0.
Note that this method clears the list of points.
xmlNode | the XML-node to print to |
points | the points along the curve |
e | the edge depicted by the curve |
|
private |
Draws a sequence of lines for an edge.
Arrow heads are added if requested.
xmlNode | the XML-node to print to |
e | the edge to be visualized |
|
private |
Draws a sequence of lines for each edge in the graph.
xmlNode | the XML-node to print to |
|
private |
Draws the path corresponding to a single line to the stream.
ss | the output stream |
p1 | the first point of the line |
p2 | the second point of the line |
Draws a list of points as straight lines.
ss | the output stream |
points | the points to be connected by lines |
|
private |
Draws a single node.
xmlNode | the XML-node to print to |
v | the node to be printed |
|
private |
Draws all nodes of the graph.
xmlNode | the XML-node to print to |
|
private |
Draws a polygon with the respective points.
xmlNode | the XML-node to print to |
points | the list of coordinates |
Draws a list of points as straight lines connected by circular arcs.
ss | the output stream |
points | the points to be connected by lines |
|
private |
Returns the size of the arrow.
The result is zero if the respective arrow is disabled (not to be drawn).
adj | the adjacency entry |
|
private |
Returns whether an edge arrow is to be drawn.
adj | the adjacency entry |
Determines whether a candidate arrow tip lies inside the rectangle of the node.
point | the candidate arrow tip |
adj | the adjacency entry |
|
private |
Generates a string that describes the requested dash type.
xmlNode | the node to append the XML-attribute to |
lineStyle | specifies the style of the dashes |
lineWidth | the stroke width of the respective edge |
|
private |
Writes the header including the bounding box as the viewport.
doc | the XML-document |
|
private |
attributes of the graph to be visualized
Definition at line 89 of file SvgPrinter.h.
|
private |
cached bounding box of the graph to be visualized
Definition at line 95 of file SvgPrinter.h.
|
private |
attributes of the cluster graph (nullptr
if no cluster graph)
Definition at line 92 of file SvgPrinter.h.
|
private |
SVG configuration.
Definition at line 98 of file SvgPrinter.h.