GaussianEstimateWidget.qo.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 #ifndef GAUSSIANESTIMATEWIDGET_QO_H
00026 #define GAUSSIANESTIMATEWIDGET_QO_H
00027
00028 #include <QWidget>
00029 #include <casa/Arrays/Vector.h>
00030 #include <display/QtPlotter/GaussianEstimateWidget.ui.h>
00031 #include <display/QtPlotter/SpecFitGaussian.h>
00032 #include <display/QtPlotter/conversion/Converter.h>
00033
00034 class QwtPlot;
00035 class QwtPlotCurve;
00036
00037 namespace casa {
00038
00039 class MolecularLine;
00040
00041 class GaussianEstimateWidget : public QWidget {
00042 Q_OBJECT
00043
00044 public:
00045 static void setEstimateColor( QColor estimateColor );
00046 GaussianEstimateWidget(QWidget *parent = 0);
00047 void setCurveData(const Vector<float>& xValues, const Vector<float>& yValues);
00048 void setCurveColor( QColor color );
00049 void setTitle( const QString& titleStr );
00050 void setRangeX( Float xValue, Float yValue );
00051 void setRangeY( Float xValue, Float yValue );
00052 void setDisplayYUnits( const QString& units );
00053 void molecularLineChanged( float peak, float center, const QString& label,
00054 const QString& chemicalName, const QString& resolvedQNs, const QString& frequencyUnits );
00055 SpecFitGaussian getEstimate();
00056 void setEstimate( const SpecFitGaussian& estimate );
00057 void unitsChanged( const QString& oldUnits, const QString& newUnits, SpectralCoordinate& coord);
00058 void setSliderValueFWHM( float value );
00059 void updateUIBasedOnEstimate();
00060 void clearMolecularLines();
00061 ~GaussianEstimateWidget();
00062
00063 signals:
00064 void coordinatedValuesChanged(float);
00065
00066 private slots:
00067 void peakSliderChanged( int value );
00068 void centerSliderChanged( int value );
00069 void fwhmSliderChanged( int value );
00070 void peakTextChanged();
00071 void centerTextChanged();
00072 void fwhmTextChanged();
00073 void peakFixedChanged( bool fixed );
00074 void centerFixedChanged( bool fixed );
00075 void fwhmFixedChanged( bool fixed );
00076
00077 private:
00078 float scale( int value, Float min, Float max ) const;
00079 float scaleY( int value ) const;
00080 float scaleX( int value ) const;
00081 int reverseScale( float value, Float min, Float max ) const;
00082 int reverseScaleY( float value ) const;
00083 int reverseScaleX( float value ) const;
00084 float getFwhmRange() const;
00085 void peakChanged( float value );
00086 void centerChanged( float value );
00087 void fwhmChanged( float value );
00088 void updateFit();
00089 void copyVectors( const Vector<float>& values, QVector<double>& vals, bool reverseOrder );
00090 void copyVectors( const Vector<float>& sourceValues, Vector<float>& destinationValues, bool reverseOrder );
00091 float adjustValue( float val ) const;
00092 void setSliderValuePeak( float value );
00093 void setSliderValueCenter( float value );
00094 float reasonableFWHM( float value ) const;
00095 float reasonableCenter( float value ) const;
00096 float reasonablePeak( float value ) const;
00097
00098 QwtPlotCurve* initCurve( QColor color );
00099 void clearCurve( QwtPlotCurve*& curve );
00100
00101 QwtPlot* plot;
00102 QwtPlotCurve* curve;
00103 QwtPlotCurve* fitCurve;
00104 Ui::GaussianEstimateWidgetClass ui;
00105 SpecFitGaussian gaussianEstimate;
00106 Vector<float> xValues;
00107 Vector<float> yValues;
00108 Float minX;
00109 Float maxX;
00110 Float minY;
00111 Float maxY;
00112 QColor curveColor;
00113 static QColor fitCurveColor;
00114 QMap<QString,MolecularLine*> molecularLineMap;
00115 };
00116 }
00117
00118 #endif // GAUSSIANESTIMATEWIDGET_QO_H