OpenMS
PlotCanvas Class Referenceabstract

Base class for visualization canvas classes. More...

#include <OpenMS/VISUAL/PlotCanvas.h>

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

Protected Member Functions

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
 
virtual void intensityModeChange_ ()
 This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes. More...
 
void dimensionsChanged_ ()
 Call this whenever the DimMapper receives new dimensions; will update the axes and scrollbars. More...
 
virtual void changeVisibleArea_ (VisibleArea 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...
 
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 VisibleArea &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...
 
- 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...
 

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 LayerDataBase::ExperimentType ExperimentType
 Main data type (experiment) More...
 
typedef LayerDataBase::ExperimentSharedPtrType ExperimentSharedPtrType
 Main managed data type (experiment) More...
 
typedef LayerDataBase::ConstExperimentSharedPtrType ConstExperimentSharedPtrType
 
typedef LayerDataBase::ODExperimentSharedPtrType ODExperimentSharedPtrType
 
typedef LayerDataBase::FeatureMapType FeatureMapType
 Main data type (features) More...
 
typedef LayerDataBase::FeatureMapSharedPtrType FeatureMapSharedPtrType
 Main managed data type (features) More...
 
typedef LayerDataBase::ConsensusMapType ConsensusMapType
 Main data type (consensus features) More...
 
typedef LayerDataBase::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...
 
using RangeType = RangeAllType
 a generic range for the most common units More...
 
using AreaXYType = Area< 2 >::AreaXYType
 The range of data shown on the X and Y axis (unit depends on runtime config) More...
 
using VisibleArea = Area< 2 >
 The visible range of data on X and Y axis as shown on plot axis (not necessarily the range of actual data, e.g. no data to show). More...
 
using GenericArea = Area< 2 >
 A generic range of data on X and Y axis as shown on plot axis. More...
 
using PixelArea = Area< 2 >
 
using UnitRange = RangeAllType
 
using PointOnAxis = DimMapper< 2 >::Point
 
 PlotCanvas (const Param &preferences, QWidget *parent=nullptr)
 Default constructor. More...
 
 ~PlotCanvas () override
 Destructor. More...
 
void setPlotWidget (PlotWidget *widget)
 Sets the spectrum widget. More...
 
PlotWidgetgetPlotWidget () 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 LayerDataBasegetLayer (Size index) const
 returns the layer data with index index More...
 
LayerDataBasegetLayer (Size index)
 returns the layer data with index index More...
 
const LayerDataBasegetCurrentLayer () const
 returns the layer data of the active layer More...
 
LayerDataBasegetCurrentLayer ()
 returns the layer data of the active layer More...
 
Size getCurrentLayerIndex () const
 returns the index of the active layer More...
 
bool getLayerFlag (LayerDataBase::Flags f) const
 returns a layer flag of the current layer More...
 
void setLayerFlag (LayerDataBase::Flags f, bool value)
 sets a layer flag of the current layer More...
 
bool getLayerFlag (Size layer, LayerDataBase::Flags f) const
 returns a layer flag of the layer layer More...
 
void setLayerFlag (Size layer, LayerDataBase::Flags f, bool value)
 sets a layer flag of the layer layer More...
 
void setLabel (LayerDataBase::LabelType label)
 
const VisibleAreagetVisibleArea () const
 Returns the currently visible area. This is the authority which determines the X and Y axis' scale. More...
 
bool isVisible (const PointOnAxis &p) const
 
PixelArea getPixelRange () const
 
virtual void setFilters (const DataFilters &filters)
 Sets the filters applied to the data before drawing (for the current layer) More...
 

Translation methods, which are called when cursor buttons are pressed

QImage buffer_
 Buffer that stores the actual peak information. More...
 
DimMapper< 2 > unit_mapper_
 Mapper for X and Y axis. More...
 
ActionModes action_mode_ = AM_TRANSLATE
 Stores the current action mode (Pick, Zoom, Translate) More...
 
IntensityModes intensity_mode_ = IM_NONE
 Stores the used intensity mode function. More...
 
LayerStack layers_
 Layer data. More...
 
VisibleArea visible_area_
 Stores the currently visible area in data units (e.g. seconds, m/z, intensity etc) and axis (X,Y) area. More...
 
RangeType overall_data_range_
 Stores the data range (m/z, RT and intensity) of all layers. More...
 
bool show_grid_ = true
 Stores whether or not to show a grid. More...
 
std::vector< VisibleAreazoom_stack_
 The zoom stack. More...
 
std::vector< VisibleArea >::iterator zoom_pos_ = zoom_stack_.end()
 The current position in the zoom stack. More...
 
bool update_buffer_ = false
 Whether to recalculate the data in the buffer when repainting. More...
 
PlotWidgetspectrum_widget_ = nullptr
 Back-pointer to the enclosing spectrum widget. More...
 
QPoint last_mouse_pos_
 start position of mouse actions More...
 
double percentage_factor_ = 1.0
 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_ = nullptr
 External context menu extension. More...
 
bool show_timing_ = false
 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...
 
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...
 
virtual void updateScrollbars_ ()
 Updates the scroll bars. More...
 
PointXYType widgetToData_ (double x, double y)
 Convert widget (pixel) to chart (unit) coordinates. More...
 
PointXYType widgetToData_ (const QPoint &pos)
 Calls widgetToData_ with x and y position of pos. More...
 
virtual void paintGridLines_ (QPainter &painter)
 Helper function to paint grid lines. More...
 
virtual void recalculateRanges_ ()
 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 addDataProcessing_ (PeakMap &map, DataProcessing::ProcessingAction action) const
 Data processing setter for peak maps. More...
 

Dataset handling methods

See also
changeVisibility
Size getLayerCount () const
 Returns the number of layers. 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...
 
void removeLayers ()
 removes all layers by calling removeLayer() for all layer indices (from highest to lowest) More...
 
bool addLayer (std::unique_ptr< LayerData1DBase > layer)
 Add an already constructed layer (e.g. for projections) More...
 
bool addPeakLayer (const ExperimentSharedPtrType &map, ODExperimentSharedPtrType od_map, const String &filename="", const bool use_noise_cutoff=false)
 Add a peak data layer. More...
 
bool addChromLayer (const ExperimentSharedPtrType &map, ODExperimentSharedPtrType od_map, const String &filename="")
 Add a chrom 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...
 
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 RangeTypegetDataRange () const
 Returns the area which encloses all data points of all layers. More...
 
double getSnapFactor ()
 Returns the first intensity scaling factor for 'snap to maximum intensity mode' (for the currently visible data range). More...
 
double getPercentageFactor () const
 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...
 
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...
 
virtual void resetZoom (bool repaint=true)
 Zooms fully out and resets the zoom stack. More...
 
void setVisibleArea (const VisibleArea &area)
 Sets the visible area. More...
 
void setVisibleArea (const RangeAllType &area)
 Sets the visible area. More...
 
void setVisibleArea (const AreaXYType &area)
 Sets the visible area. More...
 
void setVisibleAreaX (double min, double max)
 Set only the visible area for the x axis; other axes are untouched. More...
 
void setVisibleAreaY (double min, double max)
 Set only the visible area for the y axis; other axes are untouched. More...
 
void saveCurrentLayer (bool visible)
 Saves the current layer data. 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...
 
virtual void updateLayer (Size i)=0
 Updates layer i when the data in the corresponding file changes. More...
 
AreaXYType canvasPixelArea () const
 Get the Area in pixel coordinates of the current canvas for X and Y axis. More...
 
const DimMapper< 2 > & getMapper () const
 Get Mapper to translate between values for axis (X/Y) and units (m/z, RT, intensity, ...) More...
 
void setMapper (const DimMapper< 2 > &mapper)
 Set a new mapper for the canvas. More...
 
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 (const VisibleArea &area)
 Change of the visible area. 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 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 f_min, float disp_min, float disp_max, float f_max)
 Triggers the update of the vertical scrollbar. More...
 
