]> Git trees. - libqmvoc.git/commitdiff
first bunch of changes of the spektrum-stuff
authorCarsten Niehaus <cniehaus@gmx.de>
Sun, 17 Jul 2005 14:26:12 +0000 (14:26 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sun, 17 Jul 2005 14:26:12 +0000 (14:26 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.h; revision=435579

kalzium/src/element.cpp
kalzium/src/element.h
kalzium/src/spectrum.h

index c193d46311425cb554444582862c1f8385d731c7..83b42cb2092ef467e8a49be7f2612b5b80e1ae38 100644 (file)
@@ -624,16 +624,30 @@ EList KalziumDataObject::readData(  QDomDocument &dataDocument )
                }
 
                QDomNodeList spectrumList = domElement.namedItem( "spectra" ).toElement().elementsByTagName( "spectrum" );
-               QValueList<double> speclist;
+
+               Spektrum *spectrum = new Spektrum();
                for( uint i = 0; i < spectrumList.length(); i++ )
                {
+                       Spektrum::band b;
                        QDomElement spec = spectrumList.item( i ).toElement();
-                       double wavelenght = spec.text().toDouble();
-                       speclist.append( wavelenght );
+                       
+                       b.intensity = spec.attributeNode( "intensity" ).value().toInt();
+                       b.wavelength = spec.attributeNode( "wavelength" ).value().toDouble();
+                       b.aki = spec.attributeNode( "aki" ).value().toDouble();
+                       b.energy1 = spec.attributeNode( "energy1" ).value().toDouble();
+                       b.energy2 = spec.attributeNode( "energy2" ).value().toDouble();
+                       b.electronconfig1 = spec.attributeNode( "electronconfig1" ).value();
+                       b.electronconfig2 = spec.attributeNode( "electronconfig1" ).value();
+                       b.term1 = spec.attributeNode( "term1" ).value();
+                       b.term2 = spec.attributeNode( "term2" ).value();
+                       b.J1 = spec.attributeNode( "J1" ).value();
+                       b.J2 = spec.attributeNode( "J2" ).value();
+
+                       spectrum->addBand( b );
                }
        
                Element *e = new Element();
-               e->setSpectrumList( speclist );
+               e->setSpektrum( spectrum );
                e->setDate(date);
                e->setBiologicalMeaning(bio);
                e->setNumber( number );
index a158800d88cce08a1b66080fd2d80fbeccb25e67..21bd86be2450d76fae907abba29966b9972cb0d4 100644 (file)
@@ -36,6 +36,42 @@ typedef QValueList<Element*> EList;
 typedef QValueList<coordinate> CList;
 typedef QValueList<double> doubleList;
 
+/**
+ * @author Carsten Niehaus
+ *
+ * This class represents an spectrum with all its properties
+ */
+class Spektrum
+{
+       public:
+               Spektrum(){};
+               ~Spektrum(){};
+
+               /**
+                * a band is one line in the spektrum of an element
+                */
+               struct band
+               {
+                       double wavelength;
+                       double aki;
+                       double energy1;
+                       double energy2;
+                       int intensity;
+                       QString electronconfig1;
+                       QString electronconfig2;
+                       QString term1;
+                       QString term2;
+                       QString J1;
+                       QString J2;
+               };
+
+               void addBand( band b ){
+                       m_bandlist.append( b );
+               }
+
+               QValueList<band> m_bandlist;
+};
+
 /**
  * @author Carsten Niehaus
  * @author Jörg Buchwald
@@ -286,8 +322,8 @@ class Element{
                        m_isotopeList = list;
                }
 
-               void setSpectrumList( QValueList<double> list ){
-                       m_spectrumList = list;
+               void setSpektrum( Spektrum *spec ){
+                       m_spectrum = spec;
                }
 
                doubleList ionisationList() const{
@@ -526,6 +562,8 @@ class Element{
                 */
                int m_ElementNumber;
 
+               Spektrum *m_spectrum;
+
                QValueList<Isotope*> m_isotopeList;
 
                QValueList<double> m_spectrumList;
index 3cd742747afa32b2d9b8de662b30314cfa99a7a7..7bee4abd50ad4ac9fbbd6ce701a57b66d5d9e9ca 100644 (file)
@@ -33,6 +33,8 @@
 #include <kpixmapeffect.h>
 #include <kcombobox.h>
 
+#include "element.h"
+
 /**
  * @author Carsten Niehaus
  */
@@ -44,9 +46,8 @@ class SpectrumWidget : public QWidget
                SpectrumWidget( QWidget *parent, const char* name = 0 );
                ~SpectrumWidget();
 
-               void setSpectra( QValueList<double> l ){
-                       m_spectra = l;
-                       update();
+               void setSpektrum( Spektrum* spec ){
+                       m_spektrum = spec;
                }
 
                /**
@@ -105,6 +106,8 @@ class SpectrumWidget : public QWidget
                 */
                int Adjust( double color, double factor );
 
+               Spektrum *m_spektrum;
+
                /**
                 * @param the position on a 0 to 1-scale in the widget. 0.5 mean 
                 * that you want the wavelength in the middle of the widget,
@@ -207,10 +210,10 @@ class SpectrumView : public QWidget
        public: 
                SpectrumView( QWidget* parent, const char* name );
 
-               void setSpectra( QValueList<double> l ){
-                       m_spectrum->setSpectra( l );
-                       update();
-               }
+//X            void setSpectra( QValueList<double> l ){
+//X                    m_spectrum->setSpektrum( l );
+//X                    update();
+//X            }
 
        private:
                SpectrumWidget *m_spectrum;