QPScatterPlot.h
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
00027 #ifndef QPSCATTERPLOT_H_
00028 #define QPSCATTERPLOT_H_
00029
00030 #ifdef AIPS_HAS_QWT
00031
00032 #include <graphics/GenericPlotter/Plot.h>
00033 #include <casaqt/QwtPlotter/QPOptions.h>
00034 #include <casaqt/QwtPlotter/QPPlotItem.qo.h>
00035
00036 #include <QObject>
00037
00038 namespace casa {
00039
00040
00041 class QPScatterPlot : public QPPlotItem, public MaskedScatterPlot,
00042 public ErrorPlot, public ColoredPlot {
00043 public:
00044
00045
00046
00047 const static String CLASS_NAME;
00048
00049
00050
00051
00052
00053 QPScatterPlot(PlotPointDataPtr data, const String& title = "Scatter Plot");
00054
00055
00056 QPScatterPlot(const ScatterPlot& copy);
00057
00058
00059 ~QPScatterPlot();
00060
00061
00062
00063 using Plot::setLine;
00064 using ScatterPlot::setSymbol;
00065 using MaskedScatterPlot::setMaskedLine;
00066 using MaskedScatterPlot::setMaskedSymbol;
00067 using ErrorPlot::setErrorLine;
00068
00069
00070
00071
00072
00073 bool isValid() const;
00074
00075
00076
00077
00078
00079 bool shouldDraw() const;
00080
00081
00082 QwtDoubleRect boundingRect() const;
00083
00084 #if QWT_VERSION >= 0x060000
00085
00086 QwtGraphic legendIcon(int index, const QSizeF& size) const;
00087 #else
00088
00089 QWidget* legendItem() const;
00090 #endif
00091
00092
00093
00094
00095
00096 void dataChanged() { itemChanged(); }
00097
00098
00099 bool linesShown() const;
00100
00101
00102 void setLinesShown(bool linesShown = true);
00103
00104
00105 PlotLinePtr line() const;
00106
00107
00108 void setLine(const PlotLine& line);
00109
00110
00111
00112
00113
00114 PlotPointDataPtr pointData() const;
00115
00116
00117 bool symbolsShown() const;
00118
00119
00120 void setSymbolsShown(bool symbolsShown = true);
00121
00122
00123 PlotSymbolPtr symbol() const;
00124
00125
00126 void setSymbol(const PlotSymbol& symbol);
00127
00128
00129
00130
00131
00132 PlotMaskedPointDataPtr maskedData() const;
00133
00134
00135 void clearData();
00136
00137
00138 bool maskedLinesShown() const;
00139
00140
00141 void setMaskedLinesShown(bool linesShown = true);
00142
00143
00144 PlotLinePtr maskedLine() const;
00145
00146
00147 void setMaskedLine(const PlotLine& line);
00148
00149
00150 bool maskedSymbolsShown() const;
00151
00152
00153 void setMaskedSymbolsShown(bool symbolsShown = true);
00154
00155
00156 PlotSymbolPtr maskedSymbol() const;
00157
00158
00159 void setMaskedSymbol(const PlotSymbol& symbol);
00160
00161
00162
00163
00164
00165 PlotErrorDataPtr errorData() const;
00166
00167
00168 bool errorLineShown() const;
00169
00170
00171 void setErrorLineShown(bool show = true);
00172
00173
00174 PlotLinePtr errorLine() const;
00175
00176
00177 void setErrorLine(const PlotLine& line);
00178
00179
00180 unsigned int errorCapSize() const;
00181
00182
00183 void setErrorCapSize(unsigned int capSize);
00184
00185
00186
00187
00188
00189 PlotBinnedDataPtr binnedColorData() const;
00190
00191
00192 PlotColorPtr colorForBin(unsigned int bin) const;
00193
00194
00195 void setColorForBin(unsigned int bin, const PlotColorPtr color);
00196
00197 protected:
00198
00199 const String& className() const { return CLASS_NAME; }
00200
00201
00202 #if QWT_VERSION >= 0x060000
00203 void draw_(QPainter* painter, const QwtScaleMap& xMap,
00204 const QwtScaleMap& yMap, const QRectF& canvasRect,
00205 unsigned int drawIndex, unsigned int drawCount) const;
00206 #else
00207 void draw_(QPainter* painter, const QwtScaleMap& xMap,
00208 const QwtScaleMap& yMap, const QRect& canvasRect,
00209 unsigned int drawIndex, unsigned int drawCount) const;
00210 #endif
00211
00212 private:
00213
00214
00215 PlotPointDataPtr m_data;
00216 PlotMaskedPointDataPtr m_maskedData;
00217 PlotErrorDataPtr m_errorData;
00218 PlotBinnedDataPtr m_coloredData;
00219
00220
00221
00222
00223 QPSymbol m_symbol;
00224 QPLine m_line;
00225 QPSymbol m_maskedSymbol;
00226 QPLine m_maskedLine;
00227 QPLine m_errorLine;
00228 unsigned int m_errorCap;
00229
00230
00231
00232
00233 QList<QPColor*> m_colors;
00234 QList<QBrush> m_coloredBrushes;
00235
00236
00237 #if QWT_VERSION >= 0x060000
00238
00239 QPSymbol* coloredSymbol(const QColor& color) const;
00240 #endif
00241
00242
00243 void updateBrushes();
00244 };
00245
00246 }
00247
00248 #endif
00249
00250 #endif