OpenMS
Plot2DCanvas Class Reference

Canvas for 2D-visualization of peak map, feature map and consensus map data. More...

#include <OpenMS/VISUAL/Plot2DCanvas.h>

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

Public Slots

void activateLayer (Size layer_index) override
 
void removeLayer (Size layer_index) override
 
void updateLayer (Size i) override
 
void horizontalScrollBarChange (int value) override
 
void verticalScrollBarChange (int value) override
 
void pickProjectionLayer ()
 Picks an appropriate layer for projection and emits the signal showProjections(LayerDataBase*). More...
 
- Public Slots inherited from PlotCanvas
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...
 

Signals

void showProjections (const LayerDataBase *source_layer)
 Requests to show projections for the source_layer. Emitted after calling pickProjectionLayer(). More...
 
void toggleProjections ()
 Signal emitted when the projections are to be shown/hidden (e.g. via context menu) More...
 
void showSpectrumAsNew1D (int index)
 Requests to display the spectrum with index index in 1D. More...
 
void showChromatogramsAsNew1D (std::vector< int, std::allocator< int > > indices)
 
void showCurrentPeaksAs3D ()
 Requests to display all spectra in 3D plot. More...
 
- Signals inherited from PlotCanvas
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...
 

Public Member Functions

 Plot2DCanvas ()=delete
 Default C'tor hidden. More...
 
 Plot2DCanvas (const Param &preferences, QWidget *parent=nullptr)
 Constructor. More...
 
 ~Plot2DCanvas () override
 Destructor. More...
 
void showCurrentLayerPreferences () override
 Shows the preferences dialog of the active layer. More...
 
void mergeIntoLayer (Size i, const FeatureMapSharedPtrType &map)
 Merges the features in map into the features layer i. More...
 
void mergeIntoLayer (Size i, const ConsensusMapSharedPtrType &map)
 Merges the consensus features in map into the features layer i. More...
 
void mergeIntoLayer (Size i, std::vector< PeptideIdentification > &peptides)
 Merges the peptide identifications in peptides into the peptide layer i. More...
 
void recalculateCurrentLayerDotGradient ()
 recalculates the dot gradient of the active layer More...
 
- Public Member Functions inherited from PlotCanvas
 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...
 
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 showMetaData (bool modifiable=false, Int index=-1)
 Shows a dialog with the meta data. 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...
 
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...
 

Protected Slots

void currentLayerParametersChanged_ ()
 Reacts on changed layer parameters. More...
 
- Protected Slots inherited from PlotCanvas
void updateCursor_ ()
 Updates the cursor according to the current action mode. More...
 

Protected Member Functions

bool finishAdding_ () override
 Method that is called when a new layer has been added. More...
 
bool collectFragmentScansInArea_ (const RangeType &range, QAction *a, QMenu *msn_scans, QMenu *msn_meta)
 Collects fragment ion scans in the indicated RT/mz area and adds them to the indicated action. More...
 
void drawCoordinates_ (QPainter &painter, const PeakIndex &peak)
 Draws the coordinates (or coordinate deltas) to the widget's upper left corner. More...
 
void drawDeltas_ (QPainter &painter, const PeakIndex &start, const PeakIndex &end)
 Draws the coordinates (or coordinate deltas) to the widget's upper left corner. More...
 
- Protected Member Functions inherited from PlotCanvas
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
 
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 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...
 
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...
 
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...
 
void popIncompleteLayer_ (const QString &error_message="")
 
- 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...
 

Reimplemented QT events

class Painter2DBase
 
class Painter2DChrom
 
class Painter2DConsensus
 
class Painter2DIdent
 
class Painter2DFeature
 
class Painter2DIonMobility
 
class Painter2DPeak
 
PeakIndex selected_peak_
 the nearest peak/feature to the mouse cursor More...
 
PeakIndex measurement_start_
 start peak/feature of measuring mode More...
 
MultiGradient linear_gradient_
 stores the linear color gradient for non-log modes More...
 
double pen_size_min_
 minimum number of pixels for one data point More...
 
double pen_size_max_
 maximum number of pixels for one data point More...
 
double canvas_coverage_min_
 minimum coverage of the canvas required; if lower, points are upscaled in size More...
 
void mousePressEvent (QMouseEvent *e) override
 
void mouseReleaseEvent (QMouseEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void paintEvent (QPaintEvent *e) override
 
void contextMenuEvent (QContextMenuEvent *e) override
 
void keyPressEvent (QKeyEvent *e) override
 
void keyReleaseEvent (QKeyEvent *e) override
 
void mouseDoubleClickEvent (QMouseEvent *e) override
 
void updateScrollbars_ () override
 Updates the scroll bars. More...
 
void intensityModeChange_ () override
 This method is called whenever the intensity mode changes. Reimplement if you need to react on such changes. More...
 
void recalculateSnapFactor_ () override
 Recalculates the intensity scaling factor for 'snap to maximum intensity mode'. More...
 
Int precalculatedColorIndex_ (float val, const MultiGradient &gradient, double snap_factor)
 Returns the position on color gradient associated with given intensity. More...
 
QColor heightColor_ (float val, const MultiGradient &gradient, double snap_factor)
 Returns the color associated with val for the gradient gradient. More...
 
double adaptPenScaling_ (double ratio_data2pixel, double &pen_size) const
 For a certain dimension: computes the size a data point would need, such that the image reaches a certain coverage. More...
 
void recalculateDotGradient_ (Size layer)
 Recalculates the dot gradient of a layer. More...
 
void highlightPeak_ (QPainter &p, const PeakIndex &peak)
 Highlights a single peak and prints coordinates to screen. More...
 
PeakIndex findNearestPeak_ (const QPoint &pos)
 Returns the nearest peak to position pos. More...
 
void paintIcon_ (const QPoint &pos, const QRgb &color, const String &icon, Size s, QPainter &p) const
 Paints a peak icon for feature and consensus feature peaks. More...
 
void translateVisibleArea_ (double x_axis_rel, double y_axis_rel)
 Translates the visible area by a given offset specified in fractions of current visible area. More...
 
QPoint dataToWidget_ (double x, double y) const
 Convert chart to widget coordinates. More...
 
QPoint dataToWidget_ (const DPosition< 2 > &xy)
 
void translateLeft_ (Qt::KeyboardModifiers m) override
 Translation bound to the 'Left' key. More...
 
void translateRight_ (Qt::KeyboardModifiers m) override
 Translation bound to the 'Right' key. More...
 
void translateForward_ () override
 Translation bound to the 'Up' key. More...
 
void translateBackward_ () override
 Translation bound to the 'Down' key. More...
 
void finishContextMenu_ (QMenu *context_menu, QMenu *settings_menu)
 Finishes context menu after customization to peaks, features or consensus features. More...
 

Additional Inherited Members

- Public Types inherited from PlotCanvas
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
 
- 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 PlotCanvas
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...
 
- 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

Canvas for 2D-visualization of peak map, feature map and consensus map data.

This widget displays a 2D representation of a set of peaks, features or consensus elements.

The example image shows Plot2DCanvas displaying a peak layer and a feature layer.

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
default_path string.  Default path for loading/storing data.
background_color string@#ffffff  Background color.
interpolation_steps int1000 min: 1 max: 1000Number of interpolation steps for peak gradient pre-calculation.
dot:gradient stringLinear|0,@#eeeeee;1,@#ffea00;6,@#ff0000;14,@#aa00ff;23,@#5500ff;100,@#000000  Multi-color gradient for peaks.
dot:feature_icon stringcircle diamond, square, circle, triangleIcon used for features and consensus features.
dot:feature_icon_size int4 min: 1 max: 999Icon size used for features and consensus features.

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.
Improvement:
Add RT interpolation mode for high zoom in 2D View (Hiwi)
Improvement:
Snap also to min intensity (Hiwi)

Constructor & Destructor Documentation

◆ Plot2DCanvas() [1/2]

Plot2DCanvas ( )
delete

Default C'tor hidden.

◆ Plot2DCanvas() [2/2]

Plot2DCanvas ( const Param preferences,
QWidget parent = nullptr 
)

Constructor.

◆ ~Plot2DCanvas()

~Plot2DCanvas ( )
override

Destructor.

Member Function Documentation

◆ activateLayer

void activateLayer ( Size  layer_index)
overrideslot

◆ adaptPenScaling_()

double adaptPenScaling_ ( double  ratio_data2pixel,
double &  pen_size 
) const
protected

For a certain dimension: computes the size a data point would need, such that the image reaches a certain coverage.

Internally, this function makes use of the members 'canvas_coverage_min_' (giving the fraction (e.g. 20%) of area which should be covered by data) and 'pen_size_max_' (maximum allowed number of pixels per data point).

Parameters
ratio_data2pixelThe current ratio of # data points vs. # pixels of image
pen_sizeIn/Out param: gives the initial pen size, and is increased (up to MAX_PEN_SIZE) to reach desired coverage given by 'canvas_coverage_min_'
Returns
The factor by which pen_size increased (gives a hint of how many data points should be merged to avoid overplotting)

◆ collectFragmentScansInArea_()

bool collectFragmentScansInArea_ ( const RangeType range,
QAction *  a,
QMenu *  msn_scans,
QMenu *  msn_meta 
)
protected

Collects fragment ion scans in the indicated RT/mz area and adds them to the indicated action.

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent *  e)
overrideprotected

