14 #include "../exception/exceptionnotpossible.h"
16 #include "../processing/combiners/tracepluscombiner.h"
17 #include "../processing/combiners/traceminuscombiner.h"
22 qRegisterMetaType<pappso::MapTrace>(
"pappso::MapTrace");
24 qRegisterMetaType<pappso::MapTrace *>(
"pappso::MapTrace *");
36 const std::vector<std::pair<pappso_double, pappso_double>> &dataPoints)
38 for(
auto &dataPoint : dataPoints)
47 for(
auto &dataPoint : dataPoints)
49 insert(std::pair<pappso_double, pappso_double>(dataPoint.x, dataPoint.y));
64 for(
auto &dataPoint : trace)
72 insert(std::pair<pappso_double, pappso_double>(dataPoint.x, dataPoint.y));
89 const std::vector<pappso_double> &yVector)
97 if(xVector.size() != yVector.size())
99 QObject::tr(
"Fatal error at msrundatasettreenode.cpp "
100 "-- ERROR xVector and yVector must have the same size."
101 "Program aborted."));
103 for(std::size_t iter = 0; iter < xVector.size(); ++iter)
105 insert(std::pair<pappso_double, pappso_double>(xVector.at(iter),
122 for(
auto &&pair : map)
143 for(
auto &pair : other)
155 return std::make_shared<MapTrace>(*
this);
162 return std::make_shared<const MapTrace>(*
this);
166 std::vector<pappso_double>
169 std::vector<pappso_double> vector;
171 for(
auto &&pair : *
this)
172 vector.push_back(pair.first);
178 std::vector<pappso_double>
181 std::vector<pappso_double> vector;
183 for(
auto &&pair : *
this)
184 vector.push_back(pair.second);
196 std::pair<std::map<double, double>::iterator,
bool>
res =
197 insert(std::pair<double, double>(data_point.
x, data_point.
y));
204 res.first->second += data_point.
y;
222 for(
auto &&pair : *
this)
223 trace.push_back(
DataPoint(pair.first, pair.second));
235 for(
auto &&pair : *
this)
240 QString new_data_point_text = QString(
"%1 %2\n")
241 .arg(pair.first, 0,
'f', 10)
242 .arg(pair.second, 0,
'f', 10);
244 qDebug() <<
"new data point text:" << new_data_point_text;
245 text.append(new_data_point_text);
248 text.append(QString(
"%1 %2\n")
249 .arg(pair.first, 0,
'f', 10)
250 .arg(pair.second, 0,
'f', 10));
MapTraceSPtr makeMapTraceSPtr() const
virtual MapTrace & operator=(const MapTrace &other)
std::vector< pappso_double > xValues()
MapTraceCstSPtr makeMapTraceCstSPtr() const
size_t initialize(const std::vector< pappso_double > &xVector, const std::vector< pappso_double > &yVector)
void insertOrUpdate(const DataPoint &data_point)
std::vector< pappso_double > yValues()
A simple container of DataPoint instances.
int mapTracePtrMetaTypeId
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< MapTrace > MapTraceSPtr
double pappso_double
A type definition for doubles.
std::shared_ptr< const MapTrace > MapTraceCstSPtr