ImageView.qo.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
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 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                 //Accessors
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                 //Setters
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                 //Sets whether or not this is the image currently being viewed
00074                 //on the animator.
00075                 void setViewedImage( bool viewed );
00076                 void setDisplayedColor( QColor color );
00077                 void setData( QtDisplayData* other );
00078 
00079                 //Returns whether or not the data is eligible to set the
00080                 //coordinate system for the display.
00081                 bool isControlEligible() const;
00082 
00083                 virtual QSize minimumSizeHint() const;
00084 
00085                 static const QString DROP_ID;
00086                 virtual ~ImageView();
00087 
00088         signals:
00089                 //Register/unregister has changed.
00090                 void imageSelected(ImageView*);
00091                 //Raster/Contour/Vector has changed.
00092                 void displayTypeChanged( ImageView* dd );
00093                 //User has requested to view the display properties of this data.
00094                 void showDataDisplayOptions( QtDisplayData* imageData );
00095                 //Close the image.
00096                 void close( ImageView* imageToClose );
00097                 //This imageView has become the master coordinate image.
00098                 void masterCoordinateImageSelected( ImageView* imageView );
00099                 //This ImageView has become the master hue image.
00100                 void masterHueImageSelected( ImageView* imageView );
00101                 //This ImageView has become the master saturation image.
00102                 void masterSaturationImageSelected( ImageView* imageView );
00103                 //There will be no master coordinate image.
00104                 void masterCoordinateImageClear();
00105                 //An image has been selected to view on the image animator.
00106                 void viewImage( ImageView* imageToView );
00107 
00108         protected:
00109                 //Implemented to support drag and drop.
00110                 virtual void mouseMoveEvent( QMouseEvent* event );
00111 
00112 
00113         private slots:
00114                 //Method of specifying "rest" has changed.
00115                 void restChanged();
00116                 void restUnitsChanged();
00117                 //Minimize/maximize the display
00118                 void openCloseDisplay();
00119                 //Display data has changed register/unregister status.
00120                 void imageRegistrationChanged( bool selected );
00121                 //User has changed the rest frequency
00122                 void restFrequencyChanged();
00123                 //Change to raster/contour/vector/marker
00124                 void displayTypeChanged();
00125                 //Color this image will use in RGB mode has changed.
00126                 void rgbChanged();
00127                 //User selected color for RGB mode has changed.
00128                 //void otherColorChanged();
00129                 //Display the context menu.
00130                 void showContextMenu( const QPoint& location );
00131                 //Show a color dialog where the user can choose a custom color.
00132                 //void showColorDialog();
00133                 //Show the display options for this image view.
00134                 void showDataOptions();
00135 
00136                 //Reset the rest frequency back to its original value.
00137                 void resetRestFrequency();
00138 
00139                 //void _resetSpectralUnit();
00140 
00141         private:
00142                 ImageView( const ImageView& other );
00143                 ImageView operator=( const ImageView& other );
00144 
00145                 //Initialization
00146                 void initDisplayLabels();
00147                 void initDisplayLabel( QWidget* holder, DisplayLabel* label );
00148                 void initColorModeSettings();
00149                 void initRestSettings();
00150                 void initDisplayType();
00151                 void setTitle();
00152 
00153                 //Conversion
00154                 double wavelengthFrequencyConversion( double value,
00155                         QString oldUnits, QString newUnits ) const;
00156                 bool isCategoryMatch( const QString& newUnits, const QString& oldUnits ) const;
00157 
00158 
00159                 //Background color.  Master image used to set the
00160                 //coordinate system is a slightly different color
00161                 void setBackgroundColor( QColor color );
00162                 QColor getBackgroundColor() const;
00163 
00164                 //Opening/closing
00165                 void minimizeDisplay();
00166                 void maximizeDisplay();
00167 
00168                 //Snapshots
00169                 void saveSnapshot();
00170                 void restoreSnapshot();
00171 
00172                 //Drag and drop
00173                 QImage* makeDragImage();
00174                 void makeDrag( QMouseEvent* event );
00175 
00176                 //Resetting the original rest frequency
00177                 void _sendRestFrequencyChange( String comboStr );
00178                 QString updateRestUI( String& restStr );
00179                 void updateFreqUnitCombo();
00180                 void selectRestUnits( const QString& restUnits );
00181 
00182                 //Custom color for RGB image combination
00183                 //void setButtonColor( QColor color );
00184                 //QColor getButtonColor() const;
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                 //Available context menu choices
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                 //Regular background or master coordinate image background
00207                 QColor normalColor;
00208                 QColor masterCoordinateColor;
00209 
00210                 QtDisplayData* imageData;
00211                 QButtonGroup* displayGroup;
00212 
00213                 //Indicators of which display properties apply to this image view.
00214                 DisplayLabel* displayTypeLabel;
00215                 DisplayLabel* coordinateMasterLabel;
00216                 DisplayLabel* hueMasterLabel;
00217                 DisplayLabel* saturationMasterLabel;
00218                 QSpacerItem* spacerFirst;
00219                 QSpacerItem* spacerLast;
00220 
00221                 //Method used to combine images using colors.
00222                 ColorCombinationMode colorMode;
00223                 Record displayOptionsSnapshot;
00224                 bool empty;
00225 
00226                 //Rest frequency
00227                 QStringList frequencyUnits;
00228                 QStringList wavelengthUnits;
00229                 const String REST_FREQUENCY_KEY;
00230                 //const String SPECTRAL_UNIT_KEY;
00231                 const String VALUE_KEY;
00232 
00233                 //Opening/closing
00234                 int minimumSize;
00235                 const int SIZE_COLLAPSED;
00236                 const int SIZE_EXPANDED;
00237 
00238                 //Store original rest frequney value & units.
00239                 String originalFreq;
00240                 //String spectralUnit;
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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1