QtRegionStats.qo.h
Go to the documentation of this file.00001 #ifndef REGION_QTREGIONSTATS_H_
00002 #define REGION_QTREGIONSTATS_H_
00003
00004 #include <QtGui/QGroupBox>
00005 #include <QtGui/QPushButton>
00006 #include <QtGui/QLabel>
00007 #include <QVBoxLayout>
00008 #include <casa/BasicSL/String.h>
00009 #include <display/region/QtImageRegionStats.ui.h>
00010 #include <display/region/QtMsRegionStats.ui.h>
00011 #include <display/region/SlicerStats.ui.h>
00012 #include <display/region/PVLineStats.ui.h>
00013 #include <display/region/RegionInfo.h>
00014
00015
00016 class QStackedWidget;
00017
00018 namespace casa {
00019 namespace viewer {
00020
00021 class Region;
00022
00023 namespace qt {
00024
00025 typedef std::list<std::pair<QGroupBox*,QLabel*> > statfield_list_t;
00026
00027 class stats_t : public QGroupBox {
00028 Q_OBJECT
00029 public:
00030 stats_t( QWidget *parent ) : QGroupBox("",parent) { }
00031 void setLabels( const std::string &label, const std::string &desc );
00032 virtual RegionInfo::InfoTypes type( ) const = 0;
00033 virtual QPushButton *next( ) = 0;
00034 virtual bool updateStatisticsInfo( SHARED_PTR<casa::viewer::RegionInfo> ) {
00035 return false;
00036 }
00037 protected:
00038 std::string description_;
00039 std::string label_;
00040 };
00041
00042 class image_stats_t : public stats_t, public Ui::QtImageRegionStats {
00043 Q_OBJECT
00044 public:
00045 image_stats_t( statfield_list_t &fields, QWidget *parent=0 );
00046 RegionInfo::InfoTypes type( ) const {
00047 return RegionInfo::ImageInfoType;
00048 }
00049 virtual QPushButton *next( ) {
00050 return next_button;
00051 }
00052 };
00053
00054 class ms_stats_t : public stats_t, public Ui::QtMsRegionStats {
00055 Q_OBJECT
00056 public:
00057 ms_stats_t( statfield_list_t &fields, QWidget *parent=0 );
00058 RegionInfo::InfoTypes type( ) const {
00059 return RegionInfo::MsInfoType;
00060 }
00061 virtual QPushButton *next( ) {
00062 return next_button;
00063 }
00064 };
00065
00066 class SliceStats : public stats_t, public Ui::SlicerStats {
00067 Q_OBJECT
00068 public:
00069 SliceStats( QWidget *parent=0 );
00070 RegionInfo::InfoTypes type( ) const {
00071 return RegionInfo::SliceInfoType;
00072 }
00073 virtual QPushButton *next( ) {
00074 return next_button;
00075 }
00076 QWidget* getPlotHolder() {
00077 return plotHolderWidget;
00078 }
00079 bool updateStatisticsInfo( SHARED_PTR<casa::viewer::RegionInfo> );
00080 signals:
00081 void show1DSliceTool();
00082 };
00083
00084 class pvline_stats_t : public stats_t, public Ui::PVLineStats {
00085 Q_OBJECT
00086 public:
00087 pvline_stats_t( QWidget *parent=0 );
00088 RegionInfo::InfoTypes type( ) const {
00089 return RegionInfo::PVLineInfoType;
00090 }
00091 virtual QPushButton *next( ) {
00092 return next_button;
00093 }
00094 bool updateStatisticsInfo( SHARED_PTR<casa::viewer::RegionInfo> );
00095 protected:
00096 void enterEvent (QEvent *);
00097 void showEvent ( QShowEvent * );
00098
00099 signals:
00100 void createPVImage(const std::string&,const std::string&,int);
00101 void setPVInfo(int width);
00102
00103 private slots:
00104 void create_pv_image( );
00105 };
00106 }
00107
00108
00109 class QtRegionStats : public QWidget {
00110 Q_OBJECT
00111 public:
00112 QtRegionStats( QWidget *parent=0 );
00113 ~QtRegionStats( );
00114
00115 void disableNextButton( );
00116 void reset( );
00117 #if OLDSTUFF
00118 void addstats( std::list<std::pair<String,String> > *stats );
00119 #endif
00120
00121 void updateStatistics( SHARED_PTR<casa::viewer::RegionInfo> stats, Region* region = NULL );
00122
00123 void setCenterBackground(QString background);
00124
00125 void setNext( QStackedWidget *, QtRegionStats * );
00126
00127 bool updateStatisticsInfo( SHARED_PTR<casa::viewer::RegionInfo> );
00128
00129 protected slots:
00130 void go_next( );
00131
00132 protected:
00133 qt::statfield_list_t fields;
00134
00135 QStackedWidget *container_;
00136 QtRegionStats *next_;
00137
00138 private:
00139 QVBoxLayout *layout_;
00140 qt::stats_t *new_stats_box( RegionInfo::InfoTypes type, Region* region, const string& label );
00141 qt::stats_t *stats_box_;
00142 std::string description_;
00143 std::string label_;
00144 };
00145 }
00146 }
00147
00148 #endif