Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
PlotWindow.h
Go to the documentation of this file.
1#ifndef PlotWindow_h
2#define PlotWindow_h
3
26
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
48namespace Isis {
49 class MdiCubeViewport;
50 class CubePlotCurve;
51 //class CubePlotCurveConfigureDialog;
52 class PvlKeyword;
53 class TableMainWindow;
54
86 class PlotWindow : public MainWindow {
87 Q_OBJECT
88
89 public:
182
185 MenuOptions optionsToProvide = AllMenuOptions);
186 ~PlotWindow();
187 virtual void add(CubePlotCurve *pc);
188 virtual void clearPlotCurves();
189
190 bool canAdd(CubePlotCurve *curveToTest) const;
191 QColor plotBackgroundColor() const;
196 QString plotTitle() const;
197 bool userCanAddCurves() const;
200
201 virtual void paint(MdiCubeViewport *vp, QPainter *painter);
202 void replot();
203 void setAxisLabel(int axisId, QString title);
204 void setPlotBackground(QColor c);
205 void setPlotTitle(QString pt);
206 void setUserCanAddCurves(bool);
207 void showWindow();
208 virtual void update(MdiCubeViewport *activeViewport);
209
210 static QString defaultWindowTitle();
211
212
213 signals:
218 void closed();
221
223
224 public slots:
225 void clearPlot();
226 void configurePlotCurves();
227 void createBestFitLine();
228 void printPlot();
229 void changePlotLabels();
230 void savePlot();
231 void setDefaultRange();
232 void setLabels();
233 void setUserValues();
234 void showHideAllMarkers();
235 void showHideAllCurves();
236 void resetScale();
237 void showHideGrid();
238 void showHelp();
239 void showTable();
240 void switchBackground();
241 void trackerEnabled();
242
243 void scheduleFillTable();
244 void fillTable();
245
246 protected:
247 void createWidgets(MenuOptions optionsToProvide);
249 virtual void dragEnterEvent(QDragEnterEvent *event);
250 virtual void dropEvent(QDropEvent *event);
251 virtual bool eventFilter(QObject *o, QEvent *e);
252
253 using QWidget::mousePressEvent;
254 void mousePressEvent(QObject *object, QMouseEvent *e);
255
256 QwtPlot *plot();
257 void setMenus(QList<QMenu *> menus, QList<QAction *> actions);
258 QwtPlotZoomer *zoomer();
259
260 private slots:
261 void autoScaleCheckboxToggled();
262 void onClipboardChanged();
263 void pasteCurve();
264
265 private:
266 QPair<double, double> findDataRange(int axisId) const;
267 static bool numericStringLessThan(QString left, QString right);
268 bool userCanAddCurve(const QMimeData *curve);
269 void updateVisibility(PlotCurve *curve);
270 void setupDefaultMenu(MenuOptions optionsToProvide);
271
273 QWidget *m_parent;
275 QwtPlotZoomer *m_zoomer;
277 QwtPlotGrid *m_grid;
279 QCheckBox *m_autoScaleCheckBox;
281 QCheckBox *m_xLogCheckBox;
283 QCheckBox *m_yLogCheckBox;
285 QLineEdit *m_xMinEdit;
287 QLineEdit *m_xMaxEdit;
289 QLineEdit *m_yMinEdit;
291 QLineEdit *m_yMaxEdit;
293 QLineEdit *m_xAxisText;
295 QLineEdit *m_yAxisText;
297 QLineEdit *m_plotTitleText;
298
300 QMenuBar *m_menubar;
301
307 QAction *m_pasteAct;
308
310 QPointer<QAction> m_action;
312 QPointer<QAction> m_showHideAllCurves;
314 QPointer<QAction> m_showHideAllMarkers;
316 QPointer<QAction> m_showHideGrid;
317
319 PlotCurve::Units m_xAxisUnits;
321 PlotCurve::Units m_yAxisUnits;
322
324 bool m_allowUserToAddCurves;
326 bool m_autoscaleAxes;
327
328 QwtPlot *m_plot;
329 QwtLegend *m_legend;
330 bool m_plotXLogScale;
331 bool m_plotYLogScale;
332 TableMainWindow *m_tableWindow;
333 QToolBar *m_toolBar;
334
335 bool m_scheduledFillTable;
336 };
337};
338
341
342// There isn't a great place to put this currently since it's not a class we
343// can manage the header for.
345Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *);
346Q_DECLARE_METATYPE(QwtPlotSpectrogram *);
347
348#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.
Definition CubePlotCurve.h:53
MainWindow(QString title, QWidget *parent=0, Qt::WindowFlags flags=Qt::WindowFlags())
Mainwindow constructor.
Definition MainWindow.cpp:15
Cube display widget for certain Isis MDI applications.
Definition MdiCubeViewport.h:39
Definition PlotCurve.h:44
Units
These are all the possible units for the x or y data in a plot curve.
Definition PlotCurve.h:54
Definition PlotWindow.h:86
QList< CubePlotCurve * > plotCurves()
Get a comprehensive list of the plot curves inside of this plot window, excluding plot curves that ar...
Definition PlotWindow.cpp:328
void createWidgets(MenuOptions optionsToProvide)
This method is called by the constructor to create the plot, legend.
Definition PlotWindow.cpp:145
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.
Definition PlotWindow.cpp:208
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
Definition PlotWindow.cpp:436
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...
Definition PlotWindow.cpp:1821
void showHideAllMarkers()
Shows/Hides all the markers(symbols)
Definition PlotWindow.cpp:940
void plotChanged()
Emitted every time there is a change to the plot window.
QString plotTitle() const
Returns the plot title.
Definition PlotWindow.cpp:241
void showHideAllCurves()
This method shows or hides all of the curves in the plotWindow.
Definition PlotWindow.cpp:968
void printPlot()
Provides printing support of the plot image.
Definition PlotWindow.cpp:573
void setPlotBackground(QColor c)
Sets the plot background color to the given color.
Definition PlotWindow.cpp:289
void requestFillTable()
MenuOptions
There is a menu option for everything in the plot window's menu.
Definition PlotWindow.h:94
@ 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:161
@ PrintMenuOption
This option sends the plot to a printer.
Definition PlotWindow.h:116
@ ResetScaleMenuOption
This option provides the user with an alternative zoom out button.
Definition PlotWindow.h:145
@ ShowHideMarkersMenuOption
This option is titled 'Hide All Symbols' which hides all markers.
Definition PlotWindow.h:96
@ ConfigurePlotMenuOption
This option allows the user to change the curve name, color, style size, and symbol of the curve.
Definition PlotWindow.h:167
@ SaveMenuOption
This option exports the plot into a standard image format.
Definition PlotWindow.h:112
@ ShowHideGridMenuOption
This option enables the ability for a user to enable a grid over the plot area.
Definition PlotWindow.h:132
@ ShowTableMenuOption
This option brings up the table.
Definition PlotWindow.h:106
@ AllMenuOptions
This is all of the available menu options.
Definition PlotWindow.h:171
@ ClearPlotMenuOption
This option allows the user to delete all of the data inside the plot.
Definition PlotWindow.h:151
@ RenameLabelsMenuOption
This option enables the ability for a user to change the x/y axis labels and plot title.
Definition PlotWindow.h:137
@ DefaultHelpMenuOption
Not implemented.
Definition PlotWindow.h:155
@ TrackMenuOption
This option enables mouse tracking on the plot area (displays next to the mouse which x/y point you a...
Definition PlotWindow.h:122
@ ShowHideCurvesMenuOption
This option is titled 'Hide All Curves' which makes all curves invisible.
Definition PlotWindow.h:101
@ BackgroundSwitchMenuOption
This option enables the ability for a user to change the background color of the plot from black to w...
Definition PlotWindow.h:127
@ SetDisplayRangeMenuOption
This option allows the user to set the x/y axis display value ranges.
Definition PlotWindow.h:141
static QString defaultWindowTitle()
This is the typical suffix for plot windows, it's here in case we want to update all plot windows to ...
Definition PlotWindow.cpp:1808
void showWindow()
Shows the plot window, and raises it to the front of any overlapping sibling widgets.
Definition PlotWindow.cpp:185
void resetScale()
Sets plot scale back to the defaults.
Definition PlotWindow.cpp:661
void createBestFitLine()
This method prompts the user to select the best fit line criterea.
Definition PlotWindow.cpp:529
QColor plotBackgroundColor() const
Returns the plot's background color.
Definition PlotWindow.cpp:317
virtual void dropEvent(QDropEvent *event)
This is called when a user drops data into our window.
Definition PlotWindow.cpp:1842
void replot()
Reset the scale of the plot, replot it and emit plot changed.
Definition PlotWindow.cpp:1795
void trackerEnabled()
Enables the plot mouse tracker.
Definition PlotWindow.cpp:560
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves' x data in this plot window.
Definition PlotWindow.cpp:266
void setPlotTitle(QString pt)
Sets the plot title to the given string.
Definition PlotWindow.cpp:219
void setUserCanAddCurves(bool)
Allow or disallow users from manually putting curves into this plot window through either copy-and-pa...
Definition PlotWindow.cpp:231
virtual bool eventFilter(QObject *o, QEvent *e)
This method filters the events of the objects it is connected to.
Definition PlotWindow.cpp:1588
void changePlotLabels()
This method creates the dialog box which allows the user to relabel the plot window.
Definition PlotWindow.cpp:855
void setUserValues()
This method sets the scale for the axis according to the user specified numbers.
Definition PlotWindow.cpp:695
virtual void update(MdiCubeViewport *activeViewport)
This is provided to allow children to react to tool updates.
Definition PlotWindow.cpp:197
void showHideGrid()
This method hides/shows the grid on the plotWindow and changes the text for the action.
Definition PlotWindow.cpp:924
void configurePlotCurves()
This method creates a CubePlotCurveConfigureDialog object.
Definition PlotWindow.cpp:508
bool canAdd(CubePlotCurve *curveToTest) const
This method tests whethere or not a CubePlotCurve can be successfully added to this window.
Definition PlotWindow.cpp:305
void fillTable()
Fills in the table with the data from the current curves in the plotWindow immediately.
Definition PlotWindow.cpp:1412
void savePlot()
This method allows the user to save the plot as a png, jpg, or tif image file.
Definition PlotWindow.cpp:606
void showHelp()
This method creates and shows the help dialog box for the plot window.
Definition PlotWindow.cpp:1000
void showTable()
This method is called from the showTable action on the tool bar There are some checks done to make su...
Definition PlotWindow.cpp:1564
void setDefaultRange()
Resets the x/y min/max to the defaults.
Definition PlotWindow.cpp:744
virtual void paint(MdiCubeViewport *vp, QPainter *painter)
Paint plot curve information onto the viewport.
Definition PlotWindow.cpp:1785
PlotCurve::Units yAxisUnits() const
This is the data-type of the curves' y data in this plot window.
Definition PlotWindow.cpp:278
void clearPlot()
This method completely clears the plot of all plot items.
Definition PlotWindow.cpp:492
bool userCanAddCurves() const
Ask if a user action can add this curve to this window in general.
Definition PlotWindow.cpp:254
virtual void clearPlotCurves()
This method also clears the plot of all plot items, but does not call the table delete stuff This met...
Definition PlotWindow.cpp:540
void setLabels()
Makes the user specified changes to the plot labels.
Definition PlotWindow.cpp:911
void switchBackground()
This method toggles the plot background color between black and white.
Definition PlotWindow.cpp:636
void mousePressEvent(QObject *object, QMouseEvent *e)
This is a helper method for the eventFilter() method.
Definition PlotWindow.cpp:1626
void scheduleFillTable()
Fills in the table with the data from the current curves in the plotWindow once all current actions/a...
Definition PlotWindow.cpp:1400
void disableAxisAutoScale()
This turns off scaling the x/y axes automatically.
Definition PlotWindow.cpp:1662
PlotWindow(QString title, PlotCurve::Units xAxisUnits, PlotCurve::Units yAxisUnits, QWidget *parent, MenuOptions optionsToProvide=AllMenuOptions)
This constructs a plot window.
Definition PlotWindow.cpp:66
QwtPlot * plot()
Get the plot encapsulated by this PlotWindow.
Definition PlotWindow.cpp:1651
QList< QwtPlotSpectrogram * > plotSpectrograms()
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window.
Definition PlotWindow.cpp:381
QwtPlotZoomer * zoomer()
Get this window's plot's zoomer.
Definition PlotWindow.cpp:1389
void setMenus(QList< QMenu * > menus, QList< QAction * > actions)
Sets up the menus added from a parent object.
Definition PlotWindow.cpp:1359
~PlotWindow()
Definition PlotWindow.cpp:131
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
Definition TableMainWindow.h:57
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16