15 #include "../exception/exceptionnotpossible.h"
17 #include "../processing/combiners/tracepluscombiner.h"
18 #include "../processing/combiners/traceminuscombiner.h"
23 qRegisterMetaType<pappso::MapTrace>(
"pappso::MapTrace");
25 qRegisterMetaType<pappso::MapTrace *>(
"pappso::MapTrace *");
37 const std::vector<std::pair<pappso_double, pappso_double>> &dataPoints)
39 for(
auto &dataPoint : dataPoints)
48 for(
auto &dataPoint : dataPoints)
50 insert(std::pair<pappso_double, pappso_double>(dataPoint.x, dataPoint.y));
65 for(
auto &dataPoint : trace)
73 insert(std::pair<pappso_double, pappso_double>(dataPoint.x, dataPoint.y));
90 const std::vector<pappso_double> &yVector)
98 if(xVector.size() != yVector.size())
100 QObject::tr(
"Fatal error at msrundatasettreenode.cpp "
101 "-- ERROR xVector and yVector must have the same size."
102 "Program aborted."));
104 for(std::size_t iter = 0; iter < xVector.size(); ++iter)
106 insert(std::pair<pappso_double, pappso_double>(xVector.at(iter),
123 for(
auto &&pair : map)
144 for(
auto &pair : other)
156 return std::make_shared<MapTrace>(*
this);
163 return std::make_shared<const MapTrace>(*
this);
167 std::vector<pappso_double>
170 std::vector<pappso_double> vector;
172 for(
auto &&pair : *
this)
173 vector.push_back(pair.first);
179 std::vector<pappso_double>
182 std::vector<pappso_double> vector;
184 for(
auto &&pair : *
this)
185 vector.push_back(pair.second);
197 std::pair<std::map<double, double>::iterator,
bool>
res =
198 insert(std::pair<double, double>(data_point.
x, data_point.
y));
205 res.first->second += data_point.
y;
223 for(
auto &&pair : *
this)
224 trace.push_back(
DataPoint(pair.first, pair.second));
236 for(
auto &&pair : *
this)
241 QString new_data_point_text = QString(
"%1 %2\n")
242 .arg(pair.first, 0,
'f', 10)
243 .arg(pair.second, 0,
'f', 10);
245 qDebug() <<
"new data point text:" << new_data_point_text;
246 text.append(new_data_point_text);
249 text.append(QString(
"%1 %2\n")
250 .arg(pair.first, 0,
'f', 10)
251 .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