casa
$Rev:20696$
|
00001 #ifndef SPECTRALPOSITIONINGWIDGET_QO_H 00002 #define SPECTRALPOSITIONINGWIDGET_QO_H 00003 00004 #include <QtGui/QWidget> 00005 #include <display/QtPlotter/SpectralPositioningWidget.ui.h> 00006 #include <casa/Arrays/Vector.h> 00007 namespace casa { 00008 00009 class ProfileTaskMonitor; 00010 class LogIO; 00011 00012 class SpectralPositioningWidget : public QWidget 00013 { 00014 Q_OBJECT 00015 00016 public: 00017 SpectralPositioningWidget(QWidget *parent = 0); 00018 void setTaskMonitor( ProfileTaskMonitor* monitor ); 00019 void setLogger( LogIO* logger ); 00020 00021 void updateRegion( const Vector<Double> px, const Vector<Double> py, 00022 const Vector<Double> wx, const Vector<Double> wy ); 00023 ~SpectralPositioningWidget(); 00024 00025 private slots: 00026 void boxSpecChanged( int index ); 00027 void locationSelectionTypeChanged( int index ); 00028 void locationUnitsChanged( int index ); 00029 void setPosition(); 00030 00031 private: 00032 void updateUI(); 00033 void updateUIWorldBox(); 00034 void updateUIWorldPoint(); 00035 void updateUIPixelBox(); 00036 void updateUIPixelPoint(); 00040 void initSpectrumPosition(); 00041 void pageUpdate( int selectionIndex, int unitIndex ); 00042 00043 bool populateWorlds( const QList<int> &pixelX, const QList<int> &pixelY, 00044 QList<double> &worldX, QList<double> &worldY ); 00045 bool fillPointWorld( QList<double> &worldX, QList<double> &worldY ); 00046 void fillPointPixel( QList<int> &pixelX, QList<int>&pixelY )const; 00047 bool fillBoxPixel( QList<int> &pixelX, QList<int>&pixelY ); 00048 bool fillBoxWorld( QList<double> &worldX, QList<double> & worldY ); 00049 bool fillBasedOnBoxSpecification( const double* const firstXPix, const double * const firstYPix, 00050 const double* const secondXPix, const double* const secondYPix, 00051 double* const blcxPix, double* const blcyPix, 00052 double* const trcxPix, double* const trcYPix, bool pixels=true ); 00053 double toRadians( Bool& valid, QLineEdit * lineEdit ); 00054 void switchBoxLabels( int index, int pageIndex, QLabel* const x1Label, QLabel* const y1Label, 00055 QLabel* const x2Label, QLabel* const y2Label ); 00056 void setPixelLineEdits( double topLeft, double bottomLeft, 00057 double topRight, double bottomRight ); 00058 void setWorldEdits( double topLeft, double bottomLeft, 00059 double topRight, double bottomRight ); 00060 void adjustPoint( const Vector<Double>& newX, const Vector<Double>& newY, 00061 Vector<Double>& xValues, Vector<Double>& yValues ); 00062 Ui::SpectralPositioningWidgetClass ui; 00063 00064 enum PositionTypeIndex { POINT, BOX, END_POSITION_TYPE }; 00065 enum UnitIndex {RADIAN, PIXEL, END_UNIT }; 00066 QIntValidator* pixelValidator; 00067 enum StackPages { POINT_PIXEL, POINT_RA_DEC, BOX_PIXEL, BOX_RA_DEC }; 00068 enum BoxSpecificationIndex { TL_LENGTH_HEIGHT, CENTER_LENGTH_HEIGHT, TL_BR, BL_TR, 00069 TL_LENGTH_HEIGHT_WORLD, CENTER_LENGTH_HEIGHT_WORLD, TL_BR_WORLD, BL_TR_WORLD, END_SPEC }; 00070 QMap<BoxSpecificationIndex,QList<QString> > boxLabelMap; 00071 ProfileTaskMonitor* profileTaskMonitor; 00072 LogIO* logger; 00073 Vector<Double> pixelXValues; 00074 Vector<Double> pixelYValues; 00075 Vector<Double> worldXValues; 00076 Vector<Double> worldYValues; 00077 }; 00078 } 00079 #endif // SPECTRALPOSITIONINGWIDGET_H