00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OMGMAINWONDOW_H
00021 #define OMGMAINWINDOW_H
00022
00023
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
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
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
00153
00154
00155
00156
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
00166
00167
00168
00169 void addLayer();
00170 signals:
00175 void projectRead();
00176 void newProject();
00177
00178 private:
00179 void resizeEvent ( QResizeEvent * event );
00180 void readSettings();
00181 void writeSettings();
00182
00183
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
00210 QMenu * mTrayIconMenu;
00211 QAction * mMinimizeAct;
00212 QAction * mMaximizeAct;
00213 QAction * mRestoreAct;
00214 QAction * mQuitAct;
00215 QPointer <QSystemTrayIcon> mTrayIcon;
00216
00217
00218
00219 QProgressBar * mpModelProgress;
00220 QProgressBar * mpExperimentProgress;
00221 QLabel * mpExperimentProgressLabel;
00222
00223
00224 QPointer <OmgExperimentPrinter> mpExperimentPrinter;
00225
00226
00227 QProgressDialog mProgressDialog;
00228
00229
00230 QIcon mRunningIcon;
00231 QMovie * mpRunningMovie;
00232
00233
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;
00274 QAction *mpZoomInAct;
00275 QAction *mpZoomOutAct;
00276 QAction *mpPanAct;
00277 QAction *mpZoomFullAct;
00278 QAction *mpZoomPreviousAct;
00279
00280
00281
00282
00283
00284 QgsMapCanvas * mpMapCanvas;
00285 QToolBar * mpMapToolBar;
00286 QgsMapTool * mpPanTool;
00287 QgsMapTool * mpZoomInTool;
00288 QgsMapTool * mpZoomOutTool;
00289 QgsMapTool * mpZoomFullTool;
00290 QgsMapTool * mpZoomPreviousTool;
00291
00292
00293
00294
00295
00297 QPointer <QgisAppInterface> mpQgisInterface;
00298 friend class QgisAppInterface;
00299
00300
00301 bool mResetExtentsFlag;
00302 #endif
00303
00304
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
00320
00321 #ifdef WITH_OSSIMPLANET_QT
00322 void initialiseOssimPlanet();
00323 ossimPlanetQtGlWidget * mpPlanet;
00324 #endif
00325 };
00326
00327 #endif