Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlGrid.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 
00020 
00021 #ifndef _Tulip_GLGRID_H_
00022 #define _Tulip_GLGRID_H_
00023 
00024 #include <tulip/Coord.h>
00025 #include <tulip/Color.h>
00026 #include <tulip/Size.h>
00027 
00028 #include <tulip/GlSimpleEntity.h>
00029 
00030 namespace tlp {
00031 /**
00032  * @ingroup OpenGL
00033  * @brief General class used to render grids as GlSimpleEntity.
00034  *
00035  */
00036 class TLP_GL_SCOPE GlGrid : public GlSimpleEntity {
00037 
00038 public:
00039 
00040   /**
00041    * @brief Constructor
00042    * @warning Don't use this constructor : see other constructor
00043    */
00044   GlGrid() {}
00045 
00046   /**
00047    * @brief Constructor
00048    *
00049    * @param frontTopLeft The minimum of the bounding box of the grid.
00050    * @param backBottomRight The maximum of the bounding box of the grid.
00051    * @param cell The size of a single cell of the grid.
00052    * @param color The color of the lines of the grid.
00053    * @param displays The dimensions of the grid to display.
00054    * @param hollowGrid Indicates if the grid chould be hollowed.
00055    */
00056   GlGrid(const Coord& frontTopLeft, const Coord& backBottomRight,
00057          const Size& cell, const Color& color, bool displays[3]);
00058   /**
00059    * @brief Virtual function used to draw the grid.
00060    */
00061   virtual void draw(float lod,Camera *camera);
00062   /**
00063    * @brief Accessor in reading to the dimensions to display.
00064    */
00065   void getDisplayDim(bool displayDim[3]) const;
00066   /**
00067    * @brief Accessor in writing to the dimensions to display.
00068    */
00069   void setDisplayDim(bool displayDim[3]);
00070 
00071   /**
00072    * @brief Translate entity
00073    */
00074   virtual void translate(const Coord& mouvement);
00075 
00076   /**
00077    * @brief Function to export data in outString (in XML format)
00078    */
00079   virtual void getXML(std::string &outString);
00080 
00081   /**
00082    * @brief Function to set data with inString (in XML format)
00083    */
00084   virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
00085 
00086 
00087 protected:
00088   bool displayDim[3]; /**< Which dimensions should be displayed ? Note that only one dimension at most should be disabled*/
00089   bool hollowGrid; /**< Should the grid be hollowed ?*/
00090   Coord frontTopLeft; /**< Front top left point of the grid, the "minimum" */
00091   Coord backBottomRight; /**< Back bottom right point of the grid, the "maximum" */
00092   Color color; /**< The color of the grid */
00093   Size cell; /**< The size of a cell of the grid */
00094 };
00095 
00096 }
00097 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties