From 3d1ab9deb6bb0000326885227065e390712f7a71 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sat, 6 May 2006 08:14:18 +0000 Subject: [PATCH] Qt4-ify the code, remove the soon no longer used data-stuff svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=537906 --- libscience/spectrum.cpp | 45 ++++++++++++++++------------------------- libscience/spectrum.h | 24 ++-------------------- 2 files changed, 19 insertions(+), 50 deletions(-) diff --git a/libscience/spectrum.cpp b/libscience/spectrum.cpp index b73c8f0..eedd212 100644 --- a/libscience/spectrum.cpp +++ b/libscience/spectrum.cpp @@ -27,27 +27,26 @@ double Spectrum::minPeak() { - double value = ( *m_peaklist.begin() )->wavelength; - QList::const_iterator it = m_peaklist.begin(); - const QList::const_iterator itEnd = m_peaklist.end(); - for (;it!=itEnd;++it) + double value = m_peaklist.first()->wavelength; + + foreach( peak * p, m_peaklist ) { - if ( value > ( *it )->wavelength ) - value = ( *it )->wavelength; + if ( value > p->wavelength ) + value = p->wavelength; } return value; } double Spectrum::maxPeak() { - double value = ( *m_peaklist.begin() )->wavelength; - QList::const_iterator it = m_peaklist.begin(); - const QList::const_iterator itEnd = m_peaklist.end(); - for (;it!=itEnd;++it) + double value = m_peaklist.first()->wavelength; + + foreach( peak * p, m_peaklist ) { - if ( value < ( *it )->wavelength ) - value = ( *it )->wavelength; + if ( value < p->wavelength ) + value = p->wavelength; } + return value; } @@ -56,15 +55,10 @@ Spectrum* Spectrum::adjustToWavelength( double min, double max ) { Spectrum *spec = new Spectrum(); - QList::const_iterator it = m_peaklist.begin(); - const QList::const_iterator itEnd = m_peaklist.end(); - - for ( ; it != itEnd; ++it ) + foreach( peak * p , m_peaklist ) { - if ( ( *it )->wavelength < min || ( *it )->wavelength > max ) - continue; - - spec->addPeak( *it ); + if ( p->wavelength >= min || p->wavelength <= max ) + spec->addPeak( p ); } spec->adjustMinMax(); @@ -105,15 +99,10 @@ QList Spectrum::wavelengths( double min, double max ) { QList list; - QList::const_iterator it = m_peaklist.begin(); - const QList::const_iterator itEnd = m_peaklist.end(); - - for ( ; it != itEnd; ++it ) + foreach( peak * p , m_peaklist ) { - if ( ( *it )->wavelength < min || ( *it )->wavelength > max ) - continue; - - list.append( ( *it )->wavelength ); + if ( p->wavelength >= min || p->wavelength <= max ) + list.append( p->wavelength ); } return list; diff --git a/libscience/spectrum.h b/libscience/spectrum.h index bc2bdfc..9edb92b 100644 --- a/libscience/spectrum.h +++ b/libscience/spectrum.h @@ -52,34 +52,14 @@ class Spectrum public: peak(){ wavelength = -1.0; - aki = -1.0; - energy1 = -1.0; - energy2 = -1.0; intensity = -1; } ///in nm double wavelength; - ///Transition Probabilities - ///10^8s-1 (1000000000 per second) - double aki; - - ///number of energylevels per centimeter - double energy1; - - ///number of energylevels per centimeter - double energy2; - ///relative. The highest is per definition 1000 int intensity; - - QString electronconfig1; - QString electronconfig2; - QString term1; - QString term2; - QString J1; - QString J2; }; /** @@ -92,8 +72,8 @@ class Spectrum } /** - * @param min the lowest allowed wavalength in nanometer - * @param max the highest allowed wavalength in nanometer + * @param min the lowest allowed wavelength in nanometer + * @param max the highest allowed wavelength in nanometer * * @returns a spectrum with the wavelength in the range * of @p min to @p max. The intensities are readjusted -- 2.47.3