Tulip  4.6.0
Better Visualization Through Research
library/tulip-ogl/include/tulip/GlRect.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 GL_RECT_H
00022 #define GL_RECT_H
00023 
00024 #include <tulip/GlPolygon.h>
00025 #include <tulip/Size.h>
00026 
00027 namespace tlp {
00028 
00029 /**
00030  * @ingroup OpenGL
00031  * \brief This is a general class for the rendering of 2D rectangles.
00032  *
00033  * This class is used as a 2D HUD for the rendering of 2D rectangles.
00034  */
00035 
00036 class TLP_GL_SCOPE GlRect : public GlPolygon {
00037 protected:
00038 
00039 public:
00040   /**
00041    * Constructor : with topLeft/bottomRight coords, topLeft/bottomRight colors and if GlRect is filled/outlined
00042    */
00043   GlRect(const Coord &topLeftPos, const Coord &bottomRightPos, const Color &topLeftCol, const Color &bottomRightCol, bool filled=true, bool outlined=false);
00044 
00045   /**
00046    * Constructor : with center coords and size, fill color and outline color
00047    */
00048   GlRect(const Coord &center, const float width, const float height, const Color &fillColor, const Color &outlineColor);
00049 
00050 
00051   /**
00052    * Constructor : with GlRect is filled/outlined
00053    */
00054   GlRect(bool filled=true, bool outlined=false);
00055 
00056   /**
00057    * Destructor
00058    */
00059   virtual ~GlRect();
00060 
00061   /**
00062    * Accessor in reading to the Top Left Corner of the rectangle
00063    */
00064   virtual Coord getCenter();
00065 
00066   /**
00067    * Set the center and the size of the GlRect
00068    */
00069   void setCenterAndSize(const Coord &center, const Size &size);
00070 
00071   /**
00072    * Accessor in reading to the Top Left Corner of the rectangle
00073    */
00074   virtual Coord getTopLeftPos();
00075 
00076   /**
00077    * Accessor in reading to the Bottom Right Corner of the rectangle
00078    */
00079   virtual Coord getBottomRightPos();
00080 
00081   /**
00082    * Accessor in reading to the Top Left Corner Color of the rectangle
00083    */
00084   virtual Color getTopLeftColor();
00085 
00086   /**
00087    * Accessor in reading to the Bottom Right Corner Color of the Rectangle
00088    */
00089   virtual Color getBottomRightColor();
00090 
00091   /**
00092    * Accessor in writing to the Top Left Corner of the rectangle
00093    */
00094   virtual void setTopLeftPos(const Coord &topLeftPos);
00095 
00096   /**
00097    * Accessor in writing to the Bottom Right Corner Color of the rectangle
00098    */
00099   virtual void setBottomRightPos(const Coord &bottomRightPos);
00100 
00101   /**
00102    * Accessor in writing to the Top Left Corner of the rectangle
00103    */
00104   virtual void setTopLeftColor(const Color &topLeftCol);
00105 
00106   /**
00107    * Accessor in writing to the Bottom Right Corner Color of the rectangle
00108    */
00109   virtual void setBottomRightColor(const Color &bottomRightCol);
00110 
00111   /**
00112    * Is the point in the rectangle ?
00113    */
00114   bool inRect(double x, double y);
00115 
00116   virtual void draw(float lod,Camera *camera);
00117 
00118 };
00119 
00120 }
00121 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties