Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlNode.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef Tulip_GLNODE_H
00022 #define Tulip_GLNODE_H
00023 
00024 #ifndef DOXYGEN_NOTFOR_DEVEL
00025 
00026 #include <tulip/Color.h>
00027 #include <tulip/Coord.h>
00028 #include <tulip/GlComplexeEntity.h>
00029 
00030 #include <vector>
00031 
00032 namespace tlp {
00033 
00034 struct OcclusionTest;
00035 class TextRenderer;
00036 class GlSceneVisitor;
00037 class GlLabel;
00038 class GlBox;
00039 
00040 /**
00041  * Class to represent a node of a graph
00042  */
00043 class TLP_GL_SCOPE GlNode : public GlComplexeEntity {
00044 
00045 public:
00046 
00047   /**
00048    * Default constructor with id
00049    * id must be the id of the node in graph
00050    */
00051   GlNode(unsigned int id);
00052 
00053   /**
00054    * Virtual function to accept GlSceneVisitor on this class
00055    */
00056   virtual void acceptVisitor(GlSceneVisitor *visitor);
00057 
00058   /**
00059    * Return the node bounding box
00060    */
00061   virtual BoundingBox getBoundingBox(const GlGraphInputData* data);
00062 
00063   /**
00064    * Draw the node with level of detail : lod and Camera : camera
00065    */
00066   virtual void draw(float lod,const GlGraphInputData *data,Camera* camera);
00067 
00068   /**
00069    * Draw the label of the node if drawNodesLabel is true and if label selection is equal to drawSelect
00070    * Use TextRenderer : renderer to draw the label
00071    */
00072   virtual void drawLabel(bool drawSelect,OcclusionTest* test,const GlGraphInputData* data,float lod);
00073 
00074   /**
00075    * Draw the label of the node if drawEdgesLabel is true
00076    * Use TextRenderer : renderer to draw the label
00077    */
00078   virtual void drawLabel(OcclusionTest* test,const GlGraphInputData* data);
00079 
00080   /**
00081    * Draw the label of the node if drawEdgesLabel is true
00082    * Use TextRenderer : renderer to draw the label
00083    */
00084   virtual void drawLabel(OcclusionTest* test,const GlGraphInputData* data,float lod,Camera *camera=NULL);
00085 
00086   unsigned int id;
00087 
00088   /**
00089    * This function is used by the engine to get point coordinate and color of the node
00090    */
00091   void getPointAndColor(GlGraphInputData *inputData,std::vector<Coord> &pointsCoordsArray,std::vector<Color> &pointsColorsArray);
00092 
00093   /**
00094    * This function is used by the engine to get color of the node
00095    */
00096   void getColor(GlGraphInputData *inputData,std::vector<Color> &pointsColorsArray);
00097 
00098 protected :
00099 
00100   static GlLabel *label;
00101   static GlBox* selectionBox;
00102 
00103 };
00104 
00105 }
00106 
00107 #endif // DOXYGEN_NOTFOR_DEVEL
00108 
00109 #endif // Tulip_GLNODE_H
00110 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties