RangeControlsWidget.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 
00026 #ifndef RANGECONTROLSWIDGET_QO_H
00027 #define RANGECONTROLSWIDGET_QO_H
00028 
00029 #include <QtGui/QWidget>
00030 #include <guitools/Histogram/RangeControlsWidget.ui.h>
00031 #include <casa/typeinfo.h>
00032 #include <casa/Utilities/CountedPtr.h>
00033 
00034 using namespace std;
00035 
00036 class QDoubleValidator;
00037 
00038 namespace casa {
00039 
00040 template <class T> class ImageInterface;
00041 
00046 class PercentageCalculator {
00047 public:
00048         PercentageCalculator( float minValue, float maxValue, const SHARED_PTR<const ImageInterface<Float> > image );
00049         void work();
00050         float getRangeMin() const;
00051         float getRangeMax() const;
00052         virtual ~PercentageCalculator();
00053 
00054 private:
00055         float minValue;
00056         float maxValue;
00057         float rangeMin;
00058         float rangeMax;
00059     SHARED_PTR<const ImageInterface<Float> > image;
00060 };
00061 
00062 
00068 class RangeControlsWidget : public QWidget {
00069     Q_OBJECT
00070 
00071 public:
00072     RangeControlsWidget(QWidget *parent = 0);
00073     void setImage(const SHARED_PTR<const ImageInterface<Float > > image );
00074     void hideMaximum();
00075     void setRange( double min, double max, bool signal=true );
00076     void setDataLimits( double min, double max );
00077     void setIgnoreRange( bool ignore );
00078     pair<double,double> getMinMaxValues() const;
00079 
00080     ~RangeControlsWidget();
00081 
00082 signals:
00083         void minMaxChanged();
00084         void rangeCleared();
00085 
00086 public slots:
00087         void percentilesDone();
00088 
00089 protected:
00090         virtual void keyPressEvent( QKeyEvent* event );
00091 
00092 private slots:
00093         void clearRange();
00094         void rangeModeChanged( bool percentile );
00095         void percentageChanged( const QString& newPercentage );
00096 
00097 private:
00098         RangeControlsWidget(const RangeControlsWidget& );
00099         RangeControlsWidget& operator=( const RangeControlsWidget& );
00100     QDoubleValidator* minMaxValidator;
00101     PercentageCalculator* percentCalculator;
00102     Ui::RangeControlsWidgetClass ui;
00103     SHARED_PTR<const ImageInterface<Float > > image;
00104     QString percentage;
00105     double rangeMin;
00106     double rangeMax;
00107     bool ignoreRange;
00108 };
00109 }
00110 #endif // RANGECONTROLSWIDGET_QO_H
00111 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1