| OpenMS 2.5.0

Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
SpectrumCanvas Class Referenceabstract
Visual » Spectrum visualization widgets

Base class for visualization canvas classes. More...

`#include <OpenMS/VISUAL/SpectrumCanvas.h>`

Inheritance diagram for SpectrumCanvas:

## Public Types

Type definitions
enum | ActionModes { AM_TRANSLATE, AM_ZOOM, AM_MEASURE }
| Mouse action modes. More...
enum | IntensityModes { IM_NONE, IM_PERCENTAGE, IM_SNAP, IM_LOG }
| Display modes of intensity. More...
typedef LayerData::ExperimentType | ExperimentType
| Main data type (experiment) More...
typedef LayerData::ExperimentSharedPtrType | ExperimentSharedPtrType
| Main managed data type (experiment) More...
typedef LayerData::ConstExperimentSharedPtrType | ConstExperimentSharedPtrType
typedef LayerData::ODExperimentSharedPtrType | ODExperimentSharedPtrType
typedef LayerData::FeatureMapType | FeatureMapType
| Main data type (features) More...
typedef LayerData::FeatureMapSharedPtrType | FeatureMapSharedPtrType
| Main managed data type (features) More...
typedef LayerData::ConsensusMapType | ConsensusMapType
| Main data type (consensus features) More...
typedef LayerData::ConsensusMapSharedPtrType | ConsensusMapSharedPtrType
| Main managed data type (consensus features) More...
typedef ExperimentType::SpectrumType | SpectrumType
| Spectrum type. More...
typedef SpectrumType::ConstIterator | SpectrumConstIteratorType
| Spectrum iterator type (iterates over peaks) More...
typedef SpectrumType::PeakType | PeakType
| Peak type. More...
typedef FeatureMapType::FeatureType | FeatureType
| Feature type. More...
typedef DPosition< 2 > | PointType
| Type of the Points. More...
typedef DRange< 2 > | AreaType
| Types of Ranges/Areas. More...

## Public Slots

void | changeVisibility (Size i, bool b)
| change the visibility of a layer More...
void | changeLayerFilterState (Size i, bool b)
| change if the defined data filters are used More...
void | showGridLines (bool show)
| Whether or not to show grid lines. More...
void | resetZoom (bool repaint=true)
| Zooms fully out and resets the zoom stack. More...
void | setVisibleArea (AreaType area)
| Sets the visible area. More...
virtual void | horizontalScrollBarChange (int value)
| Notifies the canvas that the horizontal scrollbar has been moved. More...
virtual void | verticalScrollBarChange (int value)
| Notifies the canvas that the vertical scrollbar has been moved. More...
void | setAdditionalContextMenu (QMenu *menu)
| Sets the additional context menu. If not 0, this menu is added to the context menu of the canvas. More...
void | getVisiblePeakData (ExperimentType &map) const
| Fills the handed over `map` with the visible peaks of the current layer. More...
void | getVisibleFeatureData (FeatureMapType &map) const
| Fills the handed over `map` with the visible features of the current layer. More...
void | getVisibleConsensusData (ConsensusMapType &map) const
| Fills the handed over `map` with the visible consensus features of the current layer. More...
void | getVisibleIdentifications (std::vector< PeptideIdentification > &peptides) const
| Fills the handed over `peptides` with the visible peptide identifications of the current layer. More...
virtual void | updateLayer (Size i)=0
| Updates layer `i` when the data in the corresponding file changes. More...

## Signals

void | layerModficationChange (Size layer, bool modified)
| Signal emitted whenever the modification status of a layer changes (editing and storing) More...
void | layerActivated (QWidget *w)
| Signal emitted whenever a new layer is activated within the current window. More...
void | layerZoomChanged (QWidget *w)
| Signal emitted whenever the zoom changed. More...
void | visibleAreaChanged (DRange< 2 > area)
| Change of the visible area. More...
void | sendCursorStatus (double mz=-1.0, double rt=-1.0)
| Emitted when the cursor position changes (for displaying e.g. in status bar) More...
void | sendStatusMessage (std::string message, OpenMS::UInt time)
| 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 | recalculateAxes ()
| Forces recalculation of axis ticks in the connected widget. More...
void | updateVScrollbar (float, float, float, float)
| Triggers the update of the vertical scrollbar. More...
void | updateHScrollbar (float, float, float, float)
| Triggers the update of the horizontal scrollbar. More...
void | changeLegendVisibility ()
| Toggle axis legend visibility change. More...
void | actionModeChange ()
| Emitted when the action mode changes. More...
void | preferencesChange ()
| Emitted when the layer preferences have changed. More...

## Public Member Functions

