OpenMS  3.0.0
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-2021.
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 
38 #include <QRgb>
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
41 #include <OpenMS/CONCEPT/Types.h>
44 
45 #include <vector>
46 
47 class QPainter;
48 class QPenStyle;
49 class QPoint;
50 class String;
51 
52 namespace OpenMS
53 {
54  class ConsensusFeature;
55  class LayerDataChrom;
56  class LayerDataConsensus;
57  class LayerDataFeature;
58  class LayerDataIdent;
59  class LayerDataIonMobility;
60  class LayerDataPeak;
61  struct PeakIndex;
62  class Plot2DCanvas;
63 
67  class OPENMS_GUI_DLLAPI Painter2DBase
68  {
69  public:
70  virtual ~Painter2DBase() = default;
71 
79  virtual void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) = 0;
80 
81 
90  virtual void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element);
91 
92  protected:
94  static void paintIcon_(const QPoint& pos, const QRgb& color, const String& icon, Size s, QPainter& p);
95 
104  static void paintConvexHull_(QPainter& painter, Plot2DCanvas* canvas, const ConvexHull2D& hull, bool has_identifications);
105 
114  static void paintConvexHulls_(QPainter& painter, Plot2DCanvas* canvas, const std::vector<ConvexHull2D>& hulls, bool has_identifications);
115 
116  static void paintPeptideIDs_(QPainter* painter, Plot2DCanvas* canvas, const IPeptideIds::PepIds& ids, int layer_index);
117  };
118 
123  class OPENMS_GUI_DLLAPI Painter2DPeak : public Painter2DBase
124  {
125  public:
127  Painter2DPeak(const LayerDataPeak* parent);
128 
129  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
130 
131  protected:
132  void paintAllIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, double pen_width);
133 
145  void paintMaximumIntensities_(QPainter& painter, Plot2DCanvas* canvas, Size layer_index, Size rt_pixel_count, Size mz_pixel_count);
146 
147 
151  void paintPrecursorPeaks_(QPainter& painter, Plot2DCanvas* canvas);
153  };
154 
159  class OPENMS_GUI_DLLAPI Painter2DChrom : public Painter2DBase
160  {
161  public:
163  Painter2DChrom(const LayerDataChrom* parent);
164 
165  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
166 
167  protected:
169  };
170 
175  class OPENMS_GUI_DLLAPI Painter2DIonMobility : public Painter2DBase
176  {
177  public:
180 
181  void paint(QPainter* painter, Plot2DCanvas* canvas, int layer_index) override;
182 
183  protected:
185  };
186 
191  class OPENMS_GUI_DLLAPI Painter2DFeature : public Painter2DBase
192  {
193  public:
195  Painter2DFeature(const LayerDataFeature* parent);
196 
197  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
198 
199  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
200 
201  protected:
205  void paintTraceConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
206 
210  void paintFeatureConvexHulls_(QPainter* painter, Plot2DCanvas* canvas);
211 
213  };
214 
219  class OPENMS_GUI_DLLAPI Painter2DConsensus : public Painter2DBase
220  {
221  public:
223  Painter2DConsensus(const LayerDataConsensus* parent);
224 
225  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
226 
227  void highlightElement(QPainter* painter, Plot2DCanvas* canvas, const PeakIndex element) override;
228 
229  protected:
237  void paintConsensusElements_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index);
238 
247  void paintConsensusElement_(QPainter* painter, Plot2DCanvas* canvas, Size layer_index, const ConsensusFeature& cf);
248 
256  bool isConsensusFeatureVisible_(const Plot2DCanvas* canvas, const ConsensusFeature& cf, Size layer_index);
257 
259  };
260 
264  class OPENMS_GUI_DLLAPI Painter2DIdent : public Painter2DBase
265  {
266  public:
268  Painter2DIdent(const LayerDataIdent* parent);
269 
271  void paint(QPainter*, Plot2DCanvas* canvas, int layer_index) override;
272 
273  protected:
275  };
276 
277 } // namespace OpenMS
Painter2D for ion mobilograms.
Definition: Painter2DBase.h:175
A more convenient string class.
Definition: String.h:58
Painter2D for Features.
Definition: Painter2DBase.h:191
const LayerDataIdent * layer_
the data to paint
Definition: Painter2DBase.h:274
Class that stores the data for one layer of type IonMobility.
Definition: LayerDataIonMobility.h:53
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:54
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
A 2-dimensional hull representation in [counter]clockwise direction - depending on axis labelling...
Definition: ConvexHull2D.h:72
const LayerDataChrom * layer_
the data to paint
Definition: Painter2DBase.h:168
Painter2D for spectra.
Definition: Painter2DBase.h:123
Class that stores the data for one layer of type ConsensusMap.
Definition: LayerDataConsensus.h:49
Class that stores the data for one layer of type FeatureMap.
Definition: LayerDataFeature.h:48
const LayerDataFeature * layer_
the data to paint
Definition: Painter2DBase.h:212
Painter2D for chromatograms.
Definition: Painter2DBase.h:159
Painter2D for ConsensusFeatures.
Definition: Painter2DBase.h:219
A base class for painting all items from a data layer (as supported by class derived from here) onto ...
Definition: Painter2DBase.h:67
Canvas for 2D-visualization of peak map, feature map and consensus map data.
Definition: Plot2DCanvas.h:70
const LayerDataIonMobility * layer_
the data to paint
Definition: Painter2DBase.h:184
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
const LayerDataPeak * layer_
the data to paint
Definition: Painter2DBase.h:152
Class that stores the data for one layer of type Chromatogram.
Definition: LayerDataChrom.h:49
const LayerDataConsensus * layer_
the data to paint
Definition: Painter2DBase.h:258
Class that stores the data for one layer of type PeptideIdentifications.
Definition: LayerDataIdent.h:48
std::vector< PeptideIdentification > PepIds
Definition: IPeptideIds.h:51
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:69
Index of a peak or feature.
Definition: PeakIndex.h:50
Painter2D for Identifications.
Definition: Painter2DBase.h:264