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