libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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

◆ 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}

◆ 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}

◆ 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 185 of file datapoint.cpp.

186{
187 x += value;
188}

References x.

◆ incrementY()

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

Definition at line 192 of file datapoint.cpp.

193{
194 y += value;
195}

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

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 136 of file datapoint.cpp.

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

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 205 of file datapoint.cpp.

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

References x, and y.

◆ operator==()

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

Definition at line 198 of file datapoint.cpp.

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

References x, and y.

◆ reset()

void pappso::DataPoint::reset ( )

Definition at line 128 of file datapoint.cpp.

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

References x, and y.

◆ toString() [1/2]

QString pappso::DataPoint::toString ( ) const

Definition at line 143 of file datapoint.cpp.

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

References x, and y.

◆ toString() [2/2]

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

Definition at line 150 of file datapoint.cpp.

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

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::TimsFrame::combineScansToTraceWithDowngradedMzResolution(), pappso::TimsFrame::combineScansToTraceWithDowngradedMzResolution2(), pappso::TracePeak::containsRt(), pappso::Trace::containsX(), pappso::TimsFrame::cumulateScansToTrace(), pappso::Trace::dataPointCstIteratorWithX(), pappso::Trace::dataPointIteratorWithX(), pappso::QCPXic::drawXicPeakBorders(), pappso::MsRunXicExtractor::extractOneXicCoord(), pappso::MsRunXicExtractorDisk::extractOneXicCoord(), pappso::specself::SelfSpectrumDataPoint::fillAntiSpectrumDataPoint(), pappso::specself::SelfSpectrumDataPoint::fillSelfSpectrumDataPoint(), pappso::FilterTandemDeisotope::filter(), pappso::findFirstEqualOrGreaterX(), pappso::findFirstEqualOrGreaterX(), pappso::findFirstGreaterX(), pappso::findFirstGreaterX(), pappso::TimsFrameBase::getIonMobilityTraceByTofIndexRange(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::QCPSpectrum::getNearestPeakBetween(), pappso::TimsFrame::getRawTraceSPtr(), pappso::TimsFrameType1::getRawTraceSPtr(), pappso::TimsFrameBase::getTraceFromTofIndexIntensityMap(), incrementX(), initialize(), initialize(), initialize(), pappso::MapTrace::insertOrUpdate(), isValid(), pappso::MsRunRetentionTime< T >::linearRegressionMs2toMs1(), pappso::Trace::maxX(), pappso::Trace::minX(), pappso::operator<<(), operator=(), operator==(), pappso::operator>>(), pappso::MassSpectrumWidget::peakChangeEvent(), reset(), pappso::FilterTriangle::sumAndRemove(), toString(), and toString().

◆ y


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