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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
|
/***************************************************************************
* Copyright (C) 2003, 2004, 2005 by Carsten Niehaus *
* [email protected] *
* *
* 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. *
***************************************************************************/
#ifndef ELEMENT_H
#define ELEMENT_H
#define ELEMENTSIZE 40
#include <tqcolor.h>
#include <tqvaluelist.h>
class Element;
class TQDomDocument;
class TQPainter;
class TQPoint;
class TQFont;
class TQRect;
class Spectrum;
class Isotope;
struct coordinate;
typedef TQValueList<Element*> EList;
typedef TQValueList<coordinate> CList;
typedef TQValueList<double> doubleList;
struct coordinate{
int x;
int y;
};
/**
* In this class all information about an element are stored. This means that
* both the chemical date and the data about the position are stored
* in this class.
* @short This class is the represention of a chemical element
* @author Carsten Niehaus
*/
class Element{
public:
Element();
virtual ~Element();
/**
* @returns a pointer to the istope with @p numberOfNucleons
* nucleons
*/
Isotope* isotopeByNucleons( int numberOfNucleons );
enum RADIUSTYPE
{
ATOMIC = 0,
IONIC,
VDW, //van der Waals radius
COVALENT
};
/**
* @return the number of the element
*/
int number() const {
return m_number;
}
/**
* @return if the Element is radioactive
*/
bool radioactive() const{
return m_radioactive;
}
/**
* @return if the Element is artificial
*/
bool artificial() const{
return m_artificial;
}
/**
* @return the information where the name of the Element comes from
*/
TQString nameOrigin() const{
return m_origin;
}
TQString orbits() const{
return m_orbits;
}
void setMass( double value ) { m_mass = value; }
void setEN( double value ) { m_EN = value; }
void setEA( double value ) { m_EA = value; }
void setMeltingpoint( double value ) { m_MP = value; }
void setBoilingpoint( double value ) { m_BP = value; }
/**
* sets the density of the Element
* @param value the density of the Element
*/
void setDensity( double value ) { m_Density = value; }
/**
* set the radius of the radiustype @p type to the value @p value.
* The ionicradius also has a name @p name. This will store the charge of
* the ion (for example, +2 or -3 )
*/
void setRadius( RADIUSTYPE type, double value, const TQString& name = 0 );
void setDate( int date ) { m_date = date; }
void setPeriod( int period ){ m_period = period; }
void setBiologicalMeaning( int value ) { m_biological = value; }
void setNumber( int num ){ m_number = num; }
/**
* set the abundance in crustal rocks [pm]
* @param abundance the abundace in crustal rocks
*/
void setAbundance( int abundance ){ m_abundance = abundance; }
void setScientist( const TQString& value ) { m_scientist = value; }
void setCrysatalstructure( const TQString& value ) { m_crystalstructure = value; }
void setName( const TQString& value ) { m_name = value; }
void setOrigin( const TQString& value ) { m_origin = value; }
void setBlock( const TQString& value ) { m_block = value; }
void setGroup( const TQString& value ) { m_group = value; }
void setFamily( const TQString& value ) { m_family = value; }
void setOrbits( const TQString& value ) { m_orbits = value; }
void setSymbol( const TQString& value ) { m_symbol = value; }
void setOxydation( const TQString& value ) { m_oxstage = value; }
void setAcidicbehaviour( const TQString& value ) { m_acidbeh = value; }
void setIsotopes( const TQString& value ) { m_isotopes = value; }
void setArtificial(){ m_artificial = true; }
void setRadioactive(){ m_radioactive = true; }
void setIonisationList( doubleList l ){ m_ionenergies = l; }
TQValueList<Isotope*> isotopes() const{
return m_isotopeList;
}
TQValueList<double> spectrumList() const{
return m_spectrumList;
}
void setIsotopeList( TQValueList<Isotope*> list ){
m_isotopeList = list;
}
/**
* sets the Spectrum of the Element
* @param spec the Spectrum of the Element
*/
void setSpectrum( Spectrum *spec ){
m_spectrum = spec;
}
/**
* @return if the element has information about spectra
*/
bool hasSpectrum() const{
return m_hasSpectrum;
}
/**
* define if the element has a known Spectrum
* @param value if true, the Element has a Spectrum
*/
void setHasSepctrum(bool value){
m_hasSpectrum = value;
}
/**
* @return the Spectrum of the element
*/
Spectrum* spectrum() const{
return m_spectrum;
}
doubleList ionisationList() const{
return m_ionenergies;
}
/**
* @return the date of discovery of the element
*/
int date() const {
return m_date;
}
/**
* return the correct color of the element at the
* temperature @p temp
*/
TQColor currentColor( const double temp );
/**
* mutator for the element's color
*/
void setElementColor( const TQColor &c ) { m_Color = c; }
/**
* @return the importance of the element for biological
* systems.
* @li 0: blah
* @li 1: blub
* @li 2: blub
* @li 3: blub
* @li 4: blub
* @li 5: blub
* @li 6: blub
*/
int biological() const {
return m_biological;
}
/**
* @return the abundance in crustal rocks in parts per million
*/
int abundance() const {
return m_abundance;
}
/**
* @return the symbol of the element
*/
TQString symbol() const {
return m_symbol;
}
/**
* @return the scientist who discovered the element
*/
TQString scientist() const{
return m_scientist;
}
/**
* @return the crystal structure of the element
*/
TQString crystalstructure() const{
return m_crystalstructure;
}
/**
* @return the name of the element
*/
TQString elname() const {
return m_name;
}
//FIXME I need to add a way to have more than one ionic radius
TQString ioncharge() const{
return m_ionvalue;
}
/**
* @return the chemical block (s, p, d, f) of the element
*/
TQString block() const {
return m_block;
}
/**
* @return the group of the element
*/
TQString group() const {
return m_group;
}
int period() const {
return m_period;
}
TQString family() const {
return m_family;
}
/**
* @return the acidic behavior of the element
*/
TQString acidicbeh() const {
return m_acidbeh;
}
/**
* @return the oxydationstages of the element
*/
TQString oxstage() const {
return m_oxstage;
}
/**
* @return the orbits of the element. The TQString is already
* parsed so that the numbers are superscripts and the first
* block is bold.
* @param canBeEmpty specifies if the string returned can be
* empty instead of a "Unknown structure" one.
*/
TQString parsedOrbits( bool canBeEmpty = false );
/**
* @return the boiling point of the element in Kelvin
*/
double boiling() const {
return m_BP;
}
/**
* @return the melting point of the element in Kelvin
*/
double melting() const {
return m_MP;
}
/**
* @return the electronegativity of the element in the
* Pauling-scale
*/
double electroneg() const {
return m_EN;
}
/**
* @return the electroaffinity of the element
*/
double electroaf() const {
return m_EA;
}
/**
* @return the atomic mass of the element in units
*/
double mass() const {
return m_mass;
}
/**
* @return the density of the element in gramms per mol
*/
double density() const {
return m_Density;
}
/**
* @return the radius of the element in picometers
*/
double radius( RADIUSTYPE type );
/**
* @return the mean mass of the element
*/
double meanmass();
int x, y; //for the RegularPerodicTableView
/**
* adjusts the units for the data. The user can
* for example define if Fahrenheit, Kelvin or
* Degrees Celsius should be used for the temperature.
* This method takes care of that and adjust the
* values.
* @param type the TYPE of the data
* @return the adjusted datastring
*/
const TQString adjustUnits( const int type );
const TQString adjustRadius( RADIUSTYPE rtype );
/**
* adjusts the units for the data. The user can
* for example define if Fahrenheit, Kelvin or
* Degrees Celsius should be used for the temperature.
* This method takes care of that and adjust the
* values. Depending on @p type a unit will be
* added to the adjusted value.
* @param type the TYPE of the data
* @param value the value of the data.
* @return the adjusted datastring
*/
const TQString adjustUnits( const int type, double value );
/**
* types of datas
*/
enum TYPE
{
NOGRADIENT = 0,
ATOMICRADIUS,
COVALENTRADIUS,
VDWRADIUS,
MASS,
DENSITY,
BOILINGPOINT,
MELTINGPOINT,
EN,
EA,
DATE,
IE,
IONICRADIUS
};
TQPoint pos() const;
TQPoint coords() const;
/**
* accessor for the element's color
*/
TQColor elementColor() const {
return m_Color;
}
void setupXY();
private:
/**
* the integer num represents the number of the element
*/
int m_ElementNumber;
Spectrum *m_spectrum;
bool m_hasSpectrum;
TQValueList<Isotope*> m_isotopeList;
TQValueList<double> m_spectrumList;
TQColor m_Color;
int xPos() const;
int yPos() const;
double m_mass,
m_MP,
m_BP,
m_EN,
m_EA,
m_Density,
m_RadiusAR,
m_RadiusCR,
m_RadiusVDW,
m_RadiusIon;
int m_number,
m_date,
m_biological,
m_period,
m_abundance;
TQString m_symbol,
m_name,
m_origin,
m_oxstage,
m_block,
m_group,
m_family,
m_acidbeh,
m_orbits,
m_isotopes,
m_scientist,
m_crystalstructure,
m_ionvalue;
bool m_artificial,
m_radioactive;
doubleList m_ionenergies;
public:
/**
* draw the rectangle with the information
* @param p painter to do the drawing on
* @param value the value to display as text
* @param c the color used to paint the element
*/
virtual void drawGradient( TQPainter* p, const TQString& value, const TQColor& c);
/**
* Draw the Element grayed out. Used in the timeline
* @param p the painter used for the painting
*/
virtual void drawGrayedOut( TQPainter* p );
/**
* draw the rectangle with the information
* @param p painter to do the drawing on
* @param simple if True more information will be shown
* @param isCrystal whether the elements should draw its crystal structure
*/
virtual void drawSelf( TQPainter* p, bool simple = false, bool isCrystal = false );
virtual void drawStateOfMatter( TQPainter* p, double temperature );
};
#endif
|