Isis 3.0 Programmer Reference
Back | Home
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 
36 class QwtPlot;
37 class QwtPlotGrid;
38 class QwtPlotSpectrogram;
39 class QwtPlotZoomer;
40 class QwtLegend;
41 
42 class QDockWidget;
43 class QListWidgetItem;
44 class QLineEdit;
45 class QComboBox;
46 class QCheckBox;
47 
48 template <typename A, typename B> struct QPair;
49 
50 namespace Isis {
51  class MdiCubeViewport;
52  class CubePlotCurve;
53  //class CubePlotCurveConfigureDialog;
54  class PvlKeyword;
55  class TableMainWindow;
56 
86  class PlotWindow : public MainWindow {
87  Q_OBJECT
88 
89  public:
94  enum MenuOptions {
162 
179 
180 
181  };
182 
183  PlotWindow(QString title, PlotCurve::Units xAxisUnits,
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();
220  void plotChanged();
221 
222  void requestFillTable();
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);
248  void disableAxisAutoScale();
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:
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 
275  QwtPlotZoomer *m_zoomer;
277  QwtPlotGrid *m_grid;
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 
308 
310  QPointer<QAction> m_action;
312  QPointer<QAction> m_showHideAllCurves;
314  QPointer<QAction> m_showHideAllMarkers;
316  QPointer<QAction> m_showHideGrid;
317 
322 
327 
329  QwtLegend *m_legend;
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.
345 Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *);
346 Q_DECLARE_METATYPE(QwtPlotSpectrogram *);
347 
348 #endif
Cube display widget for certain Isis MDI applications.
This is all of the available menu options.
Definition: PlotWindow.h:171
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
bool m_plotYLogScale
Tracks if the plot Y axis is using a log (true) or linear (false) scale.
Definition: PlotWindow.h:331
This option enables the ability for a user to change the background color of the plot from black to w...
Definition: PlotWindow.h:127
PlotCurve::Units m_yAxisUnits
The units of the data on the y-left axis.
Definition: PlotWindow.h:321
void clearPlot()
This method completely clears the plot of all plot items.
Definition: PlotWindow.cpp:492
QLineEdit * m_yMaxEdit
Set Scale Dialog&#39;s edit for the max Y-axis value.
Definition: PlotWindow.h:291
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 showHideAllCurves()
This method shows or hides all of the curves in the plotWindow.
Definition: PlotWindow.cpp:967
void switchBackground()
This method toggles the plot background color between black and white.
Definition: PlotWindow.cpp:635
void savePlot()
This method allows the user to save the plot as a png, jpg, or tif image file.
Definition: PlotWindow.cpp:605
bool m_plotXLogScale
Tracks if the plot X axis is using a log (true) or linear (false) scale.
Definition: PlotWindow.h:330
MenuOptions
There is a menu option for everything in the plot window&#39;s menu.
Definition: PlotWindow.h:94
void createWidgets(MenuOptions optionsToProvide)
This method is called by the constructor to create the plot, legend.
Definition: PlotWindow.cpp:145
void showHideAllMarkers()
Shows/Hides all the markers(symbols)
Definition: PlotWindow.cpp:939
QwtPlotZoomer * m_zoomer
Plot Zoomer.
Definition: PlotWindow.h:275
bool userCanAddCurve(const QMimeData *curve)
Ask if a user action can add this curve to this window.
void pasteCurve()
When the user pastes a curve try to put it into this plot window.
This option allows the user to change the curve name, color, style size, and symbol of the curve...
Definition: PlotWindow.h:167
virtual void paint(MdiCubeViewport *vp, QPainter *painter)
Paint plot curve information onto the viewport.
QPointer< QAction > m_action
Plot window&#39;s action.
Definition: PlotWindow.h:310
QPointer< QAction > m_showHideAllCurves
Hide all curves action.
Definition: PlotWindow.h:312
This option enables mouse tracking on the plot area (displays next to the mouse which x/y point you a...
Definition: PlotWindow.h:122
QLineEdit * m_xMaxEdit
Set Scale Dialog&#39;s edit for the max X-axis value.
Definition: PlotWindow.h:287
This option provides the user with an alternative zoom out button.
Definition: PlotWindow.h:145
void createBestFitLine()
This method prompts the user to select the best fit line criterea.
Definition: PlotWindow.cpp:529
QwtPlotZoomer * zoomer()
Get this window&#39;s plot&#39;s zoomer.
QLineEdit * m_xAxisText
Set Labels Dialog&#39;s edit for the x-axis label.
Definition: PlotWindow.h:293
QwtLegend * m_legend
The legend inserted in this plot.
Definition: PlotWindow.h:329
QCheckBox * m_xLogCheckBox
Set Scale Dialog&#39;s checkbox for using logarithmic scale for the x axis.
Definition: PlotWindow.h:281
virtual void dropEvent(QDropEvent *event)
This is called when a user drops data into our window.
void configurePlotCurves()
This method creates a CubePlotCurveConfigureDialog object.
Definition: PlotWindow.cpp:508
QAction * m_pasteAct
This is the paste action in the edit menu to paste a curve into the plot window.
Definition: PlotWindow.h:307
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
void showHelp()
This method creates and shows the help dialog box for the plot window.
Definition: PlotWindow.cpp:999
void setPlotBackground(QColor c)
Sets the plot background color to the given color.
Definition: PlotWindow.cpp:289
void updateVisibility(PlotCurve *curve)
This method sets the visibility states in the curve (and it&#39;s symbols) to match with this window&#39;s cu...
void showHideGrid()
This method hides/shows the grid on the plotWindow and changes the text for the action.
Definition: PlotWindow.cpp:923
QLineEdit * m_yAxisText
Set Labels Dialog&#39;s edit for the y-axis label.
Definition: PlotWindow.h:295
QString plotTitle() const
Returns the plot title.
Definition: PlotWindow.cpp:241
QPointer< QAction > m_showHideAllMarkers
Hide all markers action.
Definition: PlotWindow.h:314
QwtPlot * m_plot
The plot in this window.
Definition: PlotWindow.h:328
void setMenus(QList< QMenu * > menus, QList< QAction * > actions)
Sets up the menus added from a parent object.
void trackerEnabled()
Enables the plot mouse tracker.
Definition: PlotWindow.cpp:560
void setUserValues()
This method sets the scale for the axis according to the user specified numbers.
Definition: PlotWindow.cpp:694
bool m_autoscaleAxes
True if we are autoscaling the x-bottom and y-left axes.
Definition: PlotWindow.h:326
QColor plotBackgroundColor() const
Returns the plot&#39;s background color.
Definition: PlotWindow.cpp:317
void fillTable()
Fills in the table with the data from the current curves in the plotWindow immediately.
TableMainWindow * m_tableWindow
Table window.
Definition: PlotWindow.h:332
void closed()
Emitted when there is a close event on this window that will be accepted.
This option sends the plot to a printer.
Definition: PlotWindow.h:116
virtual bool eventFilter(QObject *o, QEvent *e)
This method filters the events of the objects it is connected to.
QMenuBar * m_menubar
Plot window&#39;s menu bar.
Definition: PlotWindow.h:300
QwtPlotGrid * m_grid
Plot grid lines.
Definition: PlotWindow.h:277
void scheduleFillTable()
Fills in the table with the data from the current curves in the plotWindow once all current actions/a...
QLineEdit * m_yMinEdit
Set Scale Dialog&#39;s edit for the min Y-axis value.
Definition: PlotWindow.h:289
void plotChanged()
Emitted every time there is a change to the plot window.
This is a plot curve with information relating it to a particular cube or region of a cube...
Definition: CubePlotCurve.h:68
void setDefaultRange()
Resets the x/y min/max to the defaults.
Definition: PlotWindow.cpp:743
PlotWindow(QString title, PlotCurve::Units xAxisUnits, PlotCurve::Units yAxisUnits, QWidget *parent, MenuOptions optionsToProvide=AllMenuOptions)
This constructs a plot window.
Definition: PlotWindow.cpp:66
QToolBar * m_toolBar
Tool bar on the plot window.
Definition: PlotWindow.h:333
This option allows the user to delete all of the data inside the plot.
Definition: PlotWindow.h:151
QLineEdit * m_plotTitleText
Set Labels Dialog&#39;s edit for the plot title.
Definition: PlotWindow.h:297
Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *)
We have scatter plot types as QVariant data types, so here it&#39;s enabled.
void setAxisLabel(int axisId, QString title)
Sets the plots given axis title to the given string.
Definition: PlotWindow.cpp:208
void printPlot()
Provides printing support of the plot image.
Definition: PlotWindow.cpp:573
void setPlotTitle(QString pt)
Sets the plot title to the given string.
Definition: PlotWindow.cpp:219
void resetScale()
Sets plot scale back to the defaults.
Definition: PlotWindow.cpp:660
QWidget * m_parent
Parent widget.
Definition: PlotWindow.h:273
This option is titled &#39;Hide All Curves&#39; which makes all curves invisible.
Definition: PlotWindow.h:101
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
QCheckBox * m_yLogCheckBox
Set Scale Dialog&#39;s checkbox for using logarithmic scale for the y axis.
Definition: PlotWindow.h:283
This option brings up the table.
Definition: PlotWindow.h:106
void showTable()
This method is called from the showTable action on the tool bar There are some checks done to make su...
virtual void update(MdiCubeViewport *activeViewport)
This is provided to allow children to react to tool updates.
Definition: PlotWindow.cpp:197
QPair< double, double > findDataRange(int axisId) const
This calculates the data range of the specified axis (works with xBottom and yLeft only)...
void mousePressEvent(QObject *object, QMouseEvent *e)
This is a helper method for the eventFilter() method.
void disableAxisAutoScale()
This turns off scaling the x/y axes automatically.
void autoScaleCheckboxToggled()
This is a helper method for the set scale configuration dialog.
PlotCurve::Units m_xAxisUnits
The units of the data on the x-bottom axis.
Definition: PlotWindow.h:319
static QString defaultWindowTitle()
This is the typical suffix for plot windows, it&#39;s here in case we want to update all plot windows to ...
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...
This option is titled &#39;Hide All Symbols&#39; which hides all markers.
Definition: PlotWindow.h:96
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 setUserCanAddCurves(bool)
Allow or disallow users from manually putting curves into this plot window through either copy-and-pa...
Definition: PlotWindow.cpp:231
QLineEdit * m_xMinEdit
Set Scale Dialog&#39;s edit for the min X-axis value.
Definition: PlotWindow.h:285
void showWindow()
Shows the plot window, and raises it to the front of any overlapping sibling widgets.
Definition: PlotWindow.cpp:185
This option allows the user to set the x/y axis display value ranges.
Definition: PlotWindow.h:141
QList< QwtPlotSpectrogram * > plotSpectrograms()
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window.
Definition: PlotWindow.cpp:381
Base class for the Qisis main windows.
Definition: MainWindow.h:24
void setLabels()
Makes the user specified changes to the plot labels.
Definition: PlotWindow.cpp:910
This option enables the ability for a user to change the x/y axis labels and plot title...
Definition: PlotWindow.h:137
This option enables the ability for a user to enable a grid over the plot area.
Definition: PlotWindow.h:132
void replot()
Reset the scale of the plot, replot it and emit plot changed.
QCheckBox * m_autoScaleCheckBox
Set Scale Dialog&#39;s checkbox for enabling automatic scaling on x &amp; y.
Definition: PlotWindow.h:279
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
bool userCanAddCurves() const
Ask if a user action can add this curve to this window in general.
Definition: PlotWindow.cpp:254
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
Definition: PlotWindow.cpp:436
QwtPlot * plot()
Get the plot encapsulated by this PlotWindow.
bool m_allowUserToAddCurves
Is the window showing the curve markers?
Definition: PlotWindow.h:324
This option exports the plot into a standard image format.
Definition: PlotWindow.h:112
Units
These are all the possible units for the x or y data in a plot curve.
Definition: PlotCurve.h:54
QPointer< QAction > m_showHideGrid
Show plot grid lines action.
Definition: PlotWindow.h:316
void changePlotLabels()
This method creates the dialog box which allows the user to relabel the plot window.
Definition: PlotWindow.cpp:854
void setupDefaultMenu(MenuOptions optionsToProvide)
The user can add menu items from parent classes, but there are some menu items that are common betwee...
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves&#39; x data in this plot window.
Definition: PlotWindow.cpp:266
PlotCurve::Units yAxisUnits() const
This is the data-type of the curves&#39; y data in this plot window.
Definition: PlotWindow.cpp:278
void onClipboardChanged()
This slot will be called when the system clipboard is changed.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:25:35