Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

SvgPrinter.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/geometry.h>
39 
41 
42 #include <list>
43 #include <sstream>
44 
45 namespace ogdf {
46 class GraphAttributes;
47 enum class StrokeType : unsigned char;
48 template<class E>
49 class List;
50 
60 class SvgPrinter {
61 public:
68  SvgPrinter(const GraphAttributes& attr, const GraphIO::SVGSettings& settings)
69  : m_attr(attr), m_clsAttr(nullptr), m_settings(settings) { }
70 
78  : m_attr(attr), m_clsAttr(&attr), m_settings(settings) { }
79 
85  bool draw(std::ostream& os);
86 
87 private:
90 
93 
96 
99 
105  void drawClusters(pugi::xml_node xmlNode);
106 
112  void drawEdges(pugi::xml_node xmlNode);
113 
121  void drawEdge(pugi::xml_node xmlNode, edge e);
122 
135  pugi::xml_node drawCurve(pugi::xml_node xmlNode, edge e, List<DPoint>& points);
136 
144  void drawLine(std::stringstream& ss, const DPoint& p1, const DPoint& p2);
145 
152  void drawBezierPath(std::stringstream& ss, List<DPoint>& points);
153 
160  void drawRoundPath(std::stringstream& ss, List<DPoint>& points);
161 
168  void drawLines(std::stringstream& ss, List<DPoint>& points);
169 
179  void drawBezier(std::stringstream& ss, const DPoint& p1, const DPoint& p2, const DPoint& c1,
180  const DPoint& c2);
181 
187  void drawNodes(pugi::xml_node xmlNode);
188 
195  pugi::xml_node writeHeader(pugi::xml_document& doc);
196 
204  void writeDashArray(pugi::xml_node xmlNode, StrokeType lineStyle, double lineWidth);
205 
212  void drawNode(pugi::xml_node xmlNode, node v);
213 
220  void drawCluster(pugi::xml_node xmlNode, cluster c);
221 
228  bool isCoveredBy(const DPoint& point, adjEntry adj) const;
229 
239  void drawArrowHead(pugi::xml_node xmlNode, const DPoint& start, DPoint& end, adjEntry adj);
240 
246  bool isArrowEnabled(adjEntry adj);
247 
254  double getArrowSize(adjEntry adj);
255 
263  void appendLineStyle(pugi::xml_node line, edge e, bool isArrowHead = false);
264 
272  pugi::xml_node drawPolygon(pugi::xml_node xmlNode, const std::list<double> points);
273 };
274 
275 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
Graph.h
Includes declaration of graph class.
ogdf::GenericPoint< double >
ogdf::StrokeType
StrokeType
Line types of strokes.
Definition: graphics.h:50
geometry.h
Declaration of classes GenericPoint, GenericPolyline, GenericLine, GenericSegment,...
ogdf::SvgPrinter
SVG Writer.
Definition: SvgPrinter.h:60
pugixml.h
ogdf::SvgPrinter::m_bbox
DRect m_bbox
cached bounding box of the graph to be visualized
Definition: SvgPrinter.h:95
ogdf::AdjElement
Class for adjacency list elements.
Definition: Graph_d.h:142
ogdf::ClusterElement
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:62
ogdf::ClusterGraphAttributes
Stores additional attributes of a clustered graph (like layout information).
Definition: ClusterGraphAttributes.h:52
ogdf::GraphIO::SVGSettings
Condensed settings for drawing SVGs.
Definition: GraphIO.h:128
ogdf::DRect
Rectangles with real coordinates.
Definition: geometry.h:798
GraphIO.h
Declares class GraphIO which provides access to all graph read and write functionality.
pugi::xml_node
Definition: pugixml.h:401
ogdf::SvgPrinter::m_clsAttr
const ClusterGraphAttributes * m_clsAttr
attributes of the cluster graph (nullptr if no cluster graph)
Definition: SvgPrinter.h:92
ogdf::SvgPrinter::SvgPrinter
SvgPrinter(const ClusterGraphAttributes &attr, const GraphIO::SVGSettings &settings)
Creates a new SVG Printer for a ogdf::ClusterGraph.
Definition: SvgPrinter.h:77
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::SvgPrinter::SvgPrinter
SvgPrinter(const GraphAttributes &attr, const GraphIO::SVGSettings &settings)
Creates a new SVG Printer for a ogdf::Graph.
Definition: SvgPrinter.h:68
ogdf::end
HypergraphRegistry< HypernodeElement >::iterator end(const HypergraphRegistry< HypernodeElement > &self)
pugi::xml_document
Definition: pugixml.h:943
ClusterGraphAttributes.h
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
ogdf::EdgeElement
Class for the representation of edges.
Definition: Graph_d.h:363
ClusterGraph.h
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
ogdf::SvgPrinter::m_attr
const GraphAttributes & m_attr
attributes of the graph to be visualized
Definition: SvgPrinter.h:89
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240
ogdf::SvgPrinter::m_settings
const GraphIO::SVGSettings & m_settings
SVG configuration.
Definition: SvgPrinter.h:98