Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members Related Pages Search
mathfunction.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MATHFUNCTION_H
00019 #define MATHFUNCTION_H
00020
00021 #include <qpoint.h>
00022 #include <qstring.h>
00023
00024 class QPointArray;
00025 class QPainter;
00026 class QMouseEvent;
00027
00028 class FungParser;
00029 class ExpressionGraph;
00030 class BasicGraph;
00031
00042 class MathFunction
00043 {
00044 public:
00045 MathFunction(BasicGraph * = 0,int expressions = 0);
00046 virtual ~MathFunction();
00047
00053 virtual void calculate_and_draw(QPainter*){}
00054
00059 virtual void draw_stored(QPainter *p){calculate_and_draw(p);}
00060
00068 int expressionsRequired(){ return expression_count;}
00069
00070 void exec(FungParser *fp = 0, FungParser *fp2 = 0);
00071
00072 void drawFunction(QPainter *);
00073 bool active(){return _active;}
00074 void sendClick(QMouseEvent *e, double arg = 0, double arg2 = 0);
00075 void cancel();
00076
00077 protected:
00079 QPoint lowerBounds,upperBounds;
00080 double arg1, arg2, beta, arg1x, arg2x, arg1y, arg2y, beta2;
00081
00083 void setResult(QString &s);
00084
00085 int expression_count;
00086
00090 FungParser *expression;
00091 FungParser *expression2;
00092
00098 int toPixelXCoord(double x_coordinate);
00099
00105 int toPixelYCoord(double y_coordinate);
00106
00112 double toGraphXCoord(double x_coordinate);
00113
00119 double toGraphYCoord(double y_coordinate);
00120
00121 double animatorValue();
00122
00124 void drawSelectedPoint(double x, double y, QPainter *painter);
00125
00127 BasicGraph *basicgraph;
00128 private:
00129 void getTwoPoints();
00130 void drawLeftArrow(QPainter *);
00131 void drawRightArrow(QPainter *);
00132
00133 QString resultString;
00134 bool _active;
00135 int mouseClicks;
00136 QPoint lastClick;
00137
00138 static const int LEFTOFFSET = 30;
00139
00140 static const int CANCEL = -1;
00141 static const int GETLOWERBOUND = 0;
00142 static const int GOTLOWERBOUND = 1;
00143 static const int GETUPPERBOUND = 2;
00144 static const int GOTUPPERBOUND = 3;
00145 static const int CALCULATE = 4;
00146 static const int CLICKTOCONTINUE = 5;
00147
00148 static const int BOUNDS_TRIANGLE = 4;
00149 };
00150
00151 #endif //MATHFUNCTION_H
|