void updateHScrollbar (float f_min, float disp_min, float disp_max, float f_max)
 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...
 
void updateCursor_ ()
 Updates the cursor according to the current action mode. More...
 
void drawText_ (QPainter &painter, const 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...
 
void popIncompleteLayer_ (const QString &error_message="")
 

Additional Inherited Members

- 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...
 
DefaultParamHandleroperator= (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 ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () 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...
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &key_prefix="")
 Writes all parameters to meta values. 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< Stringsubsections_
 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 PlotCanvas is paired with an enclosing PlotWidget (see also the getPlotWidget() 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 PlotWidget which encloses your class derived from PlotCanvas. 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 LayerDataBase 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

Member Typedef Documentation

◆ AreaXYType

using AreaXYType = Area<2>::AreaXYType

The range of data shown on the X and Y axis (unit depends on runtime config)

◆ ConsensusMapSharedPtrType

Main managed data type (consensus features)

◆ ConsensusMapType

Main data type (consensus features)

◆ ConstExperimentSharedPtrType

◆ ExperimentSharedPtrType

Main managed data type (experiment)

◆ ExperimentType

Main data type (experiment)

◆ FeatureMapSharedPtrType

Main managed data type (features)

◆ FeatureMapType

Main data type (features)

◆ GenericArea

using GenericArea = Area<2>

A generic range of data on X and Y axis as shown on plot axis.

◆ ODExperimentSharedPtrType

◆ PeakType

Peak type.

◆ PixelArea

using PixelArea = Area<2>

The number of pixels on the axis. The lower point of the area will be zero. The maxima will reflect the number of pixels in either dimension. Note that the unit of the Axis etc is in PIXELS (-> *not* in seconds, m/z or whatever)

◆ PointOnAxis

using PointOnAxis = DimMapper<2>::Point

◆ RangeType

a generic range for the most common units

◆ SpectrumConstIteratorType

Spectrum iterator type (iterates over peaks)

◆ SpectrumType

◆ UnitRange

◆ VisibleArea

using VisibleArea = Area<2>

The visible range of data on X and Y axis as shown on plot axis (not necessarily the range of actual data, e.g. no data to show).

Member Enumeration Documentation

◆ ActionModes

Mouse action modes.

Enumerator
AM_TRANSLATE 

translate

AM_ZOOM 

zoom

AM_MEASURE 

measure

◆ IntensityModes

Display modes of intensity.

Enumerator
IM_NONE 

Normal mode: f(x)=x; y-axis shows the maximum of all layers, no scaling.

IM_PERCENTAGE 

Shows intensities normalized by each layer's maximum: f(x)=x/max(x)*100.

IM_SNAP 

Shows the maximum displayed intensity (across all layers) as if it was the overall maximum intensity.

IM_LOG 

Logarithmic version of normal mode.

Constructor & Destructor Documentation

◆ PlotCanvas()

PlotCanvas ( const Param preferences,
QWidget parent = nullptr 
)

Default constructor.

◆ ~PlotCanvas()

~PlotCanvas ( )
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)

◆ addChromLayer()

bool addChromLayer ( const ExperimentSharedPtrType map,
ODExperimentSharedPtrType  od_map,
const String filename = "" 
)

Add a chrom data layer.

Parameters
mapShared pointer to input map. It can be performed in constant time and does not double the required memory.
od_mapShared pointer to on disk data which potentially caches some data to save memory (the map can be empty, but do not pass nullptr).
filenameThis 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().

◆ addDataProcessing_()

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

Data processing setter for peak maps.

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

◆ addLayer() [1/4]

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

Add a consensus feature data layer.

Parameters
mapShared Pointer to input map. It can be performed in constant time and does not double the required memory.
filenameThis absolute filename is used to monitor changes in the file and reload the data
Returns
If a new layer was created

◆ addLayer() [2/4]

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

Add a feature data layer.

Parameters
mapShared Pointer to input map. It can be performed in constant time and does not double the required memory.
filenameThis 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 ( std::unique_ptr< LayerData1DBase layer)

Add an already constructed layer (e.g. for projections)

Referenced by TOPPViewBase::addData().

◆ addLayer() [4/4]

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

Add an identification data layer.

Parameters
peptidesInput 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.
filenameThis absolute filename is used to monitor changes in the file and reload the data
Returns
If a new layer was created

◆ addPeakLayer()

bool addPeakLayer ( const ExperimentSharedPtrType map,
ODExperimentSharedPtrType  od_map,
const String filename = "",
const bool  use_noise_cutoff = false 
)

Add a peak data layer.

Parameters
mapShared pointer to input map. It can be performed in constant time and does not double the required memory.
od_mapShared pointer to on disk data which potentially caches some data to save memory (the map can be empty, but do not pass nullptr).
filenameThis absolute filename is used to monitor changes in the file and reload the data
use_noise_cutoffAdd a noise filter which removes low-intensity peaks
Returns
If a new layer was created

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

◆ canvasPixelArea

AreaXYType canvasPixelArea ( ) const
inlineslot

Get the Area in pixel coordinates of the current canvas for X and Y axis.

Returns

◆ changeLayerFilterState

void changeLayerFilterState ( Size  i,
bool  b 
)
slot

change if the defined data filters are used

Parameters
ithe index of the layer
btrue 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
ithe index of the layer
btrue if layer is supposed to be visible

◆ changeVisibleArea_()

virtual void changeVisibleArea_ ( VisibleArea  new_area,
bool  repaint = true,
bool  add_to_stack = false 
)
protectedvirtual

Sets the visible area.

Changes the visible area, adjusts the zoom stack and notifies interested clients about the change. If the area is outside the overall data range, the new area is pushed back into the overall range.

Parameters
new_areaThe new visible area.
repaintIf true, a complete repaint is forced.
add_to_stackIf true the new area is to add to the zoom_stack_.

Reimplemented in Plot1DCanvas.

Referenced by Plot1DCanvas::resetZoom().

◆ dimensionsChanged_()

void dimensionsChanged_ ( )
protected

Call this whenever the DimMapper receives new dimensions; will update the axes and scrollbars.

◆ drawText_()

void drawText_ ( QPainter &  painter,
const QStringList &  text 
)
protected

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

◆ enterEvent()

void enterEvent ( QEvent *  e)
overrideprotected

◆ finishAdding_()

virtual bool finishAdding_ ( )
protectedpure virtual

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

Implemented in Plot3DCanvas, Plot2DCanvas, and Plot1DCanvas.

◆ focusOutEvent()

void focusOutEvent ( QFocusEvent *  e)
overrideprotected

◆ 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]

