OpenMS
Painter2DBase.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2023.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
38 
39 #include <OpenMS/CONCEPT/Types.h>
43 
44 #include <vector>
45 
46 class QPainter;
47 class QPenStyle;
48 class QPoint;
49 class String;
50 
51 namespace OpenMS
52 {
53  class ConsensusFeature;
54  class LayerDataChrom;
55  class LayerDataConsensus;
56  class LayerDataFeature;
57  class LayerDataIdent;
58  class LayerDataIonMobility;
59  class LayerDataPeak;
60  struct PeakIndex;
61  class Plot2DCanvas;
62 
63 
67  class OPENMS_GUI_DLLAPI Painter2DBase : public PainterBase
68  {
69  public:
70  virtual ~Painter2DBase() = default;
71 
79  virtual void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) = 0;
80 
89  virtual void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element);
90 
91  protected:
100  static void paintConvexHull_(QPainter& painter, Plot2DCanvas* canvas, const ConvexHull2D& hull, bool has_identifications);
101 
110  static void paintConvexHulls_(QPainter& painter, Plot2DCanvas* canvas, const std::vector<ConvexHull2D>& hulls, bool has_identifications);
111 
112  static void paintPeptideIDs_(QPainter* painter, Plot2DCanvas* canvas, const IPeptideIds::PepIds& ids, int layer_index);
113  };
114 
119  class OPENMS_GUI_DLLAPI Painter2DPeak : public Painter2DBase
120  {
121  public:
123  Painter2DPeak(const LayerDataPeak* parent);
124 
125  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
126 
127  protected:
128  void paintAllIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, double pen_width);
129 
142  void paintMaximumIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, Size rt_pixel_count, Size mz_pixel_count);
143 
144 
148  void paintPrecursorPeaks_(QPainter& painter, Plot2DCanvas* canvas);
150  };
151 
156  class OPENMS_GUI_DLLAPI Painter2DChrom : public Painter2DBase
157  {
158  public:
161 
162  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
163 
164  protected:
166  };
167 
172  class OPENMS_GUI_DLLAPI Painter2DIonMobility : public Painter2DBase
173  {
174  public:
177 
178  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
179 
180  protected:
182  };
183 
188  class OPENMS_GUI_DLLAPI Painter2DFeature : public Painter2DBase
189  {
190  public:
193 
194  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
195 
196  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
197 
198  protected:
202  void paintTraceConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
203 
207  void paintFeatureConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
208 
210  };
211 
216  class OPENMS_GUI_DLLAPI Painter2DConsensus : public Painter2DBase
217  {
218  public:
221 
222  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
223 
224  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
225 
226  protected:
234  void paintConsensusElements_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index);
235 
244  void paintConsensusElement_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index, const ConsensusFeature& cf);
245 
253  bool isConsensusFeatureVisible_(const Plot2DCanvas* canvas, const ConsensusFeature& cf, Size layer_index);
254 
256  };
257 
261  class OPENMS_GUI_DLLAPI Painter2DIdent : public Painter2DBase
262  {
263  public:
266 
268  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
269 
270  protected:
272  };
273 
274 } // namespace OpenMS
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:71
A 2-dimensional hull representation in [counter]clockwise direction - depending on axis labelling.
Definition: ConvexHull2D.h:73
std::vector< PeptideIdentification > PepIds
Definition: IPeptideIds.h:51
Class that stores the data for one layer of type Chromatogram.
Definition: LayerDataChrom.h:50
Class that stores the data for one layer of type ConsensusMap.
Definition: LayerDataConsensus.h:50
Class that stores the data for one layer of type FeatureMap.
Definition: LayerDataFeature.h:49
Class that stores the data for one layer of type PeptideIdentifications.
Definition: LayerDataIdent.h:49
Class that stores the data for one layer of type IonMobility.
Definition: LayerDataIonMobility.h:54
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:55
A base class for painting all items from a data layer (as supported by class derived from here) onto ...
Definition: Painter2DBase.h:68
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:157
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:165
Painter2DChrom(const LayerDataChrom *parent)
C'tor which remembers the layer to paint.
Painter2D for ConsensusFeatures.
Definition: Painter2DBase.h:217
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:255
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:189
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:209
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:262
const LayerDataIdent * layer_
the data to paint
Definition: Painter2DBase.h:271
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:173
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:181
Painter2DIonMobility(const LayerDataIonMobility *parent)
C'tor which remembers the layer to paint.
Painter2D for spectra.
Definition: Painter2DBase.h:120
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:149
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:65
Canvas for 2D-visualization of peak map, feature map and consensus map data.
Definition: Plot2DCanvas.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
Index of a peak or feature.
Definition: PeakIndex.h:51