FeatherPlot.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 #ifndef FEATHERPLOT_H_
00027 #define FEATHERPLOT_H_
00028
00029 #include <QList>
00030 #include <qwt_plot.h>
00031 #include <qwt_legend.h>
00032
00033 class QwtPlotCurve;
00034 class QGridLayout;
00035
00036 namespace casa {
00037
00038 class ExternalAxisControlBottom;
00039 class ExternalAxisControlRight;
00040 class ExternalAxisControlLeft;
00041 class ExternalAxisControl;
00042 class ExternalAxis;
00043 class FeatherCurve;
00044
00045 class FeatherPlot : public QwtPlot {
00046
00047 friend class ExternalAxisControlBottom;
00048 friend class ExternalAxisControlRight;
00049 friend class ExternalAxisControlLeft;
00050
00051 public:
00052 FeatherPlot(QWidget* parent );
00053 enum PlotType { SLICE_CUT, SCATTER_PLOT, NO_TYPE };
00054 virtual ~FeatherPlot();
00055 void clearCurves();
00056 void clearLegend();
00057 void resetLegend();
00058
00059 void addCurve( QVector<double> xValues, QVector<double> yValues,
00060 QColor curveColor, const QString& curveTitle, QwtPlot::Axis yAxis, bool sumCurve );
00061 void addAxisTitle( QwtPlot::Axis axis, const QString& title );
00062 void addDiagonal( QVector<double> xValues, QColor lineColor, QwtPlot::Axis yAxis );
00063 void initializePlot( const QString& title, PlotType plotType );
00064
00065
00066 void setFunctionColor( const QString& curveID, const QColor& color );
00067 void setLineThickness( int thickness );
00068 void setDotSize( int dotSize );
00069 void setLegendVisibility( bool visible );
00074 bool setLogScale( bool uvScale, bool ampScale );
00075
00076
00077 void insertSingleLegend( QWidget* parent );
00078 QWidget* getExternalAxisControl( QwtPlot::Axis position );
00079
00080
00081 FeatherPlot::PlotType getPlotType() const;
00082 bool isLogUV() const;
00083 bool isLogAmplitude() const;
00084 bool isEmpty() const;
00085 bool isScatterPlot() const;
00086 bool isSliceCut() const;
00087
00088
00089 static const QString Y_EQUALS_X;
00090
00091 private:
00092 void setCurvePenColor( int curveIndex, const QColor& color );
00093 int getCurveIndex( const QString& curveTitle ) const;
00094 void setCurveSize( int curveIndex );
00095 void updateAxes();
00096 void updateAxis( int index );
00097 void setAxisLabels();
00098 void adjustPlotBounds( std::pair<double,double> curveBounds, QwtPlot::Axis yAxis );
00099 void resetPlotBounds();
00100 void setLegendSize();
00101 void initAxes( );
00102 void setCurveData( FeatherCurve* curve, QwtPlot::Axis yAxis );
00103
00104 QwtLegend* externalLegend;
00105 QWidget* legendParent;
00106 PlotType plotType;
00107
00108 int lineThickness;
00109 int dotSize;
00110 bool scaleLogAmplitude;
00111 bool scaleLogUV;
00112
00113 const int AXIS_COUNT;
00114 const int MINIMUM_LEGEND_LINE_WIDTH;
00115
00116 QList<FeatherCurve*> curves;
00117
00118
00119 QList<QString> axisTitles;
00120 QList<QString> axisLabels;
00121 QList<ExternalAxisControl*> axisWidgets;
00122 QList<ExternalAxis*> axisBlanks;
00123
00124 double minX;
00125 double maxX;
00126 double minY;
00127 double maxY;
00128 double minYRight;
00129 double maxYRight;
00130 };
00131
00132 }
00133 #endif