QPPlotter.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 QPPLOTTER_QO_H_
00028 #define QPPLOTTER_QO_H_
00029
00030 #ifdef AIPS_HAS_QWT
00031
00032 #include <graphics/GenericPlotter/Plotter.h>
00033 #include <casaqt/QwtPlotter/QPPlotter.ui.h>
00034
00035 #include <QtGui>
00036
00037 namespace casa {
00038
00039
00040 class QPExportCanvas;
00041 class QPCanvas;
00042 class QPAxis;
00043 class PlotFactory;
00044
00045
00046
00047 class QPPlotter : public QWidget, Ui::PlotterUI, public Plotter {
00048 Q_OBJECT
00049
00050 friend class QPCanvas;
00051 friend class QPAxis;
00052
00053 public:
00054
00055
00056
00057 static QStringList GLOBAL_COLORS;
00058
00059
00060 static const String CLASS_NAME;
00061
00062
00063
00064
00065
00066
00067
00068 QPPlotter(QPCanvas* canvas = NULL,
00069 int logEventFlags = PlotLogger::NO_EVENTS,
00070 QWidget* parent = NULL);
00071
00072
00073
00074
00075 QPPlotter(PlotCanvasLayoutPtr layout,
00076 int logEventFlags = PlotLogger::NO_EVENTS,
00077 QWidget* parent = NULL);
00078
00079
00080 ~QPPlotter();
00081
00082
00083
00084
00085
00086
00087 void showGUI(bool showGUI = true);
00088 bool isGuiShown() const;
00089
00090
00091 void updateScriptGui();
00092
00093
00094 std::pair<int, int> size() const;
00095
00096
00097 void setSize(int width, int height);
00098
00099
00100 String windowTitle() const;
00101
00102
00103 void setWindowTitle(const String& newTitle);
00104
00105
00106 std::pair<int, int> canvasAreaSize() const;
00107
00108
00109 void setCanvasSize(int width, int height, bool resizeWindow = true);
00110
00111
00112 int displayDPI() const;
00113
00114
00115 bool isQWidget() const { return true; }
00116
00117
00118 PlotCursor cursor() const;
00119
00120
00121 void setCursor(PlotCursor cursor);
00122
00123
00124 void refresh();
00125
00126
00127 void close();
00128
00129 vector<QPExportCanvas*> getGridComponents();
00130
00131
00132 PlotCanvasLayoutPtr canvasLayout();
00133
00134
00135 void setCanvasLayout(PlotCanvasLayoutPtr layout);
00136
00137
00138 void canvasLayoutChanged(PlotCanvasLayout& layout);
00139
00140
00141 const String& dateFormat() const;
00142
00143
00144 void setDateFormat(const String& dateFormat);
00145
00146
00147 const String& relativeDateFormat() const;
00148
00149
00150 void setRelativeDateFormat(const String& dateFormat);
00151
00152
00153
00154 bool defaultPanelShown(DefaultPanel panel);
00155
00156
00157 void showDefaultPanel(DefaultPanel panel, bool show = true);
00158
00159
00160 int addPanel(PlotPanelPtr panel);
00161
00162
00163 vector<PlotPanelPtr> allPanels();
00164
00165
00166 unsigned int numPanels();
00167
00168
00169 PlotPanelPtr getPanel(int index);
00170
00171
00172 int panelIndex(PlotPanelPtr panel);
00173
00174
00175 void clearPanels();
00176
00177
00178 void removePanel(PlotPanelPtr annotation);
00179
00180
00181 void removePanel(int id);
00182
00183
00184 void removeLastPanel();
00185
00186
00187
00188 Implementation implementation() const { return QWT; }
00189
00190
00191 PlotFactory* implementationFactory() const;
00192
00193
00194 bool exportToFile(const PlotExportFormat& format);
00195
00196
00197 String fileChooserDialog(const String& title = "File Chooser",
00198 const String& directory = "");
00199
00200
00201
00202 void registerResizeHandler(PlotResizeEventHandlerPtr handler);
00203
00204
00205 vector<PlotResizeEventHandlerPtr> allResizeHandlers() const;
00206
00207
00208 void unregisterResizeHandler(PlotResizeEventHandlerPtr handler);
00209
00210
00211
00212
00213 const QWidget* canvasWidget() const;
00214 QWidget* canvasWidget();
00215
00216
00217
00218 QSize sizeHint() const;
00219
00220
00221 QSize minimumSizeHint() const;
00222
00223 virtual bool exportPlot(const PlotExportFormat& format );
00224
00225
00226 int getRowCount();
00227 int getColCount();
00228 protected:
00229
00230 void resizeEvent(QResizeEvent* event);
00231
00232
00233 void logObject(const String& className, void* address, bool creation,
00234 const String& message = String());
00235
00236
00237 void logMethod(const String& className, const String& methodName,
00238 bool entering, const String& message = String());
00239
00240 private:
00241
00242 PlotCanvasLayoutPtr m_layout;
00243
00244
00245 vector<PlotStandardMouseToolGroupPtr> m_canvasTools;
00246
00247
00248 vector<PlotResizeEventHandlerPtr> m_resizeHandlers;
00249
00250
00251 vector<PlotPanelPtr> m_panels;
00252
00253
00254 bool m_emitResize;
00255 bool m_guiShown;
00256
00257
00258
00259 String m_dateFormat;
00260 String m_relativeDateFormat;
00261
00262
00263 QList<QPAxis*> externalAxes;
00264
00265
00266 void setupCanvasFrame();
00267
00268
00269 void initialize();
00270
00271 void clearExternalAxes();
00272 void emptyLayout();
00273
00274
00275
00276
00277
00278 static bool __initColors;
00279 static bool initColors();
00280
00281
00282
00283
00284
00285 bool isLeftAxisInternal() const;
00286 bool isBottomAxisInternal() const;
00287 bool isRightAxisInternal() const;
00288 bool isTopAxisInternal() const;
00289
00290
00291
00292 void resetCanvasMinSizeHints();
00293 private slots:
00294
00295 void handToolChanged(bool on);
00296
00297
00298 void trackerTurned(bool on);
00299
00300
00301 void legendTurned(bool on);
00302
00303
00304 void legendPositionChanged() { legendTurned(legendBox->isChecked()); }
00305
00306
00307 void exportCanvases();
00308 };
00309
00310 }
00311
00312 #endif
00313
00314 #endif