ImageScroll.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 #ifndef IMAGESCROLL_QO_H
00026 #define IMAGESCROLL_QO_H
00027 
00028 #include <display/QtViewer/ImageManager/ImageView.qo.h>
00029 #include <display/QtViewer/ImageManager/ImageScroll.ui.h>
00030 #include <QtGui/QWidget>
00031 
00032 class QDragMoveEvent;
00033 class QDragEnterEvent;
00034 class QDropEvent;
00035 class QMimeData;
00036 class QSpacerItem;
00037 class QFrame;
00038 
00039 namespace casa {
00040 
00041         class QtDisplayData;
00042 
00047         class ImageScroll : public QWidget {
00048                 Q_OBJECT
00049 
00050         public:
00051                 ImageScroll(QWidget *parent = 0);
00052 
00053                 //Accessors
00054                 QList<ImageView*> getViews();
00055                 //Returncds the image in charge of defining the hue color..
00056                 QtDisplayData* getHueMaster() const;
00057                 //Returns the image in charge of defining the saturation color.
00058                 QtDisplayData* getSaturationMaster() const;
00059                 QtDisplayData* getCoordinateMaster() const;
00060 
00061                 //Returns the number of open images.
00062                 int getImageCount() const;
00063                 //Returns the number of registered images
00064                 int getRegisteredCount() const;
00065                 //Returns the registeration index of the image with open index given by dropIndex.
00066                 int getRegisteredIndex( int dropIndex, bool rastersOnly = false )const;
00067                 //Returns the open index of the image.
00068                 int getIndex( ImageView* view );
00069 
00070                 //Setters
00071                 //Index of image currently being viewed in animator.
00072                 void setViewedImage( int registrationIndex );
00073                 void setRegisterAll( bool selectAll);
00074                 void setColorCombinationMode( ImageView::ColorCombinationMode mode );
00075                 //Called from the ImageManagerDialog, when a new master coordinate
00076                 //image has been selected programmatically by the viewer.  Percolates
00077                 //the selection downward to the ImageView so it can be displayed.
00078                 void setMasterCoordinateImage( QString masterCoordinateImageName );
00079 
00080                 //ImageManipulation
00081                 void closeImages();
00082                 void addDisplayDataLayout( QtDisplayData* displayData, int dropIndex);
00083                 void addImageView( QtDisplayData* displayData, bool registered,
00084                                 ImageView::ColorCombinationMode mode,
00085                                 int dropIndex = -1, bool masterCoordinate = false,
00086                                 bool masterSaturation = false, bool masterHue = false,
00087                                 QColor rgbColor= QColor("#D3D3D3"));
00088                 void removeDisplayDataLayout( QtDisplayData* displayData );
00089                 void removeImageView( QtDisplayData* displayData );
00090                 virtual ~ImageScroll();
00091 
00092         signals:
00093                 //An display data was closed.
00094                 void displayDataRemoved( QtDisplayData* imageData, bool );
00095                 //A display data was added.
00096                 void displayDataAdded( QtDisplayData* imageData );
00097                 //Change from raster, contour,vector, marker
00098                 void displayTypeChanged( ImageView* displayData );
00099                 //Image was moved by the user
00100                 void imageOrderingChanged( QtDisplayData* imageData, int dropIndex,
00101                                 bool registered, bool masterCoordinate/*, bool masterSaturation,
00102                                 bool masterHue, QColor rgbColor */);
00103                 //The new display data became in charge of setting the coordinate system.
00104                 void masterCoordinateImageChanged( QtDisplayData* imageData );
00105                 //Show the display options for this data.
00106                 void showDataDisplayOptions( QtDisplayData* imageName );
00107                 //Either register/unregister occured for the ImageView.
00108                 void registrationChange( ImageView* imageView );
00109                 void animateToImage( int index );
00110 
00111         protected:
00112                 void dragEnterEvent( QDragEnterEvent* enterEvent );
00113                 void dropEvent( QDropEvent* dropEvent );
00114                 void dragMoveEvent( QDragMoveEvent* dragMoveEvent );
00115                 void dragLeaveEvent( QDragLeaveEvent* leaveEvent );
00116 
00117         private slots:
00118                 //Close this particular image view.
00119                 void closeImage( ImageView* imageView, bool deleteImage = true );
00120                 //Called by an ImageView when it has been selected to be the new
00121                 //master coordinate image.  Percolates the event upward to the the
00122                 //ImageManagerDialog.
00123                 void coordinateSystemChanged( ImageView* imageData );
00124                 //There should be no display data used to set the master coordinate
00125                 //system.
00126                 void masterCoordinateClear();
00127                 //The master image used to determine hue has changed.
00128                 void hueImageChanged( ImageView* imageData );
00129                 //The master image used to determine color saturation has changed.
00130                 void saturationImageChanged( ImageView* imageData );
00131                 void viewImage( ImageView* imageView );
00132 
00133         private:
00134                 ImageScroll( const ImageScroll& other );
00135                 ImageScroll operator=( const ImageScroll& other );
00136 
00137                 //Coordinate system master image
00138                 void resetMasterCoordinate( ImageView* newMaster );
00139 
00140                 //Adding/removing images from the layout.
00141                 void addImage( ImageView* imageView, int dropIndex = -1 );
00142                 void removeImageViewLayout( ImageView* imageView );
00143                 void addImageViewLayout( ImageView* viewerImage, int dropIndex);
00144 
00145                 //Returns the index of a particular image.
00146                 int findImageView( QString name, bool exactMatch = true );
00147                 QString removeSuffixes( QString name ) const;
00148                 QString stripBold( QString name ) const;
00149 
00150                 //Drag and drop
00151                 int getDropIndex( int dropY );
00152                 void insertDragMarker( int position );
00153                 void removeDragMarker();
00154                 int getDragMarkerLayoutIndex() const;
00155                 ImageView* getMimeImageView( const QMimeData* mimeData );
00156 
00157                 QSpacerItem* spacer;
00158                 //Horizontal line showing where the image will be placed when it is reordered.
00159                 QFrame* dropMarker;
00160                 const int LAYOUT_SPACING;
00161                 const int LAYOUT_MARGIN;
00162                 QList<ImageView*> images;
00163                 QWidget* scrollWidget;
00164                 Ui::ImageScrollClass ui;
00165         };
00166 
00167 }
00168 
00169 #endif // IMAGESCROLL_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