-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer.cpp
58 lines (52 loc) · 1.5 KB
/
container.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "container.h"
QMap<QString, QList<Spectrum>> Container::specta;
QMap<QString, QList<Spectrum>> Container::getSpecta()
{
return specta;
}
QString Container::createMottShottky(const QString & fileStr)
{
QString lines = {};
QList<Spectrum> specList = specta[fileStr];
for(int i = 0; i < specList.count(); ++i)
{
lines += specList[i].getMottShottkyLine();
specList[i].getPoints().pop_front();
}
return lines;
}
Container::Container()
{
}
void Container::fillList(const QStringList & list, const QString & srcFile)
{
int specNum = 1;
Spectrum spec = {};
QList<Spectrum> localSpecList;
foreach(const QString & str, list)
{
QStringList rawList(str.split('\t'));
if(str == list.last())
{
spec << Point(std::move(rawList));
localSpecList.append(std::move(spec));
specta.insert(srcFile, std::move(localSpecList));
return;
}
if(rawList[0].toDouble() == 0.0000000E+000 || rawList[1].toDouble() == 0.0000000E+000 || rawList[2].toDouble() == 0.0000000E+000)
{
continue;
}
else if((int)std::stod(rawList[12].toStdString()) == specNum)
{
spec << Point(std::move(rawList));
}
else
{
localSpecList.append(std::move(spec));
spec.clear();
spec << Point(std::move(rawList));
++specNum;
}
}
}