casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtCleanPanelGui.qo.h
Go to the documentation of this file.
00001 //# QtCleanPanelGui.qo.h:  interactive clean display panel
00002 //# Copyright (C) 2005,2009
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef QTCLEANPANELGUI_H_
00029 #define QTCLEANPANELGUI_H_
00030 
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL/String.h>
00033 #include <casa/Containers/Record.h>
00034 #include <casa/Arrays/Vector.h>
00035 #include <coordinates/Coordinates/CoordinateSystem.h>
00036 #include <coordinates/Coordinates/DirectionCoordinate.h>
00037 
00038 #include <graphics/X11/X_enter.h>
00039 #  include <QObject>
00040 #  include <QGroupBox>
00041 #  include <QRadioButton>
00042 #  include <QPushButton>
00043 #  include <QHBoxLayout>
00044 #  include <QVBoxLayout>
00045 #  include <QLineEdit>
00046 #include <graphics/X11/X_exit.h>
00047 #include <display/QtViewer/QtDisplayPanelGui.qo.h>
00048 
00049 
00050 namespace casa {
00051 
00052     class QtViewer;
00053     class QtDisplayPanel;
00054     class QtDisplayData;
00055     class ImageRegion;
00056     class WorldCanvasHolder;
00057 
00058     // <synopsis>
00059     // Demo class to encapsulate 'serial' running of qtviewer into callable
00060     // methods of a class; this example also applies it to the task of
00061     // interactive selection of CLEAN boxes.
00062     // </synopsis>
00063     class QtCleanPanelGui: public QtDisplayPanelGui {
00064 
00065         Q_OBJECT        //# Allows slot/signal definition.  Must only occur in
00066                         //# implement/.../*.h files; also, makefile must include
00067                         //# name of this file in 'mocs' section.
00068   
00069 
00070     protected: 
00071         friend class QtViewer;
00072         QtCleanPanelGui( QtViewer* v, QWidget* parent=0,
00073                          const std::list<std::string> &args = std::list<std::string>( ) );
00074   
00075     public: 
00076         ~QtCleanPanelGui();
00077   
00078         bool supports( SCRIPTING_OPTION option ) const;
00079         QVariant start_interact( const QVariant &input, int id );
00080         QVariant setoptions( const QMap<QString,QVariant> &input, int id);
00081 
00082         // the QtDBusViewerAdaptor can handle loading & registering data itself,
00083         // but to connect up extra functionality, the upper-level QtDisplayPanelGui
00084         // (or in the current case, the derived QtCleanPanelGui) would have to be
00085         // notified that data has been added. This will allow it to set up the
00086         // callbacks for drawing regions...
00087         void addedData( QString type, QtDisplayData * );
00088 
00089     protected slots:
00090  
00091         virtual void exitStop();
00092         virtual void exitDone();
00093         virtual void exitNoMore();
00094 
00095         // Connected to the rectangle region mouse tools new rectangle signal.
00096         // Accumulates [/ displays] selected boxes.
00097         virtual void newMouseRegion(Record mouseRegion, WorldCanvasHolder* wch);
00098 
00099         virtual void changeMaskAxis(String, String, String, std::vector<int> );
00100         virtual void changeImageAxis(String, String, String, std::vector<int> );
00101         virtual void changeMaskSelectionText( String x, String y, String z );
00102 
00103     signals:
00104         void interact( QVariant );
00105 
00106     protected: 
00107 
00108         // scripted (via dbus) panels should override the closeEvent( ) and hide the gui
00109         // instead of deleting it when it was created via a dbus script...
00110         void closeEvent(QCloseEvent *event);
00111 
00112         std::list<QWidget*> disabled_widgets;
00113  
00114         QRadioButton* addRB_;
00115         QRadioButton* eraseRB_;
00116         QRadioButton* allChanRB_;
00117         QRadioButton* thisPlaneRB_;
00118         QRadioButton* allHiddenRB_;
00119         QRadioButton* thisHiddenRB_;
00120         QPushButton* maskNoMorePB_;
00121         QPushButton* maskDonePB_;
00122         QPushButton* stopPB_;
00123         QLineEdit* niterED_;
00124         QLineEdit* ncyclesED_;
00125         QLineEdit* threshED_;
00126         Record buttonState_;
00127 
00128         // standard palette...
00129         QPalette default_palette;
00130         // palette used when input is expected for clean...
00131         QPalette input_palette;
00132 
00133     private: 
00134         bool in_interact_mode;
00135         int interact_id;
00136 
00137         void writeRegionText(const ImageRegion& imageReg, const String& filename, Float value);
00138 
00139         QtDisplayData* imagedd_;
00140         QtDisplayData* maskdd_;                 // later: to display clean region.
00141         std::string axis_change;
00142 
00143         CoordinateSystem csys_p;  
00144         DirectionCoordinate dirCoord_p;
00145 
00146 };
00147 
00148 
00149 } //# NAMESPACE CASA - END
00150 
00151 #endif
00152 
00153