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_GL2DRECT_H 00021 #define Tulip_GL2DRECT_H 00022 00023 #include <string> 00024 00025 #include <tulip/GlRect.h> 00026 00027 namespace tlp { 00028 /** 00029 * @ingroup OpenGL 00030 * 00031 * @brief Create a 2D rectangle 00032 * 00033 * This rect add screen percentage system (for example you can create a rectangle that start on (10%,10%) and finish on (90%90%) 00034 * If you whan a simple 2D rectangle with normal coordinates use GlRect class 00035 * @see GlRect 00036 */ 00037 class TLP_GL_SCOPE Gl2DRect : public GlRect { 00038 00039 public: 00040 /** 00041 * @brief Don't use this constructor 00042 */ 00043 Gl2DRect(); 00044 00045 /** 00046 * @brief Constructor 00047 * 00048 * @param top coordinate 00049 * @param bottom coordinate 00050 * @param left coordinate 00051 * @param right coordinate 00052 * @param textureName path to a texture 00053 * @param inPercent if true : top/bottom/left/right is used as in percent parameters 00054 */ 00055 Gl2DRect(float top,float bottom,float left, float right, 00056 const std::string& textureName, 00057 bool inPercent=false); 00058 00059 /** 00060 * @brief Constructor 00061 * 00062 * @param top coordinate 00063 * @param bottom coordinate 00064 * @param left coordinate 00065 * @param right coordinate 00066 * @param textureName path to a texture 00067 * @param xInv if true : use viewportX - left and viewportX - right 00068 * @param yInv if true : use viewportY - top and viewportY - bottom 00069 */ 00070 Gl2DRect(float bottom,float left,float height, float width, 00071 const std::string& textureName, 00072 bool xInv, bool yInv); 00073 00074 /** 00075 * @brief Destructor 00076 */ 00077 virtual ~Gl2DRect() {} 00078 00079 virtual BoundingBox getBoundingBox(); 00080 00081 virtual void draw(float lod,Camera *camera); 00082 00083 virtual void translate(const Coord& mouvement); 00084 00085 /** 00086 * @brief Set texture 00087 */ 00088 virtual void setTexture(const std::string &name); 00089 00090 /** 00091 * @brief Get texture 00092 */ 00093 virtual std::string getTexture(); 00094 00095 /** 00096 * @brief Set coordinates of rectangle 00097 */ 00098 virtual void setCoordinates(float bottom, float left, float width, float height); 00099 00100 virtual void getXML(std::string &outString); 00101 00102 virtual void setWithXML(const std::string &inString, unsigned int ¤tPosition); 00103 00104 protected: 00105 00106 float top; 00107 float bottom; 00108 float left; 00109 float right; 00110 bool inPercent; 00111 bool xInv; 00112 bool yInv; 00113 00114 }; 00115 00116 } 00117 #endif