Loading...
Searching...
No Matches
massspectraceplotcontext.cpp
Go to the documentation of this file.
// Copyright 2021 Filippo Rusconi
// GPLv3+
/////////////////////// StdLib includes
/////////////////////// Qt includes
#include <QString>
/////////////////////// Local includes
#include "massspectraceplotcontext.h"
namespace pappso
{
MassSpecTracePlotContext::MassSpecTracePlotContext(QObject *parent) : BasePlotContext(parent)
{
}
MassSpecTracePlotContext::~MassSpecTracePlotContext()
{
}
MassSpecTracePlotContext *
MassSpecTracePlotContext::clone(QObject *parent)
{
MassSpecTracePlotContext *copy_p = new MassSpecTracePlotContext(parent);
copy_p->initialize(*const_cast<const MassSpecTracePlotContext *>(this));
copy_p->m_lastZ = m_lastZ;
copy_p->m_lastMz = m_lastMz;
copy_p->m_lastTicIntensity = m_lastTicIntensity;
copy_p->m_lastMr = m_lastMr;
copy_p->m_lastResolvingPower = m_lastResolvingPower;
return copy_p;
}
void
MassSpecTracePlotContext::initialize(const BasePlotContext &other)
{
BasePlotContext::initialize(other);
}
void
MassSpecTracePlotContext::initialize(const MassSpecTracePlotContext &other)
{
BasePlotContext::initialize(other);
m_lastZ = other.m_lastZ;
m_lastMz = other.m_lastMz;
m_lastTicIntensity = other.m_lastTicIntensity;
m_lastMr = other.m_lastMr;
m_lastResolvingPower = other.m_lastResolvingPower;
}
void
MassSpecTracePlotContext::resetDeconvolutionData()
{
m_lastZ = std::numeric_limits<quint16>::max();
m_lastMz = qQNaN();
m_lastMr = qQNaN();
}
QString
MassSpecTracePlotContext::toString() const
{
QString text("Base context:\n");
text += BasePlotContext::toString();
text += "\n";
text += "Mass spectrum trace plot context\n";
text += QString("last z: %1").arg(m_lastZ);
text += QString(" -- last m/z: %1").arg(m_lastMz, 0, 'f', 6);
text += QString(" -- last TIC intensity: %1").arg(m_lastTicIntensity, 0, 'f', 0);
text += QString(" -- last Mr: %1").arg(m_lastMr, 0, 'f', 6);
text += QString(" -- last resolving power: %1").arg(m_lastResolvingPower, 0, 'f', 0);
text += "\n";
return text;
}
void
MassSpecTracePlotContext::registerJsConstructor(QJSEngine *engine)
{
if(!engine)
{
qWarning() << "Cannot register class: engine is null";
return;
}
// Register the meta object as a constructor
QJSValue jsMetaObject = engine->newQMetaObject(&MassSpecTracePlotContext::staticMetaObject);
engine->globalObject().setProperty("MassSpecTracePlotContext", jsMetaObject);
}
} // namespace pappso
pappso::BasePlotContext::BasePlotContext
Q_INVOKABLE BasePlotContext(QObject *parent=nullptr)
Definition baseplotcontext.cpp:38
pappso::BasePlotContext::initialize
Q_INVOKABLE void initialize(const BasePlotContext &other)
Definition baseplotcontext.cpp:190
pappso::BasePlotContext::toString
Q_INVOKABLE QString toString() const
Definition baseplotcontext.cpp:882
pappso::MassSpecTracePlotContext
Definition massspectraceplotcontext.h:33
pappso::MassSpecTracePlotContext::m_lastMz
double m_lastMz
Definition massspectraceplotcontext.h:57
pappso::MassSpecTracePlotContext::m_lastZ
quint16 m_lastZ
Definition massspectraceplotcontext.h:56
pappso::MassSpecTracePlotContext::m_lastResolvingPower
double m_lastResolvingPower
Definition massspectraceplotcontext.h:60
pappso::MassSpecTracePlotContext::clone
Q_INVOKABLE MassSpecTracePlotContext * clone(QObject *parent=nullptr)
Definition massspectraceplotcontext.cpp:27
pappso::MassSpecTracePlotContext::toString
Q_INVOKABLE QString toString() const
Definition massspectraceplotcontext.cpp:70
pappso::MassSpecTracePlotContext::initialize
Q_INVOKABLE void initialize(const BasePlotContext &other)
Definition massspectraceplotcontext.cpp:43
pappso::MassSpecTracePlotContext::~MassSpecTracePlotContext
virtual ~MassSpecTracePlotContext()
Definition massspectraceplotcontext.cpp:22
pappso::MassSpecTracePlotContext::MassSpecTracePlotContext
Q_INVOKABLE MassSpecTracePlotContext(QObject *parent=nullptr)
Definition massspectraceplotcontext.cpp:18
pappso::MassSpecTracePlotContext::resetDeconvolutionData
void resetDeconvolutionData()
Definition massspectraceplotcontext.cpp:62
pappso::MassSpecTracePlotContext::m_lastMr
double m_lastMr
Definition massspectraceplotcontext.h:59
pappso::MassSpecTracePlotContext::registerJsConstructor
static void registerJsConstructor(QJSEngine *engine)
Definition massspectraceplotcontext.cpp:92
pappso::MassSpecTracePlotContext::m_lastTicIntensity
double m_lastTicIntensity
Definition massspectraceplotcontext.h:58
massspectraceplotcontext.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39