LayerDataBase& getCurrentLayer ( )
inline

returns the layer data of the active layer

◆ getCurrentLayer() [2/2]

◆ getCurrentLayerIndex()

Size getCurrentLayerIndex ( ) const
inline

returns the index of the active layer

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

◆ getCurrentMaxIntensity()

float getCurrentMaxIntensity ( ) const
inline

Returns the maximum intensity of the active layer.

◆ getCurrentMinIntensity()

float getCurrentMinIntensity ( ) const
inline

Returns the minimum intensity of the active layer.

◆ getDataRange()

const RangeType& getDataRange ( ) const

Returns the area which encloses all data points of all layers.

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() [1/2]

LayerDataBase& getLayer ( Size  index)
inline

returns the layer data with index index

◆ getLayer() [2/2]

const LayerDataBase& getLayer ( Size  index) const
inline

returns the layer data with index index

Referenced by TOPPViewBase::addData(), TOPPViewBase::fileChanged_(), and TOPPViewBase::showCurrentPeaksAs3D().

◆ getLayerCount()

◆ getLayerFlag() [1/2]

bool getLayerFlag ( LayerDataBase::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,
LayerDataBase::Flags  f 
) const
inline

returns a layer flag of the layer layer

◆ getLayerName()

String getLayerName ( Size  i)