| SpectrumCanvas (const Param &preferences, QWidget *parent=nullptr)
| Default constructor. More...
| ~SpectrumCanvas () override
| Destructor. More...
void | setSpectrumWidget (SpectrumWidget *widget)
| Sets the spectrum widget. More...
SpectrumWidget * | getSpectrumWidget () const
| Returns the spectrum widget. More...
Int | getActionMode () const
| Returns the action mode. More...
IntensityModes | getIntensityMode () const
| Returns the intensity mode. More...
void | setIntensityMode (IntensityModes mod)
| Sets the intensity mode. More...
bool | gridLinesShown () const
| Returns if the grid is currently shown. More...
const LayerData & | getLayer (Size index) const
| returns the layer data with index `index` More...
const LayerData & | getCurrentLayer () const
| returns the layer data of the active layer More...
Size | getCurrentLayerIndex () const
| returns the index of the active layer More...
LayerData & | getCurrentLayer ()
| returns the layer data of the active layer More...
bool | getLayerFlag (LayerData::Flags f) const
| returns a layer flag of the current layer More...
void | setLayerFlag (LayerData::Flags f, bool value)
| sets a layer flag of the current layer More...
bool | getLayerFlag (Size layer, LayerData::Flags f) const
| returns a layer flag of the layer `layer` More...
void | setLayerFlag (Size layer, LayerData::Flags f, bool value)
| sets a layer flag of the layer `layer` More...
void | setLabel (LayerData::LabelType label)
const AreaType & | getVisibleArea () const
| Returns the currently visible area. More...
virtual void | setFilters (const DataFilters &filters)
| Sets the filters applied to the data before drawing (for the current layer) More...
bool | isMzToXAxis ()
| Returns the mapping of m/z to axes. More...
void | mzToXAxis (bool mz_to_x_axis)
| Sets the mapping of m/z to axes. More...
bool | addLayer (std::vector< PeptideIdentification > &peptides, const String &filename="")
| Add an identification data layer. More...
float | getCurrentMinIntensity () const
| Returns the minimum intensity of the active layer. More...
float | getCurrentMaxIntensity () const
| Returns the maximum intensity of the active layer. More...
float | getMinIntensity (Size index) const
| Returns the minimum intensity of the layer with index `index`. More...
float | getMaxIntensity (Size index) const
| Returns the maximum intensity of the layer with index `index`. More...
void | setLayerName (Size i, const String &name)
| Sets the `name` of layer `i`. More...
String | getLayerName (Size i)
| Gets the name of layer `i`. More...
void | setCurrentLayerParameters (const Param &param)
| Sets the parameters of the current layer. More...
const DRange< 3 > & | getDataRange ()
| Returns the area which encloses all data points. More...
double | getSnapFactor ()
| Returns the first intensity scaling factor for 'snap to maximum intensity mode'. More...
double | getPercentageFactor ()
| Returns the percentage factor. More...
virtual void | showCurrentLayerPreferences ()=0
| Shows the preferences dialog of the active layer. More...
virtual void | showMetaData (bool modifiable=false, Int index=-1)
| Shows a dialog with the meta data. More...
virtual void | saveCurrentLayer (bool visible)=0
| Saves the current layer data. More...
Dataset handling methods

See also
  changeVisibility

Size | getLayerCount () const
| Returns the number of layers. More...
Size | activeLayerIndex () const
| Returns the index of the active layer. More...
virtual void | activateLayer (Size layer_index)=0
| change the active layer (the one that is used for selecting and so on) More...
virtual void | removeLayer (Size layer_index)=0
| removes the layer with index `layer_index` More...
bool | addLayer (ExperimentSharedPtrType map, ODExperimentSharedPtrType od_map, const String &filename="")
| Add a peak data layer. More...
bool | addLayer (FeatureMapSharedPtrType map, const String &filename="")
| Add a feature data layer. More...
bool | addLayer (ConsensusMapSharedPtrType map, const String &filename="")
| Add a consensus feature data layer. More...
Public Member Functions inherited from DefaultParamHandler
| DefaultParamHandler (const String &name)
| Constructor with name that is displayed in error messages. More...
| DefaultParamHandler (const DefaultParamHandler &rhs)
| Copy constructor. More...
virtual | ~DefaultParamHandler ()
| Destructor. More...
virtual DefaultParamHandler & | operator= (const DefaultParamHandler &rhs)
| Assignment operator. More...
virtual bool | operator== (const DefaultParamHandler &rhs) const
| Equality operator. More...
void | setParameters (const Param &param)
| Sets the parameters. More...
const Param & | getParameters () const
| Non-mutable access to the parameters. More...
const Param & | getDefaults () const
| Non-mutable access to the default parameters. More...
const String & | getName () const
| Non-mutable access to the name. More...
void | setName (const String &name)
| Mutable access to the name. More...
const std::vector< String > & | getSubsections () const
| Non-mutable access to the registered subsections. More...

## Protected Slots

void | updateCursor_ ()
| Updates the cursor according to the current action mode. More...

## Protected Member Functions

void | drawText_ (QPainter &painter, QStringList text)
| Draws several lines of text to the upper right corner of the widget. More...
double | getIdentificationMZ_ (const Size layer_index, const PeptideIdentification &peptide) const
| Returns the m/z value of an identification depending on the m/z source of the layer (precursor mass/theoretical peptide mass) More...
virtual bool | finishAdding_ ()=0
| Method that is called when a new layer has been added. More...
LayerData & | getLayer_ (Size index)
| Returns the layer with index `index`. More...
LayerData & | getCurrentLayer_ ()
| Returns the currently active layer. More...
virtual void | intensityModeChange_ ()
| This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes. More...
virtual void | changeVisibleArea_ (const AreaType &new_area, bool repaint=true, bool add_to_stack=false)
| Sets the visible area. More...
virtual void | recalculateSnapFactor_ ()
| Recalculates the intensity scaling factor for 'snap to maximum intensity mode'. More...
virtual void | updateScrollbars_ ()
| Updates the scroll bars. More...
PointType | widgetToData_ (double x, double y)
| Convert widget to chart coordinates. More...
PointType | widgetToData_ (const QPoint &pos)
| Calls widgetToData_ with x and y position of `pos`. More...
void | dataToWidget_ (double x, double y, QPoint &point)
| Convert chart to widget coordinates. More...
virtual void | paintGridLines_ (QPainter &painter)
| Helper function to paint grid lines. More...
void | recalculateRanges_ (UInt mz_dim, UInt rt_dim, UInt it_dim)
| Recalculates the overall_data_range_. More...
virtual void | update_ (const char *caller_name)
| Updates the displayed data. More...
void | modificationStatus_ (Size layer_index, bool modified)
| Takes all actions necessary when the modification status of a layer changes (signals etc.) More...
void | adjustBuffer_ ()
| Changes the size of the paint buffer to the currently required size. More...
void | addDataProcessing_ (PeakMap &map, DataProcessing::ProcessingAction action) const
| Data processing setter for peak maps. More...
reimplemented QT events
void | resizeEvent (QResizeEvent *e) override
void | wheelEvent (QWheelEvent *e) override
void | keyPressEvent (QKeyEvent *e) override
void | keyReleaseEvent (QKeyEvent *e) override
void | focusOutEvent (QFocusEvent *e) override
void | leaveEvent (QEvent *e) override
void | enterEvent (QEvent *e) override
Zoom stack methods
virtual void | zoom_ (int x, int y, bool zoom_in)
| Zooms such that screen point x, y would still point to the same data point. More...
void | zoomBack_ ()
| Go backward in zoom history. More...
virtual void | zoomForward_ ()
| Go forward in zoom history. More...
void | zoomAdd_ (const AreaType &area)
| Add a visible area to the zoom stack. More...
void | zoomClear_ ()
| Clears the zoom stack and invalidates the current zoom position. After calling this, a valid zoom position has to be added immediately. More...
Translation methods, which are called when cursor buttons are pressed
virtual void | translateLeft_ (Qt::KeyboardModifiers m)
| Translation bound to the 'Left' key. More...
virtual void | translateRight_ (Qt::KeyboardModifiers m)
| Translation bound to the 'Right' key. More...
virtual void | translateForward_ ()
| Translation bound to the 'Up' key. More...
virtual void | translateBackward_ ()
| Translation bound to the 'Down' key. More...
Protected Member Functions inherited from DefaultParamHandler
virtual void | updateMembers_ ()
| This method is used to update extra member variables at the end of the setParameters() method. More...
void | defaultsToParam_ ()
| Updates the parameters after the defaults have been set in the constructor. More...

