QtDisplayPanelGui.qo.h

Go to the documentation of this file.
00001 //# QtDisplayPanelGui.qo.h: Qt implementation of main viewer display window.
00002 //# with surrounding Gui functionality
00003 //# Copyright (C) 2005,2009
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id: QtDisplayPanelGui.qo.h,v 1.7 2006/10/10 21:42:05 dking Exp $
00028 
00029 #ifndef QTDISPLAYPANELGUI_H
00030 #define QTDISPLAYPANELGUI_H
00031 
00032 #include <casa/aips.h>
00033 #include <graphics/X11/X_enter.h>
00034 #  include <QtCore>
00035 #  include <QtGui>
00036 #include <QTextEdit>
00037 #include <QHash>
00038 #include <QFont>
00039 
00040 //#dk Be careful to put *.ui.h within X_enter/exit bracket too,
00041 //#   because they'll have Qt includes.
00042 //#   E.g. <QApplication> needs the X11 definition of 'Display'
00043 #include <graphics/X11/X_exit.h>
00044 #include <casaqt/QtUtilities/QtPanelBase.qo.h>
00045 #include <display/QtViewer/QtDisplayPanel.qo.h>
00046 #include <display/QtViewer/DisplayDataHolder.h>
00047 #include <display/region/QtRegionDock.qo.h>
00048 #include <display/Utilities/Lowlevel.h>
00049 #include <display/DisplayDatas/DisplayDataOptions.h>
00050 #include <display/Utilities/ImageProperties.h>
00051 #include <display/Utilities/StatusSink.h>
00052 
00053 namespace casa { //# NAMESPACE CASA - BEGIN
00054 
00055         namespace viewer {
00056                 class Preferences;
00057                 class CleanGui;
00058         }
00059 
00060         class String;
00061         class QtViewer;
00062         class QtViewerPrintGui;
00063         class QtMouseToolBar;
00064         class QtCanvasManager;
00065         class QtAnnotatorGui;
00066         class MakeMask;
00067         class FileBox;
00068         class MakeRegion;
00069         class QtProfile;
00070         class QtDisplayData;
00071         class TrackBox;
00072         class QtRegionManager;
00073         class QtRegionShapeManager;
00074         class QtDataManager;
00075         class QtExportManager;
00076         class QtDataOptionsPanel;
00077         class AnimatorHolder;
00078         class BinPlotWidget;
00079         class HistogramMain;
00080         class Fit2DTool;
00081         class SlicerMainWindow;
00082         class ColorHistogram;
00083         class ImageManagerDialog;
00084         class QtDisplayPanelGui;
00085     class CursorTrackingHolder;
00086     class AboutDialogViewer;
00087 
00088         template <class T> class ImageInterface;
00089 
00090         class LinkedCursorEH : public QObject, public WCRefreshEH {
00091                 Q_OBJECT
00092         public:
00093                 LinkedCursorEH( QtDisplayPanelGui *dpg );
00094                 virtual ~LinkedCursorEH( );
00095                 void operator ()(const WCRefreshEvent &ev);
00096                 void addSource( QtDisplayPanelGui *src, QColor color );
00097                 void removeSource( QtDisplayPanelGui *src );
00098         private slots:
00099                 void boundary(QtDisplayPanel::CursorBoundaryCondition);
00100                 void position(viewer::Position);
00101         private:
00102                 struct cursor_info_t {
00103                         cursor_info_t(QColor c) : color(c) { }
00104                         QColor color;
00105                         viewer::Position pos;
00106                 };
00107                 typedef std::map<QtDisplayPanelGui*,cursor_info_t> sources_list_t;
00108                 sources_list_t cursor_sources;
00109                 QtDisplayPanelGui *dpg_;
00110         };
00111 
00112 
00113 // <summary>
00114 // The main display window for the Qt version of the viewer.
00115 // </summary>
00116 
00117         class QtDisplayPanelGui : public QtPanelBase, public viewer::StatusSink {
00118 
00119                 Q_OBJECT;       //# Allows slot/signal definition.  Must only occur in
00120                 //# implement/.../*.h files; also, makefile must include
00121                 //# name of this file in 'mocs' section.
00122 
00123         protected:
00124                 friend class QtViewer;
00125                 QtDisplayPanelGui( QtViewer *v, QWidget *parent=0, std::string rcstr="dpg",
00126                                    const std::list<std::string> &args = std::list<std::string>( ) );
00127                 QtDisplayPanelGui( const QtDisplayPanelGui *other, QWidget *parent=0, std::string rcstr="dpg",
00128                                    const std::list<std::string> &args = std::list<std::string>( ) );
00129 
00130         public:
00131                 enum SCRIPTING_OPTION { INTERACT, SETOPTIONS };
00132 
00133                 ~QtDisplayPanelGui();
00134 
00135                 // access to our viewer
00136                 QtViewer *viewer( ) const {
00137                         return v_;
00138                 }
00139                 int buttonToolState(const std::string &tool) const;
00140 
00141                 // access our logger...
00142                 LogIO &logIO( ) {
00143                         return logger;
00144                 }
00145 
00146                 // enter status information...
00147                 void status( const std::string &s, const std::string &type="info" );
00148 
00149                 // access to graphics panel 'base'....
00150                 QtDisplayPanel* displayPanel() { return qdp_; }
00151                 const QtDisplayPanel* displayPanel() const { return qdp_; }
00152 
00153                 typedef std::list<viewer::Region*> region_list_t;
00154                 region_list_t regions( ) {
00155                         return regionDock_ ? regionDock_->regions( ) : std::list<viewer::Region*>( );
00156                 }
00157                 // region coupling between QtRegionDock and QtRegionSource(s)...
00158                 void revokeRegion( viewer::Region *r ) {
00159                         // may be null at destruction time...
00160                         if ( qdp_ ) qdp_->revokeRegion(r);
00161                 }
00162 
00163 
00164                 // public toolbars, for inserting custom buttons.
00165                 QToolBar* customToolBar;        //# limited room
00166                 QToolBar* customToolBar2;       //# wider -- in its own row.
00167 
00168                 virtual void setStatsPrint(Bool printStats=True) {
00169                         qdp_->printStats = printStats;
00170                 }
00171 
00172                 virtual void setUseRegion(Bool useRegion=True) {
00173                         qdp_->useRegion = useRegion;
00174                 }
00175 
00176                 virtual bool supports( SCRIPTING_OPTION option ) const;
00177                 virtual QVariant start_interact( const QVariant &input, int id );
00178                 virtual QVariant setoptions( const QMap<QString,QVariant> &input, int id);
00179 
00180                 // At least for now, colorbars can only be placed horizontally or
00181                 // vertically, identically for all display panels.
00182                 // This returns the current value.
00183                 Bool colorBarsVertical() {
00184                         return colorBarsVertical_;
00185                 }
00186 
00187                 //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00188                 //# DisplayData functionality brought down from QtViewerBase
00189                 //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00190                 // Create a new QtDD from given parameters, and add to internal DD list.
00191                 // (For now) QtViewerBase retains 'ownership' of the QtDisplayData; call
00192                 // removeDD(qdd) to delete it.
00193                 // Unless autoregister is set False, all open DisplayPanels will
00194                 // register the DD for display.
00195                 // Check return value for 0, or connect to the createDDFailed()
00196                 // signal, to handle failure.
00197                 QtDisplayData* createDD( String path, String dataType, String displayType,
00198                                 Bool autoRegister=True, int insertPosition = -1,
00199                                 bool masterCoordinate = false, bool masterSaturation = false,
00200                                 bool masterHue = false,
00201                         const viewer::DisplayDataOptions &ddo=viewer::DisplayDataOptions(),
00202                         const viewer::ImageProperties &props=viewer::ImageProperties( ));
00203 
00204                 // Removes the QDD from the list and deletes it (if it existed --
00205                 // Return value: whether qdd was in the list in the first place).
00206                 virtual Bool removeDD(QtDisplayData*& qdd);
00207 
00208                 // retrieve a copy of the current DD list.
00209                 //List<QtDisplayData*> dds() { return qdds_;  }
00210                 DisplayDataHolder::DisplayDataIterator beginDD() const;
00211                 DisplayDataHolder::DisplayDataIterator endDD() const;
00212                 Bool isEmptyDD() const;
00213                 // return the number of user DDs.
00214                 //Int nDDs() { return qdds_.len();  }
00215 
00216                 // return a list of DDs that are registered on some panel.
00217                 //List<QtDisplayData*> registeredDDs();
00218 
00219                 // return a list of DDs that exist but are not registered on any panel.
00220                 List<QtDisplayData*> unregisteredDDs();
00221 
00222                 // retrieve a DD with given name (0 if none).
00223                 QtDisplayData* dd(const std::string& name);
00224                 // retrieve the controlling DD...
00225                 QtDisplayData* dd( );
00226 
00227                 // Check that a given DD is on the list.  Use qdd pointer or its name.
00228                 //<group>
00229                 Bool ddExists(QtDisplayData* qdd);
00230                 //Bool ddExists(const String& name) { return dd(name)!=0;  }
00231                 //</group>
00232 
00233                 // Latest error (in createDD, etc.)
00234                 virtual String errMsg() {
00235                         return errMsg_;
00236                 }
00237 
00238                 //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00239                 //# DisplayData functionality brought down from QtViewerBase
00240                 //# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
00241 
00242                 // the QtDBusViewerAdaptor can handle loading & registering data itself,
00243                 // but to connect up extra functionality, the upper-level QtDisplayPanelGui
00244                 // (or in the current case, the derived QtCleanPanelGui) would have to be
00245                 // notified that data has been added. This will allow it to set up the
00246                 // callbacks for drawing regions...
00247                 virtual void addedData( QString type, QtDisplayData * );
00248 
00249                 QtDataManager* dataMgr() {
00250                         return qdm_;
00251                 }
00252 
00253                 // return the id for viewer state for this type of panel
00254                 virtual std::string rcid( ) const {
00255                         return rcid_;
00256                 }
00257 
00258                 viewer::QtRegionDock *regionDock( ) {
00259                         return regionDock_;
00260                 }
00261                 int numFrames( );
00262 
00263                 // load casa (or DS9?) region files...
00264                 void loadRegions( const std::string &path, const std::string &datatype );
00265                 // zero length string indicates OK!
00266                 std::string outputRegions( std::list<viewer::QtRegionState*> regions, std::string file, std::string format, std::string ds9_csys="pixel" );
00267 
00268                 bool useNewRegions( ) const {
00269                         return use_new_regions;
00270                 }
00271 
00272                 // called to indicate application activation state... true -> activated, false -> deactivated
00273                 void activate( bool );
00274 
00275                 // display cursor information for the specified point (in world coordinates)
00276                 void updateCursorInfo( WorldCanvas *wc, Quantity x, Quantity y );
00277                 typedef std::pair<QString, SHARED_PTR<ImageInterface<float> > > OverplotInterface;
00278 
00279         public slots:
00280 
00281                 // At least for now, colorbars can only be placed horizontally or vertically,
00282                 // identically for all display panels.  This sets that state for everyone.
00283                 // Sends out colorBarOrientationChange signal when the state changes.
00284                 virtual void setColorBarOrientation(Bool vertical);
00285 
00286                 virtual QtDisplayPanelGui *createNewPanel( );
00287 
00288                 virtual void showDataManager();
00289                 virtual void hideDataManager();
00290 
00291                 virtual void showExportManager();
00292                 virtual void hideExportManager();
00293 
00294                 virtual void showDataOptionsPanel();
00295                 virtual void hideDataOptionsPanel();
00296 
00297                 virtual void showPreferences( );
00298 
00299                 virtual void removeAllDDs();
00300 
00301                 // Show/hide display panel's auxiliary windows.
00302                 //<group>
00303                 virtual void showPrintManager();
00304                 virtual void hidePrintManager();
00305 
00306                 virtual void showCanvasManager();
00307                 virtual void hideCanvasManager();
00308 
00309                 virtual void showRegionManager();
00310                 virtual void hideRegionManager();
00311 
00312                 virtual void showShapeManager();
00313                 virtual void hideShapeManager();
00314 
00315                 virtual void showAnnotatorPanel();
00316                 virtual void hideAnnotatorPanel();
00317 
00318                 virtual void showFileBoxPanel();
00319                 virtual void hideFileBoxPanel();
00320 
00321                 virtual void showMakeRegionPanel();
00322                 virtual void hideMakeRegionPanel();
00323 
00324                 virtual void showImageProfile();
00325                 virtual void hideImageProfile();
00326                 virtual void refreshImageProfile();
00327                 void resetImageProfile();
00328 
00329                 virtual void hideAllSubwindows();
00330                 virtual void hideImageMenus();
00331 
00332                 //Increments the channel in the images from the start channel
00333                 //to the end channel.
00334                 void movieChannels( int startChannel, int endChannel );
00335                 void movieChannels( int channel, bool forward, int stepSize, int channelStart, int channelEnd  );
00336                 void movieStop();
00337                 void registerAllDDs();
00338                 void unregisterAllDDs();
00339                 virtual void showStats(const String&);
00340                 virtual void hideStats();
00341                 //</group>
00342 
00343                 // add a new DD
00344                 virtual QtDisplayData* addDD(String path, String dataType, String displayType, Bool autoRegister=True, Bool tmpDtata=False, SHARED_PTR<ImageInterface<Float> > img = SHARED_PTR<ImageInterface<Float> >());
00345                 // go to a specifc channel
00346                 virtual void doSelectChannel(int channelIndex);
00347 
00348                 // (Attempts to) restore panel state from named file.
00349                 virtual Bool restorePanelState(String filename);
00350 
00351                 virtual void trackingMoved(Qt::DockWidgetArea);
00352                 virtual void animatorMoved(Qt::DockWidgetArea);
00353                 virtual void regionMoved(Qt::DockWidgetArea);
00354                 virtual void mousetoolbarMoved(bool);
00355 
00356                 // note that 'key' is prefixed with something like "viewer.dpg."...
00357                 // for both get and put...
00358                 std::string getrc( const std::string &key );
00359                 void putrc( const std::string &key, const std::string &val );
00360                 void showMomentsCollapseImageProfile();
00361                 void showSpecFitImageProfile();
00362                 void disconnectHistogram();
00363                 void ddClose( QtDisplayData*& removeDD);
00364                 void ddOpen( const String& path, const String& dataType,
00365                                 const String& displayType, int insertPosition = -1,
00366                                 bool register = true, bool masterCoordinate = false,
00367                                 bool masterSaturation = false, bool masterHue = false);
00368 
00369                 // retrieve the identifier string for this QtDisplayPanelGui...
00370                 std::string id( ) const {
00371                         return id_;
00372                 }
00373 
00374                 void unlinkCursorTracking(QtDisplayPanelGui*);
00375                 void linkCursorTracking(QtDisplayPanelGui*,QColor);
00376 
00377         signals:
00378 
00379                 void regionChange( viewer::Region *, std::string );
00380 
00381                 void axisToolUpdate( QtDisplayData *controlling_dd );
00382 
00383                 void colorBarOrientationChange();
00384 
00385                 //Notification that the frame has changed.
00386                 void frameChanged( int );
00387 
00388                 //Profile Overplots
00389                 void overlay(QList<OverplotInterface>);
00390 
00391                 void createDDFailed(String errMsg, String path, String dataType,
00392                                     String displayType);
00393 
00394                 // The DD now exists, and is on QtViewerBase's list.
00395                 // autoregister tells DPs whether they are to register the DD.
00396                 // ***** dd is added to the world canvas holder during *****
00397                 // ***** the processing of this event...               *****
00398                 void ddCreated(QtDisplayData*, Bool autoRegister, int insertPosition, Bool csMaster);
00399 
00400                 // The DD is no longer on QtViewerBase's list, but is not
00401                 // destroyed until after the signal.
00402                 // ***** dd is removed from the world canvas holder    *****
00403                 // ***** during the processing of this event...        *****
00404                 //void ddRemoved(QtDisplayData*);
00405 
00406                 void closed( const QtDisplayPanelGui * );
00407 
00408                 void cursorBoundary( QtDisplayPanel::CursorBoundaryCondition );
00409                 void cursorPosition( viewer::Position );
00410 
00411         protected slots:
00412 
00413                 virtual void close( );
00414 
00415                 virtual void quit( );
00416 
00417                 //# overrides of base QMainWindow slots
00418 
00419                 void hideEvent(QHideEvent* ev) {
00420                         // Note: If the display panel is iconified or the user changes
00421                         // desktops, isVisible() will remain true here (surprising, but
00422                         // useful -- see isVisible() doc).  Otherwise, in this context,
00423                         // [I believe] we can assume the display panel has been _closed_;
00424                         // in that case, we want to 'close' the auxiliary windows as well.
00425                         // (Note that there is no 'closeEvent' per se).
00426                         if(!isVisible()) hideAllSubwindows();
00427 
00428                         QMainWindow::hideEvent(ev);
00429                 }
00430 
00431 
00432                 //# purely internal slots
00433 
00434                 /* virtual void toggleAnimExtras_(); */
00435                 /* virtual void setAnimExtrasVisibility_();   */
00436 
00437                 //# slots reacting to signals from the basic QtDisplayPanel.
00438                 //# Protected, connected by this object itself.
00439 
00440                 // Respond to QDP::registrationChange() signal
00441                 virtual void ddRegChange_();
00442 
00443                 // Respond to registration/close menu clicks.
00444                 //<group>
00445                 virtual void ddRegClicked_();
00446                 virtual void ddUnregClicked_();
00447                 virtual void ddCloseClicked_();
00448                 //</group>
00449 
00450                 // Reflect animator state [changes] in gui.
00451                 virtual void updateAnimUi_();
00452 
00453                 // These react to fwd/reverse Play buttons.  They allow a single
00454                 // play button to be used to toggle between play and stop.
00455                 //<group>
00456                 virtual void fwdPlayChannelMovie_( ) {
00457                         if(qdp_->animating()>0) qdp_->stopChannelMovie( );
00458                         else qdp_->fwdPlayChannelMovie( );
00459                 }
00460                 virtual void fwdPlayImageMovie_( ) {
00461                         if(qdp_->animating()>0) qdp_->stopImageMovie( );
00462                         else qdp_->fwdPlayImageMovie( );
00463                 }
00464 
00465                 virtual void revPlayChannelMovie_( ) {
00466                         if(qdp_->animating()<0) qdp_->stopChannelMovie( );
00467                         else qdp_->revPlayChannelMovie( );
00468                 }
00469                 virtual void revPlayImageMovie_() {
00470                         if(qdp_->animating()<0) qdp_->stopImageMovie( );
00471                         else qdp_->revPlayImageMovie();
00472                 }
00473                 //</group>
00474 
00475 
00476                 // Display tracking data gathered by underlying panel.
00477                 virtual void displayTrackingData_(Record trackingRec);
00478 
00479                 // Reacts to QDP registration change signal.  If necessary, changes
00480                 // the set of cursor position tracking boxes being displayed in
00481                 // trkgWidget_ (creating new TrackBoxes as necessary).  A TrackBox
00482                 // will be shown for each qdd in qdp_->registeredDDs() where
00483                 // qdd->usesTracking() (in registration order).
00484                 virtual void arrangeTrackBoxes_();
00485 
00486                 // Deletes the TrackBox for the given QDD, if it exists.  (Deletion
00487                 // automatically removes it from the trkgWidget_ and its layout).
00488                 // Connected to the ddRemoved() signal of QtViewerBase.
00489                 virtual void deleteTrackBox_(QtDisplayData* qdd);
00490 
00491 
00492 
00493                 // Brings up dialog for saving display panel state: reg'd DDs, their
00494                 // options, etc. Triggered by dpSaveAct_.
00495                 virtual void savePanelState_();
00496 
00497                 // Brings up dialog for restore file, attempts restore.
00498                 // Triggered by dpRstrAct_.
00499                 virtual void restorePanelState_();
00500 
00501 
00502                 // Responds to qdp_->creatingRstrDoc(QDomDocument*) signal.
00503                 // (Recall that qdp_ is unaware of this gui).
00504                 // Adds gui state to the QDomDocument qdp has created.
00505                 virtual void addGuiState_(QDomDocument*);
00506 
00507                 // Responds to qdp_->restoring(QDomDocument*) signal.
00508                 // Sets gui-specific state (most notably, overall window size).
00509                 virtual void restoreGuiState_(QDomDocument*);
00510 
00511         protected:
00512 
00513                 LogIO logger;
00514                 static bool logger_did_region_warning;
00515 
00516                 // Existing user-visible QDDs
00517                 //List<QtDisplayData*> qdds_;
00518                 DisplayDataHolder* displayDataHolder;
00519                 String errMsg_;
00520 
00521 
00522                 QtDataManager* qdm_;            //# The window for loading data.
00523                 QtExportManager* qem_;    //# The window for exporting images.
00524                 QtDataOptionsPanel* qdo_;       //# The window for controlling data display.
00525 
00526                 // Keeps current data directory in sync between
00527                 // DataManager window and save-restore dialogs.
00528                 virtual Bool syncDataDir_(String filename);
00529 
00530                 virtual void updateDDMenus_(Bool doCloseMenu = True);
00531 
00532 
00533                 // scripted (via dbus) panels should override the closeEvent( ) and hide the gui
00534                 // instead of deleting it when it was created via a dbus script...
00535                 void closeEvent(QCloseEvent *event);
00536 
00537                 //# ----------------------------DATA----------------------------------
00538 
00539                 // At least for now, colorbars can only be placed horizontally or vertically,
00540                 // identically for all display panels.  Here is where that state is kept for
00541                 // everyone.
00542                 Bool colorBarsVertical_;
00543 
00544                 QtViewer* v_;                   //# (Same viewer as qdp_'s)
00545                 QtDisplayPanel* qdp_;   //# Central Widget this window operates.
00546                 QtViewerPrintGui* qpm_; //# Print dialog for this display panel.
00547                 QtCanvasManager* qcm_;  //# display panel options window.
00548                 //QtAnnotatorGui* qap_;
00549                 MakeMask* qap_;
00550                 FileBox* qfb_;
00551                 MakeRegion* qmr_;
00552                 QtRegionManager* qrm_;      //# Region manager window.
00553                 QtRegionShapeManager* qsm_; //# Region shape manager window.
00554                 QTextEdit* qst_;
00555 
00556 
00557                 QtProfile* profile_;            //# Profile window
00558                 String savedTool_;              //# (for restoring left button)
00559                 QtDisplayData* profileDD_;    //# QDD currently being profiled
00560                 //# (0 if profiler is not showing).
00561 
00562                 //# GUI LAYOUT
00563 
00564                 QMenu *dpMenu_, *ddMenu_,  *ddCloseMenu_, *tlMenu_, *vwMenu_, *helpMenu_;
00565 
00566                 QAction *dpNewAct_, *printAct_, *dpOptsAct_, *dpCloseAct_, *dpQuitAct_,
00567                         *ddOpenAct_, *ddSaveAct_, *ddAdjAct_,/* *ddRegAct_, *ddCloseAct_,*/ *unzoomAct_,
00568                         *zoomInAct_, *zoomOutAct_, *annotAct_, *mkRgnAct_, *fboxAct_, *ddPreferencesAct_,
00569                         *profileAct_, *momentsCollapseAct_, *histogramAct_, *fitAct_,
00570                         *cleanAct_, *rgnMgrAct_, *shpMgrAct_, *dpSaveAct_, *dpRstrAct_, *manageImagesAct_,
00571                         *aboutAct_;
00572 
00573                 QToolBar* mainToolBar_;
00574                 QToolButton *ddRegBtn_, *ddCloseBtn_;
00575 
00576                 QtMouseToolBar* mouseToolBar_;
00577 
00578                 // connection to rc file
00579                 Casarc &rc;
00580                 // rc id for this panel type
00581                 std::string rcid_;
00582 
00583         private:
00587                 void construct_( QtDisplayPanel *newpanel, const std::list<std::string> &args );
00588 
00589                 void animationModeChanged( bool modeZ, bool channelCubes);
00590 
00591                 bool use_new_regions;
00592 
00593                 //Animating the channel
00594                 int movieChannel;
00595                 int movieChannelEnd;
00596                 int movieLast;
00597                 int movieStart;
00598                 int movieStep;
00599 
00600                 QTimer movieTimer;
00601                 void setAnimationRate();
00602                 int getBoundedChannel( int channelNumber ) const;
00603                 void updateViewedImage();
00604                 void profiledImageChange();
00605                 void generateSliceRegionUpdates();
00606                 void generateHistogramRegionUpdates();
00607 
00608                 void clearTools();
00609                 unsigned int showdataoptionspanel_enter_count;
00610                 QtDisplayPanelGui() : rc(viewer::getrc()), linkedCursorHandler(0) {  }          // (not intended for use)
00611                 QtDisplayData* processDD( String path, String dataType,
00612                                 String displayType, Bool autoRegister, int insertPosition,
00613                                 bool masterCoordinate, bool masterSaturation, bool masterHue,
00614                         QtDisplayData* qdd, const viewer::DisplayDataOptions &ddo=viewer::DisplayDataOptions() );
00615                 void connectRegionSignals(PanelDisplay* ppd);
00616                 void notifyDDRemoval( QtDisplayData* qdd );
00617                 //Management of the controlling DD
00618                 QtDisplayData* lookForExistingController();
00619                 //void setControllingDD( QtDisplayData* controlDD );
00620 
00621 
00622                 //Methods for letting the animator know whether it should display
00623                 //the image/channel animator(s) based on the number of images and
00624                 //and the number of channels in the images.
00625                 void updateFrameInformation();
00626                 void updateFrameInformationChannel();
00627                 void updateFrameInformationImage();
00628 
00629                 void updateSliceCorners( int id, const QList<double>& worldX,
00630                                          const QList<double>& worldY );
00631                 void initAnimationHolder();
00632                 void initHistogramHolder();
00633                 void hideHistogram();
00634                 void initFit2DTool();
00635                 void hideFit2DTool();
00636                 void resetHistogram( viewer::Region* qtRegion );
00637                 viewer::Region* findRegion( int id );
00638 
00639                 viewer::Preferences *preferences;
00640 
00641                 AnimatorHolder* animationHolder;
00642                 bool adjust_channel_animator;
00643                 bool adjust_image_animator;
00644                 int animationImageIndex;
00645 
00646                 HistogramMain* histogrammer;
00647                 ColorHistogram* colorHistogram;
00648                 Fit2DTool* fitTool;
00649                 SlicerMainWindow* sliceTool;
00650                 ImageManagerDialog* imageManagerDialog;
00651                 AboutDialogViewer* aboutDialog;
00652 
00653                 // interactive clean...
00654                 void initCleanTool( );
00655                 viewer::CleanGui *clean_tool;
00656 
00657 
00658                 //Docking/Dock Widgets
00659                 string addAnimationDockWidget();
00660 
00661                 QDockWidget*  histogramDockWidget_;
00662                 viewer::QtRegionDock  *regionDock_;
00663                 CursorTrackingHolder *trkgDockWidget_;
00664 
00665                 QTimer *status_bar_timer;
00666                 QString status_bar_state;
00667                 QString status_bar_stylesheet;
00668 
00669                 LinkedCursorEH *linkedCursorHandler;
00670 
00671                 std::string id_;
00672                 static std::string idGen( );
00673 
00674         private slots:
00675                 void to_image_mode( bool channelCubes );
00676                 void to_channel_mode( );
00677                 void loadRegions( const QString &path, const QString &type );
00678                 void incrementMovieChannel();
00679                 void clear_status_bar( );
00680                 void reset_status_bar( );
00681                 void controlling_dd_axis_change(String, String, String, std::vector<int> );
00682                 void initializeProfile( );
00683                 void showHistogram();
00684                 void showAboutDialog();
00685                 void showSlicer();
00686                 void resetListenerImage();
00687                 void histogramRegionChange( int, viewer::region::RegionChanges change = viewer::region::RegionChangeLabel );
00688                 void showFitInteractive();
00689                 void showCleanTool( );
00690                 void addSkyComponentOverlay(String path, const QString& colorName);
00691                 void removeSkyComponentOverlay( String path );
00692                 void add2DFitOverlay( QList<RegionShape*> fitMarkers );
00693                 void remove2DFitOverlay( QList<RegionShape*> fitMarkers );
00694                 void addResidualFitImage( String path );
00695                 virtual void addDDSlot(String path, String dataType, String displayType,
00696                                 Bool autoRegister=True, Bool tmpData=False,
00697                                 SHARED_PTR<ImageInterface<Float> > img = SHARED_PTR<ImageInterface<Float> >());
00698                 void sliceChanged( int regionId, viewer::region::RegionChanges change,
00699                                    const QList<double> & worldX, const QList<double> & worldY,
00700                                    const QList<int> &pixelX, const QList<int> & pixelY );
00701                 void addSlice( int id, const QString& shape, const QString&, const QList<double>& worldX,
00702                                const QList<double>& worldY, const QList<int>& pixelX, const QList<int>& pixelY,
00703                                const QString&, const QString&, const QString&, int, int);
00704                 void showColorHistogram(QtDisplayData* displayData);
00705                 void globalColorSettingsChanged( bool global );
00706                 void globalOptionsChanged( QtDisplayData* originator, Record opts );
00707                 void updateColorHistogram( const QString& ddName );
00708                 void showImageManager();
00709                 void sliceMarkerVisibilityChanged(int regionId, bool visible);
00710                 void sliceMarkerPositionChanged(int regionId, int segmentIndex, float percentage);
00711                 void updateMultiSpectralFitLocation( Record trackingRec);
00723                 void animationImageChanged( int index );
00724 
00725                 void registerDD( QtDisplayData* dd, int position );
00726                 void unregisterDD( QtDisplayData* dd );
00727                 // used to manage generation of the updateAxes( ) signal...
00728                 void replaceControllingDD( QtDisplayData* oldControllingDD, QtDisplayData* newControllingDD);
00729 
00730                 //Change the image that is being viewed in the blink
00731                 //animator.
00732                 void setAnimatedImage( int index );
00733                 void createRGBImage( QtDisplayData* coordinateMaster,
00734                                                 QtDisplayData* redImage, QtDisplayData* greenImage,
00735                                                 QtDisplayData* blueImage );
00736 
00737 
00738         public:
00739 
00740                 // True by default.  Set False to disable auto-raise of the Data
00741                 // Options panel whenever the first DD is created.
00742                 //# Users want to see this panel automatically when there are DDs
00743                 //# to tweak.  (Apps like clean can turn v_->autoOptionsRaise off,
00744                 //# if desired (yes, is is (gasp!) public data)).
00745                 Bool autoDDOptionsShow;
00746 
00747                 // Intended for use only by QtDataManager (or other data dialogs such as for
00748                 // save-restore), to inform QtDisplayPanel of the directory currently
00749                 // selected for data retrieval, if any ("" if none).
00750                 String selectedDMDir;
00751 
00752         };
00753 
00754 
00755         namespace viewer {
00756                 namespace hidden {
00757                         // Qt's meta object features not supported for nested classes...
00758                         // so this class cannot be nested in QtDisplayPanelGui...
00759                         class display_panel_gui_status : public QStatusBar {
00760                                 Q_OBJECT;
00761                         public:
00762                                 display_panel_gui_status( QWidget *parent = 0 ) : QStatusBar(parent) { }
00763                                 ~display_panel_gui_status( ) { }
00764                         signals:
00765                                 void enter( );
00766                                 void leave( );
00767 
00768                         protected:
00769                                 void enterEvent( QEvent* );
00770                                 void leaveEvent( QEvent* );
00771                         };
00772                 }
00773         }
00774 
00775 
00776 } //# NAMESPACE CASA - END
00777 
00778 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1