1
/*********************************************************************************
2
* Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it *
3
* Copyright (C) 2007 by Carste Niehaus, cniehaus@kde.org *
4
* copyright (C) 2010 by Etienne Rebetez, etienne.rebetez@oberwallis.ch*
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20
***************************************************************************/
22
#include "psetables.h"
28
pseTables::pseTables()
30
m_tables << pseRegularTable::init();
31
m_tables << pseShortTable::init();
32
m_tables << pseLongTable::init();
33
m_tables << pseDTable::init();
34
m_tables << pseDZTable::init();
37
pseTables::~pseTables()
41
pseTables *pseTables::instance()
43
static pseTables tables;
47
QStringList pseTables::tables() const
50
for ( int i = 0; i < m_tables.count(); i++ )
52
l << m_tables.at( i )->description();
57
pseTable* pseTables::getTabletype(const int tableType)
59
if ( ( tableType < 0 ) || ( tableType >= m_tables.count() ) ) {
63
return m_tables.at( tableType );
66
pseTable* pseTables::getTabletype(const QString tableName)
68
for ( int i = 0; m_tables.count(); i++ ) {
69
if (tableName == m_tables.at( i )->name() ) {
70
return m_tables.at( i );
84
pseTable *pseTable::init()
89
QString pseTable::name() const
94
QString pseTable::description() const
99
QList<int> pseTable::elements() const
101
return m_elementList;
104
int pseTable::previousOf( int element ) const
106
int index = m_elementList.indexOf( element );
107
return index > 0 ? m_elementList.at( index - 1 ) : -1;
110
int pseTable::nextOf( int element ) const
112
int index = m_elementList.indexOf( element );
113
return index != -1 && ( index < m_elementList.count() - 1 ) ? m_elementList.at( index + 1 ) : -1;
116
int pseTable::firstElement() const
118
return m_elementList.first();
121
int pseTable::lastElement() const
123
return m_elementList.last();
126
QPoint pseTable::elementCoords(const int element) const
129
int elementIndex = m_elementList.indexOf( element );
131
if ( elementIndex >= 0 && elementIndex < m_elementList.count() ) {
132
// The positions lists are defined with the base of 1.
133
// But coordinates start mostly with 0.
134
x = m_posX.at( elementIndex ) - 1;
135
y = m_posY.at( elementIndex ) - 1;
140
QPoint pseTable::tableSize() const
144
for (i = 0; i < m_posX.count(); ++i) {
145
if ( m_posX.at(i) > x)
148
if ( m_posY.at(i) > y)
154
int pseTable::numerationAtPos( int xPos ) const
156
if ( xPos >= 0 && xPos < m_xCoordsNumeration.count() ) {
157
return m_xCoordsNumeration.at( xPos ) - 1;
162
/// Regular Table Data
163
pseRegularTable::pseRegularTable()
168
m_description = i18n( "Classic Periodic Table" );
170
m_xCoordsNumeration <<
171
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18;
175
1 << 2 << 13 << 14 << 15 << 16 << 17 << 18 <<
176
1 << 2 << 13 << 14 << 15 << 16 << 17 << 18 <<
177
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18 <<
178
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18 << //Element 54 (Xe)
179
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << //Element 58 (Ce) 71 (Lu)
180
4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18 <<
181
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << //Element 71 (Lr)
182
4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18
187
2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 <<
188
3 << 3 << 3 << 3 << 3 << 3 << 3 << 3 <<
189
4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 <<
190
5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << //Element 54 (Xe)
191
6 << 6 << 6 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << 9 << //Element 71 (Lr)
192
6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 <<
193
7 << 7 << 7 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 << 10 <<
194
7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7
197
// The classic PS has all Elements
198
if (m_posX.count() == m_posY.count() ) {
199
for (int i = 1; i <= m_posX.count(); i ++) {
200
m_elementList.append(i);
205
pseRegularTable *pseRegularTable::init()
207
static pseRegularTable thisTable;
212
pseLongTable::pseLongTable()
217
m_description = i18n( "Long Periodic Table" );
219
m_xCoordsNumeration <<
220
1 << 2 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 3 << 4 << 5 << 6 << 7 << 8 << 9 <<10 <<11 <<12 <<13 <<14 <<15 <<16 <<17 <<18;
224
1 << 2 << 27 <<28 <<29 <<30 <<31 <<32 <<
225
1 << 2 << 27 <<28 <<29 <<30 <<31 <<32 <<
226
1 << 2 << 17 <<18 <<19 <<20 <<21 <<22 <<23 <<24 <<25 <<26 <<27 <<28 <<29 <<30 <<31 <<32 <<
227
1 << 2 << 17 <<18 <<19 <<20 <<21 <<22 <<23 <<24 <<25 <<26 <<27 <<28 <<29 <<30 <<31 <<32 <<
228
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 <<
229
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
234
2 << 2 << 2 <<2 <<2 <<2 <<2 <<2 <<
235
3 << 3 << 3 <<3 <<3 <<3 <<3 <<3 <<
236
4 << 4 << 4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<4 <<
237
5 << 5 << 5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<5 <<
238
6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<6 <<
239
7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 << 7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7 <<7
242
// The long PS has all Elements
243
if (m_posX.count() == m_posY.count() ) {
244
for (int i = 1; i <= m_posX.count(); i ++) {
245
m_elementList.append(i);
250
pseLongTable *pseLongTable::init()
252
static pseLongTable thisTable;
257
pseShortTable::pseShortTable()
262
m_description = i18n( "Short Periodic Table" );
264
m_xCoordsNumeration <<
265
1 << 2 <<13 <<14 <<15 <<16 <<17 <<18;
269
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Ne
270
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Ar
271
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Kr
272
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Xe
273
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Rn
279
2 << 2 << 2 << 2 << 2 << 2 << 2 << 2 <<//Ne
280
3 << 3 << 3 << 3 << 3 << 3 << 3 << 3 <<//Ar
281
4 << 4 << 4 << 4 << 4 << 4 << 4 << 4 <<//Kr
282
5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 <<//Xe
283
6 << 6 << 6 << 6 << 6 << 6 << 6 << 6 <<//Rn
289
3 << 4 << 5 << 6 << 7 << 8 << 9 << 10<<//Ne
290
11<< 12<< 13<< 14<< 15<< 16<< 17<< 18<<//Ar
291
19<< 20<< 31<< 32<< 33<< 34<< 35<< 36<<//Kr
292
37<< 38<< 49<< 50<< 51<< 52<< 53<< 54<<//Xe
293
55<< 56<< 81<< 82<< 83<< 84<< 85<< 86<<//Rn
298
pseShortTable *pseShortTable::init()
300
static pseShortTable thisTable;
304
/// D-Group Table Data
305
pseDTable::pseDTable()
310
m_description = i18n( "Transition Elements" );
312
m_xCoordsNumeration <<
313
3<< 4<< 5<< 6<< 7<< 8<< 9<<10<<11<< 12;
316
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10<<
317
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10<<
318
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10<<
319
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10
323
1<< 1<< 1<< 1<< 1<< 1<< 1<< 1<< 1<< 1<<
324
2<< 2<< 2<< 2<< 2<< 2<< 2<< 2<< 2<< 2<<
325
3<< 3<< 3<< 3<< 3<< 3<< 3<< 3<< 3<< 3<<
326
4<< 4<< 4<< 4<< 4<< 4<< 4<< 4<< 4<< 4
330
21 << 22 << 23 << 24 << 25 << 26 << 27 << 28 << 29 << 30 <<
331
39 << 40 << 41 << 42 << 43 << 44 << 45 << 46 << 47 << 48 <<
332
57 << 72 << 73 << 74 << 75 << 76 << 77 << 78 << 79 << 80 <<
333
89 << 104<< 105<< 106<< 107<< 108<< 109<< 110<< 111<< 112
338
pseDTable *pseDTable::init()
340
static pseDTable thisTable;
345
pseDZTable::pseDZTable()
350
m_description = i18n( "DZ Periodic Table" );
352
m_xCoordsNumeration <<
353
1 << 2 <<13 <<14 <<15 <<16 <<17 <<18 << 3 << 4 << 5 << 6 << 7 << 8 << 9 <<10 <<11 <<12;
358
3<< 4<< 5<< 6<< 7<< 8<<
360
3<< 4<< 5<< 6<< 7<< 8<<
362
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
363
3<< 4<< 5<< 6<< 7<< 8<<
365
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
366
3 <<4 <<5 <<6 <<7 <<8 <<
368
19<<20<<21<<22<<23<<24<<25<<26<<27<<28<<29<<30<<31<<32<<
369
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
370
3 <<4 <<5 <<6 <<7 <<8 <<
372
19<<20<<21<<22<<23<<24<<25<<26<<27<<28<<29<<30<<31<<32<<
373
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
374
3 <<4 <<5 <<6 <<7 <<8
380
3<< 3<< 3<< 3<< 3<< 3<<
382
5<< 5<< 5<< 5<< 5<< 5<<
384
7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<<
385
8<< 8<< 8<< 8<< 8<< 8<<
387
10<<10<<10<<10<<10<<10<<10<<10<<10<<10<<
388
11<<11<<11<<11<<11<<11<<
391
13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<
392
14<<14<<14<<14<<14<<14<<14<<14<<14<<14<<
393
15<<15<<15<<15<<15<<15<<
395
17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<
396
18<<18<<18<<18<<18<<18<<18<<18<<18<<18<<
397
19<<19<<19<<19<<19<<19
400
// The DZ PS has all Elements
401
if (m_posX.count() == m_posY.count() ) {
402
for (int i = 1; i <= m_posX.count(); i ++) {
403
m_elementList.append(i);
409
pseDZTable *pseDZTable::init()
411
static pseDZTable thisTable;