VectorCurve.h
Go to the documentation of this file.
/***************************************************************************
File : VectorCurve.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006 - 2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Vector curve class
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef VECTORCURVE_H
#define VECTORCURVE_H
#include "PlotCurve.h"
#include <qwt_plot.h>
class QwtPlot;
class VectorCurve: public DataCurve
{
public:
enum VectorStyle{XYXY, XYAM};
VectorCurve(VectorStyle style, Table *t, const QString& xColName, const char *name,
const QString& endCol1, const QString& endCol2, int startRow, int endRow);
~VectorCurve();
enum Position{Tail, Middle, Head};
void copy(const VectorCurve *vc);
QwtDoubleRect boundingRect() const;
QString vectorEndXAColName(){return d_end_x_a;};
QString vectorEndYMColName(){return d_end_y_m;};
void setVectorEnd(const QString& xColName, const QString& yColName);
double width();
void setWidth(double w);
QColor color();
void setColor(const QColor& c);
int headLength(){return d_headLength;};
void setHeadLength(int l);
int headAngle(){return d_headAngle;};
void setHeadAngle(int a);
bool filledArrowHead(){return filledArrow;};
void fillArrowHead(bool fill);
int position(){return d_position;};
void setPosition(int pos){d_position = pos;};
int vectorStyle(){return d_style;};
void setVectorStyle(int style){d_style = style;};
bool updateData(Table *t, const QString& colName);
void loadData();
QStringList plotAssociation();
void updateColumnNames(const QString& oldName, const QString& newName, bool updateTableName);
QPen vectorPen(){return d_pen;};
void setVectorPen(const QPen& pen){d_pen = pen;};
private:
void setVectorEnd(const QwtArray<double>&x, const QwtArray<double>&y);
void draw(QPainter *painter,const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const;
void drawVector(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const;
void drawArrowHead(QPainter *p, int xs, int ys, int xe, int ye) const;
double theta(int x0, int y0, int x1, int y1) const;
protected:
QPen d_pen;
bool filledArrow;
int d_style, d_headLength, d_headAngle, d_position;
QString d_end_x_a;
QString d_end_y_m;
QwtArrayData *vectorEnd;
};
#endif
VectorCurve::theta
double theta(int x0, int y0, int x1, int y1) const
Definition: VectorCurve.cpp:165
VectorCurve::vectorEndXAColName
QString vectorEndXAColName()
Definition: VectorCurve.h:53
VectorCurve::loadData
void loadData()
Definition: VectorCurve.cpp:337
VectorCurve
Vector curve class.
Definition: VectorCurve.h:38
VectorCurve::d_headLength
int d_headLength
Definition: VectorCurve.h:102
VectorCurve::Head
Definition: VectorCurve.h:47
VectorCurve::drawArrowHead
void drawArrowHead(QPainter *p, int xs, int ys, int xe, int ye) const
Definition: VectorCurve.cpp:142
VectorCurve::XYAM
Definition: VectorCurve.h:41
VectorCurve::vectorStyle
int vectorStyle()
Definition: VectorCurve.h:75
VectorCurve::d_headAngle
int d_headAngle
Definition: VectorCurve.h:102
VectorCurve::d_style
int d_style
Definition: VectorCurve.h:102
VectorCurve::copy
void copy(const VectorCurve *vc)
Definition: VectorCurve.cpp:62
VectorCurve::width
double width()
Definition: VectorCurve.cpp:197
VectorCurve::setVectorPen
void setVectorPen(const QPen &pen)
Definition: VectorCurve.h:85
VectorCurve::plotAssociation
QStringList plotAssociation()
A list of data sources for this curve.
Definition: VectorCurve.cpp:313
DataCurve::endRow
int endRow()
Definition: PlotCurve.h:145
VectorCurve::fillArrowHead
void fillArrowHead(bool fill)
Definition: VectorCurve.cpp:230
PlotCurve.h
VectorCurve::updateColumnNames
void updateColumnNames(const QString &oldName, const QString &newName, bool updateTableName)
Definition: VectorCurve.cpp:282
VectorCurve::filledArrow
bool filledArrow
Definition: VectorCurve.h:101
VectorCurve::color
QColor color()
Definition: VectorCurve.cpp:207
VectorCurve::drawVector
void drawVector(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: VectorCurve.cpp:90
VectorCurve::setHeadLength
void setHeadLength(int l)
Definition: VectorCurve.cpp:218
VectorCurve::headLength
int headLength()
Definition: VectorCurve.h:63
VectorCurve::headAngle
int headAngle()
Definition: VectorCurve.h:66
VectorCurve::vectorEndYMColName
QString vectorEndYMColName()
Definition: VectorCurve.h:54
VectorCurve::updateData
bool updateData(Table *t, const QString &colName)
Definition: VectorCurve.cpp:327
VectorCurve::VectorCurve
VectorCurve(VectorStyle style, Table *t, const QString &xColName, const char *name, const QString &endCol1, const QString &endCol2, int startRow, int endRow)
Definition: VectorCurve.cpp:39
VectorCurve::d_position
int d_position
Definition: VectorCurve.h:102
VectorCurve::XYXY
Definition: VectorCurve.h:41
VectorCurve::Tail
Definition: VectorCurve.h:47
VectorCurve::setColor
void setColor(const QColor &c)
Definition: VectorCurve.cpp:212
DataCurve
Definition: PlotCurve.h:96
VectorCurve::filledArrowHead
bool filledArrowHead()
Definition: VectorCurve.h:69
VectorCurve::d_pen
QPen d_pen
Definition: VectorCurve.h:100
VectorCurve::VectorStyle
VectorStyle
Definition: VectorCurve.h:41
VectorCurve::boundingRect
QwtDoubleRect boundingRect() const
Definition: VectorCurve.cpp:236
VectorCurve::position
int position()
Definition: VectorCurve.h:72
VectorCurve::setWidth
void setWidth(double w)
Definition: VectorCurve.cpp:202
VectorCurve::setVectorStyle
void setVectorStyle(int style)
Definition: VectorCurve.h:76
DataCurve::startRow
int startRow()
Definition: PlotCurve.h:144
VectorCurve::setPosition
void setPosition(int pos)
Definition: VectorCurve.h:73
VectorCurve::setHeadAngle
void setHeadAngle(int a)
Definition: VectorCurve.cpp:224
VectorCurve::draw
void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: VectorCurve.cpp:73
VectorCurve::vectorPen
QPen vectorPen()
Definition: VectorCurve.h:84
VectorCurve::~VectorCurve
~VectorCurve()
Definition: VectorCurve.cpp:383
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
VectorCurve::Position
Position
Definition: VectorCurve.h:47
VectorCurve::setVectorEnd
void setVectorEnd(const QString &xColName, const QString &yColName)
Definition: VectorCurve.cpp:181
VectorCurve::d_end_x_a
QString d_end_x_a
Definition: VectorCurve.h:103
VectorCurve::d_end_y_m
QString d_end_y_m
Definition: VectorCurve.h:104
VectorCurve::Middle
Definition: VectorCurve.h:47
VectorCurve::vectorEnd
QwtArrayData * vectorEnd
Definition: VectorCurve.h:105