OpenMS
Painter2DBase.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Chris Bielow $
6 // $Authors: Chris Bielow $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
12 
13 #include <OpenMS/CONCEPT/Types.h>
17 
18 #include <vector>
19 
20 class QPainter;
21 class QPenStyle;
22 class QPoint;
23 class String;
24 
25 namespace OpenMS
26 {
27  class ConsensusFeature;
28  class LayerDataChrom;
29  class LayerDataConsensus;
30  class LayerDataFeature;
31  class LayerDataIdent;
32  class LayerDataIonMobility;
33  class LayerDataPeak;
34  struct PeakIndex;
35  class Plot2DCanvas;
36 
37 
41  class OPENMS_GUI_DLLAPI Painter2DBase : public PainterBase
42  {
43  public:
44  virtual ~Painter2DBase() = default;
45 
53  virtual void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) = 0;
54 
63  virtual void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element);
64 
65  protected:
74  static void paintConvexHull_(QPainter& painter, Plot2DCanvas* canvas, const ConvexHull2D& hull, bool has_identifications);
75 
84  static void paintConvexHulls_(QPainter& painter, Plot2DCanvas* canvas, const std::vector<ConvexHull2D>& hulls, bool has_identifications);
85 
86  static void paintPeptideIDs_(QPainter* painter, Plot2DCanvas* canvas, const IPeptideIds::PepIds& ids, int layer_index);
87  };
88 
93  class OPENMS_GUI_DLLAPI Painter2DPeak : public Painter2DBase
94  {
95  public:
97  Painter2DPeak(const LayerDataPeak* parent);
98 
99  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
100 
101  protected:
102  void paintAllIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, double pen_width);
103 
116  void paintMaximumIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, Size rt_pixel_count, Size mz_pixel_count);
117 
118 
122  void paintPrecursorPeaks_(QPainter& painter, Plot2DCanvas* canvas);
124  };
125 
130  class OPENMS_GUI_DLLAPI Painter2DChrom : public Painter2DBase
131  {
132  public:
135 
136  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
137 
138  protected:
140  };
141 
146  class OPENMS_GUI_DLLAPI Painter2DIonMobility : public Painter2DBase
147  {
148  public:
151 
152  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
153 
154  protected:
156  };
157 
162  class OPENMS_GUI_DLLAPI Painter2DFeature : public Painter2DBase
163  {
164  public:
167 
168  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
169 
170  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
171 
172  protected:
176  void paintTraceConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
177 
181  void paintFeatureConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
182 
184  };
185 
190  class OPENMS_GUI_DLLAPI Painter2DConsensus : public Painter2DBase
191  {
192  public:
195 
196  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
197 
198  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
199 
200  protected:
208  void paintConsensusElements_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index);
209 
218  void paintConsensusElement_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index, const ConsensusFeature& cf);
219 
227  bool isConsensusFeatureVisible_(const Plot2DCanvas* canvas, const ConsensusFeature& cf, Size layer_index);
228 
230  };
231 
235  class OPENMS_GUI_DLLAPI Painter2DIdent : public Painter2DBase
236  {
237  public:
240 
242  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
243 
244  protected:
246  };
247 
248 } // namespace OpenMS
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:45
Definition: ConvexHull2D.h:47
std::vector< PeptideIdentification > PepIds
Definition: IPeptideIds.h:25
Class that stores the data for one layer of type Chromatogram.
Definition: LayerDataChrom.h:24
Class that stores the data for one layer of type ConsensusMap.
Definition: LayerDataConsensus.h:24
Class that stores the data for one layer of type FeatureMap.
Definition: LayerDataFeature.h:23
Class that stores the data for one layer of type PeptideIdentifications.
Definition: LayerDataIdent.h:23
Class that stores the data for one layer of type IonMobility.
Definition: LayerDataIonMobility.h:28
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:29
A base class for painting all items from a data layer (as supported by class derived from here) onto ...
Definition: Painter2DBase.h:42
virtual void paint(QPainter *painter, Plot2DCanvas *canvas, int layer_index)=0
Paints items using the given painter onto the canvas.
virtual ~Painter2DBase()=default
static void paintConvexHull_(QPainter &painter, Plot2DCanvas *canvas, const ConvexHull2D &hull, bool has_identifications)
Paints a convex hull.
virtual void highlightElement(QPainter *painter, Plot2DCanvas *canvas, const PeakIndex element)
Emphasize a certain element (e.g. feature), e.g. when mouse hovering. By default, nothing is highligh...
static void paintPeptideIDs_(QPainter *painter, Plot2DCanvas *canvas, const IPeptideIds::PepIds &ids, int layer_index)
static void paintConvexHulls_(QPainter &painter, Plot2DCanvas *canvas, const std::vector< ConvexHull2D > &hulls, bool has_identifications)
Paints convex hulls.
Painter2D for chromatograms.
Definition: Painter2DBase.h:131
void paint(QPainter *painter, Plot2DCanvas *canvas, int layer_index) override
Paints items using the given painter onto the canvas.
const LayerDataChrom * layer_
the data to paint
Definition: Painter2DBase.h:139
Painter2DChrom(const LayerDataChrom *parent)
C'tor which remembers the layer to paint.
Painter2D for ConsensusFeatures.
Definition: Painter2DBase.h:191
void paintConsensusElement_(QPainter *painter, Plot2DCanvas *canvas, Size layer_index, const ConsensusFeature &cf)
Paints one consensus element of a consensus features layer.
const LayerDataConsensus * layer_
the data to paint
Definition: Painter2DBase.h:229
Painter2DConsensus(const LayerDataConsensus *parent)
C'tor which remembers the layer to paint.
void paintConsensusElements_(QPainter *painter, Plot2DCanvas *canvas, Size layer_index)
Paints the consensus elements of a consensus features layer.
void paint(QPainter *, Plot2DCanvas *canvas, int layer_index) override
Paints items using the given painter onto the canvas.
bool isConsensusFeatureVisible_(const Plot2DCanvas *canvas, const ConsensusFeature &cf, Size layer_index)
checks if any element of a consensus feature is currently visible.
void highlightElement(QPainter *painter, Plot2DCanvas *canvas, const PeakIndex element) override
Emphasize a certain element (e.g. feature), e.g. when mouse hovering. By default, nothing is highligh...
Painter2D for Features.
Definition: Painter2DBase.h:163
void paintTraceConvexHulls_(QPainter *painter, Plot2DCanvas *canvas)
Paints convex hulls (one for each mass trace) of a features layer.
Painter2DFeature(const LayerDataFeature *parent)
C'tor which remembers the layer to paint.
const LayerDataFeature * layer_
the data to paint
Definition: Painter2DBase.h:183
void paint(QPainter *, Plot2DCanvas *canvas, int layer_index) override
Paints items using the given painter onto the canvas.
void highlightElement(QPainter *painter, Plot2DCanvas *canvas, const PeakIndex element) override
Emphasize a certain element (e.g. feature), e.g. when mouse hovering. By default, nothing is highligh...
void paintFeatureConvexHulls_(QPainter *painter, Plot2DCanvas *canvas)
Paints the convex hulls (one for each feature) of a features layer.
Painter2D for Identifications.
Definition: Painter2DBase.h:236
const LayerDataIdent * layer_
the data to paint
Definition: Painter2DBase.h:245
Painter2DIdent(const LayerDataIdent *parent)
C'tor which remembers the layer to paint.
void paint(QPainter *, Plot2DCanvas *canvas, int layer_index) override
Implementation of base class.
Painter2D for ion mobilograms.
Definition: Painter2DBase.h:147
void paint(QPainter *painter, Plot2DCanvas *canvas, int layer_index) override
Paints items using the given painter onto the canvas.
const LayerDataIonMobility * layer_
the data to paint
Definition: Painter2DBase.h:155
Painter2DIonMobility(const LayerDataIonMobility *parent)
C'tor which remembers the layer to paint.
Painter2D for spectra.
Definition: Painter2DBase.h:94
void paintMaximumIntensities_(QPainter &painter, Plot2DCanvas *canvas, Size layer_index, Size rt_pixel_count, Size mz_pixel_count)
Paints maximum intensity of individual peaks.
void paintPrecursorPeaks_(QPainter &painter, Plot2DCanvas *canvas)
Paints the locations where MS2 scans where triggered.
void paintAllIntensities_(QPainter &painter, Plot2DCanvas *canvas, Size layer_index, double pen_width)
Painter2DPeak(const LayerDataPeak *parent)
C'tor which remembers the layer to paint.
const LayerDataPeak * layer_
the data to paint
Definition: Painter2DBase.h:123
void paint(QPainter *, Plot2DCanvas *canvas, int layer_index) override
Paints items using the given painter onto the canvas.
An empty base class with some static convenience functions.
Definition: PainterBase.h:39
Canvas for 2D-visualization of peak map, feature map and consensus map data.
Definition: Plot2DCanvas.h:46
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Index of a peak or feature.
Definition: PeakIndex.h:25