Gets the name of layer i.

◆ getMapper

const DimMapper<2>& getMapper ( ) const
slot

Get Mapper to translate between values for axis (X/Y) and units (m/z, RT, intensity, ...)

Returns
The translation from axis to units

Referenced by Annotation1DCaret< DataPoint >::draw(), and Annotation1DPeakItem< DataPoint >::draw().

◆ getMaxIntensity()

float getMaxIntensity ( Size  index) const
inline

Returns the maximum intensity of the layer with index index.

◆ getMinIntensity()

float getMinIntensity ( Size  index) const
inline

Returns the minimum intensity of the layer with index index.

◆ getPercentageFactor()

double getPercentageFactor ( ) const

Returns the percentage factor.

◆ getPixelRange()

PixelArea getPixelRange ( ) const
inline

Get the number of pixels of the current canvas (this is independent of the current visible area and zoom level). It's just the size of the canvas.

References Area< N_DIM >::setArea().

◆ getPlotWidget()

PlotWidget* getPlotWidget ( ) const
inline

Returns the spectrum widget.

Returns the enclosing spectrum widget

Returns
the spectrum widget

◆ getSnapFactor()

double getSnapFactor ( )

Returns the first intensity scaling factor for 'snap to maximum intensity mode' (for the currently visible data range).

