Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
ExtendedMetaNodeRenderer.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 #ifndef Tulip_ExtendedMetaNodeRenderer_H
22 #define Tulip_ExtendedMetaNodeRenderer_H
23 
24 #include <tulip/tulipconf.h>
25 
26 #include <tulip/GlMetaNodeRenderer.h>
27 #include <tulip/GlMainView.h>
28 
29 namespace tlp {
30 
31 class GlGraphInputData;
32 
33 /**
34  * Class use to render a meta node, this version render meta node with old OpenGl tulip system
35  */
36 class TLP_QT_SCOPE ExtendedMetaNodeRenderer : public GlMetaNodeRenderer, public Observable {
37 
38 public:
39 
40  ExtendedMetaNodeRenderer(GlGraphInputData *inputData);
41  virtual ~ExtendedMetaNodeRenderer();
42 
43  virtual void render(node n,float lod,Camera* camera);
44 
45  virtual void setInputData(GlGraphInputData *data) {
46  clearViews();//Need to regenerate views
47  inputData=data;
48  }
49  virtual GlGraphInputData *getInputData() {
50  return inputData;
51  }
52 
53  /**
54  * @brief clearViews delete all the view created to render metanodes.
55  */
56  void clearViews();
57 
58 protected :
59 
60  void treatEvent(const Event&);
61 
62  /**
63  * @brief createView creates and initialize the GlMainView object used to render the metanode.
64  *
65  * Override this method if you want to use a different view to render metanodes in a subclasses.
66  * @param metaGraph the graph to display in the view.
67  * @return the initialized view.
68  */
69  virtual GlMainView* createView(Graph* metaGraph)const;
70 
71  /**
72  * @brief viewForGraph search and returns the GlMainView used to render the given metagraph.
73  * @param metaGraph the metagraph.
74  * @return the GlMainView or NULL if there is no GlMainView associated to it.
75  */
76  GlMainView* viewForGraph(Graph* metaGraph)const;
77 
78 
79 private :
80 
81  GlGraphInputData *inputData;
82  std::map<Graph *,GlMainView *> metaGraphToViewMap;
83 
84 };
85 
86 }
87 
88 #endif // Tulip_ExtendedMetaNodeRenderer_H
89 ///@endcond