Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

jezabelplot.h

00001 /* jezabelplot.h   Qt widget for plotting a function
00002  * 
00003  * Copyright 2001 Ken McMillan
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #include <vector>
00022 #include <qwidget.h>
00023 #include <qpainter.h>
00024 
00025 class JezabelPlotFunction {
00026  public:
00027   virtual float operator()(float) = 0;
00028 };
00029 
00030 class JezabelPlot : public QWidget {
00031   Q_OBJECT
00032 public:
00033   JezabelPlot(JezabelPlotFunction *, float _xmin, float _xmax, float _ymin, float _ymax, bool xlog, bool ylog, int xsize, int ysize,
00034               QWidget *parent = 0);
00035   void setXRange(float,float);
00036   void setYRange(float,float);
00037   void drawGraph();
00038 
00039 protected:
00040   virtual void paintEvent( QPaintEvent*);
00041 
00042 private:
00043   JezabelPlotFunction *fun;
00044   float xmin,xmax,ymin,ymax,xright,xleft; 
00045   QSize graphSize;
00046   int borderwidth;
00047   int gtop,gbottom,gright,gleft;
00048   QPixmap* _buffer;
00049   float XScaleUnit,YScaleUnit;
00050   bool xlog, ylog;
00051 
00052   int xPoint(float x);
00053   int yPoint(float y);
00054   float xPointInv(int x);
00055   float yPointInv(int y);
00056   int point(float x, Orientation dir);
00057   float pointInv(int x, Orientation dir);
00058   void drawScale(QPainter &p, 
00059                  Orientation scaleDir, 
00060                  int pos, int tickDir);
00061   
00062 };
00063 

Generated at Sun Jan 18 20:51:22 2004 for Jezabel by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001