## Protected Attributes

QImage | buffer_
| Buffer that stores the actual peak information. More...
ActionModes | action_mode_
| Stores the current action mode (Pick, Zoom, Translate) More...
IntensityModes | intensity_mode_
| Stores the used intensity mode function. More...
std::vector< LayerData > | layers_
| Layer data. More...
bool | mz_to_x_axis_
| Stores the mapping of m/z. More...
AreaType | visible_area_
| Stores the currently visible area. More...
DRange< 3 > | overall_data_range_
| Stores the data range (m/z, RT and intensity) of all layers. More...
bool | show_grid_
| Stores whether or not to show a grid. More...
std::vector< AreaType > | zoom_stack_
| The zoom stack. More...
std::vector< AreaType >::iterator | zoom_pos_
| The current position in the zoom stack. More...
bool | update_buffer_
| Whether to recalculate the data in the buffer when repainting. More...
Size | current_layer_
| Stores the index of the currently active layer. More...
SpectrumWidget * | spectrum_widget_
| Back-pointer to the enclosing spectrum widget. More...
QPoint | last_mouse_pos_
| start position of mouse actions More...
double | percentage_factor_
| Intensity scaling factor for relative scale with multiple layers. More...
std::vector< double > | snap_factors_
| Intensity scaling factor for 'snap to maximum intensity mode'. More...
QRubberBand | rubber_band_
| Rubber band for selected area. More...
QMenu * | context_add_
| External context menu extension. More...
bool | show_timing_
| Flag that determines if timing data is printed to the command line. More...
PeakIndex | selected_peak_
| selected peak More...
PeakIndex | measurement_start_
| start peak of measuring mode More...
Protected Attributes inherited from DefaultParamHandler
Param | param_
| Container for current parameters. More...
Param | defaults_
| Container for default parameters. This member should be filled in the constructor of derived classes! More...
std::vector< String > | subsections_
| Container for registered subsections. This member should be filled in the constructor of derived classes! More...
String | error_name_
| Name that is displayed in error messages during the parameter checking. More...
bool | check_defaults_
| If this member is set to false no checking if parameters in done;. More...
bool | warn_empty_defaults_
| If this member is set to false no warning is emitted when defaults are empty;. More...

## Detailed Description

Base class for visualization canvas classes.

This class is the base class for the spectrum data views which are used for 1D, 2D and 3D visualization of data. In TOPPView, each SpectrumCanvas is paired with an enclosing SpectrumWidget (see also the getSpectrumWidget() function that provides a back-reference). To provide additional spectrum views, you can derive from this class and you should also create a subclass from SpectrumWidget which encloses your class derived from SpectrumCanvas. A spectrum canvas can display multiple data layers at the same time (see layers_ member variable).

The actual data to be displayed is stored as a vector of LayerData objects which hold the actual data. It also stores information about the commonly used constants such as ActionModes or IntensityModes.

All derived classes should follow these interface conventions:

- Translate mode
  - Activated by default
  - Arrow keys can be used to translate without entering translate mode
- Zoom mode
  - Activated using the CTRL key
  - Zoom stack traversal with CTRL+/CTRL- or mouses wheel
  - Pressing the Backspace key resets the zoom (and stack)
- Measure mode
  - Activated using the SHIFT key

Improvement:
  Add log mode (Hiwi)

Todo:
  Allow reordering the layer list by drag-and-drop (Hiwi, Johannes)

## Member Typedef Documentation

## ◆ AreaType

typedef DRange<2> AreaType

Types of Ranges/Areas.

## ◆ ConsensusMapSharedPtrType

typedef LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType

Main managed data type (consensus features)

## ◆ ConsensusMapType

typedef LayerData::ConsensusMapType ConsensusMapType

Main data type (consensus features)

## ◆ ConstExperimentSharedPtrType

typedef LayerData::ConstExperimentSharedPtrType ConstExperimentSharedPtrType

## ◆ ExperimentSharedPtrType

typedef LayerData::ExperimentSharedPtrType ExperimentSharedPtrType

Main managed data type (experiment)

## ◆ ExperimentType

typedef LayerData::ExperimentType ExperimentType

Main data type (experiment)

## ◆ FeatureMapSharedPtrType

typedef LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType

Main managed data type (features)

## ◆ FeatureMapType

typedef LayerData::FeatureMapType FeatureMapType

Main data type (features)

## ◆ FeatureType

typedef FeatureMapType::FeatureType FeatureType

Feature type.

## ◆ ODExperimentSharedPtrType

typedef LayerData::ODExperimentSharedPtrType ODExperimentSharedPtrType

## ◆ PeakType

typedef SpectrumType::PeakType PeakType

Peak type.

## ◆ PointType

typedef DPosition<2> PointType

Type of the Points.

## ◆ SpectrumConstIteratorType