See also
snap_factors_

◆ getVisibleArea()

const VisibleArea& getVisibleArea ( ) const
inline

Returns the currently visible area. This is the authority which determines the X and Y axis' scale.

See also
visible_area_

Referenced by TOPPViewBase::zoomOtherWindows().

◆ 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)
virtualslot

Notifies the canvas that the horizontal scrollbar has been moved.

Reimplement this slot to react on scrollbar events.

◆ intensityModeChange_()

virtual void intensityModeChange_ ( )
protectedvirtual

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

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ isVisible()

bool isVisible ( const PointOnAxis p) const
inline

Given a 2D axis coordinate, is it in the currently visible area? (useful to avoid plotting stuff outside the visible area) Note: The input p must have unit coordinates (i.e. the result of widgetToData_), not pixel coordinates.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ keyReleaseEvent()

void keyReleaseEvent ( QKeyEvent *  e)
overrideprotected

◆ layerActivated

void layerActivated ( QWidget w)
signal

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

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ layerModficationChange

void layerModficationChange ( Size  layer,
bool  modified 
)
signal

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

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ layerZoomChanged

void layerZoomChanged ( QWidget w)
signal

Signal emitted whenever the zoom changed.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ leaveEvent()

void leaveEvent ( QEvent *  e)
overrideprotected

◆ modificationStatus_()

void modificationStatus_ ( Size  layer_index,
bool  modified 
)
protected

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

◆ paintGridLines_()

virtual void paintGridLines_ ( QPainter &  painter)
protectedvirtual

Helper function to paint grid lines.

Reimplemented in Plot1DCanvas.

◆ popIncompleteLayer_()

void popIncompleteLayer_ ( const QString &  error_message = "")
protected

remove already added layer which did not pass final checks in finishAdding_()

Parameters
error_messageOptional error message to show as messagebox

◆ preferencesChange

void preferencesChange ( )
signal

Emitted when the layer preferences have changed.

Referenced by TOPPViewBase::showPlotWidgetInWindow().

◆ recalculateAxes

void recalculateAxes ( )
signal

Forces recalculation of axis ticks in the connected widget.

◆ recalculateRanges_()

virtual void recalculateRanges_ ( )
protectedvirtual

Recalculates the overall_data_range_.

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

Reimplemented in Plot1DCanvas.

Referenced by Plot1DCanvas::recalculateRanges_().

◆ recalculateSnapFactor_()

virtual void recalculateSnapFactor_ ( )
protectedvirtual

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

See also
snap_factors_

Reimplemented in Plot2DCanvas.

◆ removeLayer()

virtual void removeLayer ( Size  layer_index)
pure virtual

removes the layer with index layer_index

◆ removeLayers()

void removeLayers ( )
inline

removes all layers by calling removeLayer() for all layer indices (from highest to lowest)

◆ resetZoom

virtual void resetZoom ( bool  repaint = true)
virtualslot

Zooms fully out and resets the zoom stack.

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

Parameters
repaintIf true a repaint is forced. Otherwise only the new area is set.

Reimplemented in Plot1DCanvas.

Referenced by TOPPViewBase::resetZoom().

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  e)
overrideprotected

