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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
#ifndef SPECTRUM_H
#define SPECTRUM_H
/***************************************************************************
* Copyright (C) 2005 by Carsten Niehaus *
* cniehaus@kde.org *
*
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <tqstring.h>
#include <tqvaluelist.h>
class TQPixmap;
class Element;
/**
* @author Carsten Niehaus
*
* This class represents an spectrum with all its properties
*/
class Spectrum
{
public:
/**
* This spectrum doesn't belong to any element
*/
Spectrum(){}
/**
* public destructor
*/
~Spectrum(){}
/**
* a band is one line in the spectrum of an element
*/
struct band
{
///in nm)
double wavelength;
///Transition Probabilities
///10^8s-1 (1000000000 per second)
double aki;
///number of energylevels per centimeter
double energy1;
///number of energylevels per centimeter
double energy2;
///relative. The highest is per definition 1000
int intensity;
TQString electronconfig1;
TQString electronconfig2;
TQString term1;
TQString term2;
TQString J1;
TQString J2;
};
/**
* adds the band @p b to the internal
* lists of bands
*/
void addBand( band b ){
m_bandlist.append( b );
}
/**
* @param min the lowest allowed wavalength in nanometer
* @param max the highest allowed wavalength in nanometer
*
* @returns a spectrum with the wavelength in the range
* of @p min to @p max. The intensities are readjusted
* so that the biggest intensity is again 1000 and the
* others are adopted.
*/
Spectrum* adjustToWavelength( double min, double max );
/**
* sets the highest intensity to 1000 and adjusts the
* others
*/
void adjustIntensities();
/**
* @param min the lowest allowed wavalength in nanometer
* @param max the highest allowed wavalength in nanometer
*
* @return the wavelength in a TQValueList<double>
*/
TQValueList<double> wavelengths( double min, double max );
/**
* @return the smallest wavelength
*/
double min() const{
return m_min;
}
/**
* @return the highest wavelength
*/
double max() const{
return m_max;
}
/**
* @return the list of bands of the spectrum
*/
TQValueList<band>* bandlist(){
return &m_bandlist;
}
/**
* cache the values of the biggest and
* smallest wavelenght
*/
void adjustMinMax(){
m_min = minBand();
m_max = maxBand();
}
/**
* @return the data of a spectrum as HTML code
*/
TQString bandsAsHtml();
/**
* @return the parent element of this spectrum
*/
Element* parentElement()
{ return m_parentElement; }
private:
/**
* @return the smallest wavelength
*/
double minBand();
/**
* @return the biggest wavelength
*/
double maxBand();
/**
* the internal dataset
*/
TQValueList<band> m_bandlist;
/**
* the cached values of the highest and lowest wavelength
*/
double m_max, m_min;
Element* m_parentElement;
};
#endif // SPECTRUM_H
|