SciDAVis  1.D4
VectorCurve.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : VectorCurve.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7  Description : Vector curve class
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef VECTORCURVE_H
30 #define VECTORCURVE_H
31 
32 #include "PlotCurve.h"
33 #include <qwt_plot.h>
34 
35 class QwtPlot;
36 
38 class VectorCurve: public DataCurve
39 {
40 public:
42 
43  VectorCurve(VectorStyle style, Table *t, const QString& xColName, const char *name,
44  const QString& endCol1, const QString& endCol2, int startRow, int endRow);
45  ~VectorCurve();
46 
48 
49  void copy(const VectorCurve *vc);
50 
51  QwtDoubleRect boundingRect() const;
52 
53  void draw(QPainter *painter,const QwtScaleMap &xMap,
54  const QwtScaleMap &yMap, int from, int to) const;
55 
56  void drawVector(QPainter *painter, const QwtScaleMap &xMap,
57  const QwtScaleMap &yMap, int from, int to) const;
58 
59  void drawArrowHead(QPainter *p, int xs, int ys, int xe, int ye) const;
60  double theta(int x0, int y0, int x1, int y1) const;
61 
62  QString vectorEndXAColName(){return d_end_x_a;};
63  QString vectorEndYMColName(){return d_end_y_m;};
64  void setVectorEnd(const QString& xColName, const QString& yColName);
65  void setVectorEnd(const QwtArray<double>&x, const QwtArray<double>&y);
66 
67  int width();
68  void setWidth(int w);
69 
70  QColor color();
71  void setColor(const QColor& c);
72 
73  int headLength(){return d_headLength;};
74  void setHeadLength(int l);
75 
76  int headAngle(){return d_headAngle;};
77  void setHeadAngle(int a);
78 
79  bool filledArrowHead(){return filledArrow;};
80  void fillArrowHead(bool fill);
81 
82  int position(){return d_position;};
83  void setPosition(int pos){d_position = pos;};
84 
85  bool updateData(Table *t, const QString& colName);
86  virtual bool loadData();
87 
88  QString plotAssociation();
89  void updateColumnNames(const QString& oldName, const QString& newName, bool updateTableName);
90 
91 protected:
92  QwtArrayData *vectorEnd;
93  QPen pen;
96 
97  QString d_end_x_a;
98  QString d_end_y_m;
99 };
100 
101 #endif