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{
23 // qDebug() << "Constructing" << this;
24}
25
26IntegrationScope::IntegrationScope(const QPointF &point, double width)
27 : m_point(point), m_width(width)
28{
29 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
30}
31
32IntegrationScope::IntegrationScope(const QPointF &point, double width, Enums::DataKind data_kind)
33 : m_point(point), m_width(width), m_dataKindX(data_kind)
34{
35 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
36}
37
39 : IntegrationScopeBase(other),
40 m_point(other.m_point),
41 m_width(other.m_width),
43{
44 // qDebug() << "Constructing" << this << "point:" << m_point << "width:" << m_width
45 // << "datakindx:" << m_dataKindX;
46}
47
49{
50 // qDebug() << "Destructing" << this;
51}
52
55{
56 IntegrationScope *new_p = new IntegrationScope(*this);
57
58 // if(dynamic_cast<const IntegrationScope *>(new_p) != nullptr)
59 // qDebug() << "Copy scope is IntegrationScope.";
60
61 return new_p;
62}
63
66{
67
68 if(this == &other)
69 return *this;
70
72
73 m_point = other.m_point;
74 m_width = other.m_width;
75
76 return *this;
77}
78
79void
81{
82 m_point = point;
83}
84
85bool
87{
88 point = m_point;
89 return true;
90}
91
98
101{
102 point = QPointF(m_point.x() + m_width, m_point.y());
104}
105
112
119
120void
122{
123 m_width = width;
124}
125
127IntegrationScope::getWidth(double &width) const
128{
129 width = m_width;
131}
132
133bool
134IntegrationScope::range(Enums::Axis axis, double &start, double &end) const
135{
136 if(axis == Enums::Axis::x)
137 {
138 start = m_point.x();
139 end = start + m_width;
140
141 return true;
142 }
143
144 return false;
145}
146
147void
149{
150 m_dataKindX = data_kind;
151}
152
153bool
155{
156 data_kind = m_dataKindX;
157 return true;
158}
159
160bool
162{
163 return true;
164}
165
166bool
168{
169 return !is1D();
170}
171
172bool
174{
175 return false;
176}
177
178bool
180{
181 return false;
182}
183
184bool
186{
187 return false;
188}
189
190void
191IntegrationScope::update(const QPointF &point, double width)
192{
193 m_point = point;
194 m_width = width;
195}
196
197bool
199{
200 return (point.x() >= m_point.x() && point.x() <= m_point.x() + m_width);
201}
202
203QString
205{
206 return QString("(%1, %2)").arg(m_point.x(), 0, 'f', 3).arg(m_point.x() + m_width, 0, 'f', 3);
207}
208
209void
211{
212 m_point.rx() = 0;
213 m_point.ry() = 0;
214
215 m_width = 0;
216}
217
218} // namespace pappso
virtual IntegrationScopeBase & operator=(const IntegrationScopeBase &other)
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 IntegrationScope * clone() const
virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override
virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override
WRITE setPoint() NOTIFY pointChanged() FINAL) Q_PROPERTY(double width READ getWidth() WRITE setWidth() NOTIFY widthChanged() FINAL) public IntegrationScope(const QPointF &point, double width)
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)
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