GL2DPlot.h

00001 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
00002 /* 
00003  * Copyright (C) 2008 Micha Hersch, EPFL
00004  * RobotCub Consortium, European Commission FP6 Project IST-004370
00005  * email:   micha.hersch@robotcub.org
00006  * website: www.robotcub.org
00007  * Permission is granted to copy, distribute, and/or modify this program
00008  * under the terms of the GNU General Public License, version 2 or any
00009  * later version published by the Free Software Foundation.
00010  *
00011  * A copy of the license can be found at
00012  * http://www.robotcub.org/icub/license/gpl.txt
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00017  * Public License for more details
00018  */
00019 #ifndef __GL2DPLOT_H__
00020 #define __GL2DPLOT_H__
00021 
00022 
00023 #include <GL/glut.h>
00024 #include <vector>
00025 using namespace std;
00026 
00027 #include "GLSubWindow.h"
00028 
00029 typedef struct{
00030   float r;
00031   float g;
00032   float b;  
00033 } RGBColor, *pRGBColor;
00034 
00035 
00036 class GL2DPlot : public GLSubWindow
00037 {
00038 protected:
00039   int               m_NbPlots;
00040   vector<int>       m_PlotSize;
00041   vector<float*>    m_XValues;
00042   vector<float*>    m_YValues;
00043   vector<RGBColor>  m_Color;
00044   vector<int>       m_LineStyle;
00045 
00046   float             m_MinX, m_MaxX;
00047   float             m_MinY, m_MaxY;
00048 
00049   bool              m_AxesAuto;
00050 
00051   int               m_Offset;
00052 public:
00053   GL2DPlot(pGLSubWindow parentWindow = NULL);
00054   ~GL2DPlot();
00055 
00056           void  Clear();
00057           void  AddPlot(float* YVal, int size);
00058           void  AddPlot(float* XVal, float* YVal, int size);
00059           void  SetColor(float r, float g, float b);
00060           void  SetColor(int no, float r, float g, float b);
00061 
00062           void  SetAxes(float minX, float minY, float maxX, float maxY);
00063           void  ClearAxes();
00064   virtual void  Render();
00065 
00066   virtual void  Resize(int w, int h);
00067   virtual void  OnNormalKey(char key);
00068   virtual void  OnSpecialKey(int key);
00069 
00070           void  SetOffset(int off);
00071 };
00072 typedef GL2DPlot *pGL2DPlot;
00073 
00074 #endif
 All Data Structures Functions Variables

Generated on Wed Sep 22 16:51:25 2010 for Body_Schema_Learning by  doxygen 1.6.1