Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlyphRenderer.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 GLYPHPREVIEWGENERATOR_H
23 #define GLYPHPREVIEWGENERATOR_H
24 #include <map>
25 
26 #include <QtGui/QPixmap>
27 
28 #include <tulip/tulipconf.h>
29 #include <tulip/Node.h>
30 #include <tulip/Edge.h>
31 
32 namespace tlp {
33 class Graph;
34 
35 
36 /**
37  * @brief Generate Qt previews for Glyphs plug-ins.
38  **/
39 class TLP_QT_SCOPE GlyphRenderer {
40 public:
41  static GlyphRenderer & getInst();
42  ~GlyphRenderer();
43  /**
44  * @brief Get the preview for the glyph with the given Id.
45  */
46  QPixmap render(unsigned int pluginId);
47 
48 private:
49  GlyphRenderer();
50  static GlyphRenderer* _instance;
51  std::map<unsigned int,QPixmap> _previews;
52  tlp::Graph* _graph;
53  tlp::node _node;
54 };
55 
56 /**
57  * @brief Generate Qt previews for edge extremities glyphs plug-ins.
58  **/
59 class TLP_QT_SCOPE EdgeExtremityGlyphRenderer {
60 public:
61 
62  ~EdgeExtremityGlyphRenderer();
63  static EdgeExtremityGlyphRenderer & getInst();
64  /**
65  * @brief Get the preview for the edge extremity glyph with the given Id.
66  */
67  QPixmap render(unsigned int pluginId);
68 
69 private:
70  EdgeExtremityGlyphRenderer();
71  static EdgeExtremityGlyphRenderer* _instance;
72  std::map<unsigned int,QPixmap> _previews;
73  tlp::Graph* _graph;
74  tlp::edge _edge;
75 
76 };
77 }
78 #endif // GLYPHPREVIEWGENERATOR_H
79 ///@endcond