◆ saveCurrentLayer

void saveCurrentLayer ( bool  visible)
slot

Saves the current layer data.

Parameters
visibleIf true, only the visible data is stored. Otherwise the whole data is stored.

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

◆ 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)

◆ 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::TOPPViewBase().

◆ setIntensityMode()

void setIntensityMode ( IntensityModes  mod)
inline

Sets the intensity mode.

Sets the intensity mode and calls intensityModeChange_()

Parameters
modthe new intensity mode
See also
intensityModeChange_()

◆ setLabel()

void setLabel ( LayerDataBase::LabelType  label)
inline

◆ setLayerFlag() [1/2]

void setLayerFlag ( LayerDataBase::Flags  f,
bool  value 
)
inline

sets a layer flag of the current layer

Referenced by TOPPViewBase::changeUnassigned().

◆ setLayerFlag() [2/2]

void setLayerFlag ( Size  layer,
LayerDataBase::Flags  f,
bool  value 
)
inline

sets a layer flag of the layer layer

◆ setLayerName()

void setLayerName ( Size  i,
const String name 
)

Sets the name of layer i.

Referenced by TOPPViewBase::showCurrentPeaksAsDIA().

◆ setMapper

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

Set a new mapper for the canvas.

Parameters
mapperThe new mapper for translating between units and axis

◆ setPlotWidget()

void setPlotWidget ( PlotWidget widget)
inline

Sets the spectrum widget.

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

Parameters
widgetthe spectrum widget

◆ setVisibleArea [1/3]

void setVisibleArea ( const AreaXYType area)
slot

Sets the visible area.

Sets the visible area to a new value and emits visibleAreaChanged() if the area is different from the old one.

Parameters
areathe new visible area

◆ setVisibleArea [2/3]

void setVisibleArea ( const RangeAllType area)
slot

Sets the visible area.

Sets the visible area to a new value and emits visibleAreaChanged() if the area is different from the old one.

Parameters
areathe new visible area

◆ setVisibleArea [3/3]

void setVisibleArea ( const VisibleArea area)
slot

Sets the visible area.

Sets the visible area to a new value and emits visibleAreaChanged() if the area is different from the old one.

Parameters
areathe new visible area

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

◆ setVisibleAreaX

void setVisibleAreaX ( double  min,
double  max 
)
slot

Set only the visible area for the x axis; other axes are untouched.

Parameters
min
max

◆ setVisibleAreaY

void setVisibleAreaY ( double  min,
double  max 
)
slot

Set only the visible area for the y axis; other axes are untouched.

Parameters
min
max

◆ showCurrentLayerPreferences()

virtual void showCurrentLayerPreferences ( )
pure virtual

Shows the preferences dialog of the active layer.

Implemented in Plot3DCanvas, Plot2DCanvas, and Plot1DCanvas.

Referenced by TOPPViewBase::showPreferences().

◆ showGridLines

void showGridLines ( bool  show)
slot

Whether or not to show grid lines.

Sets whether grid lines are shown or not.

Parameters
showBoolean 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
modifiableindicates if the data can be modified.
indexIf 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_ ( )
protectedvirtual

Translation bound to the 'Down' key.

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ translateForward_()

virtual void translateForward_ ( )
protectedvirtual

Translation bound to the 'Up' key.

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ translateLeft_()

virtual void translateLeft_ ( Qt::KeyboardModifiers  m)
protectedvirtual

Translation bound to the 'Left' key.

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ translateRight_()

virtual void translateRight_ ( Qt::KeyboardModifiers  m)
protectedvirtual

Translation bound to the 'Right' key.

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ update_()

virtual void update_ ( const char *  caller_name)
protectedvirtual

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_nameName of the calling function (use OPENMS_PRETTY_FUNCTION).

Reimplemented in Plot3DCanvas.

◆ updateCursor_

void updateCursor_ ( )
protectedslot

Updates the cursor according to the current action mode.

◆ updateHScrollbar

void updateHScrollbar ( float  f_min,
float  disp_min,
float  disp_max,
float  f_max 
)
signal

