Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / basic / GraphAttributes.h
blob9077ead26f46f505ee05f8f76a28c91d61e7194b
1 /*
2 * $Revision: 2585 $
4 * last checkin:
5 * $Author: klein $
6 * $Date: 2012-07-12 03:46:50 +0200 (Do, 12. Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of class GraphAttributes which extends a Graph
11 * by additional attributes.
13 * \author Carsten Gutwenger
14 * Karsten Klein
15 * Joachim Kupke
16 * Sebastian Leipert
18 * \par License:
19 * This file is part of the Open Graph Drawing Framework (OGDF).
21 * \par
22 * Copyright (C)<br>
23 * See README.txt in the root directory of the OGDF installation for details.
25 * \par
26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License
28 * Version 2 or 3 as published by the Free Software Foundation;
29 * see the file LICENSE.txt included in the packaging of this file
30 * for details.
32 * \par
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * \par
39 * You should have received a copy of the GNU General Public
40 * License along with this program; if not, write to the Free
41 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
42 * Boston, MA 02110-1301, USA.
44 * \see http://www.gnu.org/copyleft/gpl.html
45 ***************************************************************/
47 #ifdef _MSC_VER
48 #pragma once
49 #endif
51 #ifndef OGDF_ATTRIBUTED_GRAPH_H
52 #define OGDF_ATTRIBUTED_GRAPH_H
54 #include <ogdf/basic/NodeArray.h>
55 #include <ogdf/basic/EdgeArray.h>
56 #include <ogdf/basic/String.h>
57 #include <ogdf/basic/geometry.h>
59 namespace ogdf {
61 //---------------------------------------------------------
62 // GraphAttributes
63 // graph topology + graphical attributes
64 //---------------------------------------------------------
65 //! Stores additional attributes of a graph (like layout information).
66 /**
67 * It is frequently necessary to associate additional attributes with a graph.
68 * The class GraphAttributes provides various such attributes and is the
69 * central place were such attributes are stored.
71 * Attributes are simply stored in node or edge arrays; for memory consumption
72 * reasons, only a subset of these arrays is in fact initialized for the graph;
73 * non-initialized arrays require only a few bytes of extra memory.
75 * Which arrays are initialized is specified by a bit vector; each bit in this
76 * bit vector corresponds to one or more attributes. E.g., \a #nodeGraphics
77 * corresponds to the attributes \a #m_x, \a #m_y, \a #m_width, and \a #m_height;
78 * whereas \a #edgeDoubleWeight only corresponds to the attribute \a #m_doubleWeight.
80 * Attributes can be initialized by the constructor GraphAttributes(const Graph &,long)
81 * or the function initAttributes(); attributes can also be deinitialized by
82 * calling destroyAttributes().
85 class OGDF_EXPORT GraphAttributes {
86 public:
87 //! Types for edge arrows.
88 enum EdgeArrow {
89 none, //!< no edge arrows
90 last, //!< edge arrow at target node of the edge
91 first, //!< edge arrow at source node of the edge
92 both, //!< edge arrow at target and source node of the edge
93 undefined
96 //! Types for line styles.
97 /**
98 * The line styles are preliminary the same as in QT.
100 enum EdgeStyle {
101 esNoPen = 0, //!< no line
102 esSolid = 1, //!< solid line
103 esDash = 2, //!< dashed line
104 esDot = 3, //!< dotted line
105 esDashdot = 4, //!< line style "dash dot dash dot ..."
106 esDashdotdot = 5
107 //!< line style "dash dot dot dash dot dot ..."
110 //! Converts integer \a i to edge style.
111 static EdgeStyle intToStyle(int i) {
112 switch (i) {
113 case 0:
114 return esNoPen;
115 case 1:
116 return esSolid;
117 case 2:
118 return esDash;
119 case 3:
120 return esDot;
121 case 4:
122 return esDashdot;
123 case 5:
124 return esDashdotdot;
125 default:
126 return esNoPen;
131 //! Types for object brush patterns.
133 * The brush patterns are currently the same as the GDE project.
135 enum BrushPattern {
136 bpNone = 0,
137 bpSolid = 1,
138 bpDense1 = 2,
139 bpDense2 = 3,
140 bpDense3 = 4,
141 bpDense4 = 5,
142 bpDense5 = 6,
143 bpDense6 = 7,
144 bpDense7 = 8,
145 bpHorizontal = 9,
146 bpVertical = 10,
147 bpCross = 11,
148 BackwardDiagonal = 12,
149 ForwardDiagonal = 13,
150 DiagonalCross = 14
153 //! Converts integer \a i to brush pattern.
154 static BrushPattern intToPattern(int i) {
155 switch (i) {
156 case 0:
157 return bpNone;
158 break;
159 case 1:
160 return bpSolid;
161 break;
162 case 2:
163 return bpDense1;
164 break;
165 case 3:
166 return bpDense2;
167 break;
168 case 4:
169 return bpDense3;
170 break;
171 case 5:
172 return bpDense4;
173 break;
174 case 6:
175 return bpDense5;
176 break;
177 case 7:
178 return bpDense6;
179 break;
180 case 8:
181 return bpDense7;
182 break;
183 case 9:
184 return bpHorizontal;
185 break;
186 case 10:
187 return bpVertical;
188 break;
189 case 11:
190 return bpCross;
191 break;
192 case 12:
193 return BackwardDiagonal;
194 break;
195 case 13:
196 return ForwardDiagonal;
197 break;
198 case 14:
199 return DiagonalCross;
200 break;
201 default:
202 return bpNone;
203 break;
207 //! Specifies scaling of images.
208 enum ImageStyle {
209 FreeScale = 0, FixScale = 1
211 //! Specifies image alignment.
212 enum ImageAlignment {
213 TopLeft = 0, TopCenter, TopRight, CenterLeft, Center, CenterRight, BottomLeft, BottomCenter, BottomRight
216 //! Helper function mapping int values to image styles
217 static ImageStyle intToImageStyle(int i) {
218 switch (i) {
219 case 0:
220 return FreeScale;
221 break;
222 case 1:
223 return FixScale;
224 break;
225 default:
226 return FreeScale;
227 }//switch
228 }//intToStyle
230 //! Helper function mapping int values to image alignment
231 static ImageAlignment intToImageAlignment(int i) {
232 switch (i) {
233 case 0:
234 return TopLeft;
235 break;
236 case 1:
237 return TopCenter;
238 break;
239 case 2:
240 return TopRight;
241 break;
242 case 3:
243 return CenterLeft;
244 break;
245 case 4:
246 return Center;
247 break;
248 case 5:
249 return CenterRight;
250 break;
251 case 6:
252 return BottomLeft;
253 break;
254 case 7:
255 return BottomCenter;
256 break;
257 case 8:
258 return BottomRight;
259 break;
260 default:
261 return TopLeft;
262 }//switch
263 }//intToAlignment
265 protected:
267 * Writes string \a str into a GML file such that line length limits
268 * are respected and characters '\', '"' are correctly escaped.
270 void writeLongString(ostream &os, const String &str) const;
272 /* Methods for OGML serialization */
274 //! Static helper method for mapping edge styles to ogml.
275 static const char * edgeStyleToOGML(const GraphAttributes::EdgeStyle & edgeStyle);
277 //! Static helper method for mapping image alignments to ogml.
278 static const char * imageAlignmentToOGML(const GraphAttributes::ImageAlignment &imgAlign);
280 //! Static helper method for mapping image style to ogml.
281 static const char * imageStyleToOGML(const GraphAttributes::ImageStyle &imgStyle);
283 //! Static helper method for mapping brush patterns styles to ogml.
284 static const char * brushPatternToOGML(const GraphAttributes::BrushPattern & brushPattern);
286 //static void generateIndent(char ** indent, const int & indentSize);
288 //! Static helper method for exchanging X(HT)ML-tag specific chars.
289 String formatLabel(const String & labelText);
291 /* End methods for OGML serialization */
293 const Graph *m_pGraph; //!< associated graph
295 bool m_directed; //!< whether or not the graph is directed
297 // graphical representation of nodes
298 NodeArray<double> m_x; //!< x-coordinate of a node
299 NodeArray<double> m_y; //!< y-coordinate pf a node
300 NodeArray<double> m_width; //!< width of a node's bounding box
301 NodeArray<double> m_height; //!< height of a nodes's bounding box
302 NodeArray<String> m_nodeLabel; //!< label of a node
303 NodeArray<String> m_nodeColor; //!< color of a node
304 NodeArray<String> m_nodeLine; //!< line color of a node
305 NodeArray<int> m_nodeShape; //!< shape of a node
306 NodeArray<double> m_nodeLineWidth; //!< line width of a node
307 NodeArray<BrushPattern> m_nodePattern; //!< brush pattern of a node
308 NodeArray<EdgeStyle> m_nodeStyle; //!< line style of a node
309 NodeArray<String> m_nodeTemplate; //!< name of template of a node
311 // images
312 NodeArray<String> m_imageUri;
313 NodeArray<ImageStyle> m_imageStyle;
314 NodeArray<ImageAlignment> m_imageAlign;
315 NodeArray<bool> m_imageDrawLine;
316 NodeArray<double> m_imageWidth;
317 NodeArray<double> m_imageHeight;
319 // other node attributes
320 NodeArray<int> m_nodeId; //!< user ID of a node
321 NodeArray<int> m_level; //!< level of a node
322 NodeArray<int> m_nodeIntWeight; //!< (integer) weight of a node
323 NodeArray<Graph::NodeType> m_vType; // type (vertex, dummy, generalizationMerger)
325 // graphical representation of edges
326 EdgeArray<DPolyline> m_bends; //!< list of bend points of an edge
327 EdgeArray<String> m_edgeLabel; //!< label of an edge
328 EdgeArray<EdgeArrow> m_edgeArrow; //!< arrow type of an edge
329 EdgeArray<EdgeStyle> m_edgeStyle; //!< line style of an edge
330 EdgeArray<String> m_edgeColor; //!< line color of an edge
331 EdgeArray<double> m_edgeWidth; //!< line width of an edge
332 EdgeArray<Graph::EdgeType> m_eType; //!< type of an edge (association or generalization)
334 // other edge attributes
335 EdgeArray<int> m_intWeight; //!< (integer) weight of an edge
336 EdgeArray<double> m_doubleWeight; //!< (real number) weight of an edge
337 EdgeArray<unsigned int> m_subGraph; //!< is element of subgraphs given by bitvector
339 long m_attributes; //!< bit vector of currently used attributes
341 public:
342 //! Bits for specifying attributes.
343 enum {
344 nodeGraphics = 0x00001, //!< node attributes m_x, m_y, m_width, m_height, m_nodeShape
345 edgeGraphics = 0x00002, //!< edge attribute m_bends
346 nodeLevel = 0x00004, //!< node attribute m_level
347 edgeIntWeight = 0x00008, //!< edge attribute m_intWeight
348 edgeDoubleWeight = 0x00010, //!< edge attribute m_doubleWeight
349 edgeLabel = 0x00020, //!< edge attribute m_edgeLabel
350 nodeLabel = 0x00040, //!< node attribute m_nodeLabel
351 edgeType = 0x00080, //!< edge attribute m_eType
352 nodeType = 0x00100, //!< node attribute m_vType
353 nodeColor = 0x00200, //!< node attribute m_nodeColor, m_nodeLine
354 nodeId = 0x00400, //!< node attribute m_nodeId
355 edgeArrow = 0x00800, //!< edge attribute m_edgeArrow
356 edgeColor = 0x01000, //!< edge attribute m_edgeColor
357 edgeStyle = 0x02000, //!< edge attribute m_edgeStyle, m_edgeWidth
358 nodeStyle = 0x04000, //!< node attributes m_nodePattern, m_nodeStyle, m_nodeLineWidth;
359 //!< experimental: m_imageUri, m_imageStyle, m_imageAlign,
360 //!< m_imageDrawLine, m_imageWidth, m_imageHeight
361 nodeTemplate = 0x08000, //!< node attribute m_nodeTemplate
362 edgeSubGraph = 0x10000, //!< edge attribute m_subGraph
363 nodeWeight = 0x20000
364 //!< node attribute m_nodeIntWeight
367 //! Bits for specifying node shapes.
368 enum {
369 oval = 0x8001, rectangle = 0x8002
372 //! Constructs graph attributes for no associated graph (default constructor).
374 * The associated graph can be set later with the init() function.
376 GraphAttributes();
378 //! Constructs graph attributes associated with the graph \a G.
380 * @param G is the associated graph.
381 * @param initAttributes specifies the set of attributes that can be accessed.
383 GraphAttributes(const Graph &G, long initAttributes = nodeGraphics | edgeGraphics);
385 virtual ~GraphAttributes() {
388 //! Initializes the graph attributes for graph \a G.
390 * @param G is the new associated graph.
391 * @param initAttr specifies the set of attributes that can be accessed.
393 * \warning All attributes that were allocated before are destroyed by this function!
394 * If you wish to extend the set of allocated attributes, use initAttributes().
396 virtual void init(const Graph &G, long initAttr);
398 //! Returns currently accessible attributes.
399 long attributes() const {
400 return m_attributes;
403 //! Initializes attributes in \a attr for usage.
404 void initAttributes(long attr);
406 //! Destroys attributes in attr.
407 void destroyAttributes(long attr);
409 //! Returns a reference to the associated graph
410 const Graph& constGraph() const {
411 return *m_pGraph;
414 //! Returns if the graph is directed.
415 bool directed() {
416 return m_directed;
419 //! Sets if the graph is directed to \a directed.
420 void directed(bool directed) {
421 m_directed = directed;
424 //! Returns the template name of node \a v.
425 const String &templateNode(node v) const {
426 return m_nodeTemplate[v];
428 //! Returns the template name of node \a v.
429 String &templateNode(node v) {
430 return m_nodeTemplate[v];
433 //! Returns the x-coordinate of node \a v.
434 const double &x(node v) const {
435 return m_x[v];
437 //! Returns the x-coordinate of node \a v.
438 double &x(node v) {
439 return m_x[v];
442 //! Returns the y-coordinate of node \a v.
443 const double &y(node v) const {
444 return m_y[v];
446 //! Returns the y-coordinate of node \a v.
447 double &y(node v) {
448 return m_y[v];
451 //! Returns a reference to the NodeArray \a m_width.
452 const NodeArray<double> &width() const {
453 return m_width;
455 //! Returns a refeence to the NodeArray \a m_width.
456 NodeArray<double> &width() {
457 return m_width;
460 //! Returns the width of the bounding box of node \a v.
461 const double &width(node v) const {
462 return m_width[v];
464 //! Returns the width of the bounding box of node \a v.
465 double &width(node v) {
466 return m_width[v];
469 //! Returns a reference to the NodeArray \a m_height.
470 const NodeArray<double> &height() const {
471 return m_height;
473 //! Returns a refeence to the NodeArray \a m_height.
474 NodeArray<double> &height() {
475 return m_height;
478 //! Returns the height of the bounding box of node \a v.
479 const double &height(node v) const {
480 return m_height[v];
482 //! Returns the height of the bounding box of node \a v.
483 double &height(node v) {
484 return m_height[v];
487 //! Returns the level of node \a v.
488 const int &level(node v) const {
489 return m_level[v];
491 //! Returns the level of node \a v.
492 int &level(node v) {
493 return m_level[v];
496 //! Returns the weight of node \a v.
497 const int &weight(node v) const {
498 return m_nodeIntWeight[v];
500 //! Returns the weight of node \a v.
501 int &weight(node v) {
502 return m_nodeIntWeight[v];
505 //! Returns the brush pattern of node \a v.
506 const BrushPattern &nodePattern(node v) const {
507 return m_nodePattern[v];
509 //! Returns the brush pattern of node \a v.
510 BrushPattern &nodePattern(node v) {
511 return m_nodePattern[v];
514 //! Returns the line style of node \ v.
515 const EdgeStyle &styleNode(node v) const {
516 return m_nodeStyle[v];
518 //! Returns the line style of node \ v.
519 EdgeStyle &styleNode(node v) {
520 return m_nodeStyle[v];
523 //! Returns the line width of node \a v.
524 const double &lineWidthNode(node v) const {
525 return m_nodeLineWidth[v];
527 //! Returns the line width of node \a v.
528 double &lineWidthNode(node v) {
529 return m_nodeLineWidth[v];
532 //! Returns the line color of node \a v.
533 const String &nodeLine(node v) const {
534 return m_nodeLine[v];
536 //! Returns the line color of node \a v.
537 String &nodeLine(node v) {
538 return m_nodeLine[v];
541 //! Returns the list of bend points of edge \a e.
542 const DPolyline &bends(edge e) const {
543 return m_bends[e];
545 //! Returns the list of bend points of edge \a e.
546 DPolyline &bends(edge e) {
547 return m_bends[e];
550 //! Returns the (integer) weight of edge \a e.
551 const int &intWeight(edge e) const {
552 return m_intWeight[e];
554 //! Returns the (integer) weight of edge \a e.
555 int &intWeight(edge e) {
556 return m_intWeight[e];
559 //! Returns the (real number) weight of edge \a e.
560 const double &doubleWeight(edge e) const {
561 return m_doubleWeight[e];
563 //! Returns the (real number) weight of edge \a e.
564 double &doubleWeight(edge e) {
565 return m_doubleWeight[e];
568 //! Returns the line width of edge \a e.
569 const double &edgeWidth(edge e) const {
570 return m_edgeWidth[e];
572 //! Returns the line width of edge \a e.
573 double &edgeWidth(edge e) {
574 return m_edgeWidth[e];
577 //! Returns the color of node \a v.
578 const String &colorNode(node v) const {
579 return m_nodeColor[v];
581 //! Returns the color of node \a v.
582 String &colorNode(node v) {
583 return m_nodeColor[v];
586 //! Returns the shape type of node \a v.
587 int shapeNode(node v) const {
588 return m_nodeShape[v];
590 //! Returns the shape type of node \a v.
591 int &shapeNode(node v) {
592 return m_nodeShape[v];
595 //! Returns the label of node \ v.
596 const String &labelNode(node v) const {
597 return m_nodeLabel[v];
599 //! Returns the label of node \ v.
600 String &labelNode(node v) {
601 return m_nodeLabel[v];
604 //! Returns the label of edge \a e.
605 const String &labelEdge(edge e) const {
606 return m_edgeLabel[e];
608 //! Returns the label of edge \a e.
609 String &labelEdge(edge e) {
610 return m_edgeLabel[e];
613 //! Returns the type of edge \a e.
614 Graph::EdgeType type(edge e) const {
615 return m_eType.valid() ? m_eType[e] : Graph::association;
617 //! Returns the type of edge \a e.
618 Graph::EdgeType &type(edge e) {
619 return m_eType[e];
622 //! Returns the type of node \a v.
623 Graph::NodeType type(node v) const {
624 return m_vType.valid() ? m_vType[v] : Graph::vertex;
626 //! Returns the type of node \a v.
627 Graph::NodeType &type(node v) {
628 return m_vType[v];
631 //! Returns the user ID of node \a v.
632 const int &idNode(node v) const {
633 return m_nodeId[v];
635 //! Returns the user ID of node \a v.
636 int &idNode(node v) {
637 return m_nodeId[v];
640 //! Returns the arrow type of edge \a e.
641 const EdgeArrow &arrowEdge(edge e) const {
642 return m_edgeArrow[e];
644 //! Returns the arrow type of edge \a e.
645 EdgeArrow &arrowEdge(edge e) {
646 return m_edgeArrow[e];
649 //! Returns the line style of an edge \a e.
650 const EdgeStyle &styleEdge(edge e) const {
651 return m_edgeStyle[e];
653 //! Returns the line style of an edge \a e.
654 EdgeStyle &styleEdge(edge e) {
655 return m_edgeStyle[e];
658 //! Returns the color of node \a v.
659 const String &colorEdge(edge e) const {
660 return m_edgeColor[e];
662 //! Returns the color of node \a v.
663 String &colorEdge(edge e) {
664 return m_edgeColor[e];
667 // Images:
668 //! Returns image uri of node v.
669 const String &imageUriNode(node v) const {
670 return m_imageUri[v];
672 //! Returns image uri of node v.
673 String &imageUriNode(node v) {
674 return m_imageUri[v];
676 //! Returns image style of node v.
677 const ImageStyle &imageStyleNode(node v) const {
678 return m_imageStyle[v];
680 //! Returns image style of node v.
681 ImageStyle &imageStyleNode(node v) {
682 return m_imageStyle[v];
684 // Returns image alignment of node v.
685 const ImageAlignment &imageAlignmentNode(node v) const {
686 return m_imageAlign[v];
688 // Returns image alignment of node v.
689 ImageAlignment &imageAlignmentNode(node v) {
690 return m_imageAlign[v];
692 //! Returns bool value drawLine of node v.
693 const bool &imageDrawLineNode(node v) const {
694 return m_imageDrawLine[v];
696 //! Returns bool value drawLine of node v.
697 bool &imageDrawLineNode(node v) {
698 return m_imageDrawLine[v];
700 //! Returns image width of node v.
701 const double &imageWidthNode(node v) const {
702 return m_imageWidth[v];
704 //! Returns image width of node v.
705 double &imageWidthNode(node v) {
706 return m_imageWidth[v];
708 // Returns image height of node v.
709 const double &imageHeightNode(node v) const {
710 return m_imageHeight[v];
712 // Returns image height of node v.
713 double &imageHeightNode(node v) {
714 return m_imageHeight[v];
717 //! Returns the edgesubgraph value of an edge \a e.
718 const unsigned int &subGraphBits(edge e) const {
719 return m_subGraph[e];
721 //! Returns the edgesubgraph value of an edge \a e.
722 unsigned int &subGraphBits(edge e) {
723 return m_subGraph[e];
726 //! Checks whether edge \a e belongs to basic graph \a n.
727 bool inSubGraph(edge e, int n) const {
728 OGDF_ASSERT( n>=0 && n<32 );
729 return (m_subGraph[e] & (1 << n)) != 0;
731 //! Addes edge \a e to basic graph \a n.
732 void addSubGraph(edge e, int n) {
733 OGDF_ASSERT( n>=0 && n<32 );
734 m_subGraph[e] |= (1 << n);
736 //! Removes edge \a e from basic graph \a n.
737 void removeSubGraph(edge e, int n) {
738 OGDF_ASSERT( n>=0 && n<32 );
739 m_subGraph[e] &= ~(1 << n);
742 //! Returns the bounding box of the graph.
743 const DRect boundingBox() const;
746 * We hide the internal representation of semantic node types from
747 * the user to be able to change this later (semantic node type member array).
748 * We are not allowed to set association classes manually, only by calling
749 * createAssociationClass().
751 bool isAssociationClass(node v) const {
752 return (type(v) == Graph::associationClass);
756 * According to the \a mode switch add either the node center points to
757 * the bends or the anchor point on the node boundary
758 * - \a mode = 0: only add node center
759 * - \a mode = 1: compute intersection with the line segment to the center
760 * and the boundary of the rectangular node
761 * - \a mode = 2: compute intersection with the first/last line segment
762 * and the boundary of the rectangular node
764 void addNodeCenter2Bends(int mode = 1);
766 void clearAllBends();
768 //! Returns a list of all inheritance hierarchies in the graph.
770 * Inheritance hierarchies are identified by edges with type Graph::generalization.
772 * @param list is a list of all hierarchies; each hierarchie is itself a list
773 * of all nodes in this hierarchy.
775 * \return Returns the number of generalization hierarchies.
777 int hierarchyList(List<List<node>*> &list) const;
779 //! Returns a list of all inheritance hierarchies in the graph.
781 * Inheritance hierarchies are identified by edges with type Graph::generalization.
783 * @param list is a list of all hierarchies; each hierarchie is itself a list
784 * of all edges in this hierarchy.
786 * \return Returns the number of generalization hierarchies.
788 int hierarchyList(List<List<edge>*> &list) const;
790 //! Sets the width of all nodes to \a w.
791 void setAllWidth(double w);
792 //! Sets the height of all nodes to \a h.
793 void setAllHeight(double h);
795 //! Reads the graph from a GML file \a fileName.
796 bool readGML(Graph &G, const String &fileName);
798 //! Reads the graph from a GML input stream \a is.
799 bool readGML(Graph &G, istream &is);
801 //! Writes the graph with its attributes in GML format to file \a fileName.
802 void writeGML(const String &fileName) const;
804 //! Writes the graph with its attributes in GML format to output stream \a os.
805 void writeGML(ostream &os) const;
807 //! Writes the graph with its attributes in SVG format to file \a fileName.
809 * @param fileName filename of the SVG
810 * @param fontSize size of node label (default = 3)
811 * @param fontColor color of node label (default = #000000)
813 void writeSVG(const String &fileName, int fontSize = 3, const String &fontColor = "#000000") const;
815 //! Writes the graph with its attributes in SVG format to output stream \a os.
817 * @param os output stream for SVG
818 * @param fontSize size of node label
819 * @param fontColor color of node label
821 void writeSVG(ostream &os, int fontSize, const String &fontColor) const;
823 //! Reads the graph and attributes from the XML file \a fileName.
824 bool readXML(Graph &G, const String &fileName);
826 //! Reads the graph and attributes from the XML input stream \a is.
827 bool readXML(Graph &G, istream &is);
829 //! Writes the graph to the XML file \a fileName.
830 void writeXML(const String &fileName, const char* delimiter = "", const char* offset = "") const;
832 //! Writes the graph to XML output stream \a os.
833 virtual void writeXML(ostream &os, const char* delimiter = "", const char* offset = "") const;
835 //! Reads a graph in Rudy format from file \a fileName.
836 bool readRudy(Graph &G, const String &fileName);
838 //! Reads a graph in Rudy format from input stream \a is.
839 bool readRudy(Graph &G, istream &is);
841 //! Writes the graph in Rudy format to file \a fileName.
842 void writeRudy(const String &fileName) const;
844 //! Writes the graph in Rudy format to output stream \a os.
845 void writeRudy(ostream &os) const;
847 //! Removes unnecessary bend points in orthogonal segements.
849 * Processes all edges and removes unnecessary bend points in the bend point list
850 * of the edge, i.e., bend points such that the preceding and succeeding bend point
851 * form a horizontal or vertical segement containing this bend point. This function
852 * is useful to remove redundant bend points in an orthogonal layout.
854 void removeUnnecessaryBendsHV();
857 } // end namespace ogdf
860 #endif