casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageScroll.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 #ifndef IMAGESCROLL_QO_H
26 #define IMAGESCROLL_QO_H
27 
29 #include <display/QtViewer/ImageManager/ImageScroll.ui.h>
30 #include <QWidget>
31 
32 class QDragMoveEvent;
33 class QDragEnterEvent;
34 class QDropEvent;
35 class QMimeData;
36 class QSpacerItem;
37 class QFrame;
38 
39 namespace casa {
40 
41  class QtDisplayData;
42 
47  class ImageScroll : public QWidget {
48  Q_OBJECT
49 
50  public:
51  ImageScroll(QWidget *parent = 0);
52 
53  //Accessors
54  QList<ImageView*> getViews();
55  //Returncds the image in charge of defining the hue color..
56  QtDisplayData* getHueMaster() const;
57  //Returns the image in charge of defining the saturation color.
60 
61  //Returns the number of open images.
62  int getImageCount() const;
63  //Returns the number of registered images
64  int getRegisteredCount() const;
65  //Returns the registeration index of the image with open index given by dropIndex.
66  int getRegisteredIndex( int dropIndex, bool rastersOnly = false )const;
67  //Returns the open index of the image.
68  int getIndex( ImageView* view );
69 
70  //Setters
71  //Index of image currently being viewed in animator.
72  void setViewedImage( int registrationIndex );
73  void setRegisterAll( bool selectAll);
75  //Called from the ImageManagerDialog, when a new master coordinate
76  //image has been selected programmatically by the viewer. Percolates
77  //the selection downward to the ImageView so it can be displayed.
78  void setMasterCoordinateImage( QString masterCoordinateImageName );
79 
80  //ImageManipulation
81  void closeImages();
82  void addDisplayDataLayout( QtDisplayData* displayData, int dropIndex);
83  void addImageView( QtDisplayData* displayData, bool registered,
85  int dropIndex = -1, bool masterCoordinate = false,
86  bool masterSaturation = false, bool masterHue = false,
87  QColor rgbColor= QColor("#D3D3D3"));
88  void removeDisplayDataLayout( QtDisplayData* displayData );
89  void removeImageView( QtDisplayData* displayData );
90  virtual ~ImageScroll();
91 
92  signals:
93  //An display data was closed.
94  void displayDataRemoved( QtDisplayData* imageData, bool );
95  //A display data was added.
96  void displayDataAdded( QtDisplayData* imageData );
97  //Change from raster, contour,vector, marker
98  void displayTypeChanged( ImageView* displayData );
99  //Image was moved by the user
100  void imageOrderingChanged( QtDisplayData* imageData, int dropIndex,
101  bool registered, bool masterCoordinate/*, bool masterSaturation,
102  bool masterHue, QColor rgbColor */);
103  //The new display data became in charge of setting the coordinate system.
104  void masterCoordinateImageChanged( QtDisplayData* imageData );
105  //Show the display options for this data.
106  void showDataDisplayOptions( QtDisplayData* imageName );
107  //Either register/unregister occured for the ImageView.
108  void registrationChange( ImageView* imageView );
109  void animateToImage( int index );
110 
111  protected:
112  void dragEnterEvent( QDragEnterEvent* enterEvent );
113  void dropEvent( QDropEvent* dropEvent );
114  void dragMoveEvent( QDragMoveEvent* dragMoveEvent );
115  void dragLeaveEvent( QDragLeaveEvent* leaveEvent );
116 
117  private slots:
118  //Close this particular image view.
119  void closeImage( ImageView* imageView, bool deleteImage = true );
120  //Called by an ImageView when it has been selected to be the new
121  //master coordinate image. Percolates the event upward to the the
122  //ImageManagerDialog.
123  void coordinateSystemChanged( ImageView* imageData );
124  //There should be no display data used to set the master coordinate
125  //system.
126  void masterCoordinateClear();
127  //The master image used to determine hue has changed.
128  void hueImageChanged( ImageView* imageData );
129  //The master image used to determine color saturation has changed.
130  void saturationImageChanged( ImageView* imageData );
131  void viewImage( ImageView* imageView );
132 
133  private:
134  ImageScroll( const ImageScroll& other );
135  ImageScroll operator=( const ImageScroll& other );
136 
137  //casacore::Coordinate system master image
138  void resetMasterCoordinate( ImageView* newMaster );
139 
140  //Adding/removing images from the layout.
141  void addImage( ImageView* imageView, int dropIndex = -1 );
142  void removeImageViewLayout( ImageView* imageView );
143  void addImageViewLayout( ImageView* viewerImage, int dropIndex);
144 
145  //Returns the index of a particular image.
146  int findImageView( QString name, bool exactMatch = true );
147  QString removeSuffixes( QString name ) const;
148  QString stripBold( QString name ) const;
149 
150  //Drag and drop
151  int getDropIndex( int dropY );
152  void insertDragMarker( int position );
153  void removeDragMarker();
154  int getDragMarkerLayoutIndex() const;
155  ImageView* getMimeImageView( const QMimeData* mimeData );
156 
157  QSpacerItem* spacer;
158  //Horizontal line showing where the image will be placed when it is reordered.
159  QFrame* dropMarker;
160  const int LAYOUT_SPACING;
161  const int LAYOUT_MARGIN;
162  QList<ImageView*> images;
163  QWidget* scrollWidget;
164  Ui::ImageScrollClass ui;
165  };
166 
167 }
168 
169 #endif // IMAGESCROLL_QO_H
void hueImageChanged(ImageView *imageData)
The master image used to determine hue has changed.
Displays properties of an image for manipulation such as color and display type.
Definition: ImageView.qo.h:48
int getImageCount() const
Returns the number of open images.
QtDisplayData * getHueMaster() const
Returncds the image in charge of defining the hue color.
QWidget * scrollWidget
const int LAYOUT_MARGIN
int getDragMarkerLayoutIndex() const
Ui::ImageScrollClass ui
ImageScroll(QWidget *parent=0)
void closeImage(ImageView *imageView, bool deleteImage=true)
Close this particular image view.
void removeImageViewLayout(ImageView *imageView)
void imageOrderingChanged(QtDisplayData *imageData, int dropIndex, bool registered, bool masterCoordinate)
Image was moved by the user.
const int LAYOUT_SPACING
void dropEvent(QDropEvent *dropEvent)
QList< ImageView * > images
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void addImageView(QtDisplayData *displayData, bool registered, ImageView::ColorCombinationMode mode, int dropIndex=-1, bool masterCoordinate=false, bool masterSaturation=false, bool masterHue=false, QColor rgbColor=QColor("#D3D3D3"))
QtDisplayData * getSaturationMaster() const
Returns the image in charge of defining the saturation color.
void setViewedImage(int registrationIndex)
Setters Index of image currently being viewed in animator.
void masterCoordinateClear()
There should be no display data used to set the master coordinate system.
int getRegisteredCount() const
Returns the number of registered images.
QString stripBold(QString name) const
int getRegisteredIndex(int dropIndex, bool rastersOnly=false) const
Returns the registeration index of the image with open index given by dropIndex.
void dragMoveEvent(QDragMoveEvent *dragMoveEvent)
void closeImages()
ImageManipulation.
void registrationChange(ImageView *imageView)
Either register/unregister occured for the ImageView.
void displayDataAdded(QtDisplayData *imageData)
A display data was added.
void masterCoordinateImageChanged(QtDisplayData *imageData)
The new display data became in charge of setting the coordinate system.
int findImageView(QString name, bool exactMatch=true)
Returns the index of a particular image.
virtual ~ImageScroll()
QString removeSuffixes(QString name) const
void viewImage(ImageView *imageView)
void setRegisterAll(bool selectAll)
void showDataDisplayOptions(QtDisplayData *imageName)
Show the display options for this data.
void addImageViewLayout(ImageView *viewerImage, int dropIndex)
void setMasterCoordinateImage(QString masterCoordinateImageName)
Called from the ImageManagerDialog, when a new master coordinate image has been selected programmatic...
QList< ImageView * > getViews()
Accessors.
void displayDataRemoved(QtDisplayData *imageData, bool)
An display data was closed.
void saturationImageChanged(ImageView *imageData)
The master image used to determine color saturation has changed.
int getIndex(ImageView *view)
Returns the open index of the image.
void resetMasterCoordinate(ImageView *newMaster)
casacore::Coordinate system master image
void removeImageView(QtDisplayData *displayData)
void setColorCombinationMode(ImageView::ColorCombinationMode mode)
void addImage(ImageView *imageView, int dropIndex=-1)
Adding/removing images from the layout.
void displayTypeChanged(ImageView *displayData)
Change from raster, contour,vector, marker.
void removeDisplayDataLayout(QtDisplayData *displayData)
void insertDragMarker(int position)
void coordinateSystemChanged(ImageView *imageData)
Called by an ImageView when it has been selected to be the new master coordinate image.
ImageScroll operator=(const ImageScroll &other)
QSpacerItem * spacer
void dragEnterEvent(QDragEnterEvent *enterEvent)
void dragLeaveEvent(QDragLeaveEvent *leaveEvent)
void addDisplayDataLayout(QtDisplayData *displayData, int dropIndex)
int getDropIndex(int dropY)
Drag and drop.
Displays a list of images, allowing the user to reorder them.
ImageView * getMimeImageView(const QMimeData *mimeData)
void animateToImage(int index)
QFrame * dropMarker
Horizontal line showing where the image will be placed when it is reordered.
QtDisplayData * getCoordinateMaster() const