typedef SpectrumType::ConstIterator SpectrumConstIteratorType

Spectrum iterator type (iterates over peaks)

## ◆ SpectrumType

typedef ExperimentType::SpectrumType SpectrumType

Spectrum type.

## Member Enumeration Documentation

## ◆ ActionModes

enum ActionModes

Mouse action modes.

Enumerator
AM_TRANSLATE | translate
AM_ZOOM | zoom
AM_MEASURE | measure

## ◆ IntensityModes

enum IntensityModes

Display modes of intensity.

Enumerator
IM_NONE | Normal mode: f(x)=x.
IM_PERCENTAGE | Shows intensities normalized by layer maximum: f(x)=x/max(x)*100.
IM_SNAP | Shows the maximum displayed intensity as if it was the overall maximum intensity.
IM_LOG | Logarithmic mode.

## Constructor & Destructor Documentation

## ◆ SpectrumCanvas()

SpectrumCanvas | ( | const Param & | preferences,
|  | QWidget * | parent = `nullptr`
| ) |  |

Default constructor.

## ◆ ~SpectrumCanvas()

~SpectrumCanvas | ( |  | ) |

override

Destructor.

## Member Function Documentation

## ◆ actionModeChange

void actionModeChange | ( |  | ) |

signal

Emitted when the action mode changes.

## ◆ activateLayer()

virtual void activateLayer | ( | Size | layer_index | ) |

pure virtual

change the active layer (the one that is used for selecting and so on)

Referenced by TOPPViewBase::layerSelectionChange().

## ◆ activeLayerIndex()

Size activeLayerIndex | ( |  | ) | const

Returns the index of the active layer.

Referenced by TOPPViewBase::showCurrentPeaksAs2D(), TOPPViewBase::showCurrentPeaksAs3D(), TOPPViewBase::showCurrentPeaksAsDIA(), TOPPViewBase::showCurrentPeaksAsIonMobility(), and TOPPViewBase::updateLayerBar().

## ◆ addDataProcessing_()

void addDataProcessing_ | ( | PeakMap & | map,
|  | DataProcessing::ProcessingAction | action
| ) |  | const

inline protected

Data processing setter for peak maps.

References VersionInfo::getVersion(), DateTime::now(), and MSExperiment::size().

## ◆ addLayer() [1/4]

bool addLayer | ( | ExperimentSharedPtrType | map,
|  | ODExperimentSharedPtrType | od_map,
|  | const String & | filename = `""`
| ) |  |

Add a peak data layer.

If chromatograms are present, a chromatogram layer is shown. Otherwise a peak layer is shown. Make sure to remove chromatograms from peak data and vice versa.

Parameters

  map | Shared pointer to input map. It can be performed in constant time and does not double the required memory.
  od_map | Shared pointer to on disk data which potentially caches some data to save memory (the map can be empty, but do not pass nullptr).
  filename | This absolute filename is used to monitor changes in the file and reload the data

Returns
  If a new layer was created

Referenced by TOPPViewBase::addData(), TOPPViewBase::showCurrentPeaksAs2D(), TOPPViewBase::showCurrentPeaksAs3D(), TOPPViewBase::showCurrentPeaksAsDIA(), and TOPPViewBase::showCurrentPeaksAsIonMobility().

## ◆ addLayer() [2/4]

bool addLayer | ( | FeatureMapSharedPtrType | map,
|  | const String & | filename = `""`
| ) |  |

Add a feature data layer.

Parameters

  map | Shared Pointer to input map. It can be performed in constant time and does not double the required memory.
  filename | This absolute filename is used to monitor changes in the file and reload the data

Returns
  If a new layer was created

## ◆ addLayer() [3/4]

bool addLayer | ( | ConsensusMapSharedPtrType | map,
|  | const String & | filename = `""`
| ) |  |

Add a consensus feature data layer.

Parameters

  map | Shared Pointer to input map. It can be performed in constant time and does not double the required memory.
  filename | This absolute filename is used to monitor changes in the file and reload the data

Returns
  If a new layer was created

## ◆ addLayer() [4/4]

bool addLayer | ( | std::vector< PeptideIdentification > & | peptides,
|  | const String & | filename = `""`
| ) |  |

Add an identification data layer.

Parameters

  peptides | Input list of peptides, which has to be mutable and will be empty after adding. Swapping is used to insert the data. It can be performed in constant time and does not double the required memory.
  filename | This absolute filename is used to monitor changes in the file and reload the data

Returns
  If a new layer was created

## ◆ adjustBuffer_()

void adjustBuffer_ | ( |  | ) |

protected

Changes the size of the paint buffer to the currently required size.

## ◆ changeLayerFilterState

void changeLayerFilterState | ( | Size | i,
|  | bool | b
| ) |  |

slot

change if the defined data filters are used

Parameters

  i | the index of the layer
  b | true if layer is supposed to be visible

Referenced by TOPPViewBase::layerFilterVisibilityChange().

## ◆ changeLegendVisibility

void changeLegendVisibility | ( |  | ) |

signal

Toggle axis legend visibility change.

## ◆ changeVisibility

void changeVisibility | ( | Size | i,
|  | bool | b
| ) |  |

slot

change the visibility of a layer

Parameters

  i | the index of the layer
  b | true if layer is supposed to be visible

Referenced by TOPPViewBase::layerVisibilityChange().

## ◆ changeVisibleArea_()

virtual void changeVisibleArea_ | ( | const AreaType & | new_area,
|  | bool | repaint = `true`,
|  | bool | add_to_stack = `false`
| ) |  |

protected virtual

Sets the visible area.

Changes the visible area, adjusts the zoom stack and notifies interested clients about the change. If parts of the area are outside of the data area, the new area will be adjusted.

Parameters

  new_area | The new visible area.
  repaint | If true, a complete repaint is forced.
  add_to_stack | If true the new area is to add to the zoom_stack_.

Reimplemented in Spectrum1DCanvas.

## ◆ dataToWidget_()

void dataToWidget_ | ( | double | x,
|  | double | y,
|  | QPoint & | point
| ) |  |

