casa
$Rev:20696$
|
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( std::tr1::shared_ptr<casa::viewer::RegionInfo> ) { return false; } 00035 protected: 00036 std::string description_; 00037 std::string label_; 00038 }; 00039 00040 class image_stats_t : public stats_t, public Ui::QtImageRegionStats { 00041 Q_OBJECT 00042 public: 00043 image_stats_t( statfield_list_t &fields, QWidget *parent=0 ); 00044 RegionInfo::InfoTypes type( ) const { return RegionInfo::ImageInfoType; } 00045 virtual QPushButton *next( ) { return next_button; } 00046 }; 00047 00048 class ms_stats_t : public stats_t, public Ui::QtMsRegionStats { 00049 Q_OBJECT 00050 public: 00051 ms_stats_t( statfield_list_t &fields, QWidget *parent=0 ); 00052 RegionInfo::InfoTypes type( ) const { return RegionInfo::MsInfoType; } 00053 virtual QPushButton *next( ) { return next_button; } 00054 }; 00055 00056 class SliceStats : public stats_t, public Ui::SlicerStats { 00057 Q_OBJECT 00058 public: 00059 SliceStats( QWidget *parent=0 ); 00060 RegionInfo::InfoTypes type( ) const { return RegionInfo::SliceInfoType; } 00061 virtual QPushButton *next( ) { return next_button; } 00062 QWidget* getPlotHolder() { return plotHolderWidget; } 00063 signals: 00064 void show1DSliceTool(); 00065 }; 00066 00067 class pvline_stats_t : public stats_t, public Ui::PVLineStats { 00068 Q_OBJECT 00069 public: 00070 pvline_stats_t( QWidget *parent=0 ); 00071 RegionInfo::InfoTypes type( ) const { return RegionInfo::PVLineInfoType; } 00072 virtual QPushButton *next( ) { return next_button; } 00073 bool updateStatisticsInfo( std::tr1::shared_ptr<casa::viewer::RegionInfo> ); 00074 signals: 00075 void createPVImage(const std::string&,const std::string&,int); 00076 00077 private slots: 00078 void create_pv_image( ); 00079 }; 00080 } 00081 00082 00083 class QtRegionStats : public QWidget { 00084 Q_OBJECT 00085 public: 00086 QtRegionStats( QWidget *parent=0 ); 00087 ~QtRegionStats( ); 00088 00089 void disableNextButton( ); 00090 void reset( ); 00091 #if OLDSTUFF 00092 void addstats( std::list<std::pair<String,String> > *stats ); 00093 #endif 00094 00095 void updateStatistics( std::tr1::shared_ptr<casa::viewer::RegionInfo> stats, Region* region = NULL ); 00096 00097 void setCenterBackground(QString background); 00098 00099 void setNext( QStackedWidget *, QtRegionStats * ); 00100 00101 bool updateStatisticsInfo( std::tr1::shared_ptr<casa::viewer::RegionInfo> ); 00102 00103 protected slots: 00104 void go_next( ); 00105 00106 protected: 00107 qt::statfield_list_t fields; 00108 00109 QStackedWidget *container_; 00110 QtRegionStats *next_; 00111 00112 private: 00113 QVBoxLayout *layout_; 00114 qt::stats_t *new_stats_box( RegionInfo::InfoTypes type, Region* region, const string& label ); 00115 qt::stats_t *stats_box_; 00116 std::string description_; 00117 std::string label_; 00118 }; 00119 } 00120 } 00121 00122 #endif