casa
$Rev:20696$
|
00001 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000 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 FIND_SOURCES_DIALOG_QO_H 00027 #define FIND_SOURCES_DIALOG_QO_H 00028 00029 #include <QtGui/QDialog> 00030 #include <QMap> 00031 #include <casa/Containers/Record.h> 00032 #include <display/Fit/FindSourcesDialog.ui.h> 00033 #include <display/Fit/ComponentListWrapper.h> 00034 #include <display/Fit/PixelRangeDialog.qo.h> 00035 #include <display/region/QtRegionSource.qo.h> 00036 00037 00038 class QFileSystemModel; 00039 00040 namespace casa { 00041 00042 class SkyCatOverlayDD; 00043 class RegionBox; 00044 class ColorComboDelegate; 00045 00051 class FindSourcesDialog : public QDialog 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 FindSourcesDialog(QWidget *parent = 0, bool displayModeFunctionality = true); 00057 void setImage( ImageInterface<Float>* image ); 00058 void setChannel( int channel ); 00059 00060 QString getRegionString() const; 00061 String getPixelBox() const; 00062 String getScreenedEstimatesFile( const String& estimatesFileName, 00063 bool* errorWritingFile ); 00064 const static QStringList colorNames; 00065 ~FindSourcesDialog(); 00066 00067 signals: 00068 void showOverlay(String, const QString& ); 00069 void removeOverlay(String path ); 00070 void estimateFileSpecified( const QString& fullPath ); 00071 00072 public slots: 00073 void setImageMode( bool imageMode ); 00074 bool newRegion( int id, const QString & shape, const QString &name, 00075 const QList<double> & world_x, const QList<double> & world_y, 00076 const QList<int> &pixel_x, const QList<int> &pixel_y, 00077 const QString & linecolor, const QString & text, const QString & font, 00078 int fontsize, int fontstyle ); 00079 bool updateRegion( int id, viewer::region::RegionChanges changes, 00080 const QList<double> & world_x, const QList<double> & world_y, 00081 const QList<int> &pixel_x, const QList<int> &pixel_y ); 00082 void setOverlayColor(const QString& colorName); 00083 00084 private slots: 00085 void findSources(); 00086 void deleteSelectedSource(); 00087 void canceledFindSources(); 00088 void saveEstimateFile(); 00089 void directoryChanged(const QModelIndex& modelIndex ); 00090 void validateDirectory( const QString& str ); 00091 void cutoffModeChanged( bool noise ); 00092 void showPixelRange(); 00093 void pixelRangeChanged(); 00094 void viewerDisplayChanged(); 00095 00096 private: 00097 FindSourcesDialog( const FindSourcesDialog& other ); 00098 FindSourcesDialog& operator=( const FindSourcesDialog& other ); 00099 void populatePixelBox(); 00100 //Written because when a fit of a residual image was being done, the region 00101 //bounds were larger than the bounds in the residual image. 00102 void populateImageBounds(); 00103 QString getImagePixelBox() const; 00104 void resetCurrentId( int suggestedId ); 00105 void resetSourceView(); 00106 void setSourceResultsVisible( bool visible ); 00107 void createTable(); 00108 void initializeFileManagement(); 00109 void setTableValue(int row, int col, const String& val ); 00110 double populateCutOff(bool* valid) const; 00111 Record makeRegion( bool * valid ) const; 00112 void resetSkyOverlay(); 00113 void clearSkyOverlay(); 00114 void clearRegions(); 00115 bool writeEstimateFile( QString& filePath, 00116 bool screenEstimates = false, RegionBox* screeningBox = NULL ); 00117 QString getRemoveOverlayPath() const; 00118 00119 ComponentListWrapper skyList; 00120 enum SourceColumns { ID_COL, RA_COL, DEC_COL, FLUX_COL, 00121 MAJOR_AXIS_COL, MINOR_AXIS_COL, ANGLE_COL/*, FIXED_COL*/ }; 00122 ImageInterface<Float>* image; 00123 String pixelBox; 00124 QString skyPath; 00125 QString overlayColorName; 00126 bool imageMode; 00127 int channel; 00128 int resultIndex; 00129 int currentRegionId; 00130 QFileSystemModel* fileModel; 00131 QMap< int, RegionBox*> regions; 00132 const int DEFAULT_KEY; 00133 const QString SKY_CATALOG; 00134 ColorComboDelegate* colorDelegate; 00135 PixelRangeDialog pixelRangeDialog; 00136 Vector<int> blcVector; 00137 Vector<int> trcVector; 00138 Ui::FindSourcesDialogClass ui; 00139 }; 00140 } 00141 #endif // FIND_SOURCES_DIALOG_QO_H