OpenMS
PlotWidget Class Referenceabstract

Base class for spectrum widgets. More...

#include <OpenMS/VISUAL/PlotWidget.h>

Inheritance diagram for PlotWidget:
[legend]
Collaboration diagram for PlotWidget:
[legend]

Static Public Attributes

static const char RT_AXIS_TITLE []
 
static const char MZ_AXIS_TITLE []
 
static const char INTENSITY_AXIS_TITLE []
 
static const char IM_MS_AXIS_TITLE []
 
static const char IM_ONEKZERO_AXIS_TITLE []
 

Type definitions

typedef LayerDataBase::ExperimentType ExperimentType
 Main data type (experiment) More...
 
typedef LayerDataBase::FeatureMapType FeatureMapType
 Main data type (features) More...
 
typedef ExperimentType::SpectrumType SpectrumType
 Spectrum type. More...
 
 PlotWidget (const Param &preferences, QWidget *parent=nullptr)
 Default constructor. More...
 
 ~PlotWidget () override
 Destructor. More...
 
virtual PlotCanvascanvas () const =0
 Returns a pointer to canvas object. More...
 
virtual AxisWidgetxAxis ()
 Returns a pointer to the x-axis axis widget. More...
 
virtual AxisWidgetyAxis ()
 Returns a pointer to the y-axis axis widget. More...
 
Int getActionMode () const
 Get the mouse action mode. More...
 
virtual bool isLegendShown () const
 Returns if the axis labels are shown. More...
 
virtual void showLegend (bool show)
 Shows/hides axis labels. More...
 
void setIntensityMode (PlotCanvas::IntensityModes mode)
 Sets the intensity mode of the PlotCanvas. More...
 
virtual void hideAxes ()
 Hides x-axis and y-axis. More...
 
virtual void saveAsImage ()
 Saves the widget's content as image file. More...
 
void sendStatusMessage (std::string, OpenMS::UInt)
 Emits a status message that should be displayed for time ms. If time is 0 the message should be displayed until the next message is emitted. More...
 
void sendCursorStatus (const String &x_value, const String &y_value)
 Emitted when the cursor position changes (for displaying e.g. in status bar) More...
 
void aboutToBeDestroyed (int window_id)
 Message about the destruction of this widget. More...
 
void openPreferences ()
 Shows the main preferences dialog. More...
 
void dropReceived (const QMimeData *data, QWidget *source, int id)
 Signal that is emitted, when a drag-and-drop action ends on this widget. More...
 
void showStatistics ()
 Shows statistics about the data (count, min, max, avg of intensity, charge, quality and meta data) More...
 
void showIntensityDistribution (const Math::Histogram<> &dist)
 Shows the intensity distribution of the current layer. More...
 
void showMetaDistribution (const String &name, const Math::Histogram<> &dist)
 Shows the meta data distribution of value name of the current layer. More...
 
void updateAxes ()
 Updates the axes by setting the right labels and calling recalculateAxes_();. More...
 
void updateHScrollbar (float min, float disp_min, float disp_max, float max)
 Updates the horizontal scrollbar. More...
 
void updateVScrollbar (float min, float disp_min, float disp_max, float max)
 Updates the vertical scrollbar. More...
 
virtual void showGoToDialog ()=0
 Shows a goto dialog. More...
 
void changeLegendVisibility ()
 Toggles the axis legend visibility. More...
 
virtual void setMapper (const DimMapper< 2 > &mapper)=0
 Set a new mapper for the canvas and axis. Internally, all dependent components are updated (e.g. projections in 2D View) More...
 

Reimplemented Qt events

PlotCanvascanvas_
 Pointer to the canvas widget. More...
 
QGridLayout * grid_
 Main layout. More...
 
AxisWidgety_axis_
 Vertical axis. More...
 
AxisWidgetx_axis_
 Horizontal axis. More...
 
QScrollBar * x_scrollbar_
 Horizontal scrollbar. More...
 
QScrollBar * y_scrollbar_
 Vertical scrollbar. More...
 
void closeEvent (QCloseEvent *e) override
 
void setCanvas_ (PlotCanvas *canvas, UInt row=0, UInt col=2)
 Adds the canvas, axes and scrollbars to the layout. More...
 
virtual void intensityModeChange_ ()
 Switch between different intensity modes. More...
 
virtual void recalculateAxes_ ()=0
 recalculates the Axis ticks More...
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
void paintEvent (QPaintEvent *) override
 make our subclassed QWidget listen to things like stylesheet changes More...
 

