libpappsomspp
Library for mass spectrometry
pappso::DataPoint Struct Reference

#include <datapoint.h>

Public Member Functions

 DataPoint ()
 
 DataPoint (const DataPoint &other)
 
 DataPoint (pappso_double x, pappso_double y)
 
 DataPoint (std::pair< pappso_double, pappso_double > pair)
 
 DataPoint (const QString &text)
 
DataPointCstSPtr makeDataPointCstSPtr () const
 
void initialize (pappso_double x, pappso_double y)
 
void initialize (const DataPoint &other)
 
bool initialize (const QString &text)
 
void reset ()
 
void incrementX (pappso_double value)
 
void incrementY (pappso_double value)
 
bool operator== (const DataPoint &other) const
 
DataPointoperator= (const DataPoint &other)
 
bool isValid () const
 
QString toString () const
 
QString toString (int decimals) const
 

Public Attributes

pappso_double x = -1
 
pappso_double y = 0
 

Detailed Description

Definition at line 21 of file datapoint.h.

Constructor & Destructor Documentation

◆ DataPoint() [1/5]

pappso::DataPoint::DataPoint ( )

Definition at line 35 of file datapoint.cpp.

36{
37}

◆ DataPoint() [2/5]

pappso::DataPoint::DataPoint ( const DataPoint other)

Definition at line 40 of file datapoint.cpp.

40 : x(other.x), y(other.y)
41{
42}
pappso_double x
Definition: datapoint.h:23
pappso_double y
Definition: datapoint.h:24

References pappso::x, and pappso::y.

◆ DataPoint() [3/5]

pappso::DataPoint::DataPoint ( pappso_double  x,
pappso_double  y 
)

Definition at line 45 of file datapoint.cpp.

45 : x(x), y(y)
46{
47}

References pappso::x, and pappso::y.

◆ DataPoint() [4/5]

pappso::DataPoint::DataPoint ( std::pair< pappso_double, pappso_double pair)

Definition at line 50 of file datapoint.cpp.

51 : x(pair.first), y(pair.second)
52{
53}

References pappso::x, and pappso::y.

◆ DataPoint() [5/5]

pappso::DataPoint::DataPoint ( const QString &  text)

Definition at line 56 of file datapoint.cpp.

57{
58 if(!initialize(text))
59 throw ExceptionNotPossible(
60 "Failed to initialize the DataPoint object using the provided string.");
61}
void initialize(pappso_double x, pappso_double y)
Definition: datapoint.cpp:80

References initialize().

Member Function Documentation

◆ incrementX()

void pappso::DataPoint::incrementX ( pappso_double  value)

Definition at line 184 of file datapoint.cpp.

185{
186 x += value;
187}

References x.

◆ incrementY()

void pappso::DataPoint::incrementY ( pappso_double  value)

Definition at line 191 of file datapoint.cpp.

192{
193 y += value;
194}

References y.

◆ initialize() [1/3]

void pappso::DataPoint::initialize ( const DataPoint other)

Definition at line 88 of file datapoint.cpp.

89{
90 x = other.x;
91 y = other.y;
92}

References x, and y.

◆ initialize() [2/3]

bool pappso::DataPoint::initialize ( const QString &  text)

Definition at line 96 of file datapoint.cpp.

97{
98 QRegularExpressionMatch regExpMatch;
99
100 regExpMatch = Utils::xyMassDataFormatRegExp.match(text);
101
102 if(!regExpMatch.hasMatch())
103 return false;
104
105 bool ok = false;
106
107 double key = regExpMatch.captured(1).toDouble(&ok);
108
109 if(!ok)
110 return false;
111
112 // Note that group 2 is the separator group.
113
114 double val = regExpMatch.captured(3).toDouble(&ok);
115
116 if(!ok)
117 return false;
118
119 x = key;
120 y = val;
121
122 return true;
123}
static QRegularExpression xyMassDataFormatRegExp
Definition: utils.h:53

References x, pappso::Utils::xyMassDataFormatRegExp, and y.

◆ initialize() [3/3]

