Isis 3 Programmer Reference
PlotWindow.h
Go to the documentation of this file.
1#ifndef PlotWindow_h
2#define PlotWindow_h
3
27// This is needed for the QVariant macro
28#include <QMetaType>
29
30// This is the parent
31#include "MainWindow.h"
32
33// This is for an enum inside of plot curve
34#include "PlotCurve.h"
35
36class QwtPlot;
37class QwtPlotGrid;
38class QwtPlotSpectrogram;
39class QwtPlotZoomer;
40class QwtLegend;
41
42class QDockWidget;
43class QListWidgetItem;
44class QLineEdit;
45class QComboBox;
46class QCheckBox;
47
48template <typename A, typename B> struct QPair;
49
50namespace Isis {
51 class MdiCubeViewport;
52 class CubePlotCurve;
53 //class CubePlotCurveConfigureDialog;
54 class PvlKeyword;
55 class TableMainWindow;
56
88 class PlotWindow : public MainWindow {
89 Q_OBJECT
90
91 public:
184
187 MenuOptions optionsToProvide = AllMenuOptions);
188 ~PlotWindow();
189 virtual void add(CubePlotCurve *pc);
190 virtual void clearPlotCurves();
191
192 bool canAdd(CubePlotCurve *curveToTest) const;
193 QColor plotBackgroundColor() const;
194 QList<CubePlotCurve *> plotCurves();
195 QList<const CubePlotCurve *> plotCurves() const;
196 QList<QwtPlotSpectrogram *> plotSpectrograms();
197 QList<const QwtPlotSpectrogram *> plotSpectrograms() const;
198 QString plotTitle() const;
199 bool userCanAddCurves() const;
202
203 virtual void paint(MdiCubeViewport *vp, QPainter *painter);
204 void replot();
205 void setAxisLabel(int axisId, QString title);
206 void setPlotBackground(QColor c);
207 void setPlotTitle(QString pt);
208 void setUserCanAddCurves(bool);
209 void showWindow();
210 virtual void update(MdiCubeViewport *activeViewport);
211
212 static QString defaultWindowTitle();
213
214
215 signals:
220 void closed();
223
224 void requestFillTable();
225
226 public slots:
227 void clearPlot();
228 void configurePlotCurves();
229 void createBestFitLine();
230 void printPlot();
231 void changePlotLabels();
232 void savePlot();
233 void setDefaultRange();
234 void setLabels();
235 void setUserValues();
236 void showHideAllMarkers();
237 void showHideAllCurves();
238 void resetScale();
239 void showHideGrid();
240 void showHelp();
241 void showTable();
242 void switchBackground();
243 void trackerEnabled();
244
245 void scheduleFillTable();
246 void fillTable();
247
248 protected:
249 void createWidgets(MenuOptions optionsToProvide);
251 virtual void dragEnterEvent(QDragEnterEvent *event);
252 virtual void dropEvent(QDropEvent *event);
253 virtual bool eventFilter(QObject *o, QEvent *e);
254
255 using QWidget::mousePressEvent;
256 void mousePressEvent(QObject *object, QMouseEvent *e);
257
258 QwtPlot *plot();
259 void setMenus(QList<QMenu *> menus, QList<QAction *> actions);
260 QwtPlotZoomer *zoomer();
261
262 private slots:
264 void onClipboardChanged();
265 void pasteCurve();
266
267 private:
268 QPair<double, double> findDataRange(int axisId) const;
269 static bool numericStringLessThan(QString left, QString right);
270 bool userCanAddCurve(const QMimeData *curve);
271 void updateVisibility(PlotCurve *curve);
272 void setupDefaultMenu(MenuOptions optionsToProvide);
273
277 QwtPlotZoomer *m_zoomer;
279 QwtPlotGrid *m_grid;
283 QCheckBox *m_xLogCheckBox;
285 QCheckBox *m_yLogCheckBox;
287 QLineEdit *m_xMinEdit;
289 QLineEdit *m_xMaxEdit;
291 QLineEdit *m_yMinEdit;
293 QLineEdit *m_yMaxEdit;
295 QLineEdit *m_xAxisText;
297 QLineEdit *m_yAxisText;
299 QLineEdit *m_plotTitleText;
300
302 QMenuBar *m_menubar;
303
310
312 QPointer<QAction> m_action;
314 QPointer<QAction> m_showHideAllCurves;
316 QPointer<QAction> m_showHideAllMarkers;
318 QPointer<QAction> m_showHideGrid;
319
324
329
331 QwtLegend *m_legend;
336
337 bool m_scheduledFillTable;
338 };
339};
340
343
344// There isn't a great place to put this currently since it's not a class we
345// can manage the header for.
347Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *);
348Q_DECLARE_METATYPE(QwtPlotSpectrogram *);
349
350#endif
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.
Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *)
We have scatter plot types as QVariant data types, so here it's enabled.
This is a plot curve with information relating it to a particular cube or region of a cube.
Base class for the Qisis main windows.
Definition MainWindow.h:24
Cube display widget for certain Isis MDI applications.
Units
These are all the possible units for the x or y data in a plot curve.
Definition PlotCurve.h:54
QLineEdit * m_plotTitleText
Set Labels Dialog's edit for the plot title.
Definition PlotWindow.h:299
QList< CubePlotCurve * > plotCurves()
Get a comprehensive list of the plot curves inside of this plot window, excluding plot curves that ar...
QPointer< QAction > m_showHideAllCurves
Hide all curves action.
Definition PlotWindow.h:314
QwtPlot * m_plot
The plot in this window.
Definition PlotWindow.h:330
void createWidgets(MenuOptions optionsToProvide)
This method is called by the constructor to create the plot, legend.
void closed()
Emitted when there is a close event on this window that will be accepted.
void setAxisLabel(int axisId, QString title)
Sets the plots given axis title to the given string.
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
virtual void dragEnterEvent(QDragEnterEvent *event)
When a user drags data into our plot window, we need to indicate whether or not this data is compatib...
QLineEdit * m_xMinEdit
Set Scale Dialog's edit for the min X-axis value.
Definition PlotWindow.h:287
void autoScaleCheckboxToggled()
This is a helper method for the set scale configuration dialog.
void showHideAllMarkers()
Shows/Hides all the markers(symbols)
bool m_plotXLogScale
Tracks if the plot X axis is using a log (true) or linear (false) scale.
Definition PlotWindow.h:332
void plotChanged()
Emitted every time there is a change to the plot window.
QMenuBar * m_menubar
Plot window's menu bar.
Definition PlotWindow.h:302
QLineEdit * m_xMaxEdit
Set Scale Dialog's edit for the max X-axis value.
Definition PlotWindow.h:289
QLineEdit * m_yMinEdit
Set Scale Dialog's edit for the min Y-axis value.
Definition PlotWindow.h:291
QPointer< QAction > m_action
Plot window's action.
Definition PlotWindow.h:312
bool m_allowUserToAddCurves
Is the window showing the curve markers?
Definition PlotWindow.h:326
QString plotTitle() const
Returns the plot title.
QLineEdit * m_xAxisText
Set Labels Dialog's edit for the x-axis label.
Definition PlotWindow.h:295
void showHideAllCurves()
This method shows or hides all of the curves in the plotWindow.
QPointer< QAction > m_showHideGrid
Show plot grid lines action.
Definition PlotWindow.h:318
void printPlot()
Provides printing support of the plot image.
QwtPlotZoomer * m_zoomer
Plot Zoomer.
Definition PlotWindow.h:277
void setPlotBackground(QColor c)
Sets the plot background color to the given color.
MenuOptions
There is a menu option for everything in the plot window's menu.
Definition PlotWindow.h:96
@ LineFitMenuOption
This option allows the user to create a best fit line for any of the scatter plot data or cube plot c...
Definition PlotWindow.h:163
@ PrintMenuOption
This option sends the plot to a printer.
Definition PlotWindow.h:118
@ ResetScaleMenuOption
This option provides the user with an alternative zoom out button.
Definition PlotWindow.h:147
@ ShowHideMarkersMenuOption
This option is titled 'Hide All Symbols' which hides all markers.
Definition PlotWindow.h:98
@ ConfigurePlotMenuOption
This option allows the user to change the curve name, color, style size, and symbol of the curve.
Definition PlotWindow.h:169
@ SaveMenuOption
This option exports the plot into a standard image format.
Definition PlotWindow.h:114
@ ShowHideGridMenuOption
This option enables the ability for a user to enable a grid over the plot area.
Definition PlotWindow.h:134
@ ShowTableMenuOption
This option brings up the table.
Definition PlotWindow.h:108
@ AllMenuOptions
This is all of the available menu options.
Definition PlotWindow.h:173
@ ClearPlotMenuOption
This option allows the user to delete all of the data inside the plot.
Definition PlotWindow.h:153
@ RenameLabelsMenuOption
This option enables the ability for a user to change the x/y axis labels and plot title.
Definition PlotWindow.h:139
@ DefaultHelpMenuOption
Not implemented.
Definition PlotWindow.h:157
@ TrackMenuOption
This option enables mouse tracking on the plot area (displays next to the mouse which x/y point you a...
Definition PlotWindow.h:124
@ ShowHideCurvesMenuOption
This option is titled 'Hide All Curves' which makes all curves invisible.
Definition PlotWindow.h:103
@ BackgroundSwitchMenuOption
This option enables the ability for a user to change the background color of the plot from black to w...
Definition PlotWindow.h:129
@ SetDisplayRangeMenuOption
This option allows the user to set the x/y axis display value ranges.
Definition PlotWindow.h:143
QLineEdit * m_yMaxEdit
Set Scale Dialog's edit for the max Y-axis value.
Definition PlotWindow.h:293
void pasteCurve()
When the user pastes a curve try to put it into this plot window.
static QString defaultWindowTitle()
This is the typical suffix for plot windows, it's here in case we want to update all plot windows to ...
void showWindow()
Shows the plot window, and raises it to the front of any overlapping sibling widgets.
QCheckBox * m_yLogCheckBox
Set Scale Dialog's checkbox for using logarithmic scale for the y axis.
Definition PlotWindow.h:285
void resetScale()
Sets plot scale back to the defaults.
QPointer< QAction > m_showHideAllMarkers
Hide all markers action.
Definition PlotWindow.h:316
void createBestFitLine()
This method prompts the user to select the best fit line criterea.
QAction * m_pasteAct
This is the paste action in the edit menu to paste a curve into the plot window.
Definition PlotWindow.h:309
bool userCanAddCurve(const QMimeData *curve)
Ask if a user action can add this curve to this window.
void setupDefaultMenu(MenuOptions optionsToProvide)
The user can add menu items from parent classes, but there are some menu items that are common betwee...
QColor plotBackgroundColor() const
Returns the plot's background color.
QLineEdit * m_yAxisText
Set Labels Dialog's edit for the y-axis label.
Definition PlotWindow.h:297
TableMainWindow * m_tableWindow
Table window.
Definition PlotWindow.h:334
virtual void dropEvent(QDropEvent *event)
This is called when a user drops data into our window.
void onClipboardChanged()
This slot will be called when the system clipboard is changed.
void replot()
Reset the scale of the plot, replot it and emit plot changed.
QPair< double, double > findDataRange(int axisId) const
This calculates the data range of the specified axis (works with xBottom and yLeft only).
void trackerEnabled()
Enables the plot mouse tracker.
void updateVisibility(PlotCurve *curve)
This method sets the visibility states in the curve (and it's symbols) to match with this window's cu...
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves' x data in this plot window.
void setPlotTitle(QString pt)
Sets the plot title to the given string.
QwtLegend * m_legend
The legend inserted in this plot.
Definition PlotWindow.h:331
void setUserCanAddCurves(bool)
Allow or disallow users from manually putting curves into this plot window through either copy-and-pa...
virtual bool eventFilter(QObject *o, QEvent *e)
This method filters the events of the objects it is connected to.
bool m_autoscaleAxes
True if we are autoscaling the x-bottom and y-left axes.
Definition PlotWindow.h:328
void changePlotLabels()
This method creates the dialog box which allows the user to relabel the plot window.
QWidget * m_parent
Parent widget.
Definition PlotWindow.h:275
void setUserValues()
This method sets the scale for the axis according to the user specified numbers.
virtual void update(MdiCubeViewport *activeViewport)
This is provided to allow children to react to tool updates.
void showHideGrid()
This method hides/shows the grid on the plotWindow and changes the text for the action.
void configurePlotCurves()
This method creates a CubePlotCurveConfigureDialog object.
PlotCurve::Units m_xAxisUnits
The units of the data on the x-bottom axis.
Definition PlotWindow.h:321
QCheckBox * m_autoScaleCheckBox
Set Scale Dialog's checkbox for enabling automatic scaling on x & y.
Definition PlotWindow.h:281
bool canAdd(CubePlotCurve *curveToTest) const
This method tests whethere or not a CubePlotCurve can be successfully added to this window.
void fillTable()
Fills in the table with the data from the current curves in the plotWindow immediately.
QToolBar * m_toolBar
Tool bar on the plot window.
Definition PlotWindow.h:335
QwtPlotGrid * m_grid
Plot grid lines.
Definition PlotWindow.h:279
void savePlot()
This method allows the user to save the plot as a png, jpg, or tif image file.
PlotCurve::Units m_yAxisUnits
The units of the data on the y-left axis.
Definition PlotWindow.h:323
void showHelp()
This method creates and shows the help dialog box for the plot window.
void showTable()
This method is called from the showTable action on the tool bar There are some checks done to make su...
void setDefaultRange()
Resets the x/y min/max to the defaults.
virtual void paint(MdiCubeViewport *vp, QPainter *painter)
Paint plot curve information onto the viewport.
PlotCurve::Units yAxisUnits() const
This is the data-type of the curves' y data in this plot window.
void clearPlot()
This method completely clears the plot of all plot items.
bool userCanAddCurves() const
Ask if a user action can add this curve to this window in general.
virtual void clearPlotCurves()
This method also clears the plot of all plot items, but does not call the table delete stuff This met...
void setLabels()
Makes the user specified changes to the plot labels.
QCheckBox * m_xLogCheckBox
Set Scale Dialog's checkbox for using logarithmic scale for the x axis.
Definition PlotWindow.h:283
void switchBackground()
This method toggles the plot background color between black and white.
void mousePressEvent(QObject *object, QMouseEvent *e)
This is a helper method for the eventFilter() method.
void scheduleFillTable()
Fills in the table with the data from the current curves in the plotWindow once all current actions/a...
void disableAxisAutoScale()
This turns off scaling the x/y axes automatically.
PlotWindow(QString title, PlotCurve::Units xAxisUnits, PlotCurve::Units yAxisUnits, QWidget *parent, MenuOptions optionsToProvide=AllMenuOptions)
This constructs a plot window.
QwtPlot * plot()
Get the plot encapsulated by this PlotWindow.
QList< QwtPlotSpectrogram * > plotSpectrograms()
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window.
QwtPlotZoomer * zoomer()
Get this window's plot's zoomer.
void setMenus(QList< QMenu * > menus, QList< QAction * > actions)
Sets up the menus added from a parent object.
bool m_plotYLogScale
Tracks if the plot Y axis is using a log (true) or linear (false) scale.
Definition PlotWindow.h:333
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
This is free and unencumbered software released into the public domain.