inline protected

Convert chart to widget coordinates.

Translates chart coordinates to widget coordinates.

Parameters

  x | the chart coordinate x
  y | the chart coordinate y
  point | returned widget coordinates

References SpectrumCanvas::IM_LOG.

## ◆ drawText_()

void drawText_ | ( | QPainter & | painter,
|  | QStringList | text
| ) |  |

protected

Draws several lines of text to the upper right corner of the widget.

## ◆ enterEvent()

void enterEvent | ( | QEvent * | e | ) |

override protected

## ◆ finishAdding_()

virtual bool finishAdding_ | ( |  | ) |

protected pure virtual

Method that is called when a new layer has been added.

Implemented in Spectrum1DCanvas, Spectrum2DCanvas, and Spectrum3DCanvas.

## ◆ focusOutEvent()

void focusOutEvent | ( | QFocusEvent * | e | ) |

override protected

## ◆ getActionMode()

Int getActionMode | ( |  | ) | const

inline

Returns the action mode.

Returns the current action mode of type ActionModes

Returns
  the current action mode

## ◆ getCurrentLayer() [1/2]

const LayerData& getCurrentLayer | ( |  | ) | const

inline

returns the layer data of the active layer

References OPENMS_PRECONDITION.

Referenced by TOPPViewBase::addData(), TOPPViewBase::annotateMS1FromMassFingerprinting_(), TOPPViewBase::annotateWithID(), TOPPViewBase::copyLayer(), TOPPViewBase::editMetadata(), TOPPViewBase::enhancedWorkspaceWindowChanged(), TOPPViewBase::filterContextMenu(), TOPPViewBase::filterEdit(), TOPPViewBase::getCurrentLayer(), TOPPViewBase::layerZoomChanged(), TOPPViewBase::loadFiles(), TOPPViewBase::rerunTOPPTool(), TOPPViewBase::runTOPPTool_(), TOPPViewBase::showCurrentPeaksAs2D(), TOPPViewBase::showCurrentPeaksAsDIA(), TOPPViewBase::showCurrentPeaksAsIonMobility(), TOPPViewBase::showTOPPDialog_(), TOPPViewBase::updateFilterBar(), TOPPViewBase::updateToolBar(), and TOPPViewBase::updateViewBar().

## ◆ getCurrentLayer() [2/2]

LayerData& getCurrentLayer | ( |  | ) |

inline

returns the layer data of the active layer

References OPENMS_PRECONDITION.

## ◆ getCurrentLayer_()

LayerData& getCurrentLayer_ | ( |  | ) |

inline protected

Returns the currently active layer.

## ◆ getCurrentLayerIndex()

Size getCurrentLayerIndex | ( |  | ) | const

inline

returns the index of the active layer

Referenced by TOPPViewBase::showCurrentPeaksAs3D().

## ◆ getCurrentMaxIntensity()

float getCurrentMaxIntensity | ( |  | ) | const

inline

Returns the maximum intensity of the active layer.

References LayerData::DT_CHROMATOGRAM, LayerData::DT_FEATURE, and LayerData::DT_PEAK.

## ◆ getCurrentMinIntensity()

float getCurrentMinIntensity | ( |  | ) | const

inline

Returns the minimum intensity of the active layer.

References LayerData::DT_CHROMATOGRAM, LayerData::DT_FEATURE, and LayerData::DT_PEAK.

## ◆ getDataRange()

const DRange<3>& getDataRange | ( |  | ) |

Returns the area which encloses all data points.

See also
  overall_data_range_

## ◆ getIdentificationMZ_()

double getIdentificationMZ_ | ( | const Size | layer_index,
|  | const PeptideIdentification & | peptide
| ) |  | const

protected

Returns the m/z value of an identification depending on the m/z source of the layer (precursor mass/theoretical peptide mass)

## ◆ getIntensityMode()

IntensityModes getIntensityMode | ( |  | ) | const

inline

Returns the intensity mode.

Returns the current intensity mode of type IntensityModes

Returns
  the current intensity mode

Referenced by TOPPViewBase::updateToolBar().

## ◆ getLayer()

const LayerData& getLayer | ( | Size | index | ) | const

inline

returns the layer data with index `index`

References OPENMS_PRECONDITION.

Referenced by TOPPViewBase::addData(), TOPPViewBase::fileChanged_(), TOPPViewBase::getFilenamesOfOpenFiles_(), TOPPViewBase::layerContextMenu(), TOPPViewBase::layerVisibilityChange(), TOPPViewBase::showCurrentPeaksAs3D(), and TOPPViewBase::updateLayerBar().

## ◆ getLayer_()

LayerData& getLayer_ | ( | Size | index | ) |

inline protected

Returns the layer with index `index`.

References OPENMS_PRECONDITION.

## ◆ getLayerCount()

Size getLayerCount | ( |  | ) | const

inline

Returns the number of layers.

Referenced by TOPPViewBase::addData(), TOPPViewBase::enhancedWorkspaceWindowChanged(), TOPPViewBase::fileChanged_(), TOPPViewBase::getFilenamesOfOpenFiles_(), TOPPViewBase::showCurrentPeaksAs3D(), TOPPViewBase::updateFilterBar(), TOPPViewBase::updateLayerBar(), and TOPPViewBase::updateToolBar().

## ◆ getLayerFlag() [1/2]

bool getLayerFlag | ( | LayerData::Flags | f | ) | const

inline

returns a layer flag of the current layer

Referenced by TOPPViewBase::changeUnassigned(), and TOPPViewBase::updateToolBar().

## ◆ getLayerFlag() [2/2]

bool getLayerFlag | ( | Size | layer,
|  | LayerData::Flags | f
| ) |  | const

inline

returns a layer flag of the layer `layer`

References OPENMS_PRECONDITION.

## ◆ getLayerName()

String getLayerName | ( | Size | i | ) |

Gets the name of layer `i`.

## ◆ getMaxIntensity()

float getMaxIntensity | ( | Size | index | ) | const

inline

