Tulip
4.6.0
Better Visualization Through Research
|
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 00020 #ifndef Tulip_GLGRAPHRENDERER_H 00021 #define Tulip_GLGRAPHRENDERER_H 00022 00023 #include <tulip/GlScene.h> 00024 #include <tulip/tulipconf.h> 00025 00026 namespace tlp { 00027 00028 class Graph; 00029 class GlGraphInputData; 00030 class Camera; 00031 00032 /** 00033 * @ingroup OpenGL 00034 * @brief Class used by GlGraphComposite to render the graph in OpenGL 00035 * 00036 * To create a graph renderer, you have to implement two functions : draw() and selectEntities() 00037 * @see GlGraphComposite 00038 */ 00039 class TLP_GL_SCOPE GlGraphRenderer { 00040 00041 public: 00042 00043 /** 00044 * @brief Constructor 00045 * \param inputData : GlGraphInputData used by renderer to display the graph (in input data you have pointers on properties used to render nodes/edges 00046 * \param parameters : GlGraphRenderingParameters used by renderer to display the graph 00047 */ 00048 GlGraphRenderer(const GlGraphInputData *inputData); 00049 00050 /** 00051 * @brief Destructor 00052 */ 00053 virtual ~GlGraphRenderer() {} 00054 00055 /** 00056 * @brief This function is call by GlGraphComposite to draw the graph 00057 * 00058 * If you reimplement this function you have to render nodes/edges. It's the most important function of GlGraphRenderer 00059 * 00060 * \param lod : lod used to this Rendering 00061 * \param camera : camera used to this rendering 00062 */ 00063 virtual void draw(float lod,Camera* camera) = 0; 00064 00065 /** 00066 * @brief This function is call by GlGraphComposite to selected entities into the graph 00067 * \param type : type of selected entities 00068 * \param x : x of the selected zone 00069 * \param y : y of the selected zone 00070 * \param w : width of the selected zone 00071 * \param h : height of the selected zone 00072 * \param selectedEntities : you have to put selected entities into this vector 00073 */ 00074 virtual void selectEntities(Camera *camera,RenderingEntitiesFlag type,int x, int y, int w, int h, std::vector<SelectedEntity>& selectedEntities) = 0; 00075 00076 /** 00077 * @brief You can use this funtion if you want to inject a visitor on the graph 00078 */ 00079 virtual void visitGraph(GlSceneVisitor *visitor,bool visitHiddenEntities=false); 00080 00081 /** 00082 * @brief This function set if the content of the graph is modified 00083 */ 00084 void setGraphModified(bool graphModified) { 00085 this->graphModified=graphModified; 00086 } 00087 00088 protected: 00089 00090 void visitNodes(Graph *graph,GlSceneVisitor *visitor,bool visitHiddenEntities=false); 00091 void visitEdges(Graph *graph,GlSceneVisitor *visitor,bool visitHiddenEntities=false); 00092 00093 const GlGraphInputData* inputData; 00094 00095 bool graphModified; 00096 00097 bool selectionDrawActivate; 00098 RenderingEntitiesFlag selectionType; 00099 std::map<unsigned int, SelectedEntity> *selectionIdMap; 00100 unsigned int *selectionCurrentId; 00101 }; 00102 } 00103 00104 #endif