GaussianEstimateWidget.qo.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1