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 #ifndef PLOT2D_OBJECT_H
00027 #define PLOT2D_OBJECT_H
00028
00029 #include "Plot2d.h"
00030
00031 #include <QList>
00032 #include <qwt_plot.h>
00033
00034 struct PLOT2D_EXPORT Plot2d_Point
00035 {
00036 double x;
00037 double y;
00038 QString text;
00039 Plot2d_Point();
00040 Plot2d_Point( double theX, double theY, const QString& theText = QString() );
00041 };
00042
00043 typedef QList<Plot2d_Point> pointList;
00044
00045 class PLOT2D_EXPORT Plot2d_Object
00046 {
00047 public:
00048 Plot2d_Object();
00049 Plot2d_Object( const Plot2d_Object& );
00050
00051 virtual ~Plot2d_Object();
00052 Plot2d_Object& operator= ( const Plot2d_Object& );
00053
00054 virtual int rtti() = 0;
00055 virtual QwtPlotItem* createPlotItem() = 0;
00056 virtual void autoFill( const QwtPlot* );
00057 virtual void updatePlotItem( QwtPlotItem* );
00058
00059 virtual QString getTableTitle() const;
00060
00061 void setHorTitle( const QString& );
00062 QString getHorTitle() const;
00063 void setVerTitle( const QString& );
00064 QString getVerTitle() const;
00065
00066 void setHorUnits( const QString& );
00067 QString getHorUnits() const;
00068 void setVerUnits( const QString& );
00069 QString getVerUnits() const;
00070
00071 void setName( const QString& );
00072 QString getName() const;
00073
00074 void addPoint( double, double, const QString& = QString() );
00075 void addPoint( const Plot2d_Point& );
00076 void insertPoint( int, double, double, const QString& = QString() );
00077 void insertPoint( int, const Plot2d_Point& );
00078 void deletePoint( int );
00079 void clearAllPoints();
00080 pointList getPointList() const;
00081 void setPointList( const pointList& points );
00082
00083 void setData( const double*, const double*,
00084 long, const QStringList& = QStringList() );
00085 double* horData() const;
00086 double* verData() const;
00087 long getData( double**, double** ) const;
00088
00089 void setText( const int, const QString& );
00090 QString text( const int ) const;
00091
00092 int nbPoints() const;
00093 bool isEmpty() const;
00094
00095 void setAutoAssign( bool );
00096 bool isAutoAssign() const;
00097
00098 void setXAxis( QwtPlot::Axis );
00099 QwtPlot::Axis getXAxis() const;
00100 void setYAxis( QwtPlot::Axis );
00101 QwtPlot::Axis getYAxis() const;
00102
00103
00104
00105
00106 double getMinX() const;
00107 double getMaxX() const;
00108 double getMinY() const;
00109 double getMaxY() const;
00110
00111 static bool closeColors( const QColor&, const QColor&, int distance = -1 );
00112
00113 protected:
00114 bool myAutoAssign;
00115 QString myHorTitle;
00116 QString myVerTitle;
00117 QString myHorUnits;
00118 QString myVerUnits;
00119 QString myName;
00120 QwtPlot::Axis myXAxis;
00121 QwtPlot::Axis myYAxis;
00122
00123 pointList myPoints;
00124 };
00125
00126 typedef QList<Plot2d_Object*> objectList;
00127
00128 #endif