casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageView.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef IMAGEVIEW_QO_H
27 #define IMAGEVIEW_QO_H
28 
29 #include <QFrame>
30 #include <QMenu>
31 #include <casa/BasicSL/String.h>
32 #include <casa/Containers/Record.h>
34 #include <display/QtViewer/ImageManager/ImageView.ui.h>
35 
36 class QSpacerItem;
37 
38 namespace casa {
39 
40  class QtDisplayData;
41  class DisplayLabel;
42 
48  class ImageView : public QFrame {
49  Q_OBJECT
50 
51  public:
52  ImageView(QtDisplayData* data, QWidget *parent = 0);
54 
55  //Accessors
56  QString getName() const;
57  QtDisplayData* getData() const;
58  QString getDataDisplayTypeName() const;
59  bool isRegistered() const;
60  bool isMasterHue() const;
61  bool isMasterSaturation() const;
62  bool isMasterCoordinate() const;
63  bool isEmpty() const;
64  bool isRaster() const;
65  QColor getDisplayedColor() const;
66 
67  //Setters
68  void setRegistered( bool selected );
70  void setMasterCoordinateImage( bool masterImage );
71  void setMasterHueImage( bool masterImage );
72  void setMasterSaturationImage( bool masterImage );
73  //Sets whether or not this is the image currently being viewed
74  //on the animator.
75  void setViewedImage( bool viewed );
76  void setDisplayedColor( QColor color );
77  void setData( QtDisplayData* other );
78 
79  //Returns whether or not the data is eligible to set the
80  //coordinate system for the display.
81  bool isControlEligible() const;
82 
83  virtual QSize minimumSizeHint() const;
84 
85  static const QString DROP_ID;
86  virtual ~ImageView();
87 
88  signals:
89  //Register/unregister has changed.
90  void imageSelected(ImageView*);
91  //Raster/Contour/casacore::Vector has changed.
92  void displayTypeChanged( ImageView* dd );
93  //User has requested to view the display properties of this data.
95  //Close the image.
96  void close( ImageView* imageToClose );
97  //This imageView has become the master coordinate image.
98  void masterCoordinateImageSelected( ImageView* imageView );
99  //This ImageView has become the master hue image.
100  void masterHueImageSelected( ImageView* imageView );
101  //This ImageView has become the master saturation image.
102  void masterSaturationImageSelected( ImageView* imageView );
103  //There will be no master coordinate image.
105  //An image has been selected to view on the image animator.
106  void viewImage( ImageView* imageToView );
107 
108  protected:
109  //Implemented to support drag and drop.
110  virtual void mouseMoveEvent( QMouseEvent* event );
111 
112 
113  private slots:
114  //Method of specifying "rest" has changed.
115  void restChanged();
116  void restUnitsChanged();
117  //Minimize/maximize the display
118  void openCloseDisplay();
119  //Display data has changed register/unregister status.
120  void imageRegistrationChanged( bool selected );
121  //User has changed the rest frequency
122  void restFrequencyChanged();
123  //Change to raster/contour/vector/marker
124  void displayTypeChanged();
125  //Color this image will use in RGB mode has changed.
126  void rgbChanged();
127  //User selected color for RGB mode has changed.
128  //void otherColorChanged();
129  //Display the context menu.
130  void showContextMenu( const QPoint& location );
131  //Show a color dialog where the user can choose a custom color.
132  //void showColorDialog();
133  //Show the display options for this image view.
134  void showDataOptions();
135 
136  //Reset the rest frequency back to its original value.
137  void resetRestFrequency();
138 
139  //void _resetSpectralUnit();
140 
141  private:
142  ImageView( const ImageView& other );
143  ImageView operator=( const ImageView& other );
144 
145  //Initialization
146  void initDisplayLabels();
147  void initDisplayLabel( QWidget* holder, DisplayLabel* label );
148  void initColorModeSettings();
149  void initRestSettings();
150  void initDisplayType();
151  void setTitle();
152 
153  //Conversion
154  double wavelengthFrequencyConversion( double value,
155  QString oldUnits, QString newUnits ) const;
156  bool isCategoryMatch( const QString& newUnits, const QString& oldUnits ) const;
157 
158 
159  //Background color. Master image used to set the
160  //coordinate system is a slightly different color
161  void setBackgroundColor( QColor color );
162  QColor getBackgroundColor() const;
163 
164  //Opening/closing
165  void minimizeDisplay();
166  void maximizeDisplay();
167 
168  //Snapshots
169  void saveSnapshot();
170  void restoreSnapshot();
171 
172  //Drag and drop
173  QImage* makeDragImage();
174  void makeDrag( QMouseEvent* event );
175 
176  //Resetting the original rest frequency
178  QString updateRestUI( casacore::String& restStr );
179  void updateFreqUnitCombo();
180  void selectRestUnits( const QString& restUnits );
181 
182  //Custom color for RGB image combination
183  //void setButtonColor( QColor color );
184  //QColor getButtonColor() const;
185  void rgbModeChanged();
186 
188  QMap<DisplayType,QString> displayTypeMap;
190 
193  QString restUnits;
194 
195  //Available context menu choices
196  QAction viewAction;
197  QAction closeAction;
202  QAction rasterAction;
203  QAction contourAction;
204  QMenu contextMenu;
205 
206  //Regular background or master coordinate image background
207  QColor normalColor;
209 
211  QButtonGroup* displayGroup;
212 
213  //Indicators of which display properties apply to this image view.
218  QSpacerItem* spacerFirst;
219  QSpacerItem* spacerLast;
220 
221  //Method used to combine images using colors.
224  bool empty;
225 
226  //Rest frequency
227  QStringList frequencyUnits;
228  QStringList wavelengthUnits;
230  //const casacore::String SPECTRAL_UNIT_KEY;
232 
233  //Opening/closing
235  const int SIZE_COLLAPSED;
236  const int SIZE_EXPANDED;
237 
238  //Store original rest frequney value & units.
240  //casacore::String spectralUnit;
241 
244  bool isViewed() const;
245  bool isRGBImage() const;
246  Ui::ImageViewClass ui;
247  };
248 
249 }
250 
251 #endif // IMAGEVIEW_QO_H
void setMasterCoordinateImage(bool masterImage)
QAction masterCoordinateSystemUndoAction
Definition: ImageView.qo.h:199
void masterCoordinateImageSelected(ImageView *imageView)
This imageView has become the master coordinate image.
void initDisplayLabels()
Initialization.
void setDisplayedColor(QColor color)
void masterCoordinateImageClear()
There will be no master coordinate image.
QSpacerItem * spacerLast
Definition: ImageView.qo.h:219
Displays properties of an image for manipulation such as color and display type.
Definition: ImageView.qo.h:48
bool isMasterSaturation() const
Provides a quick view of a particular display property that has been set.
DisplayType storedDisplay
Definition: ImageView.qo.h:189
QButtonGroup * displayGroup
Definition: ImageView.qo.h:211
void imageSelected(ImageView *)
Register/unregister has changed.
const int VIEWED_BORDER_SIZE
casacore::String spectralUnit;
Definition: ImageView.qo.h:242
bool isMasterHue() const
QString getDataDisplayTypeName() const
DisplayLabel * displayTypeLabel
Indicators of which display properties apply to this image view.
Definition: ImageView.qo.h:214
const casacore::String REST_FREQUENCY_KEY
Definition: ImageView.qo.h:229
virtual QSize minimumSizeHint() const
void setData(QtDisplayData *other)
bool isCategoryMatch(const QString &newUnits, const QString &oldUnits) const
DisplayLabel * hueMasterLabel
Definition: ImageView.qo.h:216
void initDisplayLabel(QWidget *holder, DisplayLabel *label)
bool isEmpty() const
Ui::ImageViewClass ui
Definition: ImageView.qo.h:246
QString updateRestUI(casacore::String &restStr)
void maximizeDisplay()
casacore::String originalFreq
Store original rest frequney value &amp; units.
Definition: ImageView.qo.h:239
QtDisplayData * imageData
Definition: ImageView.qo.h:210
QAction masterSaturationAction
Definition: ImageView.qo.h:201
QAction masterHueAction
Definition: ImageView.qo.h:200
void rgbChanged()
Color this image will use in RGB mode has changed.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
DisplayLabel * saturationMasterLabel
Definition: ImageView.qo.h:217
void showContextMenu(const QPoint &location)
User selected color for RGB mode has changed.
void _sendRestFrequencyChange(casacore::String comboStr)
Resetting the original rest frequency.
void restChanged()
Method of specifying &quot;rest&quot; has changed.
ColorCombinationMode colorMode
Method used to combine images using colors.
Definition: ImageView.qo.h:222
const casacore::String VALUE_KEY
const casacore::String SPECTRAL_UNIT_KEY;
Definition: ImageView.qo.h:231
double wavelengthFrequencyConversion(double value, QString oldUnits, QString newUnits) const
Conversion.
void minimizeDisplay()
Opening/closing.
const int SIZE_COLLAPSED
Definition: ImageView.qo.h:235
bool isControlEligible() const
Returns whether or not the data is eligible to set the coordinate system for the display.
DisplayLabel * coordinateMasterLabel
Definition: ImageView.qo.h:215
QSpacerItem * spacerFirst
Definition: ImageView.qo.h:218
void selectRestUnits(const QString &restUnits)
virtual ~ImageView()
void masterSaturationImageSelected(ImageView *imageView)
This ImageView has become the master saturation image.
void restUnitsChanged()
QColor masterCoordinateColor
Definition: ImageView.qo.h:208
bool isMasterCoordinate() const
bool isViewed() const
void setMasterSaturationImage(bool masterImage)
void close(ImageView *imageToClose)
Close the image.
void setBackgroundColor(QColor color)
Background color.
void setViewedImage(bool viewed)
Sets whether or not this is the image currently being viewed on the animator.
void makeDrag(QMouseEvent *event)
void restoreSnapshot()
RestTypes restType
Definition: ImageView.qo.h:192
QStringList frequencyUnits
Rest frequency.
Definition: ImageView.qo.h:227
void setMasterHueImage(bool masterImage)
casacore::Record displayOptionsSnapshot
Definition: ImageView.qo.h:223
QAction viewAction
Available context menu choices.
Definition: ImageView.qo.h:196
void updateFreqUnitCombo()
QAction masterCoordinateSystemAction
Definition: ImageView.qo.h:198
QColor normalColor
Regular background or master coordinate image background.
Definition: ImageView.qo.h:207
A hierarchical collection of named fields of various types.
Definition: Record.h:180
void initColorModeSettings()
bool isRaster() const
void rgbModeChanged()
Custom color for RGB image combination void setButtonColor(QColor color); QColor getButtonColor() con...
void openCloseDisplay()
Minimize/maximize the display.
void initRestSettings()
bool isRegistered() const
QAction contourAction
Definition: ImageView.qo.h:203
void imageRegistrationChanged(bool selected)
Display data has changed register/unregister status.
void setColorCombinationMode(ColorCombinationMode mode)
QColor getBackgroundColor() const
QImage * makeDragImage()
Drag and drop.
int minimumSize
Opening/closing.
Definition: ImageView.qo.h:234
void showDataOptions()
Show a color dialog where the user can choose a custom color.
void resetRestFrequency()
Reset the rest frequency back to its original value.
void viewImage(ImageView *imageToView)
An image has been selected to view on the image animator.
void setRegistered(bool selected)
Setters.
const int NOT_VIEWED_BORDER_SIZE
Definition: ImageView.qo.h:243
static const QString DROP_ID
Definition: ImageView.qo.h:85
ImageView(QtDisplayData *data, QWidget *parent=0)
virtual void mouseMoveEvent(QMouseEvent *event)
Implemented to support drag and drop.
void masterHueImageSelected(ImageView *imageView)
This ImageView has become the master hue image.
const int SIZE_EXPANDED
Definition: ImageView.qo.h:236
QtDisplayData * getData() const
void displayTypeChanged()
Change to raster/contour/vector/marker.
QStringList wavelengthUnits
Definition: ImageView.qo.h:228
void restFrequencyChanged()
User has changed the rest frequency.
void saveSnapshot()
Snapshots.
void initDisplayType()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
QAction rasterAction
Definition: ImageView.qo.h:202
bool isRGBImage() const
QString getName() const
Accessors.
QColor getDisplayedColor() const
QMap< DisplayType, QString > displayTypeMap
Definition: ImageView.qo.h:188
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
QAction closeAction
Definition: ImageView.qo.h:197
void showDataDisplayOptions(QtDisplayData *imageData)
User has requested to view the display properties of this data.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
ImageView operator=(const ImageView &other)