Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlNode.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
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_GLNODE_H
22 #define Tulip_GLNODE_H
23 
24 #ifndef DOXYGEN_NOTFOR_DEVEL
25 
26 #include <tulip/Color.h>
27 #include <tulip/Coord.h>
28 #include <tulip/GlComplexeEntity.h>
29 
30 #include <vector>
31 
32 namespace tlp {
33 
34 struct OcclusionTest;
35 class TextRenderer;
36 class GlSceneVisitor;
37 class GlLabel;
38 class GlBox;
39 
40 /**
41  * Class to represent a node of a graph
42  */
43 class TLP_GL_SCOPE GlNode : public GlComplexeEntity {
44 
45 public:
46 
47  /**
48  * Default constructor with id
49  * id must be the id of the node in graph
50  */
51  GlNode(unsigned int id);
52 
53  /**
54  * Virtual function to accept GlSceneVisitor on this class
55  */
56  virtual void acceptVisitor(GlSceneVisitor *visitor);
57 
58  /**
59  * Return the node bounding box
60  */
61  virtual BoundingBox getBoundingBox(const GlGraphInputData* data);
62 
63  /**
64  * Draw the node with level of detail : lod and Camera : camera
65  */
66  virtual void draw(float lod,const GlGraphInputData *data,Camera* camera);
67 
68  /**
69  * Draw the label of the node if drawNodesLabel is true and if label selection is equal to drawSelect
70  * Use TextRenderer : renderer to draw the label
71  */
72  virtual void drawLabel(bool drawSelect,OcclusionTest* test,const GlGraphInputData* data,float lod);
73 
74  /**
75  * Draw the label of the node if drawEdgesLabel is true
76  * Use TextRenderer : renderer to draw the label
77  */
78  virtual void drawLabel(OcclusionTest* test,const GlGraphInputData* data);
79 
80  /**
81  * Draw the label of the node if drawEdgesLabel is true
82  * Use TextRenderer : renderer to draw the label
83  */
84  virtual void drawLabel(OcclusionTest* test,const GlGraphInputData* data,float lod,Camera *camera=NULL);
85 
86  unsigned int id;
87 
88  /**
89  * This function is used by the engine to get point coordinate and color of the node
90  */
91  void getPointAndColor(GlGraphInputData *inputData,std::vector<Coord> &pointsCoordsArray,std::vector<Color> &pointsColorsArray);
92 
93  /**
94  * This function is used by the engine to get color of the node
95  */
96  void getColor(GlGraphInputData *inputData,std::vector<Color> &pointsColorsArray);
97 
98 protected :
99 
100  static GlLabel *label;
101  static GlBox* selectionBox;
102 
103 };
104 
105 }
106 
107 #endif // DOXYGEN_NOTFOR_DEVEL
108 
109 #endif // Tulip_GLNODE_H
110 ///@endcond