Returns the maximum intensity of the layer with index `index`.

References LayerData::DT_CHROMATOGRAM, LayerData::DT_FEATURE, and LayerData::DT_PEAK.

## ◆ getMinIntensity()

float getMinIntensity | ( | Size | index | ) | const

inline

Returns the minimum intensity of the layer with index `index`.

References LayerData::DT_CHROMATOGRAM, LayerData::DT_FEATURE, and LayerData::DT_PEAK.

## ◆ getPercentageFactor()

double getPercentageFactor | ( |  | ) |

Returns the percentage factor.

## ◆ getSnapFactor()

double getSnapFactor | ( |  | ) |

Returns the first intensity scaling factor for 'snap to maximum intensity mode'.

See also
  snap_factors_

## ◆ getSpectrumWidget()

SpectrumWidget* getSpectrumWidget | ( |  | ) | const

inline

Returns the spectrum widget.

Returns the enclosing spectrum widget

Returns
  the spectrum widget

## ◆ getVisibleArea()

const AreaType& getVisibleArea | ( |  | ) | const

inline

Returns the currently visible area.

See also
  visible_area_

Referenced by TOPPViewBase::layerZoomChanged().

## ◆ getVisibleConsensusData

void getVisibleConsensusData | ( | ConsensusMapType & | map | ) | const

slot

Fills the handed over `map` with the visible consensus features of the current layer.

Takes zoom area and data filters into account.

If the current layer is not a consensus feature layer, `map` is cleared only.

Referenced by TOPPViewBase::runTOPPTool_().

## ◆ getVisibleFeatureData

void getVisibleFeatureData | ( | FeatureMapType & | map | ) | const

slot

Fills the handed over `map` with the visible features of the current layer.

Takes zoom area and data filters into account.

If the current layer is not a feature layer, `map` is cleared only.

Referenced by TOPPViewBase::runTOPPTool_().

## ◆ getVisibleIdentifications

void getVisibleIdentifications | ( | std::vector< PeptideIdentification > & | peptides | ) | const

slot

Fills the handed over `peptides` with the visible peptide identifications of the current layer.

Takes zoom area into account.

If the current layer is not an identification data layer, `peptides` is cleared only.

## ◆ getVisiblePeakData

void getVisiblePeakData | ( | ExperimentType & | map | ) | const

slot

Fills the handed over `map` with the visible peaks of the current layer.

Takes zoom area and data filters into account.

If the current layer is not a peak layer, `map` is cleared only.

Referenced by TOPPViewBase::runTOPPTool_().

## ◆ gridLinesShown()

bool gridLinesShown | ( |  | ) | const

inline

Returns if the grid is currently shown.

Returns
  `true` if the grid is visible, `false` otherwise

## ◆ horizontalScrollBarChange

virtual void horizontalScrollBarChange | ( | int | value | ) |

virtual slot

Notifies the canvas that the horizontal scrollbar has been moved.

Reimplement this slot to react on scrollbar events.

## ◆ intensityModeChange_()

virtual void intensityModeChange_ | ( |  | ) |

protected virtual

This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes.

Reimplemented in Spectrum2DCanvas, and Spectrum1DCanvas.

## ◆ isMzToXAxis()

bool isMzToXAxis | ( |  | ) |

inline

Returns the mapping of m/z to axes.

## ◆ keyPressEvent()

void keyPressEvent | ( | QKeyEvent * | e | ) |

override protected

## ◆ keyReleaseEvent()

void keyReleaseEvent | ( | QKeyEvent * | e | ) |

override protected

## ◆ layerActivated

void layerActivated | ( | QWidget * | w | ) |

signal

Signal emitted whenever a new layer is activated within the current window.

## ◆ layerModficationChange

void layerModficationChange | ( | Size | layer,
|  | bool | modified
| ) |  |

signal

Signal emitted whenever the modification status of a layer changes (editing and storing)

## ◆ layerZoomChanged

void layerZoomChanged | ( | QWidget * | w | ) |

signal

Signal emitted whenever the zoom changed.

## ◆ leaveEvent()

void leaveEvent | ( | QEvent * | e | ) |

override protected

## ◆ modificationStatus_()

void modificationStatus_ | ( | Size | layer_index,
|  | bool | modified
| ) |  |

protected

Takes all actions necessary when the modification status of a layer changes (signals etc.)

## ◆ mzToXAxis()

void mzToXAxis | ( | bool | mz_to_x_axis | ) |

Sets the mapping of m/z to axes.

## ◆ paintGridLines_()

virtual void paintGridLines_ | ( | QPainter & | painter | ) |

protected virtual

Helper function to paint grid lines.

Reimplemented in Spectrum1DCanvas.

## ◆ preferencesChange

void preferencesChange | ( |  | ) |

signal

Emitted when the layer preferences have changed.

## ◆ recalculateAxes

void recalculateAxes | ( |  | ) |

signal

Forces recalculation of axis ticks in the connected widget.

## ◆ recalculateRanges_()

void recalculateRanges_ | ( | UInt | mz_dim,
|  | UInt | rt_dim,
|  | UInt | it_dim
| ) |  |

protected

Recalculates the overall_data_range_.

A small margin is added to each side of the range in order to display all data.

Parameters

  mz_dim | Int of m/z in overall_data_range_
  rt_dim | Int of RT in overall_data_range_
  it_dim | Int of intensity in overall_data_range_

## ◆ recalculateSnapFactor_()

virtual void recalculateSnapFactor_ | ( |  | ) |

protected virtual

Recalculates the intensity scaling factor for 'snap to maximum intensity mode'.

See also
  snap_factors_

Reimplemented in Spectrum2DCanvas, and Spectrum1DCanvas.

## ◆ removeLayer()

virtual void removeLayer | ( | Size | layer_index | ) |

pure virtual

removes the layer with index `layer_index`

Referenced by TOPPViewBase::layerContextMenu().

## ◆ resetZoom

void resetZoom | ( | bool | repaint = `true` | ) |

slot

Zooms fully out and resets the zoom stack.

