OpenMS
Plot1DWidget Class Reference

Widget for visualization of several spectra. More...

#include <OpenMS/VISUAL/Plot1DWidget.h>

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

Public Slots

void showGoToDialog () override
 
- Public Slots inherited from PlotWidget
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...
 

Signals

void showCurrentPeaksAs2D ()
 Requests to display the whole spectrum in 2D view. More...
 
void showCurrentPeaksAs3D ()
 Requests to display the whole spectrum in 3D view. More...
 
void showCurrentPeaksAsIonMobility (const MSSpectrum &spec)
 Requests to display the whole spectrum in ion mobility view. More...
 
void showCurrentPeaksAsDIA (const Precursor &pc, const MSExperiment &exp)
 Requests to display a full DIA window. More...
 
- Signals inherited from PlotWidget
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...
 

Public Member Functions

 Plot1DWidget (const Param &preferences, const DIM gravity_axis=DIM::Y, QWidget *parent=nullptr)
 Default constructor. More...
 
 ~Plot1DWidget () override
 Destructor. More...
 
Plot1DCanvascanvas () const override
 Returns a pointer to canvas object. More...
 
void setMapper (const DimMapper< 2 > &mapper) override
 Set a new mapper for the canvas and axis. Internally, all dependent components are updated (e.g. projections in 2D View) More...
 
void hideAxes () override
 Hides x-axis and y-axis. More...
 
void showLegend (bool show) override
 Shows/hides axis labels. More...
 
void toggleMirrorView (bool mirror)
 Switches to mirror view, displays another y-axis for the second spectrum. More...
 
void performAlignment (Size layer_index_1, Size layer_index_2, const Param &param)
 Performs an alignment of the layers with layer_index_1 and layer_index_2. More...
 
void resetAlignment ()
 Resets the alignment. More...
 
void saveAsImage () override
 Saves the widget's content as image file. More...
 
virtual void renderForImage (QPainter &painter)
 
- Public Member Functions inherited from PlotWidget
 PlotWidget (const Param &preferences, QWidget *parent=nullptr)
 Default constructor. More...
 
 ~PlotWidget () override
 Destructor. 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...
 
void setIntensityMode (PlotCanvas::IntensityModes mode)
 Sets the intensity mode of the PlotCanvas. More...
 
- 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...
 

Protected Member Functions

void recalculateAxes_ () override
 recalculates the Axis ticks More...
 
- Protected Member Functions inherited from PlotWidget
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...
 
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...
 

Protected Attributes

AxisWidgetflipped_y_axis_
 The second y-axis for the mirror view. More...
 
QSpacerItem * spacer_
 Spacer between the two y-axes in mirror mode (needed when visualizing an alignment) More...
 
- Protected Attributes inherited from PlotWidget
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...
 

Additional Inherited Members

- Public Types inherited from PlotWidget
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...
 
- Static Public Member Functions inherited from EnhancedTabBarWidgetInterface
static Int getFirstWindowID ()
 the first object to be created will get this ID More...
 
- Static Public Attributes inherited from PlotWidget
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 []
 

Detailed Description

Widget for visualization of several spectra.

The widget is composed of a scroll bar, an AxisWidget and a Plot1DCanvas as central widget.

The example image shows Plot1DWidget displaying a raw data layer and a peak data layer.

Constructor & Destructor Documentation

◆ Plot1DWidget()

Plot1DWidget ( const Param preferences,
const DIM  gravity_axis = DIM::Y,
QWidget parent = nullptr 
)

Default constructor.

◆ ~Plot1DWidget()

~Plot1DWidget ( )
override

Destructor.

Member Function Documentation

◆ canvas()

Plot1DCanvas* canvas ( ) const
inlineoverridevirtual

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.

Implements PlotWidget.

Referenced by TOPPViewBase::addData(), TOPPViewBase::setDrawMode1D(), TOPPViewBase::showSpectrumAlignmentDialog(), and TOPPViewBase::updateToolBar().

◆ hideAxes()

void hideAxes ( )
overridevirtual

Hides x-axis and y-axis.

Reimplemented from PlotWidget.

◆ performAlignment()

void performAlignment ( Size  layer_index_1,
Size  layer_index_2,
const Param param 
)

Performs an alignment of the layers with layer_index_1 and layer_index_2.

Referenced by TOPPViewBase::showSpectrumAlignmentDialog().

◆ recalculateAxes_()

void recalculateAxes_ ( )
overrideprotectedvirtual

recalculates the Axis ticks

Implements PlotWidget.

◆ renderForImage()

virtual void renderForImage ( QPainter &  painter)
virtual

◆ resetAlignment()

void resetAlignment ( )

Resets the alignment.

◆ saveAsImage()

void saveAsImage ( )
overridevirtual

Saves the widget's content as image file.

Reimplemented from PlotWidget.

◆ setMapper()

void setMapper ( const DimMapper< 2 > &  mapper)
inlineoverridevirtual

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

Implements PlotWidget.

◆ showCurrentPeaksAs2D

void showCurrentPeaksAs2D ( )
signal

Requests to display the whole spectrum in 2D view.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ showCurrentPeaksAs3D

void showCurrentPeaksAs3D ( )
signal

Requests to display the whole spectrum in 3D view.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ showCurrentPeaksAsDIA

void showCurrentPeaksAsDIA ( const Precursor pc,
const MSExperiment exp 
)
signal

Requests to display a full DIA window.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ showCurrentPeaksAsIonMobility

void showCurrentPeaksAsIonMobility ( const MSSpectrum spec)
signal

Requests to display the whole spectrum in ion mobility view.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ showGoToDialog

void showGoToDialog ( )
overrideslot

◆ showLegend()

void showLegend ( bool  show)
overridevirtual

Shows/hides axis labels.

Reimplemented from PlotWidget.

◆ toggleMirrorView()

void toggleMirrorView ( bool  mirror)

Switches to mirror view, displays another y-axis for the second spectrum.

Member Data Documentation

◆ flipped_y_axis_

AxisWidget* flipped_y_axis_
protected

The second y-axis for the mirror view.

◆ spacer_

QSpacerItem* spacer_
protected

Spacer between the two y-axes in mirror mode (needed when visualizing an alignment)