From: Carsten Niehaus Date: Sun, 17 Jul 2005 14:26:12 +0000 (+0000) Subject: first bunch of changes of the spektrum-stuff X-Git-Tag: v3.80.2~300^2~63 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=991c2e80c890d738cefb05bc236c00056b321588;p=libqmvoc.git first bunch of changes of the spektrum-stuff svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.h; revision=435579 --- diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index c193d46..83b42cb 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -624,16 +624,30 @@ EList KalziumDataObject::readData( QDomDocument &dataDocument ) } QDomNodeList spectrumList = domElement.namedItem( "spectra" ).toElement().elementsByTagName( "spectrum" ); - QValueList 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 ); diff --git a/kalzium/src/element.h b/kalzium/src/element.h index a158800..21bd86b 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -36,6 +36,42 @@ typedef QValueList EList; typedef QValueList CList; typedef QValueList 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 m_bandlist; +}; + /** * @author Carsten Niehaus * @author Jörg Buchwald @@ -286,8 +322,8 @@ class Element{ m_isotopeList = list; } - void setSpectrumList( QValueList 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 m_isotopeList; QValueList m_spectrumList; diff --git a/kalzium/src/spectrum.h b/kalzium/src/spectrum.h index 3cd7427..7bee4ab 100644 --- a/kalzium/src/spectrum.h +++ b/kalzium/src/spectrum.h @@ -33,6 +33,8 @@ #include #include +#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 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 l ){ - m_spectrum->setSpectra( l ); - update(); - } +//X void setSpectra( QValueList l ){ +//X m_spectrum->setSpektrum( l ); +//X update(); +//X } private: SpectrumWidget *m_spectrum;