◆ currentLayerParametersChanged_

void currentLayerParametersChanged_ ( )
protectedslot

Reacts on changed layer parameters.

◆ dataToWidget_() [1/2]

QPoint dataToWidget_ ( const DPosition< 2 > &  xy)
inlineprotected

◆ dataToWidget_() [2/2]

QPoint dataToWidget_ ( double  x,
double  y 
) const
inlineprotected

Convert chart to widget coordinates.

Translates chart coordinates to widget coordinates.

Parameters
xthe chart coordinate x
ythe chart coordinate y
Returns
A point in widget coordinates

◆ drawCoordinates_()

void drawCoordinates_ ( QPainter &  painter,
const PeakIndex peak 
)
protected

Draws the coordinates (or coordinate deltas) to the widget's upper left corner.

◆ drawDeltas_()

void drawDeltas_ ( QPainter &  painter,
const PeakIndex start,
const PeakIndex end 
)
protected

Draws the coordinates (or coordinate deltas) to the widget's upper left corner.

◆ findNearestPeak_()

PeakIndex findNearestPeak_ ( const QPoint &  pos)
protected

Returns the nearest peak to position pos.

◆ finishAdding_()

bool finishAdding_ ( )
overrideprotectedvirtual

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

Implements PlotCanvas.

◆ finishContextMenu_()

void finishContextMenu_ ( QMenu *  context_menu,
QMenu *  settings_menu 
)
protected

Finishes context menu after customization to peaks, features or consensus features.

◆ heightColor_()

QColor heightColor_ ( float  val,
const MultiGradient gradient,
double  snap_factor 
)
inlineprotected

Returns the color associated with val for the gradient gradient.

Takes intensity modes into account.

References MultiGradient::precalculatedColorByIndex().

◆ highlightPeak_()

void highlightPeak_ ( QPainter &  p,
const PeakIndex peak 
)
protected

Highlights a single peak and prints coordinates to screen.

◆ horizontalScrollBarChange

void horizontalScrollBarChange ( int  value)
overrideslot

◆ intensityModeChange_()

void intensityModeChange_ ( )
overrideprotectedvirtual

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

Reimplemented from PlotCanvas.

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ keyReleaseEvent()

void keyReleaseEvent ( QKeyEvent *  e)
overrideprotected

◆ mergeIntoLayer() [1/3]

void mergeIntoLayer ( Size  i,
const ConsensusMapSharedPtrType map 
)

Merges the consensus features in map into the features layer i.

◆ mergeIntoLayer() [2/3]

void mergeIntoLayer ( Size  i,
const FeatureMapSharedPtrType map 
)

Merges the features in map into the features layer i.

Referenced by TOPPViewBase::addData().

◆ mergeIntoLayer() [3/3]

void mergeIntoLayer ( Size  i,
std::vector< PeptideIdentification > &  peptides 
)

Merges the peptide identifications in peptides into the peptide layer i.

◆ mouseDoubleClickEvent()

void mouseDoubleClickEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  e)
overrideprotected

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent *  e)
overrideprotected

◆ paintEvent()

void paintEvent ( QPaintEvent *  e)
overrideprotected

◆ paintIcon_()

void paintIcon_ ( const QPoint &  pos,
const QRgb &  color,
const String icon,
Size  s,
QPainter &  p 
) const
protected

Paints a peak icon for feature and consensus feature peaks.

◆ pickProjectionLayer

void pickProjectionLayer ( )
slot

