Isis Developer 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 
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 
88  class PlotWindow : public MainWindow {
89  Q_OBJECT
90 
91  public:
96  enum MenuOptions {
164 
181 
182 
183  };
184 
185  PlotWindow(QString title, PlotCurve::Units xAxisUnits,
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;
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();
222  void plotChanged();
223 
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);
250  void disableAxisAutoScale();
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:
263  void autoScaleCheckboxToggled();
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 
275  QWidget *m_parent;
277  QwtPlotZoomer *m_zoomer;
279  QwtPlotGrid *m_grid;
281  QCheckBox *m_autoScaleCheckBox;
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 
309  QAction *m_pasteAct;
310 
312  QPointer<QAction> m_action;
314  QPointer<QAction> m_showHideAllCurves;
316  QPointer<QAction> m_showHideAllMarkers;
318  QPointer<QAction> m_showHideGrid;
319 
321  PlotCurve::Units m_xAxisUnits;
323  PlotCurve::Units m_yAxisUnits;
324 
326  bool m_allowUserToAddCurves;
328  bool m_autoscaleAxes;
329 
330  QwtPlot *m_plot;
331  QwtLegend *m_legend;
332  bool m_plotXLogScale;
333  bool m_plotYLogScale;
334  TableMainWindow *m_tableWindow;
335  QToolBar *m_toolBar;
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.
347 Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *);
348 Q_DECLARE_METATYPE(QwtPlotSpectrogram *);
349 
350 #endif
Isis::PlotWindow::dragEnterEvent
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:1823
QwtPlot
Isis::PlotWindow::yAxisUnits
PlotCurve::Units yAxisUnits() const
This is the data-type of the curves' y data in this plot window.
Definition: PlotWindow.cpp:278
Isis::PlotWindow::setMenus
void setMenus(QList< QMenu * > menus, QList< QAction * > actions)
Sets up the menus added from a parent object.
Definition: PlotWindow.cpp:1358
CubePlotCurve.h
Isis::PlotWindow::showWindow
void showWindow()
Shows the plot window, and raises it to the front of any overlapping sibling widgets.
Definition: PlotWindow.cpp:185
FileName.h
Isis::PlotWindow::showHideGrid
void showHideGrid()
This method hides/shows the grid on the plotWindow and changes the text for the action.
Definition: PlotWindow.cpp:923
Stretch.h
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
QWidget
Isis::TableMainWindow::listWidget
QListWidget * listWidget() const
Returns the list widget.
Definition: TableMainWindow.h:84
Cube.h
Isis::PlotWindow::createBestFitLine
void createBestFitLine()
This method prompts the user to select the best fit line criterea.
Definition: PlotWindow.cpp:529
Isis::PlotCurve::CubeDN
@ CubeDN
The data is a Cube DN value.
Definition: PlotCurve.h:67
Isis::PlotWindow::requestFillTable
void requestFillTable()
Isis::PlotWindow::ResetScaleMenuOption
@ ResetScaleMenuOption
This option provides the user with an alternative zoom out button.
Definition: PlotWindow.h:147
MdiCubeViewport.h
Isis::TableMainWindow::table
QTableWidget * table() const
Returns the table.
Definition: TableMainWindow.h:70
Isis::PlotWindow::setLabels
void setLabels()
Makes the user specified changes to the plot labels.
Definition: PlotWindow.cpp:910
Isis::CubePlotCurve::updateLegendItemWidget
void updateLegendItemWidget(QWidget *legendItem)
This creates a legend item and overrides events from it.
Definition: CubePlotCurve.cpp:345
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::PlotWindow::plotTitle
QString plotTitle() const
Returns the plot title.
Definition: PlotWindow.cpp:241
Isis::PlotWindow::PlotWindow
PlotWindow(QString title, PlotCurve::Units xAxisUnits, PlotCurve::Units yAxisUnits, QWidget *parent, MenuOptions optionsToProvide=AllMenuOptions)
This constructs a plot window.
Definition: PlotWindow.cpp:66
Isis::CubePlotCurve
This is a plot curve with information relating it to a particular cube or region of a cube.
Definition: CubePlotCurve.h:53
Isis::PlotWindow::setAxisLabel
void setAxisLabel(int axisId, QString title)
Sets the plots given axis title to the given string.
Definition: PlotWindow.cpp:208
Isis::PlotWindow::showHelp
void showHelp()
This method creates and shows the help dialog box for the plot window.
Definition: PlotWindow.cpp:999
Isis::PlotCurve::PixelNumber
@ PixelNumber
The data is a pixel #.
Definition: PlotCurve.h:79
Isis::PlotWindow::showHideAllMarkers
void showHideAllMarkers()
Shows/Hides all the markers(symbols)
Definition: PlotWindow.cpp:939
Isis::PlotWindow::setUserValues
void setUserValues()
This method sets the scale for the axis according to the user specified numbers.
Definition: PlotWindow.cpp:694
Isis::CubePlotCurveConfigureDialog
This should be an inner class for CubePlotCurve, but Qt doesn't support having a QObject as an inner ...
Definition: CubePlotCurveConfigureDialog.h:41
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::TableMainWindow::syncColumns
void syncColumns()
This method hides and shows the columns according to which items the user has selected to be view-abl...
Definition: TableMainWindow.cpp:291
MainWindow.h
QwtPlotItem
Isis::PlotCurve::yUnits
Units yUnits() const
Get the units of the y-axis double data.
Definition: PlotCurve.cpp:86
PvlGroup.h
Isis::PlotWindow::userCanAddCurves
bool userCanAddCurves() const
Ask if a user action can add this curve to this window in general.
Definition: PlotWindow.cpp:254
QMenu
Isis::PlotWindow::fillTable
void fillTable()
Fills in the table with the data from the current curves in the plotWindow immediately.
Definition: PlotWindow.cpp:1411
Isis::PlotWindow::showHideAllCurves
void showHideAllCurves()
This method shows or hides all of the curves in the plotWindow.
Definition: PlotWindow.cpp:967
Isis::CubePlotCurve::paint
void paint(CubeViewport *vp, QPainter *painter)
Use information inside of the plot curve to paint onto a cube viewport.
Definition: CubePlotCurve.cpp:171
Isis::PlotWindow::printPlot
void printPlot()
Provides printing support of the plot image.
Definition: PlotWindow.cpp:573
Isis::PlotWindow::ShowHideCurvesMenuOption
@ ShowHideCurvesMenuOption
This option is titled 'Hide All Curves' which makes all curves invisible.
Definition: PlotWindow.h:103
Isis::PlotCurve
Definition: PlotCurve.h:44
Isis::PlotWindow::changePlotLabels
void changePlotLabels()
This method creates the dialog box which allows the user to relabel the plot window.
Definition: PlotWindow.cpp:854
Isis::PlotWindow::MenuOptions
MenuOptions
There is a menu option for everything in the plot window's menu.
Definition: PlotWindow.h:96
Isis::PlotWindow::showTable
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:1566
Isis::PlotWindow::defaultWindowTitle
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:1810
Isis::PlotCurve::Meters
@ Meters
The data is in meters.
Definition: PlotCurve.h:83
PlotWindow.h
Isis::PlotCurve::Units
Units
These are all the possible units for the x or y data in a plot curve.
Definition: PlotCurve.h:54
Isis::PlotWindow::update
virtual void update(MdiCubeViewport *activeViewport)
This is provided to allow children to react to tool updates.
Definition: PlotWindow.cpp:197
Isis::PlotWindow::add
virtual void add(CubePlotCurve *pc)
This method adds the curves to the plot.
Definition: PlotWindow.cpp:436
Isis::PlotWindow::ShowHideGridMenuOption
@ ShowHideGridMenuOption
This option enables the ability for a user to enable a grid over the plot area.
Definition: PlotWindow.h:134
QToolBar
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
QHistogram.h
Isis::IsSpecial
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:197
Isis::PlotWindow::BackgroundSwitchMenuOption
@ 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
QComboBox
Isis::TableMainWindow::addToTable
void addToTable(bool setOn, const QString &heading, const QString &menuText="", int insertAt=-1, Qt::Orientation o=Qt::Horizontal, QString toolTip="")
Adds a new column to the table when a new curve is added to the plot.
Definition: TableMainWindow.cpp:208
Isis::PlotCurve::Kilometers
@ Kilometers
The data is in kilometers.
Definition: PlotCurve.h:87
CubeViewport.h
Isis::PlotWindow::configurePlotCurves
void configurePlotCurves()
This method creates a CubePlotCurveConfigureDialog object.
Definition: PlotWindow.cpp:508
Isis::PlotWindow::ShowTableMenuOption
@ ShowTableMenuOption
This option brings up the table.
Definition: PlotWindow.h:108
Isis::PlotWindow::AllMenuOptions
@ AllMenuOptions
This is all of the available menu options.
Definition: PlotWindow.h:173
Isis::TableMainWindow::setTrackListItems
void setTrackListItems(bool track=false)
If this property is true, the class will keep track of the checked/unchecked items in the dock area w...
Definition: TableMainWindow.cpp:875
Isis::PlotWindow::zoomer
QwtPlotZoomer * zoomer()
Get this window's plot's zoomer.
Definition: PlotWindow.cpp:1388
Isis::PlotWindow::xAxisUnits
PlotCurve::Units xAxisUnits() const
This is the data-type of the curves' x data in this plot window.
Definition: PlotWindow.cpp:266
Isis::PlotCurve::Band
@ Band
The data is a band number.
Definition: PlotCurve.h:63
Isis::PlotWindow::plotBackgroundColor
QColor plotBackgroundColor() const
Returns the plot's background color.
Definition: PlotWindow.cpp:317
Isis::PlotWindow::RenameLabelsMenuOption
@ RenameLabelsMenuOption
This option enables the ability for a user to change the x/y axis labels and plot title.
Definition: PlotWindow.h:139
CubePlotCurveConfigureDialog.h
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
PlotCurve.h
Isis::PlotCurve::Percentage
@ Percentage
The data is a percentage (0-100).
Definition: PlotCurve.h:75
Isis::PlotWindowBestFitDialog
Definition: PlotWindowBestFitDialog.h:30
Isis::PlotWindow::dropEvent
virtual void dropEvent(QDropEvent *event)
This is called when a user drops data into our window.
Definition: PlotWindow.cpp:1844
Isis::PlotWindow::setUserCanAddCurves
void setUserCanAddCurves(bool)
Allow or disallow users from manually putting curves into this plot window through either copy-and-pa...
Definition: PlotWindow.cpp:231
Isis::PlotWindow::~PlotWindow
~PlotWindow()
Definition: PlotWindow.cpp:131
Isis::PlotWindow::mousePressEvent
void mousePressEvent(QObject *object, QMouseEvent *e)
This is a helper method for the eventFilter() method.
Definition: PlotWindow.cpp:1628
Isis::PlotWindow::setDefaultRange
void setDefaultRange()
Resets the x/y min/max to the defaults.
Definition: PlotWindow.cpp:743
Isis::PlotWindow::plotCurves
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
Isis::PlotWindow::scheduleFillTable
void scheduleFillTable()
Fills in the table with the data from the current curves in the plotWindow once all current actions/a...
Definition: PlotWindow.cpp:1399
Isis::PlotWindow::SaveMenuOption
@ SaveMenuOption
This option exports the plot into a standard image format.
Definition: PlotWindow.h:114
Isis::TableMainWindow
a subclass of the qisis mainwindow, tablemainwindow handles all of the table tasks.
Definition: TableMainWindow.h:57
TableMainWindow.h
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::PlotWindow::PrintMenuOption
@ PrintMenuOption
This option sends the plot to a printer.
Definition: PlotWindow.h:118
Isis::PlotCurve::Wavelength
@ Wavelength
The data is a wavelength.
Definition: PlotCurve.h:92
Isis::PlotWindow::setPlotBackground
void setPlotBackground(QColor c)
Sets the plot background color to the given color.
Definition: PlotWindow.cpp:289
Isis::PlotWindow::LineFitMenuOption
@ 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
Isis::PlotWindow::disableAxisAutoScale
void disableAxisAutoScale()
This turns off scaling the x/y axes automatically.
Definition: PlotWindow.cpp:1664
Isis::PlotCurve::Elevation
@ Elevation
The data is an elevation (in meters).
Definition: PlotCurve.h:71
Isis::PlotWindow::plotSpectrograms
QList< QwtPlotSpectrogram * > plotSpectrograms()
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window.
Definition: PlotWindow.cpp:381
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::PlotCurve::xUnits
Units xUnits() const
Get the units of the x-axis double data.
Definition: PlotCurve.cpp:76
Isis::PlotWindow::plot
QwtPlot * plot()
Get the plot encapsulated by this PlotWindow.
Definition: PlotWindow.cpp:1653
Isis::MainWindow::readSettings
virtual void readSettings(QSize defaultSize=QSize())
This method ensure that the settings get written even if the Main window was only hidden,...
Definition: MainWindow.cpp:80
QwtPlotCurve
Isis::PlotWindow::canAdd
bool canAdd(CubePlotCurve *curveToTest) const
This method tests whethere or not a CubePlotCurve can be successfully added to this window.
Definition: PlotWindow.cpp:305
Isis::PlotWindow::savePlot
void savePlot()
This method allows the user to save the plot as a png, jpg, or tif image file.
Definition: PlotWindow.cpp:605
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
Isis::PlotCurve::attachMarkers
void attachMarkers()
After attaching this curve to a plot, due to an inheritance/implementation complication with qwt the ...
Definition: PlotCurve.cpp:46
QPair< double, double >
Isis::PlotWindow::SetDisplayRangeMenuOption
@ SetDisplayRangeMenuOption
This option allows the user to set the x/y axis display value ranges.
Definition: PlotWindow.h:143
PvlKeyword.h
Isis::PlotWindow::trackerEnabled
void trackerEnabled()
Enables the plot mouse tracker.
Definition: PlotWindow.cpp:560
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
QDialog
Isis::PlotWindow::ShowHideMarkersMenuOption
@ ShowHideMarkersMenuOption
This option is titled 'Hide All Symbols' which hides all markers.
Definition: PlotWindow.h:98
Isis::PlotWindow::TrackMenuOption
@ 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
Isis::PlotWindow::ConfigurePlotMenuOption
@ ConfigurePlotMenuOption
This option allows the user to change the curve name, color, style size, and symbol of the curve.
Definition: PlotWindow.h:169
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::MainWindow
Base class for the Qisis main windows.
Definition: MainWindow.h:24
QObject
Isis::PlotWindow::createWidgets
void createWidgets(MenuOptions optionsToProvide)
This method is called by the constructor to create the plot, legend.
Definition: PlotWindow.cpp:145
Isis::PlotWindow::replot
void replot()
Reset the scale of the plot, replot it and emit plot changed.
Definition: PlotWindow.cpp:1797
Isis::PlotWindow::switchBackground
void switchBackground()
This method toggles the plot background color between black and white.
Definition: PlotWindow.cpp:635
IsisDebug.h
Isis::PlotWindow
Definition: PlotWindow.h:88
Interpolator.h
Isis::PlotWindow::clearPlot
void clearPlot()
This method completely clears the plot of all plot items.
Definition: PlotWindow.cpp:492
QAction
QDockWidget
Isis::PlotWindow::ClearPlotMenuOption
@ ClearPlotMenuOption
This option allows the user to delete all of the data inside the plot.
Definition: PlotWindow.h:153
Isis::PlotWindow::eventFilter
virtual bool eventFilter(QObject *o, QEvent *e)
This method filters the events of the objects it is connected to.
Definition: PlotWindow.cpp:1590
Isis::PlotWindow::setPlotTitle
void setPlotTitle(QString pt)
Sets the plot title to the given string.
Definition: PlotWindow.cpp:219
Isis::PlotWindow::plotChanged
void plotChanged()
Emitted every time there is a change to the plot window.
Isis::PlotWindow::resetScale
void resetScale()
Sets plot scale back to the defaults.
Definition: PlotWindow.cpp:660
Isis::PlotWindow::closed
void closed()
Emitted when there is a close event on this window that will be accepted.
Isis::PlotWindow::clearPlotCurves
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
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::PlotCurve::color
QColor color() const
This method returns the color of the curve.
Definition: PlotCurve.cpp:56
Q_DECLARE_OPAQUE_POINTER
Q_DECLARE_OPAQUE_POINTER(QwtPlotSpectrogram *)
We have scatter plot types as QVariant data types, so here it's enabled.
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.
Isis::PlotWindow::paint
virtual void paint(MdiCubeViewport *vp, QPainter *painter)
Paint plot curve information onto the viewport.
Definition: PlotWindow.cpp:1787
PlotWindowBestFitDialog.h
Isis::PlotWindow::DefaultHelpMenuOption
@ DefaultHelpMenuOption
Not implemented.
Definition: PlotWindow.h:157