ImageView.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 #ifndef IMAGEVIEW_QO_H
00027 #define IMAGEVIEW_QO_H
00028
00029 #include <QtGui/QFrame>
00030 #include <QMenu>
00031 #include <casa/BasicSL/String.h>
00032 #include <casa/Containers/Record.h>
00033 #include <measures/Measures/MDoppler.h>
00034 #include <display/QtViewer/ImageManager/ImageView.ui.h>
00035
00036 class QSpacerItem;
00037
00038 namespace casa {
00039
00040 class QtDisplayData;
00041 class DisplayLabel;
00042
00048 class ImageView : public QFrame {
00049 Q_OBJECT
00050
00051 public:
00052 ImageView(QtDisplayData* data, QWidget *parent = 0);
00053 enum ColorCombinationMode {NO_COMBINATION, RGB, HUE_SATURATION };
00054
00055
00056 QString getName() const;
00057 QtDisplayData* getData() const;
00058 QString getDataDisplayTypeName() const;
00059 bool isRegistered() const;
00060 bool isMasterHue() const;
00061 bool isMasterSaturation() const;
00062 bool isMasterCoordinate() const;
00063 bool isEmpty() const;
00064 bool isRaster() const;
00065 QColor getDisplayedColor() const;
00066
00067
00068 void setRegistered( bool selected );
00069 void setColorCombinationMode( ColorCombinationMode mode );
00070 void setMasterCoordinateImage( bool masterImage );
00071 void setMasterHueImage( bool masterImage );
00072 void setMasterSaturationImage( bool masterImage );
00073
00074
00075 void setViewedImage( bool viewed );
00076 void setDisplayedColor( QColor color );
00077 void setData( QtDisplayData* other );
00078
00079
00080
00081 bool isControlEligible() const;
00082
00083 virtual QSize minimumSizeHint() const;
00084
00085 static const QString DROP_ID;
00086 virtual ~ImageView();
00087
00088 signals:
00089
00090 void imageSelected(ImageView*);
00091
00092 void displayTypeChanged( ImageView* dd );
00093
00094 void showDataDisplayOptions( QtDisplayData* imageData );
00095
00096 void close( ImageView* imageToClose );
00097
00098 void masterCoordinateImageSelected( ImageView* imageView );
00099
00100 void masterHueImageSelected( ImageView* imageView );
00101
00102 void masterSaturationImageSelected( ImageView* imageView );
00103
00104 void masterCoordinateImageClear();
00105
00106 void viewImage( ImageView* imageToView );
00107
00108 protected:
00109
00110 virtual void mouseMoveEvent( QMouseEvent* event );
00111
00112
00113 private slots:
00114
00115 void restChanged();
00116 void restUnitsChanged();
00117
00118 void openCloseDisplay();
00119
00120 void imageRegistrationChanged( bool selected );
00121
00122 void restFrequencyChanged();
00123
00124 void displayTypeChanged();
00125
00126 void rgbChanged();
00127
00128
00129
00130 void showContextMenu( const QPoint& location );
00131
00132
00133
00134 void showDataOptions();
00135
00136
00137 void resetRestFrequency();
00138
00139
00140
00141 private:
00142 ImageView( const ImageView& other );
00143 ImageView operator=( const ImageView& other );
00144
00145
00146 void initDisplayLabels();
00147 void initDisplayLabel( QWidget* holder, DisplayLabel* label );
00148 void initColorModeSettings();
00149 void initRestSettings();
00150 void initDisplayType();
00151 void setTitle();
00152
00153
00154 double wavelengthFrequencyConversion( double value,
00155 QString oldUnits, QString newUnits ) const;
00156 bool isCategoryMatch( const QString& newUnits, const QString& oldUnits ) const;
00157
00158
00159
00160
00161 void setBackgroundColor( QColor color );
00162 QColor getBackgroundColor() const;
00163
00164
00165 void minimizeDisplay();
00166 void maximizeDisplay();
00167
00168
00169 void saveSnapshot();
00170 void restoreSnapshot();
00171
00172
00173 QImage* makeDragImage();
00174 void makeDrag( QMouseEvent* event );
00175
00176
00177 void _sendRestFrequencyChange( String comboStr );
00178 QString updateRestUI( String& restStr );
00179 void updateFreqUnitCombo();
00180 void selectRestUnits( const QString& restUnits );
00181
00182
00183
00184
00185 void rgbModeChanged();
00186
00187 enum DisplayType { DISPLAY_RASTER, DISPLAY_CONTOUR, DISPLAY_VECTOR, DISPLAY_MARKER, DISPLAY_NONE };
00188 QMap<DisplayType,QString> displayTypeMap;
00189 DisplayType storedDisplay;
00190
00191 enum RestTypes { REST_FREQUENCY, REST_WAVELENGTH, REST_REDSHIFT };
00192 RestTypes restType;
00193 QString restUnits;
00194
00195
00196 QAction viewAction;
00197 QAction closeAction;
00198 QAction masterCoordinateSystemAction;
00199 QAction masterCoordinateSystemUndoAction;
00200 QAction masterHueAction;
00201 QAction masterSaturationAction;
00202 QAction rasterAction;
00203 QAction contourAction;
00204 QMenu contextMenu;
00205
00206
00207 QColor normalColor;
00208 QColor masterCoordinateColor;
00209
00210 QtDisplayData* imageData;
00211 QButtonGroup* displayGroup;
00212
00213
00214 DisplayLabel* displayTypeLabel;
00215 DisplayLabel* coordinateMasterLabel;
00216 DisplayLabel* hueMasterLabel;
00217 DisplayLabel* saturationMasterLabel;
00218 QSpacerItem* spacerFirst;
00219 QSpacerItem* spacerLast;
00220
00221
00222 ColorCombinationMode colorMode;
00223 Record displayOptionsSnapshot;
00224 bool empty;
00225
00226
00227 QStringList frequencyUnits;
00228 QStringList wavelengthUnits;
00229 const String REST_FREQUENCY_KEY;
00230
00231 const String VALUE_KEY;
00232
00233
00234 int minimumSize;
00235 const int SIZE_COLLAPSED;
00236 const int SIZE_EXPANDED;
00237
00238
00239 String originalFreq;
00240
00241
00242 const int VIEWED_BORDER_SIZE;
00243 const int NOT_VIEWED_BORDER_SIZE;
00244 bool isViewed() const;
00245 bool isRGBImage() const;
00246 Ui::ImageViewClass ui;
00247 };
00248
00249 }
00250
00251 #endif // IMAGEVIEW_QO_H