Isis Developer Reference
|
#include <PlotWindow.h>
Public Types | |
enum | MenuOptions { ShowHideMarkersMenuOption = 1, ShowHideCurvesMenuOption = 2, ShowTableMenuOption = 4, SaveMenuOption = 8, PrintMenuOption = 16, TrackMenuOption = 32, BackgroundSwitchMenuOption = 64, ShowHideGridMenuOption = 128, RenameLabelsMenuOption = 256, SetDisplayRangeMenuOption = 512, ResetScaleMenuOption = 1024, ClearPlotMenuOption = 2048, DefaultHelpMenuOption = 4096, LineFitMenuOption = 8192, ConfigurePlotMenuOption = 16384, AllMenuOptions } |
There is a menu option for everything in the plot window's menu. More... | |
Public Slots | |
void | clearPlot () |
This method completely clears the plot of all plot items. More... | |
void | configurePlotCurves () |
This method creates a CubePlotCurveConfigureDialog object. More... | |
void | createBestFitLine () |
This method prompts the user to select the best fit line criterea. More... | |
void | printPlot () |
Provides printing support of the plot image. More... | |
void | changePlotLabels () |
This method creates the dialog box which allows the user to relabel the plot window. More... | |
void | savePlot () |
This method allows the user to save the plot as a png, jpg, or tif image file. More... | |
void | setDefaultRange () |
Resets the x/y min/max to the defaults. More... | |
void | setLabels () |
Makes the user specified changes to the plot labels. More... | |
void | setUserValues () |
This method sets the scale for the axis according to the user specified numbers. More... | |
void | showHideAllMarkers () |
Shows/Hides all the markers(symbols) More... | |
void | showHideAllCurves () |
This method shows or hides all of the curves in the plotWindow. More... | |
void | resetScale () |
Sets plot scale back to the defaults. More... | |
void | showHideGrid () |
This method hides/shows the grid on the plotWindow and changes the text for the action. More... | |
void | showHelp () |
This method creates and shows the help dialog box for the plot window. More... | |
void | showTable () |
This method is called from the showTable action on the tool bar There are some checks done to make sure there are data to fill the table. More... | |
void | switchBackground () |
This method toggles the plot background color between black and white. More... | |
void | trackerEnabled () |
Enables the plot mouse tracker. More... | |
void | scheduleFillTable () |
Fills in the table with the data from the current curves in the plotWindow once all current actions/activations are done. More... | |
void | fillTable () |
Fills in the table with the data from the current curves in the plotWindow immediately. More... | |
Signals | |
void | closed () |
Emitted when there is a close event on this window that will be accepted. More... | |
void | plotChanged () |
Emitted every time there is a change to the plot window. More... | |
void | requestFillTable () |
Public Member Functions | |
PlotWindow (QString title, PlotCurve::Units xAxisUnits, PlotCurve::Units yAxisUnits, QWidget *parent, MenuOptions optionsToProvide=AllMenuOptions) | |
This constructs a plot window. More... | |
~PlotWindow () | |
virtual void | add (CubePlotCurve *pc) |
This method adds the curves to the plot. More... | |
virtual void | clearPlotCurves () |
This method also clears the plot of all plot items, but does not call the table delete stuff This method is called from plotTool each time the changePlot() method is called. More... | |
bool | canAdd (CubePlotCurve *curveToTest) const |
This method tests whethere or not a CubePlotCurve can be successfully added to this window. More... | |
QColor | plotBackgroundColor () const |
Returns the plot's background color. More... | |
QList< CubePlotCurve * > | plotCurves () |
Get a comprehensive list of the plot curves inside of this plot window, excluding plot curves that are in the process of being removed. More... | |
QList< const CubePlotCurve * > | plotCurves () const |
Get a comprehensive const list of the plot curves inside of this plot window, excluding plot curves that are in the process of being removed. More... | |
QList< QwtPlotSpectrogram * > | plotSpectrograms () |
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window. More... | |
QList< const QwtPlotSpectrogram * > | plotSpectrograms () const |
Get a comprehensive const list of the scatter plots (spectrograms) inside of this plot window. More... | |
QString | plotTitle () const |
Returns the plot title. More... | |
bool | userCanAddCurves () const |
Ask if a user action can add this curve to this window in general. More... | |
PlotCurve::Units | xAxisUnits () const |
This is the data-type of the curves' x data in this plot window. More... | |
PlotCurve::Units | yAxisUnits () const |
This is the data-type of the curves' y data in this plot window. More... | |
virtual void | paint (MdiCubeViewport *vp, QPainter *painter) |
Paint plot curve information onto the viewport. More... | |
void | replot () |
Reset the scale of the plot, replot it and emit plot changed. More... | |
void | setAxisLabel (int axisId, QString title) |
Sets the plots given axis title to the given string. More... | |
void | setPlotBackground (QColor c) |
Sets the plot background color to the given color. More... | |
void | setPlotTitle (QString pt) |
Sets the plot title to the given string. More... | |
void | setUserCanAddCurves (bool) |
Allow or disallow users from manually putting curves into this plot window through either copy-and-paste or drag-and-drop. More... | |
void | showWindow () |
Shows the plot window, and raises it to the front of any overlapping sibling widgets. More... | |
virtual void | update (MdiCubeViewport *activeViewport) |
This is provided to allow children to react to tool updates. More... | |
Static Public Member Functions | |
static QString | defaultWindowTitle () |
This is the typical suffix for plot windows, it's here in case we want to update all plot windows to have a different ending than just 'Plot' on them (for example, 'Plot Window'). More... | |
static QString | settingsFileName (QString objectTitle) |
Protected Member Functions | |
void | createWidgets (MenuOptions optionsToProvide) |
This method is called by the constructor to create the plot, legend. More... | |
void | disableAxisAutoScale () |
This turns off scaling the x/y axes automatically. More... | |
virtual void | dragEnterEvent (QDragEnterEvent *event) |
When a user drags data into our plot window, we need to indicate whether or not this data is compatible with this window. More... | |
virtual void | dropEvent (QDropEvent *event) |
This is called when a user drops data into our window. More... | |
virtual bool | eventFilter (QObject *o, QEvent *e) |
This method filters the events of the objects it is connected to. More... | |
void | mousePressEvent (QObject *object, QMouseEvent *e) |
This is a helper method for the eventFilter() method. More... | |
QwtPlot * | plot () |
Get the plot encapsulated by this PlotWindow. More... | |
void | setMenus (QList< QMenu * > menus, QList< QAction * > actions) |
Sets up the menus added from a parent object. More... | |
QwtPlotZoomer * | zoomer () |
Get this window's plot's zoomer. More... | |
QString | settingsFileName () const |
virtual void | closeEvent (QCloseEvent *event) |
This method is overridden so that we can be sure to write the current settings of the Main window. More... | |
virtual void | readSettings (QSize defaultSize=QSize()) |
This method ensure that the settings get written even if the Main window was only hidden, not closed. More... | |
There is a menu option for everything in the plot window's menu.
This is provided so that you can enable/disable any given option.
Isis::PlotWindow::PlotWindow | ( | QString | title, |
PlotCurve::Units | xAxisUnits, | ||
PlotCurve::Units | yAxisUnits, | ||
QWidget * | parent, | ||
MenuOptions | optionsToProvide = AllMenuOptions |
||
) |
This constructs a plot window.
The plot window graphs any curve sent to it via the addPlotCurve() method.
title | The window title and default plot title |
xAxisUnits | The x-bottom axis data's units, which must match any curves' units that are added to this window. |
yAxisUnits | The y-left axis data's units, which must match any curves' units that are added to this window. |
parent | The Qt parent widget |
optionsToProvide | A bit-flag containing information on which options to provide to the users. |
References _FILEINFO_, Isis::PlotCurve::Band, createWidgets(), Isis::PlotCurve::CubeDN, Isis::PlotCurve::Elevation, fillTable(), Isis::PlotCurve::Kilometers, Isis::PlotCurve::Meters, Isis::PlotCurve::Percentage, Isis::PlotCurve::PixelNumber, plot(), plotChanged(), Isis::IException::Programmer, Isis::MainWindow::readSettings(), requestFillTable(), scheduleFillTable(), setPlotBackground(), setPlotTitle(), Isis::PlotCurve::Wavelength, xAxisUnits(), and yAxisUnits().
Isis::PlotWindow::~PlotWindow | ( | ) |
References plotCurves().
|
virtual |
This method adds the curves to the plot.
pc |
References Isis::PlotCurve::attachMarkers(), canAdd(), fillTable(), plot(), plotChanged(), replot(), resetScale(), and Isis::CubePlotCurve::updateLegendItemWidget().
Referenced by dropEvent().
bool Isis::PlotWindow::canAdd | ( | CubePlotCurve * | curveToTest | ) | const |
This method tests whethere or not a CubePlotCurve can be successfully added to this window.
Plot curves with mismatched X/Y data from the plot's x/y axis types can not be added to the window. This does not test whether or not a user is allowed to add the curve manually, just if the curve can be added programatically.
curveToTest | The plot curve to test for compatibility with this window |
References Isis::PlotCurve::xUnits(), and Isis::PlotCurve::yUnits().
Referenced by add().
|
slot |
This method creates the dialog box which allows the user to relabel the plot window.
References plot(), and setLabels().
|
slot |
This method completely clears the plot of all plot items.
i.e. curves and markers, which also deletes the legend also calls the necessary method to delete the table stuff
References clearPlotCurves(), and Isis::TableMainWindow::table().
|
virtual |
This method also clears the plot of all plot items, but does not call the table delete stuff This method is called from plotTool each time the changePlot() method is called.
References replot().
Referenced by clearPlot().
|
signal |
Emitted when there is a close event on this window that will be accepted.
Referenced by eventFilter().
|
protectedvirtualinherited |
This method is overridden so that we can be sure to write the current settings of the Main window.
event |
Reimplemented in Isis::ViewportMainWindow, and Isis::TableMainWindow.
Referenced by Isis::TableMainWindow::closeEvent(), and Isis::ViewportMainWindow::closeEvent().
|
slot |
This method creates a CubePlotCurveConfigureDialog object.
When there are no curves in this PlotWindow, the dialog will not be created.
References plotChanged(), and plotCurves().
|
slot |
This method prompts the user to select the best fit line criterea.
The PlotWindowBestFitDialog will create the best fit line automatically when the user asks for one, so we don't need to worry about doing any more than showing a dialog here.
References plot().
|
protected |
This method is called by the constructor to create the plot, legend.
zoomer, and main window.
optionsToProvide | This is a bit-flag containing information on which menu options to give the user/put in the GUI. |
Referenced by PlotWindow().
|
static |
This is the typical suffix for plot windows, it's here in case we want to update all plot windows to have a different ending than just 'Plot' on them (for example, 'Plot Window').
Referenced by Isis::HistogramTool::createWindow(), Isis::SpatialPlotTool::createWindow(), and Isis::SpectralPlotTool::createWindow().
|
protected |
This turns off scaling the x/y axes automatically.
Use this if you have a very specific axis range you want to use, but keep in mind that users (potentially) have an option to re-enable axis auto scaling if they want to.
Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().
|
protectedvirtual |
When a user drags data into our plot window, we need to indicate whether or not this data is compatible with this window.
This checks userCanAddCurve() on the drag & drop data and allows or disallowed the event accordingly.
event | The drag event to test |
|
protectedvirtual |
This is called when a user drops data into our window.
The dragEnterEvent() must have said that this curve is compatible with this window. This provides all of the available options to the user (if any) set by the creator of the drag & drop event (i.e. whether or not we can move or just copy). If there are options, we create a context menu - otherwise the default action is taken.
event | The drop event containing the curve to put into the current window. |
References add(), and plotChanged().
|
protectedvirtual |
This method filters the events of the objects it is connected to.
In this case, the eventFilter has been installed on the m_plot and m_legend.
o | |
e |
Reimplemented in Isis::ScatterPlotWindow.
References closed(), mousePressEvent(), and plot().
Referenced by Isis::ScatterPlotWindow::eventFilter().
|
slot |
Fills in the table with the data from the current curves in the plotWindow immediately.
References Isis::TableMainWindow::addToTable(), Isis::IsSpecial(), Isis::TableMainWindow::listWidget(), Isis::Null, plotCurves(), Isis::TableMainWindow::table(), Isis::toDouble(), and Isis::toString().
Referenced by add(), PlotWindow(), and showTable().
|
protected |
This is a helper method for the eventFilter() method.
When a mouse press event is seen, this handles it. For example, if the user right clicks and the clipboard contains compatible data then this will give a paste option.
object | The object which was pressed |
event | The mouse event which contains button information |
Referenced by eventFilter().
|
virtual |
Paint plot curve information onto the viewport.
vp | The cube viewport to paint onto |
painter | The painter to use for painting |
Reimplemented in Isis::ScatterPlotWindow.
References Isis::CubePlotCurve::paint(), and plotCurves().
Referenced by Isis::ScatterPlotWindow::paint(), and Isis::AbstractPlotTool::paintViewport().
|
protected |
Get the plot encapsulated by this PlotWindow.
Referenced by add(), Isis::HistogramPlotWindow::add(), changePlotLabels(), Isis::ScatterPlotWindow::colorPlot(), createBestFitLine(), eventFilter(), Isis::ScatterPlotWindow::eventFilter(), Isis::HistogramPlotWindow::HistogramPlotWindow(), PlotWindow(), Isis::ScatterPlotWindow::ScatterPlotWindow(), setDefaultRange(), and Isis::ScatterPlotWindow::setMousePosition().
QColor Isis::PlotWindow::plotBackgroundColor | ( | ) | const |
Returns the plot's background color.
|
signal |
Emitted every time there is a change to the plot window.
Referenced by add(), configurePlotCurves(), dropEvent(), PlotWindow(), and replot().
QList< CubePlotCurve * > Isis::PlotWindow::plotCurves | ( | ) |
Get a comprehensive list of the plot curves inside of this plot window, excluding plot curves that are in the process of being removed.
References Isis::PlotCurve::color().
Referenced by configurePlotCurves(), fillTable(), paint(), showTable(), and ~PlotWindow().
QList< const CubePlotCurve * > Isis::PlotWindow::plotCurves | ( | ) | const |
Get a comprehensive const list of the plot curves inside of this plot window, excluding plot curves that are in the process of being removed.
QList< QwtPlotSpectrogram * > Isis::PlotWindow::plotSpectrograms | ( | ) |
Get a comprehensive list of the scatter plots (spectrograms) inside of this plot window.
QList< const QwtPlotSpectrogram * > Isis::PlotWindow::plotSpectrograms | ( | ) | const |
Get a comprehensive const list of the scatter plots (spectrograms) inside of this plot window.
QString Isis::PlotWindow::plotTitle | ( | ) | const |
Returns the plot title.
|
slot |
Provides printing support of the plot image.
|
protectedvirtualinherited |
This method ensure that the settings get written even if the Main window was only hidden, not closed.
event | This method is called from the constructor so that when the Main window is created, it know's it's size and location. |
References Isis::MainWindow::settingsFileName().
Referenced by PlotWindow(), Isis::TableMainWindow::TableMainWindow(), and Isis::ViewportMainWindow::ViewportMainWindow().
void Isis::PlotWindow::replot | ( | ) |
Reset the scale of the plot, replot it and emit plot changed.
References plotChanged(), and resetScale().
Referenced by add(), clearPlotCurves(), Isis::ScatterPlotWindow::colorPlot(), Isis::HistogramTool::refreshPlot(), Isis::SpatialPlotTool::refreshPlot(), Isis::SpectralPlotTool::refreshPlot(), Isis::ScatterPlotWindow::ScatterPlotWindow(), Isis::SpectralPlotWindow::setBandMarkersVisible(), setUserValues(), and Isis::ScatterPlotWindow::showHideContour().
|
signal |
Referenced by PlotWindow(), and scheduleFillTable().
|
slot |
Sets plot scale back to the defaults.
References Isis::PlotCurve::Band.
|
slot |
This method allows the user to save the plot as a png, jpg, or tif image file.
|
slot |
Fills in the table with the data from the current curves in the plotWindow once all current actions/activations are done.
This is provided for performance reasons - re-plotting 4 curves only requires one fillTable at the end, instead of after each curve change.
References requestFillTable().
Referenced by PlotWindow().
void Isis::PlotWindow::setAxisLabel | ( | int | axisId, |
QString | title | ||
) |
Sets the plots given axis title to the given string.
axisId | |
title |
|
slot |
Resets the x/y min/max to the defaults.
References plot(), and setUserValues().
|
slot |
Makes the user specified changes to the plot labels.
Referenced by changePlotLabels().
Sets up the menus added from a parent object.
menu | |
actions |
void Isis::PlotWindow::setPlotBackground | ( | QColor | c | ) |
Sets the plot background color to the given color.
c |
Referenced by Isis::HistogramPlotWindow::HistogramPlotWindow(), and PlotWindow().
void Isis::PlotWindow::setPlotTitle | ( | QString | pt | ) |
Sets the plot title to the given string.
This does not update the window title.
pt | The plot title to use |
Referenced by PlotWindow().
|
protectedinherited |
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::TableMainWindow::readColumnSettings(), Isis::TableMainWindow::readItemSettings(), Isis::BlinkTool::readSettings(), Isis::MainWindow::readSettings(), Isis::BlinkTool::writeSettings(), and Isis::TableMainWindow::writeSettings().
|
staticinherited |
References _FILEINFO_, and Isis::IException::Programmer.
void Isis::PlotWindow::setUserCanAddCurves | ( | bool | userHasControl | ) |
Allow or disallow users from manually putting curves into this plot window through either copy-and-paste or drag-and-drop.
userHasControl | True if users can add curves manually, false otherwise |
|
slot |
This method sets the scale for the axis according to the user specified numbers.
References replot().
Referenced by setDefaultRange().
|
slot |
This method creates and shows the help dialog box for the plot window.
this is called from the Help-->Basic Help menu.
|
slot |
This method shows or hides all of the curves in the plotWindow.
|
slot |
Shows/Hides all the markers(symbols)
|
slot |
This method hides/shows the grid on the plotWindow and changes the text for the action.
|
slot |
This method is called from the showTable action on the tool bar There are some checks done to make sure there are data to fill the table.
References fillTable(), plotCurves(), Isis::TableMainWindow::setTrackListItems(), and Isis::TableMainWindow::syncColumns().
void Isis::PlotWindow::showWindow | ( | ) |
Shows the plot window, and raises it to the front of any overlapping sibling widgets.
Referenced by Isis::AbstractPlotTool::showPlotWindow().
|
slot |
This method toggles the plot background color between black and white.
|
slot |
Enables the plot mouse tracker.
|
virtual |
This is provided to allow children to react to tool updates.
This is useful for example for band markers in the spectral plots.
activeViewport | The currently selected viewport |
Reimplemented in Isis::SpectralPlotWindow.
Referenced by Isis::AbstractPlotTool::updateTool().
bool Isis::PlotWindow::userCanAddCurves | ( | ) | const |
Ask if a user action can add this curve to this window in general.
This verifies that the user is allowed to add curves to this window but not that a particular curve is compatible with this window.
PlotCurve::Units Isis::PlotWindow::xAxisUnits | ( | ) | const |
This is the data-type of the curves' x data in this plot window.
All of the cube plot curves must have the same units for x axis data or the display will not make sense.
Referenced by PlotWindow(), Isis::SpatialPlotTool::refreshPlot(), and Isis::SpectralPlotTool::refreshPlot().
PlotCurve::Units Isis::PlotWindow::yAxisUnits | ( | ) | const |
This is the data-type of the curves' y data in this plot window.
All of the cube plot curves must have the same units for y-left axis data (y-right sometimes has different units) or the display will not make sense.
Referenced by PlotWindow().
|
protected |
Get this window's plot's zoomer.
Referenced by Isis::ScatterPlotWindow::ScatterPlotWindow().