00001 /*************************************************************************** 00002 File : PlotCurve.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2007 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : AbstractPlotCurve and DataCurve classes 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 PLOTCURVE_H 00030 #define PLOTCURVE_H 00031 00032 #include <qwt_plot_curve.h> 00033 #include "Table.h" 00034 00036 class PlotCurve: public QwtPlotCurve 00037 { 00038 00039 public: 00040 PlotCurve(const char *name = 0): QwtPlotCurve(name), d_type(0){}; 00041 00042 int type(){return d_type;}; 00043 void setType(int t){d_type = t;}; 00044 00045 QwtDoubleRect boundingRect() const; 00046 00047 protected: 00048 int d_type; 00049 }; 00050 00051 class DataCurve: public PlotCurve 00052 { 00053 00054 public: 00055 DataCurve(Table *t, const QString& xColName, const char *name, int startRow = 0, int endRow = -1); 00056 00057 QString xColumnName(){return d_x_column;}; 00058 void setXColumnName(const QString& name){d_x_column = name;}; 00059 00060 Table* table(){return d_table;}; 00061 00062 int startRow(){return d_start_row;}; 00063 int endRow(){return d_end_row;}; 00064 void setRowRange(int startRow, int endRow); 00065 00066 bool isFullRange(); 00067 void setFullRange(); 00068 00069 virtual bool updateData(Table *t, const QString& colName); 00070 virtual void loadData(); 00071 00073 int tableRow(int point); 00074 00075 void remove(); 00076 00089 virtual QString plotAssociation(); 00090 virtual void updateColumnNames(const QString& oldName, const QString& newName, bool updateTableName); 00091 00093 QList<DataCurve *> errorBarsList(){return d_error_bars;}; 00095 void addErrorBars(DataCurve *c){if (c) d_error_bars << c;}; 00097 void removeErrorBars(DataCurve *c); 00099 void clearErrorBars(); 00100 00101 void setVisible(bool on); 00102 00103 protected: 00105 QList <DataCurve *> d_error_bars; 00107 Table *d_table; 00109 /* 00110 *The column name used for Y values is stored in title().text(). 00111 */ 00112 QString d_x_column; 00113 00114 int d_start_row; 00115 int d_end_row; 00116 }; 00117 #endif