void pappso::DataPoint::initialize ( pappso_double  x,
pappso_double  y 
)

Definition at line 80 of file datapoint.cpp.

81{
82 this->x = x;
83 this->y = y;
84}

References x, and y.

Referenced by DataPoint().

◆ isValid()

bool pappso::DataPoint::isValid ( ) const

Definition at line 135 of file datapoint.cpp.

136{
137 return (x >= 0);
138}

References x.

Referenced by pappso::MassSpectrumMinusCombiner::combine(), and pappso::MassSpectrumPlusCombiner::combine().

◆ makeDataPointCstSPtr()

DataPointCstSPtr pappso::DataPoint::makeDataPointCstSPtr ( ) const

Definition at line 73 of file datapoint.cpp.

74{
75 return std::make_shared<const DataPoint>(*this);
76}

Referenced by pappso::MassSpectrumWidget::peakChangeEvent().

◆ operator=()

DataPoint & pappso::DataPoint::operator= ( const DataPoint other)

Definition at line 204 of file datapoint.cpp.

205{
206 x = other.x;
207 y = other.y;
208
209 return *this;
210}

References x, and y.

◆ operator==()

bool pappso::DataPoint::operator== ( const DataPoint other) const

Definition at line 197 of file datapoint.cpp.

198{
199 return ((x == other.x) && (y == other.y));
200}

References x, and y.

◆ reset()

void pappso::DataPoint::reset ( )

Definition at line 127 of file datapoint.cpp.

128{
129 x = -1;
130 y = 0;
131}

References x, and y.

◆ toString() [1/2]

QString pappso::DataPoint::toString ( ) const

Definition at line 142 of file datapoint.cpp.

143{
144 return QString("(%1,%2)").arg(x, 0, 'f', 15).arg(y, 0, 'f', 15);
145}

References x, and y.

◆ toString() [2/2]

QString pappso::DataPoint::toString ( int  decimals) const

Definition at line 149 of file datapoint.cpp.

150{
151 return QString("(%1,%2)").arg(x, 0, 'f', decimals).arg(y, 0, 'f', decimals);
152}

References x, and y.

Member Data Documentation

◆ x

pappso_double pappso::DataPoint::x = -1

Definition at line 23 of file datapoint.h.

Referenced by pappso::TracePeak::TracePeak(), pappso::FilterChargeDeconvolution::addDataPointToList(), pappso::QCPSpectrum::addMassDelta(), pappso::QCPSpectrum::addPeakIonIsotopeMatch(), pappso::MsRunRetentionTime< T >::align(), pappso::MassSpectrumMinusCombiner::combine(), pappso::MassSpectrumPlusCombiner::combine(), pappso::TracePeak::containsRt(), pappso::Trace::containsX(), pappso::TimsFrame::cumulateScanToTrace(), pappso::Trace::dataPointCstIteratorWithX(), pappso::Trace::dataPointIteratorWithX(), pappso::QCPXic::drawXicPeakBorders(), pappso::MsRunXicExtractor::extractOneXicCoord(), pappso::MsRunXicExtractorDisk::extractOneXicCoord(), pappso::FilterTandemDeisotope::filter(), pappso::findFirstEqualOrGreaterX(), pappso::findFirstGreaterX(), pappso::TimsFrameBase::getIonMobilityTraceByMzIndexRange(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::QCPSpectrum::getNearestPeakBetween(), pappso::TimsFrame::getRawTraceSPtr(), pappso::TimsFrameType1::getRawTraceSPtr(), pappso::TimsFrameBase::getTraceFromCumulatedScans(), pappso::TimsFrameBase::getTraceFromCumulatedScansBuiltinCentroid(), incrementX(), initialize(), pappso::MapTrace::insertOrUpdate(), isValid(), pappso::MsRunRetentionTime< T >::linearRegressionMs2toMs1(), pappso::operator<<(), operator=(), operator==(), pappso::operator>>(), pappso::MassSpectrumWidget::peakChangeEvent(), reset(), pappso::FilterTriangle::sumAndRemove(), and toString().

◆ y


The documentation for this struct was generated from the following files: