libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
integrationscope.cpp
Go to the documentation of this file.
1// Copyright 2021 Filippo Rusconi
2// GPLv3+
3
4
5/////////////////////// StdLib includes
6#include <limits>
7#include <cmath>
8
9
10/////////////////////// Qt includes
11#include <QDebug>
12
13
14/////////////////////// Local includes
15#include "integrationscope.h"
16
17
18namespace pappso
19{
20
22 : IntegrationScopeBase(parent_p)
23{
24 // qDebug() << "Constructing" << this;
25}
26
27IntegrationScope::IntegrationScope(const QPointF &point, double width, QObject *parent_p)
28 : IntegrationScopeBase(parent_p)
29 , m_point(point)
30 , m_width(width)
31{
32 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
33}
34
36 double width,
37 Enums::DataKind data_kind,
38 QObject *parent_p)
39 : IntegrationScopeBase(parent_p)
40 , m_point(point)
41 , m_width(width)
42 , m_dataKindX(data_kind)
43{
44 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
45}
46
48 : IntegrationScopeBase(parent_p)
49 , m_point(other.m_point)
50 , m_width(other.m_width)
52{
53 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
54}
55
57{
58 // qDebug() << "Destructing" << this;
59}
60
63{
64
65 if(this == &other)
66 return *this;
67
68 m_point = other.m_point;
69 m_width = other.m_width;
70
71 return *this;
72}
73
74void
76{
77 m_point = point;
78}
79
80bool
82{
83 point = m_point;
84 return true;
85}
86
93
96{
97 point = QPointF(m_point.x() + m_width, m_point.y());
99}
100
107
114
115void
117{
118 m_width = width;
119}
120
122IntegrationScope::getWidth(double &width) const
123{
124 width = m_width;
126}
127
128bool
129IntegrationScope::range(Enums::Axis axis, double &start, double &end) const
130{
131 if(axis == Enums::Axis::x)
132 {
133 start = m_point.x();
134 end = start + m_width;
135
136 return true;
137 }
138
139 return false;
140}
141
142void
144{
145 m_dataKindX = data_kind;
146}
147
148bool
150{
151 data_kind = m_dataKindX;
152 return true;
153}
154
155bool
157{
158 return true;
159}
160
161bool
163{
164 return !is1D();
165}
166
167bool
169{
170 return false;
171}
172
173bool
175{
176 return false;
177}
178
179bool
181{
182 return false;
183}
184
185void
186IntegrationScope::update(const QPointF &point, double width)
187{
188 m_point = point;
189 m_width = width;
190}
191
192bool
194{
195 return (point.x() >= m_point.x() && point.x() <= m_point.x() + m_width);
196}
197
198QString
200{
201 return QString("(%1, %2)").arg(m_point.x(), 0, 'f', 3).arg(m_point.x() + m_width, 0, 'f', 3);
202}
203
204void
206{
207 m_point.rx() = 0;
208 m_point.ry() = 0;
209
210 m_width = 0;
211}
212
213} // namespace pappso
IntegrationScopeBase(QObject *parent_p=nullptr)
virtual bool range(Enums::Axis axis, double &start, double &end) const override
virtual void setDataKindX(Enums::DataKind data_kind) override
virtual bool getPoint(QPointF &point) const override
virtual bool getDataKindX(Enums::DataKind &data_kind) override
virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override
virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override
virtual bool contains(const QPointF &point) const override
virtual QString toString() const override
bool is1D() const override
virtual IntegrationScopeFeatures getBottomMostPoint(QPointF &point) const override
virtual bool isRhomboid() const override
bool is2D() const override
virtual void setWidth(double width)
virtual void update(const QPointF &point, double width)
virtual IntegrationScopeFeatures getWidth(double &width) const override
virtual bool transpose() override
virtual IntegrationScope & operator=(const IntegrationScope &other)
virtual void setPoint(const QPointF &point)
WRITE setPoint() NOTIFY pointChanged() FINAL) Q_PROPERTY(double width READ getWidth() WRITE setWidth() NOTIFY widthChanged() FINAL) public IntegrationScope(const QPointF &point, double width, QObject *parent_p=nullptr)
virtual IntegrationScopeFeatures getLeftMostPoint(QPointF &point) const override
virtual bool isRectangle() const override
virtual void reset() override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39