Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

omgmainwindow.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Tim Sutton   *
00003  *   tim@linfiniti.com   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef OMGMAINWONDOW_H
00021 #define OMGMAINWINDOW_H
00022 
00023 //QT Includes
00024 #include <QMainWindow>
00025 #include <QLabel>
00026 #include <QMovie>
00027 #include <QPushButton>
00028 #include <QProgressBar>
00029 #include <QProgressDialog>
00030 #include <QString>
00031 #include <QPicture>
00032 #include <QTreeWidgetItem>
00033 #include <QTreeWidget>
00034 #include <QSystemTrayIcon>
00035 #include <QPointer>
00036 #include <QPoint>
00037 
00038 //Local Includes
00039 #include <omgmodel.h>
00040 #include <omgexperiment.h>
00041 #include <omgexperimentprinter.h>
00042 #include <omglocalitiesmodel.h>
00043 #include <ui_omgmainwindowbase.h>
00044 
00045 #ifdef WITH_QGIS
00046 #include <qgsmapcanvas.h>
00047 #include <qgsmaptool.h>
00048 #endif
00049 
00050 #ifdef WITH_OSSIMPLANET_QT
00051 #include <QtOpenGL/QGLFormat>
00052 #include <ossimPlanetQt/ossimPlanetQtGlWidget.h>
00053 #endif
00054 
00055 class QgisAppInterface;
00061 class OmgMainWindow : public QMainWindow, private Ui::OmgMainWindowBase
00062 {
00063   Q_OBJECT
00064     public:
00065       OmgMainWindow(QWidget* parent = 0, Qt::WFlags fl = 0 );
00066       ~OmgMainWindow();
00067    public slots:
00068       void saveMapAsImage();
00069       void setCurrentModel(OmgModel * thepModel);
00070       void setCurrentExperiment(OmgExperiment * theExperiment);
00071       void clearCurrentExperiment();
00072       void currentItemChanged(QTreeWidgetItem * thepCurrentItem, QTreeWidgetItem * thepPreviousItem);
00073       void treeContextMenuEvent(const QPoint & thePoint);
00074       void reportModeChanged(QString theReportMode);
00075       void setTreeColumnSizes(int position, int index);
00076       void setEnableModelDetailWidgets(bool theBool);
00077       void setViewMode(QString theMode);
00078       void printAlgorithmProfilesReport();
00079       void printExperimentReport();
00080       void printPdf();
00081       void runExperiment();
00082       void resetExperiment();
00083       void stopExperiment();
00084       void createTrayIcon();
00085       void setModelCreationProgress (QString theModelGuid, int theProgress);
00086       void setModelProjectionProgress (QString theModelGuid, int theProgress);
00091       void modelCompleted(QString theModelGuid);
00092       void setExperimentProgress (int theProgress);
00093       void setExperimentMaximum(int theMaximum);
00094       void logMessage(QString theMessage);
00095       void logMessage(QString theModelGuid, QString theMessage);
00096       void logError(QString theModelGuid, QString theMessage);
00097       //
00098       // Slots called from context menus
00099       //
00100       void removeModelFromExperiment();
00101       void removeAlgorithmFromExperiment();
00102       void removeTaxonFromExperiment();
00103    protected:
00104       void closeEvent(QCloseEvent *event);
00105    private slots:
00106       void on_tabModelViewDetails_currentChanged(int);
00107       void on_cboSortBy_currentIndexChanged(QString);
00108       void fileNew();
00109       void fileSave();
00110       void fileOpen();
00111       void closeExperiment();
00112       void fileFetch();
00113       void fileExit();
00114       void settingsOptions();
00115       void about();
00116       void showLicense();
00117       void showLayerSetManager();
00118       void showAlgorithmManager();
00119       bool checkLicenseIsAgreed();
00120       bool toolsConvert();
00121       bool toolsContour();
00122       bool toolsRasterThreshold();
00123       bool toolsClimateConvert();
00124       bool toolsWarp();
00125       bool toolsFileSplitter();
00126       void exportSamplesToCsv();
00127       void refreshReports();
00129       void showHelp();
00131       void showSurvey();
00136       bool populateTree();
00139       void showAlgorithmSummary(QString theAlgorithmName);
00142       void showTaxonSummary(QString theTaxonName);
00144       void experimentStopped();
00147       void updateRunningIcon(const QRect & theRect );
00149       void publishModel();
00150 
00151       
00152 // A problem with cmake currently prevents this ifdef from working
00153 //I will reinstate it when cmake issue is resolved
00154 // @see http://public.kitware.com/pipermail/cmake/2007-March/013161.html
00155 
00156 //#ifdef WITH_QGIS
00157       void zoomInMode();
00158       void zoomOutMode();
00159       void panMode();
00160       void zoomFull();
00161       void zoomPrevious();
00162       void loadQGisPlugin(QString theName, 
00163             QString theDescription, QString theFullPathName);
00164       /*
00165       void identifyMode();
00166       void measureMode();
00167       void measureAreaMode();
00168       */
00169       void addLayer();
00170     signals:
00175       void projectRead();
00176       void newProject();
00177 //#endif
00178     private:
00179       void resizeEvent ( QResizeEvent * event );
00180       void readSettings();
00181       void writeSettings(); 
00182       //currently there doesnt seem to be a way to set these up in designer
00183       //so we are going to manually create the toolbars etc
00184       void createActions();
00185       void createMenus();
00186       void createToolBars();
00187       void createStatusBar();
00188       void showReport(QString theReportMode);
00189       void disableControlsWhileRunning();
00190       void enableControlsAfterRunning();
00191       void disableMapControls();
00192       void enableMapControls();
00193       void setReportStyleSheet();
00195       QString helpText();
00197       QString experimentHelpText();
00198 
00199       
00200       enum SortMode {BY_TAXON,BY_ALGORITHM};
00201       SortMode mSortMode;
00206       typedef QHash <QString,QTreeWidgetItem * > TreeItemsHash;
00207       TreeItemsHash mTreeItemsHash;
00208       
00209       //this little group needed for our system tray
00210       QMenu * mTrayIconMenu; 
00211       QAction * mMinimizeAct;
00212       QAction * mMaximizeAct;
00213       QAction * mRestoreAct;
00214       QAction * mQuitAct;
00215       QPointer <QSystemTrayIcon> mTrayIcon;
00216       //
00217       // status bar widgets
00218       //
00219       QProgressBar * mpModelProgress;
00220       QProgressBar * mpExperimentProgress;
00221       QLabel * mpExperimentProgressLabel;
00222 
00223       //an experiment printer (can run the print prep in a separte thread)
00224       QPointer <OmgExperimentPrinter>  mpExperimentPrinter;
00225 
00226       //for when we want a blocking progress dialog e.g. for printing
00227       QProgressDialog mProgressDialog;
00228       
00229       //running animated icon widget
00230       QIcon mRunningIcon;
00231       QMovie * mpRunningMovie;
00232 
00233       //menu and toolbar stuff
00234       QMenu *mpFileMenu;
00235       QMenu *mpEditMenu;
00236       QMenu *mpDataPrepMenu;
00237       QMenu *mpPostProcessingMenu;
00238       QMenu *mpReportsMenu;
00239       QMenu *mpSettingsMenu;
00240       QMenu *mpHelpMenu;
00241       QToolBar *mpFileToolBar;
00242       QToolBar *mpDataPrepToolBar;
00243       QToolBar *mpPostProcessingToolBar;
00244       QToolBar *mpReportsToolBar;
00245       QAction *mpNewAct;
00246       QAction *mpRunAct;
00247       QAction *mpResetAct;
00248       QAction *mpOpenAct;
00249       QAction *mpCloseAct;
00250       QAction *mpSaveAct;
00251       QAction *mpSaveAsImageAct;
00252       QAction *mpFetchAct;
00253       QAction *mpPrintPdfAct;
00254       QAction *mpRefreshReportsAct;
00255       QAction *mpExitAct;
00256       QAction *mpOptionsAct;
00257       QAction *mpToolsConvertAct;
00258       QAction *mpToolsClimateConvertAct;
00259       QAction *mpToolsContourAct;
00260       QAction *mpToolsRasterThresholdAct;
00261       QAction *mpToolsWarpAct;
00262       QAction *mpToolsFileSplitterAct;
00263       QAction *mpAboutOmgAct;
00264       QAction *mpLicenseAct;
00265       QAction *mpHelpAct;
00266       QAction *mpSurveyAct;
00267       QAction *mpLayerSetManagerAct;
00268       QAction *mpExportToCsvAct;
00269       QAction *mpAlgorithmManagerAct;
00270       QAction *mpAvailableAlgorithmsReportAct;
00271       QAction *mpExperimentReportAct;
00272 #ifdef WITH_QGIS
00273       QAction *mpAddLayerAct; //do we need this...
00274       QAction *mpZoomInAct;
00275       QAction *mpZoomOutAct;
00276       QAction *mpPanAct;
00277       QAction *mpZoomFullAct;
00278       QAction *mpZoomPreviousAct;
00279       /*
00280       QAction *mpIdentifyAct;
00281       QAction *mpMeasureAct;
00282       QAction *mpMeasureAreaAct;
00283       */
00284       QgsMapCanvas * mpMapCanvas;
00285       QToolBar * mpMapToolBar;
00286       QgsMapTool * mpPanTool;
00287       QgsMapTool * mpZoomInTool;
00288       QgsMapTool * mpZoomOutTool;
00289       QgsMapTool * mpZoomFullTool;
00290       QgsMapTool * mpZoomPreviousTool;
00291       /*
00292       QgsMapTool * mpIdentifyTool;
00293       QgsMapTool * mpMeasureTool;
00294       QgsMapTool * mpMeasureAreaTool;
00295       */
00297       QPointer <QgisAppInterface> mpQgisInterface;
00298       friend class QgisAppInterface;
00299       // when an experiment is first loaded we
00300       // need to reset the map cavnase extents
00301       bool mResetExtentsFlag;
00302 #endif      
00303       //
00304       // Context menus and their actions
00305       //
00306       QMenu *mpExperimentContextMenu;
00307       QMenu *mpAlgorithmContextMenu;
00308       QMenu *mpTaxonContextMenu;
00309       QMenu *mpModelContextMenu;
00310       QAction *mpDeleteModelAct;
00311       QAction *mpPublishModelAct;
00312       QAction *mpDeleteAlgorithmAct;
00313       QAction *mpDeleteTaxonAct;
00314       
00315       QLabel * mpPictureWidget;
00316       QPointer<OmgModel>  mpCurrentModel;
00317       OmgLocalitiesModel * mpLocalitiesModel;
00318       QPointer<OmgExperiment> mpCurrentExperiment;
00319       //OmGuiReportBase *  mReport;
00320       
00321 #ifdef WITH_OSSIMPLANET_QT
00322       void initialiseOssimPlanet();
00323       ossimPlanetQtGlWidget * mpPlanet;
00324 #endif
00325 };
00326 
00327 #endif

Generated on Mon Apr 28 15:07:32 2008 for openModellerDesktop by  doxygen 1.4.1-20050210