VectorCurve.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : VectorCurve.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr, thzs*gmx.net
00007     Description          : Vector curve class
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
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     int width();
00068     void setWidth(int 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 protected:
00095     QwtArrayData *vectorEnd;
00096     QPen pen;
00097     bool filledArrow;
00098     int d_style, d_headLength, d_headAngle, d_position;
00099 
00100     QString d_end_x_a;
00101     QString d_end_y_m;
00102 };
00103 
00104 #endif

Generated on Mon Oct 15 06:11:42 2007 for QtiPlot by  doxygen 1.5.3