00001 /***************************************************************** 00002 * 00003 * This file is part of the GMAPPING project 00004 * 00005 * GMAPPING Copyright (c) 2004 Giorgio Grisetti, 00006 * Cyrill Stachniss, and Wolfram Burgard 00007 * 00008 * This software is licensed under the "Creative Commons 00009 * License (Attribution-NonCommercial-ShareAlike 2.0)" 00010 * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss, 00011 * and Wolfram Burgard. 00012 * 00013 * Further information on this license can be found at: 00014 * http://creativecommons.org/licenses/by-nc-sa/2.0/ 00015 * 00016 * GMAPPING is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied 00018 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00019 * PURPOSE. 00020 * 00021 *****************************************************************/ 00022 00023 00024 #ifndef QGRAPHPAINTER_H 00025 #define QGRAPHPAINTER_H 00026 00027 #include <qpainter.h> 00028 #include <qpixmap.h> 00029 #include <qstring.h> 00030 #include <qwidget.h> 00031 #include <qmatrix.h> 00032 #include <deque> 00033 #include <utils/gvalues.h> 00034 00035 typedef std::deque<double> DoubleDeque; 00036 00037 class QGraphPainter : public QWidget{ 00038 Q_OBJECT 00039 public: 00040 QGraphPainter( QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0); 00041 virtual ~QGraphPainter(); 00042 public slots: 00043 void clear(); 00044 void valueAdded(double); 00045 void valueAdded(double, double, double); 00046 void setYReference(double y); 00047 void disableYReference(); 00048 void setRange(double min, double max); 00049 void start(int period); 00050 void setTitle(const char* title); 00051 void setAutoscale(bool a); 00052 bool getAutoscale() const; 00053 protected: 00054 virtual void timerEvent(QTimerEvent * te); 00055 virtual void resizeEvent(QResizeEvent *); 00056 double min, max, reference; 00057 DoubleDeque values; 00058 bool autoscale; 00059 bool m_useYReference; 00060 int timer; 00061 virtual void paintEvent ( QPaintEvent *paintevent ); 00062 QPixmap * m_pixmap; 00063 QString title; 00064 }; 00065 00066 #endif 00067