Additional Inherited Members

- Public Member Functions inherited from EnhancedTabBarWidgetInterface
 EnhancedTabBarWidgetInterface ()
 C'tor; creates a new ID;. More...
 
virtual ~EnhancedTabBarWidgetInterface ()
 Destructor (emits SignalProvider::aboutToBeDestroyed) More...
 
void addToTabBar (EnhancedTabBar *const parent, const String &caption, const bool make_active_tab=true)
 
Int getWindowId () const
 get the EnhancedTabBar unique window id More...
 
- Static Public Member Functions inherited from EnhancedTabBarWidgetInterface
static Int getFirstWindowID ()
 the first object to be created will get this ID More...
 

Detailed Description

Base class for spectrum widgets.

This class is the base class for the different MDI window types in the TOPPView application. For each type of spectrum view (such as 1D view, 2D view, 3D view etc.), there must exist a corresponding class derived from this class.

In TOPPView, each PlotWidget holds an enclosed PlotCanvas with which it is paired (e.g. a Plot1DWidget holds a Plot1DCanvas) which can retrieved with the canvas() function. While the PlotCanvas does the actual drawing, the PlotWidget holds information about the axes (axis widgets), scrolling (scrollbars) etc. The PlotWidget uses a grid layout (QGridLayout) with a default 3x3 grid where the upper right corner of the grid is the canvas and the spaces left and below the canvas are for the axes widget and scrollbars.

To integrate a new spectrum view (i.e. classes derived from PlotWidget and PlotCanvas) into the TOPPView application, a class must be derived from this class which holds an instance of the PlotCanvas class as a child widget.

Todo:
Add support to store the displayed data as SVG image (HiWi)

Member Typedef Documentation

◆ ExperimentType

Main data type (experiment)

◆ FeatureMapType

Main data type (features)

◆ SpectrumType

Constructor & Destructor Documentation

◆ PlotWidget()

PlotWidget ( const Param preferences,
QWidget parent = nullptr 
)

Default constructor.

◆ ~PlotWidget()

~PlotWidget ( )
override

Destructor.

Member Function Documentation

◆ aboutToBeDestroyed

void aboutToBeDestroyed ( int  window_id)
signal

Message about the destruction of this widget.

◆ canvas()

virtual PlotCanvas* canvas ( ) const
pure virtual

Returns a pointer to canvas object.

This method is overwritten for 1D, 2D, 3D to make the class specific members accessible.

The canvas object is set with the setCanvas_() method. This is usually done in the constructor.

Implemented in Plot3DWidget, Plot2DWidget, and Plot1DWidget.

Referenced by TOPPViewBase::addData(), TOPPViewBase::fileChanged_(), TOPPViewBase::getActiveCanvas(), TOPPViewBase::resetZoom(), TOPPViewBase::showPlotWidgetInWindow(), TOPPViewBase::updateToolBar(), and TOPPViewBase::zoomOtherWindows().

◆ changeLegendVisibility

void changeLegendVisibility ( )
slot

Toggles the axis legend visibility.

◆ closeEvent()

void closeEvent ( QCloseEvent *  e)
overrideprotected

◆ dragEnterEvent()

void dragEnterEvent ( QDragEnterEvent *  event)
overrideprotected

◆ dragMoveEvent()

void dragMoveEvent ( QDragMoveEvent *  event)
overrideprotected

◆ dropEvent()

void dropEvent ( QDropEvent *  event)
overrideprotected

◆ dropReceived

void dropReceived ( const QMimeData *  data,
QWidget source,
int  id 
)
signal

Signal that is emitted, when a drag-and-drop action ends on this widget.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ getActionMode()

Int getActionMode ( ) const

Get the mouse action mode.

◆ hideAxes()

virtual void hideAxes ( )
virtual

Hides x-axis and y-axis.

Reimplemented in Plot1DWidget.

◆ intensityModeChange_()

virtual void intensityModeChange_ ( )
protectedvirtual

Switch between different intensity modes.

◆ isLegendShown()

virtual bool isLegendShown ( ) const
virtual

Returns if the axis labels are shown.

Reimplemented in Plot3DWidget.

◆ openPreferences

void openPreferences ( )
signal

Shows the main preferences dialog.

◆ paintEvent()

void paintEvent ( QPaintEvent *  )
overrideprotected

make our subclassed QWidget listen to things like stylesheet changes

◆ recalculateAxes_()

virtual void recalculateAxes_ ( )
protectedpure virtual

recalculates the Axis ticks

