USGS

Isis 3.0 Developer's Reference (API)

Home

MosaicController.h

Go to the documentation of this file.
00001 #ifndef MosaicWidgetController_H
00002 #define MosaicWidgetController_H
00003 
00004 #include <QObject>
00005 
00006 class QAction;
00007 template <typename A> class QFutureWatcher;
00008 template <typename A> class QList;
00009 class QMenu;
00010 class QMutex;
00011 class QProgressBar;
00012 class QSettings;
00013 class QStatusBar;
00014 
00015 // This is required since we have a slot with a QStringList
00016 #include <QStringList>
00017 
00018 // This is the parent of the inner class
00019 #include <functional>
00020 
00021 #include "PvlObject.h"
00022 
00023 namespace Isis {
00024   class ControlNet;
00025   class CubeDisplayProperties;
00026   class MosaicFileListWidget;
00027   class MosaicSceneWidget;
00028   class ProgressBar;
00029   class PvlObject;
00030 
00058   class MosaicController : public QObject {
00059       Q_OBJECT
00060 
00061     public:
00062       MosaicController(QStatusBar *status, QSettings &settings);
00063       virtual ~MosaicController();
00064 
00065       MosaicSceneWidget *getMosaicScene() {
00066         return p_scene;
00067       }
00068 
00069       MosaicSceneWidget *getMosaicWorldScene() {
00070         return p_worldScene;
00071       }
00072 
00073       MosaicFileListWidget *getMosaicFileList() {
00074         return p_fileList;
00075       }
00076 
00077       void addExportActions(QMenu &fileMenu);
00078 
00079       QProgressBar *getProgress();
00080       void saveProject();
00081 
00082       QList<QAction *> getSettingsActions();
00083       void saveSettings(QSettings &settings);
00084 
00085     signals:
00089       void cubesAdded(QList<CubeDisplayProperties *>);
00090 
00091       void allCubesClosed();
00092 
00093     public slots:
00094       void saveProject(QString filename);
00095       void readProject(QString filename);
00096       void openCubes(QStringList filenames);
00097       void openProjectCubes(QList<PvlObject> projectCubes);
00098       void cubeDisplayReady(int);
00099 
00100     private slots:
00101       void changeDefaultAlpha();
00102       void changeMaxThreads();
00103       void cubeClosed(QObject * cubeDisplay);
00104       void defaultFillChanged(bool);
00105       void loadFinished();
00106       void saveList();
00107       void setSmallNumberOfOpenCubes(bool useSmallNumber);
00108 
00109     private:
00110       void flushCubes();
00111 
00112     private:
00113       QList<CubeDisplayProperties *> p_cubes;
00114       QList<CubeDisplayProperties *> p_unannouncedCubes;
00115 
00116       MosaicFileListWidget *p_fileList;
00117       MosaicSceneWidget *p_scene;
00118       MosaicSceneWidget *p_worldScene;
00119       ProgressBar *p_progress;
00120       PvlObject *m_projectPvl;
00121 
00122       bool m_openFilled;
00123       int m_defaultAlpha;
00124       int m_maxOpenCubes;
00125       int m_maxThreads;
00126 
00127       QScopedPointer< QStringList > m_cubesLeftToOpen;
00128       QScopedPointer< QList<PvlObject> > m_projectCubesLeftToOpen;
00129 
00130       // Cameras are not re-entrant and so this mutex will make sure they
00131       //   aren't overly abused
00132       QMutex *m_mutex;
00133 
00134       QFutureWatcher< CubeDisplayProperties * > * m_watcher;
00135 
00136 
00142       class FilenameToDisplayFunctor : public std::unary_function<
00143           const QString &, CubeDisplayProperties *> {
00144 
00145         public:
00146           FilenameToDisplayFunctor(QMutex *cameraMutex, QThread *targetThread,
00147               bool openFilled, int defaultAlpha);
00148           CubeDisplayProperties *operator()(const QString &);
00149 
00150         private:
00151           QMutex *m_mutex;
00152           QThread *m_targetThread;
00153           bool m_openFilled;
00154           int m_defaultAlpha;
00155       };
00156 
00157 
00163       class ProjectToDisplayFunctor : public std::unary_function<
00164           const PvlObject &, CubeDisplayProperties *> {
00165 
00166         public:
00167           ProjectToDisplayFunctor(QMutex *cameraMutex, QThread *targetThread);
00168           CubeDisplayProperties *operator()(const PvlObject &);
00169 
00170         private:
00171           QMutex *m_mutex;
00172           QThread *m_targetThread;
00173       };
00174   };
00175 };
00176 
00177 #endif
00178