Sets the visible area to the initial value, such that all data is shown.

Parameters

  repaint | If true a repaint is forced. Otherwise only the new area is set.

Referenced by TOPPViewBase::resetZoom().

## ◆ resizeEvent()

void resizeEvent | ( | QResizeEvent * | e | ) |

override protected

## ◆ saveCurrentLayer()

virtual void saveCurrentLayer | ( | bool | visible | ) |

pure virtual

Saves the current layer data.

Parameters

  visible | If true, only the visible data is stored. Otherwise the whole data is stored.

Implemented in Spectrum1DCanvas, Spectrum3DCanvas, and Spectrum2DCanvas.

Referenced by TOPPViewBase::saveLayerAll(), and TOPPViewBase::saveLayerVisible().

## ◆ sendCursorStatus

void sendCursorStatus | ( | double | mz = `-1.0`,
|  | double | rt = `-1.0`
| ) |  |

signal

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

## ◆ sendStatusMessage

void sendStatusMessage | ( | std::string | message,
|  | OpenMS::UInt | time
| ) |  |

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.

## ◆ setAdditionalContextMenu

void setAdditionalContextMenu | ( | QMenu * | menu | ) |

slot

Sets the additional context menu. If not 0, this menu is added to the context menu of the canvas.

## ◆ setCurrentLayerParameters()

void setCurrentLayerParameters | ( | const Param & | param | ) |

inline

Sets the parameters of the current layer.

Referenced by TOPPViewBase::loadFiles().

## ◆ setFilters()

virtual void setFilters | ( | const DataFilters & | filters | ) |

virtual

Sets the filters applied to the data before drawing (for the current layer)

Referenced by TOPPViewBase::addData(), TOPPViewBase::filterContextMenu(), and TOPPViewBase::filterEdit().

## ◆ setIntensityMode()

void setIntensityMode | ( | IntensityModes | mod | ) |

inline

Sets the intensity mode.

Sets the intensity mode

Parameters

  mod | the new intensity mode

See also
  intensityModeChange_()

## ◆ setLabel()

void setLabel | ( | LayerData::LabelType | label | ) |

inline

References OPENMS_PRECONDITION.

Referenced by TOPPViewBase::changeLabel().

## ◆ setLayerFlag() [1/2]

void setLayerFlag | ( | LayerData::Flags | f,
|  | bool | value
| ) |  |

inline

sets a layer flag of the current layer

Referenced by TOPPViewBase::changeUnassigned().

## ◆ setLayerFlag() [2/2]

void setLayerFlag | ( | Size | layer,
|  | LayerData::Flags | f,
|  | bool | value
| ) |  |

inline

sets a layer flag of the layer `layer`

References OPENMS_PRECONDITION.

## ◆ setLayerName()

void setLayerName | ( | Size | i,
|  | const String & | name
| ) |  |

Sets the `name` of layer `i`.

Referenced by TOPPViewBase::layerContextMenu(), TOPPViewBase::showCurrentPeaksAs2D(), TOPPViewBase::showCurrentPeaksAs3D(), TOPPViewBase::showCurrentPeaksAsDIA(), and TOPPViewBase::showCurrentPeaksAsIonMobility().

## ◆ setSpectrumWidget()

void setSpectrumWidget | ( | SpectrumWidget * | widget | ) |

inline

Sets the spectrum widget.

Sets the enclosing spectrum widget. Call this from your SpectrumWidget derived class.

Parameters

  widget | the spectrum widget

## ◆ setVisibleArea

void setVisibleArea | ( | AreaType | area | ) |

slot

Sets the visible area.

Sets the visible area to a new value. Note that it does not emit visibleAreaChanged()

Parameters

  area | the new visible area

Referenced by TOPPViewBase::layerZoomChanged(), and TOPPViewBase::showCurrentPeaksAs3D().

## ◆ showCurrentLayerPreferences()

virtual void showCurrentLayerPreferences | ( |  | ) |

pure virtual

Shows the preferences dialog of the active layer.

Implemented in Spectrum1DCanvas, Spectrum3DCanvas, and Spectrum2DCanvas.

Referenced by TOPPViewBase::layerContextMenu(), TOPPViewBase::layerEdit(), and TOPPViewBase::showPreferences().

## ◆ showGridLines

void showGridLines | ( | bool | show | ) |

slot

Whether or not to show grid lines.

Sets whether grid lines are shown or not.

Parameters

  show | Boolean variable deciding whether or not to show the grid lines.

Referenced by TOPPViewBase::toggleGridLines().

## ◆ showMetaData()

virtual void showMetaData | ( | bool | modifiable = `false`,
|  | Int | index = `-1`
| ) |  |

virtual

Shows a dialog with the meta data.

Parameters

  modifiable | indicates if the data can be modified.
  index | If given, the meta data of the corresponding element (spectrum, feature, consensus feature) is shown instead of the layer meta data.

Referenced by TOPPViewBase::editMetadata(), and TOPPViewBase::showSpectrumMetaData().

## ◆ translateBackward_()

virtual void translateBackward_ | ( |  | ) |

protected virtual

Translation bound to the 'Down' key.

Reimplemented in Spectrum2DCanvas, and Spectrum3DCanvas.

## ◆ translateForward_()

virtual void translateForward_ | ( |  | ) |

protected virtual

Translation bound to the 'Up' key.

Reimplemented in Spectrum2DCanvas, and Spectrum3DCanvas.

## ◆ translateLeft_()

virtual void translateLeft_ | ( | Qt::KeyboardModifiers | m | ) |

protected virtual

Translation bound to the 'Left' key.

Reimplemented in Spectrum2DCanvas, Spectrum1DCanvas, and Spectrum3DCanvas.

## ◆ translateRight_()

virtual void translateRight_ | ( | Qt::KeyboardModifiers | m | ) |

protected virtual

Translation bound to the 'Right' key.

Reimplemented in Spectrum2DCanvas, Spectrum1DCanvas, and Spectrum3DCanvas.

## ◆ update_()

