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

35 {
36 }

◆ DataPoint() [2/5]

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

Definition at line 39 of file datapoint.cpp.

39  : x(other.x), y(other.y)
40 {
41 }
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 44 of file datapoint.cpp.

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

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

◆ DataPoint() [4/5]

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

Definition at line 49 of file datapoint.cpp.

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

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

◆ DataPoint() [5/5]

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

Definition at line 55 of file datapoint.cpp.

56 {
57  initialize(text);
58 }
void initialize(pappso_double x, pappso_double y)
Definition: datapoint.cpp:77

References initialize().

Member Function Documentation

◆ incrementX()

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

Definition at line 181 of file datapoint.cpp.

182 {
183  x += value;
184 }

References x.

◆ incrementY()

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

Definition at line 188 of file datapoint.cpp.

189 {
190  y += value;
191 }

References y.

◆ initialize() [1/3]

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

Definition at line 85 of file datapoint.cpp.

86 {
87  x = other.x;
88  y = other.y;
89 }

References x, and y.

◆ initialize() [2/3]

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

Definition at line 93 of file datapoint.cpp.

94 {
95  QRegularExpressionMatch regExpMatch;
96 
97  regExpMatch = Utils::xyMassDataFormatRegExp.match(text);
98 
99  if(!regExpMatch.hasMatch())
100  return false;
101 
102  bool ok = false;
103 
104  double key = regExpMatch.captured(1).toDouble(&ok);
105 
106  if(!ok)
107  return false;
108 
109  // Note that group 2 is the separator group.
110 
111  double val = regExpMatch.captured(3).toDouble(&ok);
112 
113  if(!ok)
114  return false;
115 
116  x = key;
117  y = val;
118 
119  return true;
120 }
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 77 of file datapoint.cpp.

78 {
79  this->x = x;
80  this->y = y;
81 }

References x, and y.

Referenced by DataPoint().

◆ isValid()

bool pappso::DataPoint::isValid ( ) const

Definition at line 132 of file datapoint.cpp.

133 {
134  return (x >= 0);
135 }

References x.

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

◆ makeDataPointCstSPtr()

DataPointCstSPtr pappso::DataPoint::makeDataPointCstSPtr ( ) const

Definition at line 70 of file datapoint.cpp.

71 {
72  return std::make_shared<const DataPoint>(*this);
73 }

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

◆ operator=()

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

Definition at line 201 of file datapoint.cpp.

202 {
203  x = other.x;
204  y = other.y;
205 
206  return *this;
207 }

References x, and y.

◆ operator==()

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

Definition at line 194 of file datapoint.cpp.

195 {
196  return ((x == other.x) && (y == other.y));
197 }

References x, and y.

◆ reset()

void pappso::DataPoint::reset ( )

Definition at line 124 of file datapoint.cpp.

125 {
126  x = -1;
127  y = 0;
128 }

References x, and y.

◆ toString() [1/2]

QString pappso::DataPoint::toString ( ) const

Definition at line 139 of file datapoint.cpp.

140 {
141  return QString("(%1,%2)").arg(x, 0, 'f', 15).arg(y, 0, 'f', 15);
142 }

References x, and y.

◆ toString() [2/2]

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

Definition at line 146 of file datapoint.cpp.

147 {
148  return QString("(%1,%2)").arg(x, 0, 'f', decimals).arg(y, 0, 'f', decimals);
149 }

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: