Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
TulipToOGDF.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef TULIPTOOGDF_H_
23 #define TULIPTOOGDF_H_
24 
25 #include <ogdf/basic/GraphAttributes.h>
26 #include <ogdf/fileformats/GmlParser.h>
27 
28 #include <tulip/tulipconf.h>
29 #include <tulip/Graph.h>
30 #include <tulip/TlpTools.h>
31 #include <tulip/StringProperty.h>
32 #include <tulip/ForEach.h>
33 
34 #include <exception>
35 #include <string>
36 #include <iostream>
37 #include <vector>
38 
39 using namespace tlp;
40 using namespace ogdf;
41 using namespace std;
42 
43 namespace tlp {
44 class DoubleProperty;
45 class SizeProperty;
46 }
47 
48 class TLP_OGDF_SCOPE TulipToOGDF {
49 public:
50 
51  TulipToOGDF(tlp::Graph *g);
52  ~TulipToOGDF();
53 
54  void saveToGML(const char * fileName);
55 
56  tlp::Graph &getTlp();
57  ogdf::GraphAttributes &getOGDFGraphAttr();
58  ogdf::Graph &getOGDFGraph();
59 
60  ogdf::node getOGDFGraphNode(unsigned int nodeIndex);
61  ogdf::edge getOGDFGraphEdge(unsigned int edgeIndex);
62 
63  tlp::Coord getNodeCoordFromOGDFGraphAttr(unsigned int nodeIndex);
64 
65  void copyTlpDoublePropertyToOGDFEdgeLength(tlp::DoubleProperty *);
66  void copyTlpDoublePropertyToOGDFNodeWeight(tlp::DoubleProperty *);
67  void copyTlpNodeSizeToOGDF(tlp::SizeProperty *);
68 
69  vector<tlp::Coord> getEdgeCoordFromOGDFGraphAttr(unsigned int edgeIndex);
70 
71 private:
72  tlp::Graph *tulipGraph;
73  ogdf::Graph ogdfGraph;
74  ogdf::GraphAttributes ogdfAttributes;
75 
76  MutableContainer<ogdf::node> ogdfNodes;
77  MutableContainer<ogdf::edge> ogdfEdges;
78 };
79 
80 #endif /* !TULIPTOOGDF_H_ */
81 ///@endcond