virtual void update_ | ( | const char * | caller_name | ) |

protected virtual

Updates the displayed data.

The default implementation calls QWidget::update().

This method is reimplemented in the 3D view to update the OpenGL widget.

Parameters

  caller_name | Name of the calling function (use OPENMS_PRETTY_FUNCTION).

Reimplemented in Spectrum3DCanvas.

## ◆ updateCursor_

void updateCursor_ | ( |  | ) |

protected slot

Updates the cursor according to the current action mode.

## ◆ updateHScrollbar

void updateHScrollbar | ( | float | ,
|  | float | ,
|  | float | ,
|  | float |
| ) |  |

signal

Triggers the update of the horizontal scrollbar.

## ◆ updateLayer

virtual void updateLayer | ( | Size | i | ) |

pure virtual slot

Updates layer `i` when the data in the corresponding file changes.

Referenced by TOPPViewBase::fileChanged_().

## ◆ updateScrollbars_()

virtual void updateScrollbars_ | ( |  | ) |

protected virtual

Updates the scroll bars.

Updates the scrollbars after a change of the visible area.

Reimplemented in Spectrum1DCanvas, and Spectrum2DCanvas.

## ◆ updateVScrollbar

void updateVScrollbar | ( | float | ,
|  | float | ,
|  | float | ,
|  | float |
| ) |  |

signal

Triggers the update of the vertical scrollbar.

## ◆ verticalScrollBarChange

virtual void verticalScrollBarChange | ( | int | value | ) |

virtual slot

Notifies the canvas that the vertical scrollbar has been moved.

Reimplement this slot to react on scrollbar events.

## ◆ visibleAreaChanged

void visibleAreaChanged | ( | DRange< 2 > | area | ) |

signal

Change of the visible area.

Signal emitted whenever the visible area changes.

Parameters

  area | The new visible area.

## ◆ wheelEvent()

void wheelEvent | ( | QWheelEvent * | e | ) |

override protected

## ◆ widgetToData_() [1/2]

PointType widgetToData_ | ( | double | x,
|  | double | y
| ) |  |

inline protected

Convert widget to chart coordinates.

Translates widget coordinates to chart coordinates.

Parameters

  x | the widget coordinate x
  y | the widget coordinate y

Returns
  chart coordinates

## ◆ widgetToData_() [2/2]

PointType widgetToData_ | ( | const QPoint & | pos | ) |

inline protected

Calls widgetToData_ with x and y position of `pos`.

## ◆ zoom_()

virtual void zoom_ | ( | int | x,
|  | int | y,
|  | bool | zoom_in
| ) |  |

protected virtual

Zooms such that screen point x, y would still point to the same data point.

Reimplemented in Spectrum1DCanvas.

## ◆ zoomAdd_()

void zoomAdd_ | ( | const AreaType & | area | ) |

protected

Add a visible area to the zoom stack.

## ◆ zoomBack_()

void zoomBack_ | ( |  | ) |

protected

Go backward in zoom history.

## ◆ zoomClear_()

void zoomClear_ | ( |  | ) |

protected

Clears the zoom stack and invalidates the current zoom position. After calling this, a valid zoom position has to be added immediately.

## ◆ zoomForward_()

virtual void zoomForward_ | ( |  | ) |

protected virtual

Go forward in zoom history.

Reimplemented in Spectrum1DCanvas.

## Member Data Documentation

## ◆ action_mode_

ActionModes action_mode_

protected

Stores the current action mode (Pick, Zoom, Translate)

## ◆ buffer_

QImage buffer_

protected

Buffer that stores the actual peak information.

## ◆ context_add_

QMenu* context_add_

protected

External context menu extension.

## ◆ current_layer_

Size current_layer_

protected

Stores the index of the currently active layer.

## ◆ intensity_mode_

IntensityModes intensity_mode_

protected

Stores the used intensity mode function.

## ◆ last_mouse_pos_

QPoint last_mouse_pos_

protected

start position of mouse actions

## ◆ layers_

std::vector<LayerData> layers_

protected

Layer data.

## ◆ measurement_start_

PeakIndex measurement_start_

protected

start peak of measuring mode

## ◆ mz_to_x_axis_

bool mz_to_x_axis_

protected

Stores the mapping of m/z.

## ◆ overall_data_range_

DRange<3> overall_data_range_

protected

Stores the data range (m/z, RT and intensity) of all layers.

Dimension 0 is the m/z dimension.
Dimension 1 is the RT dimension (2D and 3D view) or the intensity dimension (1D view).
Dimension 2 is the intensity dimension (2D and 3D view) or the RT dimension (1D view).

## ◆ percentage_factor_

double percentage_factor_

protected

Intensity scaling factor for relative scale with multiple layers.

In this mode all layers are scaled to the same maximum.

## ◆ rubber_band_

QRubberBand rubber_band_

protected

Rubber band for selected area.

## ◆ selected_peak_

PeakIndex selected_peak_

protected

selected peak

## ◆ show_grid_

bool show_grid_

protected

Stores whether or not to show a grid.

## ◆ show_timing_

bool show_timing_

protected

Flag that determines if timing data is printed to the command line.

## ◆ snap_factors_

std::vector<double> snap_factors_

protected

Intensity scaling factor for 'snap to maximum intensity mode'.

In this mode the highest currently visible intensity is treated like the maximum overall intensity.

## ◆ spectrum_widget_

SpectrumWidget* spectrum_widget_

protected

Back-pointer to the enclosing spectrum widget.

## ◆ update_buffer_

bool update_buffer_

protected

Whether to recalculate the data in the buffer when repainting.

## ◆ visible_area_

AreaType visible_area_

protected

Stores the currently visible area.

Dimension 0 is the m/z dimension.
Dimension 1 is the RT dimension (2D and 3D view) or the intensity dimension (1D view).

## ◆ zoom_pos_

std::vector<AreaType>::iterator zoom_pos_

protected

The current position in the zoom stack.

## ◆ zoom_stack_

std::vector<AreaType> zoom_stack_

protected

The zoom stack.