Triggers the update of the horizontal scrollbar.

◆ updateLayer

virtual void updateLayer ( Size  i)
pure virtualslot

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

Referenced by TOPPViewBase::fileChanged_().

◆ updateScrollbars_()

virtual void updateScrollbars_ ( )
protectedvirtual

Updates the scroll bars.

Updates the scrollbars after a change of the visible area.

Reimplemented in Plot2DCanvas, and Plot1DCanvas.

◆ updateVScrollbar

void updateVScrollbar ( float  f_min,
float  disp_min,
float  disp_max,
float  f_max 
)
signal

Triggers the update of the vertical scrollbar.

◆ verticalScrollBarChange

virtual void verticalScrollBarChange ( int  value)
virtualslot

Notifies the canvas that the vertical scrollbar has been moved.

Reimplement this slot to react on scrollbar events.

◆ visibleAreaChanged

void visibleAreaChanged ( const VisibleArea area)
signal

Change of the visible area.

Signal emitted whenever the visible area changes.

Parameters
areaThe new visible area.

◆ wheelEvent()

void wheelEvent ( QWheelEvent *  e)
overrideprotected

◆ widgetToData_() [1/2]

PointXYType widgetToData_ ( const QPoint &  pos)
inlineprotected

Calls widgetToData_ with x and y position of pos.

◆ widgetToData_() [2/2]

PointXYType widgetToData_ ( double  x,
double  y 
)
inlineprotected

Convert widget (pixel) to chart (unit) coordinates.

Translates widget coordinates to chart coordinates.

Parameters
xthe widget coordinate x
ythe widget coordinate y
Returns
chart coordinates

◆ zoom_()

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

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

Reimplemented in Plot1DCanvas.

◆ zoomAdd_()

void zoomAdd_ ( const VisibleArea 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_ ( )
protectedvirtual

Go forward in zoom history.

Reimplemented in Plot1DCanvas.

Member Data Documentation

◆ action_mode_

ActionModes action_mode_ = AM_TRANSLATE
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_ = nullptr
protected

External context menu extension.

◆ intensity_mode_

IntensityModes intensity_mode_ = IM_NONE
protected

Stores the used intensity mode function.

◆ last_mouse_pos_

QPoint last_mouse_pos_
protected

start position of mouse actions

◆ layers_

LayerStack layers_
protected

Layer data.

◆ measurement_start_

PeakIndex measurement_start_
protected

start peak of measuring mode

◆ overall_data_range_

RangeType overall_data_range_
protected

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

◆ percentage_factor_

double percentage_factor_ = 1.0
protected

Intensity scaling factor for relative scale with multiple layers.

In this mode all layers are scaled to the same maximum. FIXME: this factor changes, depending on the layer which is currently plotted! Ouch!

◆ rubber_band_

QRubberBand rubber_band_
protected

Rubber band for selected area.

◆ selected_peak_

PeakIndex selected_peak_
protected

selected peak

◆ show_grid_

bool show_grid_ = true
protected

Stores whether or not to show a grid.

◆ show_timing_

bool show_timing_ = false
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.

Only used in 2D mode.

◆ spectrum_widget_

PlotWidget* spectrum_widget_ = nullptr
protected

Back-pointer to the enclosing spectrum widget.

◆ unit_mapper_

DimMapper<2> unit_mapper_
protected

Mapper for X and Y axis.

◆ update_buffer_

bool update_buffer_ = false
protected

Whether to recalculate the data in the buffer when repainting.

◆ visible_area_

VisibleArea visible_area_
protected

Stores the currently visible area in data units (e.g. seconds, m/z, intensity etc) and axis (X,Y) area.

This is always (and only) the data shown in the widget. In 1D, the gravity axis may get some headroom on the y-axis, see Plot1DCanvas::correctGravityAxisOfVisibleArea_()

◆ zoom_pos_

std::vector<VisibleArea>::iterator zoom_pos_ = zoom_stack_.end()
protected

The current position in the zoom stack.

◆ zoom_stack_

std::vector<VisibleArea> zoom_stack_
protected

The zoom stack.