qwt_data.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 // vim: expandtab
00011 
00012 #ifndef QWT_DATA_H
00013 #define QWT_DATA_H 1
00014 
00015 #include "qwt_global.h"
00016 #include "qwt_array.h"
00017 #include "qwt_double_rect.h"
00018 #if QT_VERSION >= 0x040000
00019 #include <QPolygonF>
00020 #endif
00021 
00022 // MOC_SKIP_BEGIN
00023 
00024 #if defined(QWT_TEMPLATEDLL)
00025 
00026 template class QWT_EXPORT QwtArray<double>;
00027 
00028 #if QT_VERSION < 0x040000
00029 #ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
00030 #define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
00031 template class QWT_EXPORT QwtArray<QwtDoublePoint>;
00032 #endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
00033 #endif
00034 
00035 #endif
00036 
00037 // MOC_SKIP_END
00038 
00047 class QWT_EXPORT QwtData
00048 {
00049 public:
00050     QwtData();
00051     virtual ~QwtData(); 
00052 
00054     virtual QwtData *copy() const = 0;
00055 
00057     virtual size_t size() const = 0;
00058 
00064     virtual double x(size_t i) const = 0;
00070     virtual double y(size_t i) const = 0;
00071 
00072     virtual QwtDoubleRect boundingRect() const;
00073 
00074 protected:
00078     QwtData &operator=(const QwtData &);
00079 };
00080 
00081 
00085 class QWT_EXPORT QwtPolygonFData: public QwtData
00086 {
00087 public:
00088 #if QT_VERSION < 0x040000
00089     QwtPolygonFData(const QwtArray<QwtDoublePoint> &);
00090 #else
00091     QwtPolygonFData(const QPolygonF &);
00092 #endif
00093 
00094     QwtPolygonFData &operator=(const QwtPolygonFData &);
00095     virtual QwtData *copy() const;
00096 
00097     virtual size_t size() const;
00098     virtual double x(size_t i) const;
00099     virtual double y(size_t i) const;
00100 
00101 #if QT_VERSION < 0x040000
00102     const QwtArray<QwtDoublePoint> &data() const;
00103 #else
00104     const QPolygonF &data() const;
00105 #endif
00106 
00107 private:
00108 #if QT_VERSION < 0x040000
00109     QwtArray<QwtDoublePoint> d_data;
00110 #else
00111     QPolygonF d_data;
00112 #endif
00113 };
00114 
00119 class QWT_EXPORT QwtArrayData: public QwtData
00120 {
00121 public:
00122     QwtArrayData(const QwtArray<double> &x, const QwtArray<double> &y);
00123     QwtArrayData(const double *x, const double *y, size_t size);
00124     QwtArrayData &operator=(const QwtArrayData &);
00125     virtual QwtData *copy() const;
00126 
00127     virtual size_t size() const;
00128     virtual double x(size_t i) const;
00129     virtual double y(size_t i) const;
00130 
00131     const QwtArray<double> &xData() const;
00132     const QwtArray<double> &yData() const;
00133 
00134     virtual QwtDoubleRect boundingRect() const;
00135 
00136 private:
00137     QwtArray<double> d_x;
00138     QwtArray<double> d_y;
00139 };
00140 
00144 class QWT_EXPORT QwtCPointerData: public QwtData
00145 {
00146 public:
00147     QwtCPointerData(const double *x, const double *y, size_t size);
00148     QwtCPointerData &operator=(const QwtCPointerData &);
00149     virtual QwtData *copy() const;
00150 
00151     virtual size_t size() const;
00152     virtual double x(size_t i) const;
00153     virtual double y(size_t i) const;
00154 
00155     const double *xData() const;
00156     const double *yData() const;
00157 
00158     virtual QwtDoubleRect boundingRect() const;
00159 
00160 private:
00161     const double *d_x;
00162     const double *d_y;
00163     size_t d_size;
00164 };
00165 
00166 #endif // !QWT_DATA

Generated on Mon Feb 26 21:22:36 2007 for Qwt User's Guide by  doxygen 1.4.6