QtRegionDock.qo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef REGION_QTREGIONDOCK_H_
00029 #define REGION_QTREGIONDOCK_H_
00030 #include <map>
00031 #include <list>
00032 #include <iostream>
00033 #include <display/region/QtRegionDock.ui.h>
00034 #include <display/QtViewer/InActiveDock.qo.h>
00035 #include <imageanalysis/Annotations/AnnRegion.h>
00036 #include <imageanalysis/Annotations/RegionTextList.h>
00037 #include <display/region/Region.qo.h>
00038
00039 namespace casa {
00040
00041 class QtDisplayData;
00042 class QtDisplayPanelGui;
00043
00044 namespace viewer {
00045
00046 class Region;
00047 class QtRegionState;
00048 class ds9writer;
00049 class Region;
00050
00051 class QtRegionDock : public InActiveDock, protected Ui::QtRegionDock {
00052 Q_OBJECT
00053 public:
00054
00055 QtRegionDock( QtDisplayPanelGui *, QWidget* parent=0 );
00056 ~QtRegionDock();
00057
00058 void addRegion(Region *,QtRegionState*,int index = -1);
00059 int indexOf(QtRegionState*) const;
00060 void removeRegion(QtRegionState*);
00061 void selectRegion(QtRegionState*,bool scroll=true);
00062 void updateFrameCount( int count );
00063 void status( const std::string &msg, const std::string &type="info" );
00064
00065 QtDisplayPanelGui *panel( ) {
00066 return dpg;
00067 }
00068
00069
00070
00071
00072
00073 std::pair<int,int> &tabState( ) {
00074 return current_tab_state;
00075 }
00076 std::map<std::string,int> &coordState( ) {
00077 return current_coord_state;
00078 }
00079 QString &saveDir( ) {
00080 return current_save_dir;
00081 }
00082 QString &loadDir( ) {
00083 return current_load_dir;
00084 }
00085 int &colorIndex( ) {
00086 return current_color_index;
00087 }
00088
00089
00090 void selectedCountUpdateNeeded( );
00091
00092 size_t selectedRegionCount( ) {
00093 return selected_region_set_.size( );
00094 }
00095 const region::region_list_type &selectedRegionSet( ) {
00096 return selected_region_set_;
00097 }
00098 size_t markedRegionCount( ) {
00099 return marked_region_set_.size( );
00100 }
00101 const region::region_list_type &markedRegionSet( ) {
00102 return marked_region_set_;
00103 }
00104 const region::region_list_type &weaklySelectedRegionSet( ) {
00105 return weakly_selected_region_set_;
00106 }
00107 void clearWeaklySelectedRegionSet( );
00108 bool isWeaklySelectedRegion( const Region * ) const;
00109 void addWeaklySelectedRegion( Region * );
00110 void removeWeaklySelectedRegion( Region * );
00111
00112 void dismiss( );
00113
00114 std::list<Region*> regions( ) const {
00115 return region_list;
00116 }
00117
00118 std::string outputRegions( std::list<viewer::QtRegionState*> regions, std::string file,
00119 std::string format, std::string ds9_csys="pixel" );
00120
00121 void updateRegionStats( );
00126 void updateStackOrder( int topIndex );
00127 void emitCreate( Region * );
00128
00129 int numFrames( ) const;
00130 void deleteRegions( const region::region_list_type & );
00131 void revokeRegion( Region *r );
00132
00133 signals:
00134
00135
00136 void deleteRegion(QtRegionState*);
00137
00138
00139
00140 void regionChange( viewer::Region *, std::string );
00141 void deleteAllRegions();
00142 void regionSelected( int id );
00143 void saveRegions( std::list<QtRegionState*>, RegionTextList & );
00144 void saveRegions( std::list<QtRegionState*>, ds9writer & );
00145 void loadRegions( const QString &path, const QString &type );
00146
00147 void region_stack_change(QWidget*);
00148 void showHistogramTool();
00149
00150 public slots:
00151 void updateRegionState(QtDisplayData*);
00152 void delete_all_regions( bool );
00153 private slots:
00154 void stack_changed(int);
00155 void change_stack(int);
00156 void delete_current_region(bool);
00157
00158 void output_region_event(const QString &what, const QString &where, const QString &type, const QString &csys );
00159 void handle_visibility(bool);
00160 void emit_region_stack_change( int );
00161
00162 protected:
00163 void enterEvent( QEvent* );
00164 void leaveEvent( QEvent* );
00165 void closeEvent ( QCloseEvent * event );
00166
00167 private:
00168 QtDisplayPanelGui *dpg;
00169 QtDisplayData *current_dd;
00170 std::pair<int,int> current_tab_state;
00171 std::map<std::string,int> current_coord_state;
00172 int current_color_index;
00173 QString current_save_dir;
00174 QString current_load_dir;
00175 bool dismissed;
00176 bool mouse_in_dock;
00177
00178 typedef std::list<Region*> region_list_t;
00179 region_list_t region_list;
00180 typedef std::map<QtRegionState*,Region*> region_map_t;
00181 region_map_t region_map;
00182
00183
00184
00185 region::region_list_type selected_region_set_;
00186 region::region_list_type weakly_selected_region_set_;
00187 region::region_list_type marked_region_set_;
00188 void update_region_statistics( );
00189
00190 };
00191 }
00192 }
00193
00194 #endif