libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
basetraceplotwidget.h
Go to the documentation of this file.
1/* This code comes right from the msXpertSuite software project.
2 *
3 * msXpertSuite - mass spectrometry software suite
4 * -----------------------------------------------
5 * Copyright(C) 2009,...,2018 Filippo Rusconi
6 *
7 * http://www.msxpertsuite.org
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * END software license
23 */
24
25
26#pragma once
27
28/////////////////////// StdLib includes
29
30
31/////////////////////// Qt includes
32#include <QObject>
33#include <QString>
34#include <QWidget>
35#include <QBrush>
36#include <QColor>
37#include <QVector>
38
39
40/////////////////////// QCustomPlot
41#include <qcustomplot.h>
42
43
44/////////////////////// Local includes
46#include "baseplotwidget.h"
48
49namespace pappso
50{
51
52
54
55typedef std::shared_ptr<BaseTracePlotWidget> BaseTracePlotWidgetSPtr;
56typedef std::shared_ptr<const BaseTracePlotWidget> BaseTracePlotWidgetCstSPtr;
57
59{
60 Q_OBJECT
61
62 public:
63 enum class PlotType : int8_t
64 {
65 NONE = 0x00,
66 GRAPH,
67 BARS,
68 };
69
70 explicit BaseTracePlotWidget(QWidget *parent = 0);
71 explicit BaseTracePlotWidget(QWidget *parent,
72 const QString &x_axis_label,
73 const QString &y_axis_label);
74
75 virtual ~BaseTracePlotWidget();
76
77 virtual void setGraphData(int graph_index,
78 const std::vector<double> &keys,
79 const std::vector<double> &values);
80
81 virtual void setGraphData(QCPGraph *graph_p,
82 const std::vector<double> &keys,
83 const std::vector<double> &values);
84
85 virtual void clearGraphData(int graph_index);
86
87 virtual void axisDoubleClickHandler(QCPAxis *axis,
88 QCPAxis::SelectablePart part,
89 QMouseEvent *event) override;
90
91 // All these need to be overridden because of some special treatment in case
92 // of Trace plots (graphs, specifically, and not color maps, for example).
93 virtual void axisRescale() override;
94 virtual void axisReframe() override;
95 virtual void axisZoom() override;
96 virtual void axisPan() override;
97
98 virtual QCPGraph *addGraphPlot(const Trace &trace, const QColor &color);
99 virtual QCPBars *addBarsPlot(const Trace &bars, const QColor &color);
100
101 virtual bool
102 findIntegrationLowerRangeForKey(int index, double key, QCPRange &range);
103
104 std::vector<double> getValuesX(int index) const;
105 std::vector<double> getValuesY(int index) const;
106
107 QCPRange getValueRangeOnKeyRange(QCPAbstractPlottable *plottable_p, bool &ok);
108 QCPRange getValueRangeOnKeyRange(int index, bool &ok);
109
110 double getYatX(double x, QCPGraph *graph_p);
111 // index is 0 by default, which means that if there is a single graph, then,
112 // that will be it.
113 double getYatX(double x, int index = 0);
114
115 Trace toTrace(int index, bool only_visible_range = false) const;
116 Trace toTrace(const QCPGraph *graph_p, bool only_visible_range = false) const;
117 Trace toTrace(const QCPRange &x_axis_range, int index) const;
118 Trace toTrace(const QCPRange &x_axis_range, const QCPGraph *graph_p) const;
119 Trace toTrace(const QCPRange &x_axis_range, const QCPBars *bars_p) const;
120 Trace toTrace(const QCPRange &x_axis_range, const QCPAbstractPlottable *plottable_p) const;
121 Trace toTrace(const QCPAbstractPlottable *plottable_p) const;
122};
123
124
125} // namespace pappso
BasePlotWidget(QWidget *parent)
A simple container of DataPoint instances.
Definition trace.h:152
#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< BaseTracePlotWidget > BaseTracePlotWidgetSPtr
std::shared_ptr< const BaseTracePlotWidget > BaseTracePlotWidgetCstSPtr