pseTables::~pseTables()
{
+// foreach(psTable *i, m_tables) {
+// delete i;
+// }
}
pseTables *pseTables::instance()
return 0;
}
-
-
pseTable::pseTable()
{
}
{
int x = 0, y = 0, i;
- for(i = 0; i < m_posX.count(); i++) {
+ for (i = 0; i < m_posX.count(); i++) {
if (m_posX.at(i) > x) {
x = m_posX.at(i) ;
}
return QPoint(x, y);
}
+int pseTable::numeration( int xPos ) const
+{
+ if ( xPos >= 0 && xPos < m_xCoordsNumeration.count() ) {
+ return m_xCoordsNumeration.at( xPos );
+ }
+ return -1;
+}
+
/// Regular Table Data
pseRegularTable::pseRegularTable()
: pseTable()
m_description = i18n( "Classic Periodic Table" );
+ m_xCoordsNumeration <<
+ 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 17 << 18;
+
m_posX <<
1 << 18 <<
1 << 2 << 13 << 14 << 15 << 16 << 17 << 18 <<
m_description = i18n( "Long Periodic Table" );
+ m_xCoordsNumeration <<
+ 1 << 2 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 <<-1 << 3 << 4 << 5 << 6 << 7 << 8 << 9 <<10 <<11 <<12 <<13 <<14 <<15 <<16 <<17 <<18;
+
m_posX <<
1 << 32 <<
1 << 2 << 27 <<28 <<29 <<30 <<31 <<32 <<
m_description = i18n( "Short Periodic Table" );
+ m_xCoordsNumeration <<
+ 1 << 2 <<13 <<14 <<15 <<16 <<17 <<18;
+
m_posX <<
1 << 8 <<//He
1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 <<//Ne
m_description = i18n( "Transition Elements" );
+ m_xCoordsNumeration <<
+ 3<< 4<< 5<< 6<< 7<< 8<< 9<<10<<11<< 12;
+
m_posX <<
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10<<
1<< 2<< 3<< 4<< 5<< 6<< 7<< 8<< 9<< 10<<
m_description = i18n( "DZ Periodic Table" );
+ m_xCoordsNumeration <<
+ 1 << 2 <<13 <<14 <<15 <<16 <<17 <<18 << 3 << 4 << 5 << 6 << 7 << 8 << 9 <<10 <<11 <<12;
+
m_posX <<
1<< 2<<
2<< 2<<
- 3<< 4<< 5<< 6<< 7<< 8<<
+ 3<< 4<< 5<< 6<< 7<< 8<<
1<< 2<<
- 3<< 4<< 5<< 6<< 7<< 8<<
+ 3<< 4<< 5<< 6<< 7<< 8<<
1<< 2<<
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
3<< 4<< 5<< 6<< 7<< 8<<
1<< 2<<
19<<20<<21<<22<<23<<24<<25<<26<<27<<28<<29<<30<<31<<32<<
9<<10<<11<<12<<13<<14<<15<<16<<17<<18<<
- 3 <<4 <<5 <<6
+ 3 <<4 <<5 <<6 <<7 <<8
;
m_posY <<
1<< 1<<
2<< 2<<
- 3<< 3<< 3<< 3<< 3<< 3<<
+ 3<< 3<< 3<< 3<< 3<< 3<<
4<< 4<<
- 5<< 5<< 5<< 5<< 5<< 5<<
+ 5<< 5<< 5<< 5<< 5<< 5<<
6<< 6<<
7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<< 7<<
8<< 8<< 8<< 8<< 8<< 8<<
9<< 9<<
- 10<<10<<10<<10<<10<<10<<10<<10<<10<<10<<
- 11<<11<<11<<11<<11<<11<<
+ 10<<10<<10<<10<<10<<10<<10<<10<<10<<10<<
+ 11<<11<<11<<11<<11<<11<<
12<<12<<
+
13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<13<<
14<<14<<14<<14<<14<<14<<14<<14<<14<<14<<
15<<15<<15<<15<<15<<15<<
16<<16<<
17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<17<<
18<<18<<18<<18<<18<<18<<18<<18<<18<<18<<
- 19<<19<<19<<19
+ 19<<19<<19<<19<<19<<19
;
// The DZ PS has all Elements
{
static pseDZTable thisTable;
return &thisTable;
-}
\ No newline at end of file
+}
/*********************************************************************************
- * Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it *
- * Copyright (C) 2007 by Carste Niehaus, cniehaus@kde.org *
- * copyright (C) 2010 by Etienne Rebetez, etienne.rebetez@oberwallis.ch*
+ * Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it *
+ * Copyright (C) 2007 by Carste Niehaus, cniehaus@kde.org *
+ * copyright (C) 2010 by Etienne Rebetez, etienne.rebetez@oberwallis.ch *
* *
- * 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 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 *
#include <QList>
#include <QStringList>
+/**
+ * @class pseTables
+ * Provides functions to easyli create pse tables with q*GridLayouts or qGraphicsView.
+ *
+ * creating a table for the gridlayout
+@code
+ foreach (intElement, pseTables::instance()->getTabletype( m_psTableType )->elements()) {
+ group = pseTables::instance()->getTabletype( m_psTableType )->elementCoords( intElement ).x();
+ period = pseTables::instance()->getTabletype( m_psTableType )->elementCoords( intElement ).y();
+
+ ElementLabel *element = new ElementLabel( intElement );
+
+ gridLayoutOfPeriodSystem->addItem (element, period, group );
+ }
+
+@endcode
+
+ * position elements in a qGraphicsScene
+@code
+
+
+@endcode
+
+ * getting the position of the Numerations for the pse (j)
+ @code
+ for (int i = 0; i < pseTables::instance()->getTabletype( j )->coordsMax().x() || i < numerationItems.count(); i++) {
+ int itemAtPos = pseTables::instance()->getTabletype( j )->numeration( i );
+ }
+ @endcode
+ * @short Provides shape and elements of diferent peridic tables of elements
+ * @author Etienne Rebetez
+ */
class pseTable;
/**
* defines a Periodic Table.
* Holds the position (x,y) and all the displaed elements
*/
-class SCIENCE_EXPORT pseTable
+class pseTable
+
{
public:
static pseTable *init();
virtual QPoint elementCoords(int element);
/**
+ * Returns a list with all elements in the actual periodic table
+ */
+ virtual QList<int> elements() const;
+
+ /**
+
* Returns the element that comes right before the specified @p element.
* -1 means that @p element is the first in this table type.
*
* The default implementation returns <tt>element - 1</tt> if @p element
* is not 1, else -1.
*/
- int previousOf ( int element ) const;
+ virtual int previousOf ( int element ) const;
/**
* Returns the element that comes right after the specified @p element.
* The default implementation returns <tt>element + 1</tt> if @p element
* is not the latest element, else -1.
*/
- int nextOf ( int element ) const;
+ virtual int nextOf ( int element ) const;
/**
* Returns the first element of the table.
*/
- int firstElement() const;
+ virtual int firstElement() const;
/**
* Returns the last element of the table.
*/
- int lastElement() const;
-
- /**
- * Returns a list with all elements in the actual periodic table
- */
- virtual QList<int> elements() const;
+ virtual int lastElement() const;
/**
* Returns the maximal Coordinates of the periodic table.
*/
virtual QPoint coordsMax() const;
+ /**
+ * Returns the Numeration for the current Table according to the position in the Table. IUPAC Style eq. numbers
+ */
+ virtual int numeration( int xPos ) const;
+
protected:
pseTable();
QList<int> m_posX;
QList<int> m_posY;
+ QList<int> m_xCoordsNumeration;
QList<int> m_elementList;
};