VectorCurve.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef VECTORCURVE_H
00030 #define VECTORCURVE_H
00031
00032 #include "PlotCurve.h"
00033 #include <qwt_plot.h>
00034
00035 class QwtPlot;
00036
00038 class VectorCurve: public DataCurve
00039 {
00040 public:
00041 enum VectorStyle{XYXY, XYAM};
00042
00043 VectorCurve(VectorStyle style, Table *t, const QString& xColName, const char *name,
00044 const QString& endCol1, const QString& endCol2, int startRow, int endRow);
00045 ~VectorCurve();
00046
00047 enum Position{Tail, Middle, Head};
00048
00049 void copy(const VectorCurve *vc);
00050
00051 QwtDoubleRect boundingRect() const;
00052
00053 void draw(QPainter *painter,const QwtScaleMap &xMap,
00054 const QwtScaleMap &yMap, int from, int to) const;
00055
00056 void drawVector(QPainter *painter, const QwtScaleMap &xMap,
00057 const QwtScaleMap &yMap, int from, int to) const;
00058
00059 void drawArrowHead(QPainter *p, int xs, int ys, int xe, int ye) const;
00060 double theta(int x0, int y0, int x1, int y1) const;
00061
00062 QString vectorEndXAColName(){return d_end_x_a;};
00063 QString vectorEndYMColName(){return d_end_y_m;};
00064 void setVectorEnd(const QString& xColName, const QString& yColName);
00065 void setVectorEnd(const QwtArray<double>&x, const QwtArray<double>&y);
00066
00067 double width();
00068 void setWidth(double w);
00069
00070 QColor color();
00071 void setColor(const QColor& c);
00072
00073 int headLength(){return d_headLength;};
00074 void setHeadLength(int l);
00075
00076 int headAngle(){return d_headAngle;};
00077 void setHeadAngle(int a);
00078
00079 bool filledArrowHead(){return filledArrow;};
00080 void fillArrowHead(bool fill);
00081
00082 int position(){return d_position;};
00083 void setPosition(int pos){d_position = pos;};
00084
00085 int vectorStyle(){return d_style;};
00086 void setVectorStyle(int style){d_style = style;};
00087
00088 bool updateData(Table *t, const QString& colName);
00089 void loadData();
00090
00091 QString plotAssociation();
00092 void updateColumnNames(const QString& oldName, const QString& newName, bool updateTableName);
00093
00094 QPen vectorPen(){return d_pen;};
00095 void setVectorPen(const QPen& pen){d_pen = pen;};
00096
00097 protected:
00098 QwtArrayData *vectorEnd;
00099 QPen d_pen;
00100 bool filledArrow;
00101 int d_style, d_headLength, d_headAngle, d_position;
00102
00103 QString d_end_x_a;
00104 QString d_end_y_m;
00105 };
00106
00107 #endif