Loading...
Searching...
No Matches
integrationscope.cpp
Go to the documentation of this file.
// Copyright 2021 Filippo Rusconi
// GPLv3+
/////////////////////// StdLib includes
#include <limits>
#include <cmath>
/////////////////////// Qt includes
#include <QDebug>
/////////////////////// Local includes
#include "integrationscope.h"
namespace pappso
{
IntegrationScope::IntegrationScope() : IntegrationScopeBase()
{
// qDebug() << "Constructing" << this;
}
IntegrationScope::IntegrationScope(const QPointF &point, double width)
: IntegrationScopeBase(), m_point(point), m_width(width)
{
// qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
}
IntegrationScope::IntegrationScope(const QPointF &point,
double width,
DataKind data_kind)
: IntegrationScopeBase(),
m_point(point),
m_width(width),
m_dataKindX(data_kind)
{
// qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
}
IntegrationScope::IntegrationScope(const IntegrationScope &other)
: IntegrationScopeBase(),
m_point(other.m_point),
m_width(other.m_width),
m_dataKindX(other.m_dataKindX)
{
// qDebug() << "Constructing" << this << "point:" << point << "width:" << width;
}
IntegrationScope::~IntegrationScope()
{
// qDebug() << "Destructing" << this;
}
IntegrationScope &
IntegrationScope::operator=(const IntegrationScope &other)
{
if(this == &other)
return *this;
m_point = other.m_point;
m_width = other.m_width;
return *this;
}
void
IntegrationScope::setPoint(const QPointF &point)
{
m_point = point;
}
bool
IntegrationScope::getPoint(QPointF &point) const
{
point = m_point;
return true;
}
IntegrationScopeFeatures
IntegrationScope::getLeftMostPoint(QPointF &point) const
{
point = m_point;
return IntegrationScopeFeatures::SUCCESS;
}
IntegrationScopeFeatures
IntegrationScope::getRightMostPoint(QPointF &point) const
{
point = QPointF(m_point.x() + m_width, m_point.y());
return IntegrationScopeFeatures::SUCCESS;
}
IntegrationScopeFeatures
IntegrationScope::getTopMostPoint(QPointF &point) const
{
point = m_point;
return IntegrationScopeFeatures::SUCCESS;
}
IntegrationScopeFeatures
IntegrationScope::getBottomMostPoint(QPointF &point) const
{
point = m_point;
return IntegrationScopeFeatures::SUCCESS;
}
void
IntegrationScope::setWidth(double width)
{
m_width = width;
}
IntegrationScopeFeatures
IntegrationScope::getWidth(double &width) const
{
width = m_width;
return IntegrationScopeFeatures::SUCCESS;
}
bool
IntegrationScope::range(Axis axis, double &start, double &end) const
{
if(axis == Axis::x)
{
start = m_point.x();
end = start + m_width;
return true;
}
return false;
}
void
IntegrationScope::setDataKindX([[maybe_unused]] DataKind data_kind)
{
m_dataKindX = data_kind;
}
bool
IntegrationScope::getDataKindX([[maybe_unused]] DataKind &data_kind)
{
data_kind = m_dataKindX;
return true;
}
bool
IntegrationScope::is1D() const
{
return true;
}
bool
IntegrationScope::is2D() const
{
return !is1D();
}
bool
IntegrationScope::isRectangle() const
{
return false;
}
bool
IntegrationScope::isRhomboid() const
{
return false;
}
bool
IntegrationScope::transpose()
{
return false;
}
void
IntegrationScope::update(const QPointF &point, double width)
{
m_point = point;
m_width = width;
}
bool
IntegrationScope::contains(const QPointF &point) const
{
return (point.x() >= m_point.x() && point.x() <= m_point.x() + m_width);
}
QString
IntegrationScope::toString() const
{
return QString("(%1, %2)")
.arg(m_point.x(), 0, 'f', 3)
.arg(m_point.x() + m_width, 0, 'f', 3);
}
void
IntegrationScope::reset()
{
m_point.rx() = 0;
m_point.ry() = 0;
m_width = 0;
}
} // namespace pappso
pappso::IntegrationScopeBase
Definition integrationscopebase.h:61
pappso::IntegrationScope
Definition integrationscope.h:38
pappso::IntegrationScope::getPoint
virtual bool getPoint(QPointF &point) const override
Definition integrationscope.cpp:77
pappso::IntegrationScope::IntegrationScope
IntegrationScope()
Definition integrationscope.cpp:21
pappso::IntegrationScope::getRightMostPoint
virtual IntegrationScopeFeatures getRightMostPoint(QPointF &point) const override
Definition integrationscope.cpp:91
pappso::IntegrationScope::getTopMostPoint
virtual IntegrationScopeFeatures getTopMostPoint(QPointF &point) const override
Definition integrationscope.cpp:98
pappso::IntegrationScope::getDataKindX
virtual bool getDataKindX(DataKind &data_kind) override
Definition integrationscope.cpp:145
pappso::IntegrationScope::contains
virtual bool contains(const QPointF &point) const override
Definition integrationscope.cpp:189
pappso::IntegrationScope::~IntegrationScope
virtual ~IntegrationScope()
Definition integrationscope.cpp:52
pappso::IntegrationScope::m_dataKindX
DataKind m_dataKindX
Definition integrationscope.h:85
pappso::IntegrationScope::m_width
double m_width
Definition integrationscope.h:84
pappso::IntegrationScope::toString
virtual QString toString() const override
Definition integrationscope.cpp:195
pappso::IntegrationScope::is1D
bool is1D() const override
Definition integrationscope.cpp:152
pappso::IntegrationScope::getBottomMostPoint
virtual IntegrationScopeFeatures getBottomMostPoint(QPointF &point) const override
Definition integrationscope.cpp:105
pappso::IntegrationScope::isRhomboid
virtual bool isRhomboid() const override
Definition integrationscope.cpp:170
pappso::IntegrationScope::is2D
bool is2D() const override
Definition integrationscope.cpp:158
pappso::IntegrationScope::setWidth
virtual void setWidth(double width)
Definition integrationscope.cpp:112
pappso::IntegrationScope::update
virtual void update(const QPointF &point, double width)
Definition integrationscope.cpp:182
pappso::IntegrationScope::getWidth
virtual IntegrationScopeFeatures getWidth(double &width) const override
Definition integrationscope.cpp:118
pappso::IntegrationScope::transpose
virtual bool transpose() override
Definition integrationscope.cpp:176
pappso::IntegrationScope::m_point
QPointF m_point
Definition integrationscope.h:83
pappso::IntegrationScope::range
virtual bool range(Axis axis, double &start, double &end) const override
Definition integrationscope.cpp:125
pappso::IntegrationScope::setDataKindX
virtual void setDataKindX(DataKind data_kind) override
Definition integrationscope.cpp:139
pappso::IntegrationScope::operator=
virtual IntegrationScope & operator=(const IntegrationScope &other)
Definition integrationscope.cpp:58
pappso::IntegrationScope::setPoint
virtual void setPoint(const QPointF &point)
Definition integrationscope.cpp:71
pappso::IntegrationScope::getLeftMostPoint
virtual IntegrationScopeFeatures getLeftMostPoint(QPointF &point) const override
Definition integrationscope.cpp:84
pappso::IntegrationScope::isRectangle
virtual bool isRectangle() const override
Definition integrationscope.cpp:164
pappso::IntegrationScope::reset
virtual void reset() override
Definition integrationscope.cpp:203
integrationscope.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::Axis
Axis
Definition types.h:227
pappso::Axis::x
@ x
pappso::IntegrationScopeFeatures
IntegrationScopeFeatures
Definition integrationscopebase.h:46
pappso::SUCCESS
@ SUCCESS
Definition integrationscopebase.h:50
pappso::DataKind
DataKind
Definition types.h:218