Qwt User's Guide: qwt_data.h Source File

Qwt User's Guide 5.2.3

- Main Page
- Related Pages
- Classes

qwt_data.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 // vim: expandtab
11
12 #ifndef QWT_DATA_H
13 #define QWT_DATA_H 1
14
15 #include "qwt_global.h"
16 #include "qwt_array.h"
17 #include "qwt_double_rect.h"
18 #if QT_VERSION >= 0x040000
19 #include <QPolygonF>
20 #endif
21
22 // MOC_SKIP_BEGIN
23
24 #if defined(QWT_TEMPLATEDLL)
25
26 template class QWT_EXPORT QwtArray<double>;
27
28 #if QT_VERSION < 0x040000
29 #ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
30 #define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
31 template class QWT_EXPORT QwtArray<QwtDoublePoint>;
32 #endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
33 #endif
34
35 #endif
36
37 // MOC_SKIP_END
38
47 class QWT_EXPORT QwtData
48 {
49 public:
50 QwtData();
51 virtual ~QwtData();
52
54 virtual QwtData *copy() const = 0;
55
57 virtual size_t size() const = 0;
58
64 virtual double x(size_t i) const = 0;
70 virtual double y(size_t i) const = 0;
71
72 virtual QwtDoubleRect boundingRect() const;
73
74 protected:
78 QwtData &operator=(const QwtData &);
79 };
80
81
85 class QWT_EXPORT QwtPolygonFData: public QwtData
86 {
87 public:
88 #if QT_VERSION < 0x040000
89 QwtPolygonFData(const QwtArray<QwtDoublePoint> &);
90 #else
91 QwtPolygonFData(const QPolygonF &);
92 #endif
93
94 QwtPolygonFData &operator=(const QwtPolygonFData &);
95 virtual QwtData *copy() const;
96
97 virtual size_t size() const;
98 virtual double x(size_t i) const;
99 virtual double y(size_t i) const;
100
101 #if QT_VERSION < 0x040000
102 const QwtArray<QwtDoublePoint> &data() const;
103 #else
104 const QPolygonF &data() const;
105 #endif
106
107 private:
108 #if QT_VERSION < 0x040000
109 QwtArray<QwtDoublePoint> d_data;
110 #else
111 QPolygonF d_data;
112 #endif
113 };
114
119 class QWT_EXPORT QwtArrayData: public QwtData
120 {
121 public:
122 QwtArrayData(const QwtArray<double> &x, const QwtArray<double> &y);
123 QwtArrayData(const double *x, const double *y, size_t size);
124 QwtArrayData &operator=(const QwtArrayData &);
125 virtual QwtData *copy() const;
126
127 virtual size_t size() const;
128 virtual double x(size_t i) const;
129 virtual double y(size_t i) const;
130
131 const QwtArray<double> &xData() const;
132 const QwtArray<double> &yData() const;
133
134 virtual QwtDoubleRect boundingRect() const;
135
136 private:
137 QwtArray<double> d_x;
138 QwtArray<double> d_y;
139 };
140
144 class QWT_EXPORT QwtCPointerData: public QwtData
145 {
146 public:
147 QwtCPointerData(const double *x, const double *y, size_t size);
148 QwtCPointerData &operator=(const QwtCPointerData &);
149 virtual QwtData *copy() const;
150
151 virtual size_t size() const;
152 virtual double x(size_t i) const;
153 virtual double y(size_t i) const;
154
155 const double *xData() const;
156 const double *yData() const;
157
158 virtual QwtDoubleRect boundingRect() const;
159
160 private:
161 const double *d_x;
162 const double *d_y;
163 size_t d_size;
164 };
165
166 #endif // !QWT_DATA