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 : IntegrationScopeBase(), m_point(point), m_width(width)
28{
29 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
30}
31
33 double width,
34 DataKind data_kind)
36 m_point(point),
37 m_width(width),
38 m_dataKindX(data_kind)
39{
40 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
41}
42
45 m_point(other.m_point),
46 m_width(other.m_width),
47 m_dataKindX(other.m_dataKindX)
48{
49 // qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
50}
51
53{
54 // qDebug() << "Destructing" << this;
55}
56
59{
60
61 if(this == &other)
62 return *this;
63
64 m_point = other.m_point;
65 m_width = other.m_width;
66
67 return *this;
68}
69
70void
71IntegrationScope::setPoint(const QPointF &point)
72{
73 m_point = point;
75
76bool
77IntegrationScope::getPoint(QPointF &point) const
78{
79 point = m_point;
80 return true;
81}
82
85{
86 point = m_point;
88}
89
92{
93 point = QPointF(m_point.x() + m_width, m_point.y());
95}
96
99{
100 point = m_point;
102}
103
106{
107 point = m_point;
109}
110
111void
113{
114 m_width = width;
115}
116
118IntegrationScope::getWidth(double &width) const
119{
120 width = m_width;
122}
123
124bool
125IntegrationScope::range(Axis axis, double &start, double &end) const
126{
127 if(axis == Axis::x)
128 {
129 start = m_point.x();
130 end = start + m_width;
131
132 return true;
133 }
134
135 return false;
136}
137
138void
139IntegrationScope::setDataKindX([[maybe_unused]] DataKind data_kind)
140{
141 m_dataKindX = data_kind;
142}
143
144bool
145IntegrationScope::getDataKindX([[maybe_unused]] DataKind &data_kind)
146{
147 data_kind = m_dataKindX;
148 return true;
149}
150
151bool
153{
154 return true;
155}
156
157bool
159{
160 return !is1D();
161}
162
163bool
165{
166 return false;
167}
168
169bool
171{
172 return false;
173}
174
175bool
177{
178 return false;
179}
180
181void
182IntegrationScope::update(const QPointF &point, double width)
183{
184 m_point = point;
185 m_width = width;
186}
187
188bool
189IntegrationScope::contains(const QPointF &point) const
190{
191 return (point.x() >= m_point.x() && point.x() <= m_point.x() + m_width);
192}
193
194QString
196{
197 return QString("(%1, %2)")
198 .arg(m_point.x(), 0, 'f', 3)
199 .arg(m_point.x() + m_width, 0, 'f', 3);
200}
201
202void
204{
205 m_point.rx() = 0;
206 m_point.ry() = 0;
207
208 m_width = 0;
209}
210
211} // namespace pappso
virtual bool getPoint(QPointF &point) const override
virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override
virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override
virtual bool getDataKindX(DataKind &data_kind) 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 bool range(Axis axis, double &start, double &end) const override
virtual void setDataKindX(DataKind data_kind) 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
DataKind
Definition types.h:215