casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GaussianEstimateWidget.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 #ifndef GAUSSIANESTIMATEWIDGET_QO_H
26 #define GAUSSIANESTIMATEWIDGET_QO_H
27 
28 #include <QWidget>
29 #include <casa/Arrays/Vector.h>
30 #include <display/QtPlotter/GaussianEstimateWidget.ui.h>
33 
34 class QwtPlot;
35 class QwtPlotCurve;
36 
37 namespace casa {
38 
39  class MolecularLine;
40 
41  class GaussianEstimateWidget : public QWidget {
42  Q_OBJECT
43 
44  public:
45  static void setEstimateColor( QColor estimateColor );
46  GaussianEstimateWidget(QWidget *parent = 0);
48  void setCurveColor( QColor color );
49  void setTitle( const QString& titleStr );
50  void setRangeX( float xValue, float yValue );
51  void setRangeY( float xValue, float yValue );
52  void setDisplayYUnits( const QString& units );
53  void molecularLineChanged( float peak, float center, const QString& label,
54  const QString& chemicalName, const QString& resolvedQNs, const QString& frequencyUnits );
56  void setEstimate( const SpecFitGaussian& estimate );
57  void unitsChanged( const QString& oldUnits, const QString& newUnits, casacore::SpectralCoordinate& coord);
58  void setSliderValueFWHM( float value );
60  void clearMolecularLines();
62 
63  signals:
64  void coordinatedValuesChanged(float);
65 
66  private slots:
67  void peakSliderChanged( int value );
68  void centerSliderChanged( int value );
69  void fwhmSliderChanged( int value );
70  void peakTextChanged();
71  void centerTextChanged();
72  void fwhmTextChanged();
73  void peakFixedChanged( bool fixed );
74  void centerFixedChanged( bool fixed );
75  void fwhmFixedChanged( bool fixed );
76 
77  private:
78  float scale( int value, float min, float max ) const;
79  float scaleY( int value ) const;
80  float scaleX( int value ) const;
81  int reverseScale( float value, float min, float max ) const;
82  int reverseScaleY( float value ) const;
83  int reverseScaleX( float value ) const;
84  float getFwhmRange() const;
85  void peakChanged( float value );
86  void centerChanged( float value );
87  void fwhmChanged( float value );
88  void updateFit();
89  void copyVectors( const casacore::Vector<float>& values, QVector<double>& vals, bool reverseOrder );
90  void copyVectors( const casacore::Vector<float>& sourceValues, casacore::Vector<float>& destinationValues, bool reverseOrder );
91  float adjustValue( float val ) const;
92  void setSliderValuePeak( float value );
93  void setSliderValueCenter( float value );
94  float reasonableFWHM( float value ) const;
95  float reasonableCenter( float value ) const;
96  float reasonablePeak( float value ) const;
97 
98  QwtPlotCurve* initCurve( QColor color );
99  void clearCurve( QwtPlotCurve*& curve );
100 
101  QwtPlot* plot;
102  QwtPlotCurve* curve;
103  QwtPlotCurve* fitCurve;
104  Ui::GaussianEstimateWidgetClass ui;
108  float minX;
109  float maxX;
110  float minY;
111  float maxY;
112  QColor curveColor;
113  static QColor fitCurveColor;
114  QMap<QString,MolecularLine*> molecularLineMap;
115  };
116 }
117 
118 #endif // GAUSSIANESTIMATEWIDGET_QO_H
void setSliderValuePeak(float value)
int reverseScaleY(float value) const
void setDisplayYUnits(const QString &units)
void coordinatedValuesChanged(float)
int reverseScaleX(float value) const
void setSliderValueCenter(float value)
void centerChanged(float value)
#define max(a, b)
Definition: hio.h:44
#define min(a, b)
Definition: hio.h:45
Ui::GaussianEstimateWidgetClass ui
void setCurveColor(QColor color)
void setSliderValueFWHM(float value)
void peakSliderChanged(int value)
float reasonableCenter(float value) const
void molecularLineChanged(float peak, float center, const QString &label, const QString &chemicalName, const QString &resolvedQNs, const QString &frequencyUnits)
void fwhmSliderChanged(int value)
GaussianEstimateWidget(QWidget *parent=0)
void setRangeY(float xValue, float yValue)
void fwhmChanged(float value)
static void setEstimateColor(QColor estimateColor)
void unitsChanged(const QString &oldUnits, const QString &newUnits, casacore::SpectralCoordinate &coord)
void setRangeX(float xValue, float yValue)
float scaleY(int value) const
QwtPlotCurve * initCurve(QColor color)
float scaleX(int value) const
void fwhmFixedChanged(bool fixed)
float reasonablePeak(float value) const
void centerSliderChanged(int value)
void clearCurve(QwtPlotCurve *&curve)
int reverseScale(float value, float min, float max) const
void copyVectors(const casacore::Vector< float > &values, QVector< double > &vals, bool reverseOrder)
void centerFixedChanged(bool fixed)
void peakChanged(float value)
void peakFixedChanged(bool fixed)
Interconvert pixel and frequency values.
void setEstimate(const SpecFitGaussian &estimate)
void setCurveData(const casacore::Vector< float > &xValues, const casacore::Vector< float > &yValues)
QMap< QString, MolecularLine * > molecularLineMap
float reasonableFWHM(float value) const
SpecFitGaussian getEstimate()
float adjustValue(float val) const
float scale(int value, float min, float max) const
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
void setTitle(const QString &titleStr)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.