Implemented in Plot3DWidget, and Plot1DWidget.

◆ saveAsImage()

virtual void saveAsImage ( )
virtual

Saves the widget's content as image file.

Reimplemented in Plot1DWidget.

◆ sendCursorStatus

void sendCursorStatus ( const String x_value,
const String y_value 
)
signal

Emitted when the cursor position changes (for displaying e.g. in status bar)

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ sendStatusMessage

void sendStatusMessage ( std::string  ,
OpenMS::UInt   
)
signal

Emits a status message that should be displayed for time ms. If time is 0 the message should be displayed until the next message is emitted.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ setCanvas_()

void setCanvas_ ( PlotCanvas canvas,
UInt  row = 0,
UInt  col = 2 
)
protected

Adds the canvas, axes and scrollbars to the layout.

row and col define the position of the canvas. Axes and scrollbars are added to the left and bottom of the canvas.

◆ setIntensityMode()

void setIntensityMode ( PlotCanvas::IntensityModes  mode)

Sets the intensity mode of the PlotCanvas.

Referenced by TOPPViewBase::setIntensityMode().

◆ setMapper

virtual void setMapper ( const DimMapper< 2 > &  mapper)
pure virtualslot

Set a new mapper for the canvas and axis. Internally, all dependent components are updated (e.g. projections in 2D View)

Parameters
mapperThe new mapper for translating between units and axis

Implemented in Plot2DWidget, Plot1DWidget, and Plot3DWidget.

◆ showGoToDialog

virtual void showGoToDialog ( )
pure virtualslot

Shows a goto dialog.

Referenced by TOPPViewBase::showGoToDialog().

◆ showIntensityDistribution

void showIntensityDistribution ( const Math::Histogram<> &  dist)
slot

Shows the intensity distribution of the current layer.

◆ showLegend()

virtual void showLegend ( bool  show)
virtual

Shows/hides axis labels.

Reimplemented in Plot3DWidget, and Plot1DWidget.

Referenced by TOPPViewBase::toggleAxisLegends().

◆ showMetaDistribution

void showMetaDistribution ( const String name,
const Math::Histogram<> &  dist 
)
slot

Shows the meta data distribution of value name of the current layer.

◆ showStatistics

void showStatistics ( )
slot

Shows statistics about the data (count, min, max, avg of intensity, charge, quality and meta data)

Referenced by TOPPViewBase::layerStatistics().

◆ updateAxes

void updateAxes ( )
slot

Updates the axes by setting the right labels and calling recalculateAxes_();.

◆ updateHScrollbar

void updateHScrollbar ( float  min,
float  disp_min,
float  disp_max,
float  max 
)
slot

Updates the horizontal scrollbar.

Parameters
minThe overall minimum of the range
disp_minThe displayed minimum
disp_maxThe displayed maximum
maxThe overall maximum of the range

◆ updateVScrollbar

void updateVScrollbar ( float  min,
float  disp_min,
float  disp_max,
float  max 
)
slot

Updates the vertical scrollbar.

Parameters
minThe overall minimum of the range
disp_minThe displayed minimum
disp_maxThe displayed maximum
maxThe overall maximum of the range

◆ xAxis()

virtual AxisWidget* xAxis ( )
inlinevirtual

Returns a pointer to the x-axis axis widget.

◆ yAxis()

virtual AxisWidget* yAxis ( )
inlinevirtual

Returns a pointer to the y-axis axis widget.

Member Data Documentation

◆ canvas_

PlotCanvas* canvas_
protected

Pointer to the canvas widget.

◆ grid_

QGridLayout* grid_
protected

Main layout.

◆ IM_MS_AXIS_TITLE

const char IM_MS_AXIS_TITLE[]
static

◆ IM_ONEKZERO_AXIS_TITLE

const char IM_ONEKZERO_AXIS_TITLE[]
static

◆ INTENSITY_AXIS_TITLE

const char INTENSITY_AXIS_TITLE[]
static

◆ MZ_AXIS_TITLE

const char MZ_AXIS_TITLE[]
static

◆ RT_AXIS_TITLE

const char RT_AXIS_TITLE[]
static

◆ x_axis_

AxisWidget* x_axis_
protected

Horizontal axis.

◆ x_scrollbar_

QScrollBar* x_scrollbar_
protected

Horizontal scrollbar.

◆ y_axis_

AxisWidget* y_axis_
protected

Vertical axis.

◆ y_scrollbar_

QScrollBar* y_scrollbar_
protected

Vertical scrollbar.