Tulip  5.2.0
Large graphs analysis and drawing
GlyphRenderer.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 #ifndef GLYPHPREVIEWGENERATOR_H
22 #define GLYPHPREVIEWGENERATOR_H
23 
24 #include <map>
25 
26 #include <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  * @brief Generate Qt previews for Glyphs plug-ins.
37  **/
38 class TLP_QT_SCOPE GlyphRenderer {
39 public:
40  static GlyphRenderer &getInst();
41  ~GlyphRenderer();
42  /**
43  * @brief Get the preview for the glyph with the given Id.
44  */
45  QPixmap render(unsigned int pluginId);
46 
47 private:
48  GlyphRenderer();
49  static GlyphRenderer *_instance;
50  std::map<unsigned int, QPixmap> _previews;
51  tlp::Graph *_graph;
52  tlp::node _node;
53 };
54 
55 /**
56  * @brief Generate Qt previews for edge extremities glyphs plug-ins.
57  **/
58 class TLP_QT_SCOPE EdgeExtremityGlyphRenderer {
59 public:
60  ~EdgeExtremityGlyphRenderer();
61  static EdgeExtremityGlyphRenderer &getInst();
62  /**
63  * @brief Get the preview for the edge extremity glyph with the given Id.
64  */
65  QPixmap render(unsigned int pluginId);
66 
67 private:
68  EdgeExtremityGlyphRenderer();
69  static EdgeExtremityGlyphRenderer *_instance;
70  std::map<unsigned int, QPixmap> _previews;
71  tlp::Graph *_graph;
72  tlp::edge _edge;
73 };
74 }
75 #endif // GLYPHPREVIEWGENERATOR_H
76 ///@endcond
The edge struct represents an edge in a Graph object.
Definition: Edge.h:40
The node struct represents a node in a Graph object.
Definition: Node.h:40