Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces 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/NumericProperty.h>
33 #include <tulip/ForEach.h>
34 
35 #include <exception>
36 #include <string>
37 #include <iostream>
38 #include <vector>
39 
40 using namespace tlp;
41 using namespace ogdf;
42 using namespace std;
43 
44 namespace tlp {
45 class DoubleProperty;
46 class SizeProperty;
47 }
48 
49 class TLP_OGDF_SCOPE TulipToOGDF {
50 public:
51 
52  TulipToOGDF(tlp::Graph *g);
53  ~TulipToOGDF();
54 
55  void saveToGML(const char * fileName);
56 
57  tlp::Graph &getTlp();
58  ogdf::GraphAttributes &getOGDFGraphAttr();
59  ogdf::Graph &getOGDFGraph();
60 
61  ogdf::node getOGDFGraphNode(unsigned int nodeIndex);
62  ogdf::edge getOGDFGraphEdge(unsigned int edgeIndex);
63 
64  tlp::Coord getNodeCoordFromOGDFGraphAttr(unsigned int nodeIndex);
65 
66  void copyTlpNumericPropertyToOGDFEdgeLength(tlp::NumericProperty *);
67  void copyTlpNumericPropertyToOGDFNodeWeight(tlp::NumericProperty *);
68  void copyTlpNodeSizeToOGDF(tlp::SizeProperty *);
69 
70  vector<tlp::Coord> getEdgeCoordFromOGDFGraphAttr(unsigned int edgeIndex);
71 
72 private:
73  tlp::Graph *tulipGraph;
74  ogdf::Graph ogdfGraph;
75  ogdf::GraphAttributes ogdfAttributes;
76 
77  MutableContainer<ogdf::node> ogdfNodes;
78  MutableContainer<ogdf::edge> ogdfEdges;
79 };
80 
81 #endif /* !TULIPTOOGDF_H_ */
82 ///@endcond