libpappsomspp
Library for mass spectrometry
xicwidget.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/widget/xicwidget/xicwidget.h
3  * \date 12/1/2018
4  * \author Olivier Langella
5  * \brief plot a XIC
6  */
7 
8 
9 /*******************************************************************************
10  * Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>.
11  *
12  * This file is part of the PAPPSOms++ library.
13  *
14  * PAPPSOms++ is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * PAPPSOms++ is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26  *
27  * Contributors:
28  * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
29  *implementation
30  ******************************************************************************/
31 
32 #pragma once
33 
34 #include <QWidget>
35 #include "../../xic/xic.h"
36 #include "../../processing/detection/tracepeak.h"
37 #include "../graphicdevicewidget.h"
38 #include <qcustomplot.h>
39 
40 
41 namespace pappso
42 {
43 class QCPXic;
44 
45 typedef std::vector<std::pair<XicCstSPtr, TracePeakCstSPtr>> XicXicPeakPairList;
46 
48 {
49  Q_OBJECT
50  public:
51  XicWidget(QWidget *parent = 0);
52  ~XicWidget();
53 
54 
55  QCPGraph *addXicSp(XicCstSPtr xic_sp);
56  void addMsMsEvent(const Xic *xic_p, pappso::pappso_double rt);
57  void
58  addXicPeakList(const Xic *xic_p,
59  const std::vector<pappso::TracePeakCstSPtr> &xic_peak_list);
60  void setName(const Xic *xic_p, const QString &name);
61  const QString &getName(const Xic *xic_p) const;
62  void clear();
63  void plot();
64  void rescale();
65  void toQPaintDevice(QPaintDevice *device, const QSize &size) override;
66  void setRetentionTimeInSeconds();
67  void setRetentionTimeInMinutes();
68  void drawXicPeakBorders(pappso::TracePeakCstSPtr xic_peak);
69  void clearXicPeakBorders();
70  /** @brief get the plots axis and rescale one axis with the given range
71  */
72  QCPAxis *getRtAxisP();
73  QCPAxis *getIntensityAxisP();
74  void rescaleOneRange(QString axis_name, QCPRange new_range);
75 
76  signals:
77  /** @brief announce the current retention time (under mouse) in seconds
78  */
79  void rtChanged(double rt) const;
81  /** @brief announce mouse position on click (rt in seconds, intensity)
82  */
83  void clicked(double rt, double intensity) const;
84  /** @brief get the new Range when its change
85  */
86  void operateNewRange(QCPRange new_range);
87 
88  protected:
89  friend class QCPXic;
90  void rtChangeEvent(pappso::pappso_double rt) const;
91  void xicClickEvent(pappso::pappso_double rt,
92  pappso::pappso_double intensity) const;
93  void replotAll();
94  XicCstSPtr getXicCstSPtr(const Xic *xic_p) const;
95 
96  protected:
97  bool _rt_in_seconds = true;
98 
99  private:
100  std::map<const Xic *, QString> _map_xic_name;
101  std::map<const Xic *, pappso::pappso_double> _map_xic_msms_event;
102  std::vector<XicCstSPtr> _xic_sp_list;
105 };
106 } // namespace pappso
void rtChanged(double rt) const
announce the current retention time (under mouse) in seconds
std::vector< XicCstSPtr > _xic_sp_list
Definition: xicwidget.h:102
void operateNewRange(QCPRange new_range)
get the new Range when its change
XicXicPeakPairList _xic_peak_sp_list
Definition: xicwidget.h:103
std::map< const Xic *, QString > _map_xic_name
Definition: xicwidget.h:100
std::map< const Xic *, pappso::pappso_double > _map_xic_msms_event
Definition: xicwidget.h:101
void xicPeakListChanged(pappso::XicXicPeakPairList xic_peak_list) const
void clicked(double rt, double intensity) const
announce mouse position on click (rt in seconds, intensity)
QCPXic * _qcp_xic
Definition: xicwidget.h:104
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< const Xic > XicCstSPtr
Definition: xic.h:37
double pappso_double
A type definition for doubles.
Definition: types.h:49
@ rt
Retention time.
std::vector< std::pair< XicCstSPtr, TracePeakCstSPtr > > XicXicPeakPairList
Definition: xicwidget.h:43
std::shared_ptr< const TracePeak > TracePeakCstSPtr
Definition: tracepeak.h:34