Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

SvgPrinter.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <list>
35 #include <sstream>
38 
39 namespace ogdf
40 {
41 
52 {
53 public:
54 
61  SvgPrinter(const GraphAttributes &attr, const GraphIO::SVGSettings &settings)
62  : m_attr(attr)
63  , m_clsAttr(nullptr)
64  , m_settings(settings)
65  {
66  }
67 
75  : m_attr(attr)
76  , m_clsAttr(&attr)
77  , m_settings(settings)
78  {
79  }
80 
86  bool draw(ostream &os);
87 
88 private:
91 
94 
97 
103  void drawClusters(pugi::xml_node xmlNode);
104 
110  void drawEdges(pugi::xml_node xmlNode);
111 
119  void drawEdge(pugi::xml_node xmlNode, edge e);
120 
134 
142  void drawLine(std::stringstream &ss, const DPoint &p1, const DPoint &p2);
143 
150  void drawBezierPath(std::stringstream &ss, List<DPoint> &points);
151 
158  void drawRoundPath(std::stringstream &ss, List<DPoint> &points);
159 
166  void drawLines(std::stringstream &ss, List<DPoint> &points);
167 
177  void drawBezier(std::stringstream &ss, const DPoint &p1, const DPoint &p2, const DPoint &c1, const DPoint &c2);
178 
184  void drawNodes(pugi::xml_node xmlNode);
185 
193 
201  void writeDashArray(pugi::xml_node xmlNode, StrokeType lineStyle, double lineWidth);
202 
209  void drawNode(pugi::xml_node xmlNode, node v);
210 
217  void drawCluster(pugi::xml_node xmlNode, cluster c);
218 
226  bool isCoveredBy(const DPoint &point, edge e, node v);
227 
238  void drawArrowHead(pugi::xml_node xmlNode, const DPoint &start, DPoint &end, node v, edge e);
239 
246  double getArrowSize(edge e, node v);
247 
255 
263  pugi::xml_node drawPolygon(pugi::xml_node xmlNode, const std::list<double> points);
264 };
265 
266 }
const GraphIO::SVGSettings & m_settings
SVG configuration.
Definition: SvgPrinter.h:96
static const int line
Definition: GmlParser.h:86
void drawBezierPath(std::stringstream &ss, List< DPoint > &points)
Draws a list of points using cubic Bézier interpolation.
void drawEdge(pugi::xml_node xmlNode, edge e)
Draws a sequence of lines for an edge.
bool isCoveredBy(const DPoint &point, edge e, node v)
Determines whether a candidate arrow tip lies inside the rectangle of the node.
void drawClusters(pugi::xml_node xmlNode)
Draws a rectangle for each cluster in the ogdf::ClusterGraph.
void drawEdges(pugi::xml_node xmlNode)
Draws a sequence of lines for each edge in the graph.
void drawCluster(pugi::xml_node xmlNode, cluster c)
Draws a single cluster as a rectangle.
const GraphAttributes & m_attr
attributes of the graph to be visualized
Definition: SvgPrinter.h:90
const ClusterGraphAttributes * m_clsAttr
attributes of the cluster graph (nullptr if no cluster graph)
Definition: SvgPrinter.h:93
Real points.
Definition: geometry.h:219
void drawNodes(pugi::xml_node xmlNode)
Draws all nodes of the graph.
SvgPrinter(const GraphAttributes &attr, const GraphIO::SVGSettings &settings)
Creates a new SVG Printer for a ogdf::Graph.
Definition: SvgPrinter.h:61
void writeDashArray(pugi::xml_node xmlNode, StrokeType lineStyle, double lineWidth)
Generates a string that describes the requested dash type.
void appendLineStyle(pugi::xml_node line, edge e)
Writes the requested line style to the line&#39;s XML-node.
pugi::xml_node writeHeader(pugi::xml_document &doc)
Writes the header including the bounding box as the viewport.
double getArrowSize(edge e, node v)
Returns the size of the arrow.
Stores additional attributes of a graph (like layout information).
pugi::xml_node drawPolygon(pugi::xml_node xmlNode, const std::list< double > points)
Draws a polygon with the respective points.
Class for the representation of edges.
Definition: Graph_d.h:291
Stores additional attributes of a clustered graph (like layout information).
Class for the representation of nodes.
Definition: Graph_d.h:167
void drawBezier(std::stringstream &ss, const DPoint &p1, const DPoint &p2, const DPoint &c1, const DPoint &c2)
Draws a cubic Bezíer path.
void drawLines(std::stringstream &ss, List< DPoint > &points)
Draws a list of points as straight lines.
void drawLine(std::stringstream &ss, const DPoint &p1, const DPoint &p2)
Draws the path corresponding to a single line to the stream.
SVG Writer.
Definition: SvgPrinter.h:51
void drawArrowHead(pugi::xml_node xmlNode, const DPoint &start, DPoint &end, node v, edge e)
Draws an arrow head at the end of the edge.
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:53
Condensed settings for drawing SVGs.
Definition: GraphIO.h:67
bool draw(ostream &os)
Prints the graph and attributes of this printer to the given output stream.
StrokeType
Line types of strokes.
Definition: graphics.h:43
void drawRoundPath(std::stringstream &ss, List< DPoint > &points)
Draws a list of points as straight lines connected by circular arcs.
The namespace for all OGDF objects.
Declares class GraphIO which provides access to all graph read and write functionality.
SvgPrinter(const ClusterGraphAttributes &attr, const GraphIO::SVGSettings &settings)
Creates a new SVG Printer for a ogdf::ClusterGraph.
Definition: SvgPrinter.h:74
pugi::xml_node drawCurve(pugi::xml_node xmlNode, edge e, List< DPoint > &points)
Draws the curve depicting a particular edge.
void drawNode(pugi::xml_node xmlNode, node v)
Draws a single node.