PlotMSPlotter.qo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PLOTMSPLOTTER_QO_H_
00028 #define PLOTMSPLOTTER_QO_H_
00029
00030 #include <plotms/Gui/PlotMSPlotter.ui.h>
00031
00032 #include <casaqt/QtUtilities/QtActionGroup.qo.h>
00033 #include <graphics/GenericPlotter/PlotFactory.h>
00034 #include <plotms/Actions/PlotMSAction.h>
00035 #include <plotms/Gui/PlotMSAnnotator.h>
00036 #include <plotms/Client/Client.h>
00037 #include <plotms/PlotMS/PlotMSConstants.h>
00038
00039 #include <QMainWindow>
00040 #include <QToolButton>
00041
00042 namespace casa {
00043
00044
00045 class QtProgressWidget;
00046 class PlotMSApp;
00047 class PlotMSAnnotatorTab;
00048 class PlotMSFlaggingTab;
00049 class PlotMSOptionsTab;
00050 class PlotMSPlotTab;
00051 class PlotMSExportTab;
00052 class PlotMSThread;
00053 class PlotMSToolsTab;
00054 class PlotMSDataSummaryTab;
00055
00056
00057
00058
00059 class PlotMSPlotter : public QMainWindow, Ui::PlotterWindow,
00060 public PlotDrawWatcher, public Client {
00061 Q_OBJECT
00062
00063 public:
00064
00065
00066 virtual bool isActionEnabled( PlotMSAction::Type type ) const;
00067
00068 virtual vector<PlotMSPlot*> getCurrentPlots() const;
00069 virtual bool plot();
00070 virtual vector<vector<PMS::Axis> > getSelectedLoadAxes() const;
00071 virtual vector<vector<PMS::Axis> > getSelectedReleaseAxes() const;
00072 virtual PlotMSFlagging getFlagging() const;
00073 virtual bool isInteractive() const;
00074 virtual void canvasAdded( PlotCanvasPtr& canvas );
00075 virtual void setAnnotationModeActive( PlotMSAction::Type type, bool active );
00076 virtual vector<String> getFiles() const;
00077
00078
00079
00080
00081
00082 static String aboutText(Plotter::Implementation implementation,
00083 bool useHTML = true);
00084
00085
00086
00087
00088
00089
00090 PlotMSPlotter(PlotMSApp* parent,
00091 Plotter::Implementation impl = Plotter::DEFAULT);
00092
00093
00094 ~PlotMSPlotter();
00095
00096
00097
00098
00099 PlotMSApp* getParent() { return itsParent_; }
00100
00101 QtProgressWidget* getProgressWidget() { return itsThreadProgress_; }
00102
00103 PlotMSAnnotator& getAnnotator() { return itsAnnotator_; }
00104
00105
00106 virtual bool isDrawing() const;
00107 virtual bool isClosed() const;
00108
00109
00110 void setShowProgress( bool showProgressDialog);
00111
00112 virtual void showGUI(bool show = true);
00113
00114
00115 virtual bool guiShown() const;
00116
00117
00118
00119
00120
00121
00122 virtual int execLoop();
00123
00124
00125
00126
00127
00128
00129 virtual void doThreadedOperation(ThreadController* thread);
00130
00131
00132 bool canvasDrawBeginning(PlotOperationPtr drawOperation,
00133 bool drawingIsThreaded, int drawnLayersFlag);
00134 virtual ThreadController* getThreadController( PlotMSAction::Type type,
00135 PMSPTMethod postThreadMethod = NULL, PlotMSPlot* plot = NULL,
00136 int index = -1 );
00137
00138
00139
00140
00141 void showIterationButtons(bool show);
00142
00143
00144
00145
00146 bool showQuestion(const String& message, const String& title);
00147
00148
00149
00150
00151
00152
00153
00154
00155 void setWindowTitle(const String& windowTitle);
00156
00157
00158 void setStatusText(const String& statusText);
00159
00160
00161 void clearStatusText() { setStatusText(""); }
00162
00163
00164 void setToolButtonStyle(Qt::ToolButtonStyle style);
00165
00166
00167
00168
00169
00170
00171
00172 const QMap<PlotMSAction::Type, QAction*>& plotActionMap() const;
00173
00174
00175
00176 void synchronizeAction(PlotMSAction::Type action, QAbstractButton* button);
00177
00178
00179
00180
00181 String actionText(PlotMSAction::Type type);
00182 void setActionText(PlotMSAction::Type type, const String& text);
00183
00184
00185
00186
00187
00188 bool actionIsChecked(PlotMSAction::Type type) const;
00189 void setActionIsChecked(PlotMSAction::Type type, bool checked,
00190 bool alsoTriggerAction = false);
00191
00192
00193
00194 virtual bool exportPlot(const PlotExportFormat& format, const bool async);
00195 virtual void setFlagging(PlotMSFlagging flag);
00196 virtual void gridSizeChanged( int rowCount, int colCount );
00197
00198 public slots:
00199
00200 virtual void showError(const String& message, const String& title, bool isWarning);
00201
00202
00203 virtual void showMessage(const String& message, const String& title, bool warning = false);
00204
00205
00206 virtual void clearMessage() { clearStatusText(); }
00207
00208
00209 void showAbout();
00210
00211
00212
00213
00214 void prepareForPlotting();
00215
00216 virtual bool close();
00217
00218
00219 protected:
00220
00221
00222
00223 void closeEvent(QCloseEvent* event);
00224
00225
00226
00227 private:
00228
00229 PlotMSApp* itsParent_;
00230
00231
00232 bool isQt_;
00233
00234
00235 bool isClosed_;
00236
00237
00238
00239
00240
00241 QList<QWidget*> itsEnableWidgets_;
00242
00243
00244 PlotMSDataSummaryTab* itsPlotTab_;
00245
00246
00247 PlotMSFlaggingTab* itsFlaggingTab_;
00248
00249
00250 PlotMSToolsTab* itsToolsTab_;
00251
00252
00253 PlotMSAnnotatorTab* itsAnnotatorTab_;
00254
00255
00256 PlotMSOptionsTab* itsOptionsTab_;
00257
00258
00259 QList<QToolButton*> itsToolButtons_;
00260
00261
00262 QtProgressWidget* itsThreadProgress_;
00263
00264
00265 PlotMSThread* itsCurrentThread_;
00266
00267
00268 vector<PlotMSThread*> itsWaitingThreads_;
00269
00270
00271 QMap<PlotMSAction::Type, QAction*> itsActionMap_;
00272
00273
00274 QtActionSynchronizer itsActionSynchronizer_;
00275
00276
00277 PlotMSAnnotator itsAnnotator_;
00278
00279
00280 QString itsAboutString_;
00281
00282 bool showProgressWidget;
00283
00284 QTabWidget* tabWidget;
00285
00286
00287 bool _triggerAction(PlotMSAction::Type type);
00288
00289
00290
00291 void initialize(Plotter::Implementation impl);
00292
00293 private slots:
00294
00295 void action_() { action(dynamic_cast<QAction*>(sender())); }
00296
00297
00298 void action(QAction* which);
00299
00300
00301
00302 void currentThreadFinished();
00303
00304
00305 void summarize();
00306
00307
00308 void exportPlots();
00309
00310 void tabChanged( );
00311 };
00312 typedef CountedPtr<PlotMSPlotter> PlotMSPlotterPtr;
00313
00314 }
00315
00316 #endif