Picks an appropriate layer for projection and emits the signal showProjections(LayerDataBase*).

◆ precalculatedColorIndex_()

Int precalculatedColorIndex_ ( float  val,
const MultiGradient gradient,
double  snap_factor 
)
inlineprotected

Returns the position on color gradient associated with given intensity.

Takes intensity modes into account.

References MultiGradient::precalculatedColorIndex().

◆ recalculateCurrentLayerDotGradient()

void recalculateCurrentLayerDotGradient ( )

recalculates the dot gradient of the active layer

◆ recalculateDotGradient_()

void recalculateDotGradient_ ( Size  layer)
protected

Recalculates the dot gradient of a layer.

◆ recalculateSnapFactor_()

void recalculateSnapFactor_ ( )
overrideprotectedvirtual

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

See also
snap_factors_

Reimplemented from PlotCanvas.

◆ removeLayer

void removeLayer ( Size  layer_index)
overrideslot

◆ showChromatogramsAsNew1D

void showChromatogramsAsNew1D ( std::vector< int, std::allocator< int > >  indices)
signal

◆ showCurrentLayerPreferences()

void showCurrentLayerPreferences ( )
overridevirtual

Shows the preferences dialog of the active layer.

Implements PlotCanvas.

◆ showCurrentPeaksAs3D

void showCurrentPeaksAs3D ( )
signal

Requests to display all spectra in 3D plot.

◆ showProjections

void showProjections ( const LayerDataBase source_layer)
signal

Requests to show projections for the source_layer. Emitted after calling pickProjectionLayer().

◆ showSpectrumAsNew1D

void showSpectrumAsNew1D ( int  index)
signal

Requests to display the spectrum with index index in 1D.

◆ toggleProjections

void toggleProjections ( )
signal

Signal emitted when the projections are to be shown/hidden (e.g. via context menu)

◆ translateBackward_()

void translateBackward_ ( )
overrideprotectedvirtual

Translation bound to the 'Down' key.

Reimplemented from PlotCanvas.

◆ translateForward_()

void translateForward_ ( )
overrideprotectedvirtual

Translation bound to the 'Up' key.

Reimplemented from PlotCanvas.

◆ translateLeft_()

void translateLeft_ ( Qt::KeyboardModifiers  m)
overrideprotectedvirtual

Translation bound to the 'Left' key.

Reimplemented from PlotCanvas.

◆ translateRight_()

void translateRight_ ( Qt::KeyboardModifiers  m)
overrideprotectedvirtual

Translation bound to the 'Right' key.

Reimplemented from PlotCanvas.

◆ translateVisibleArea_()

void translateVisibleArea_ ( double  x_axis_rel,
double  y_axis_rel 
)
protected

Translates the visible area by a given offset specified in fractions of current visible area.

◆ updateLayer

void updateLayer ( Size  i)
overrideslot

◆ updateScrollbars_()

void updateScrollbars_ ( )
overrideprotectedvirtual

Updates the scroll bars.

Updates the scrollbars after a change of the visible area.

Reimplemented from PlotCanvas.

◆ verticalScrollBarChange

void verticalScrollBarChange ( int  value)
overrideslot

Friends And Related Function Documentation

◆ Painter2DBase

friend class Painter2DBase
friend

◆ Painter2DChrom

friend class Painter2DChrom
friend

◆ Painter2DConsensus

friend class Painter2DConsensus
friend

◆ Painter2DFeature

friend class Painter2DFeature
friend

◆ Painter2DIdent

friend class Painter2DIdent
friend

◆ Painter2DIonMobility

friend class Painter2DIonMobility
friend

◆ Painter2DPeak

friend class Painter2DPeak
friend

Member Data Documentation

◆ canvas_coverage_min_

double canvas_coverage_min_
protected

minimum coverage of the canvas required; if lower, points are upscaled in size

◆ linear_gradient_

MultiGradient linear_gradient_
protected

stores the linear color gradient for non-log modes

◆ measurement_start_

PeakIndex measurement_start_
protected

start peak/feature of measuring mode

◆ pen_size_max_

double pen_size_max_
protected

maximum number of pixels for one data point

◆ pen_size_min_

double pen_size_min_
protected

minimum number of pixels for one data point

◆ selected_peak_

PeakIndex selected_peak_
protected

the nearest peak/feature to the mouse cursor