]> Git trees. - libqmvoc.git/commitdiff
remove crappy API
authorCarsten Niehaus <cniehaus@gmx.de>
Sun, 24 Sep 2006 16:49:15 +0000 (16:49 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sun, 24 Sep 2006 16:49:15 +0000 (16:49 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=588009

libscience/spectrum.cpp
libscience/spectrum.h

index eedd212b3311c95ef8ffbc8166e657f5bbb098d5..d3c1b0cd9d82e762e42e00ed54a89b1074a11ee7 100644 (file)
@@ -61,37 +61,30 @@ Spectrum* Spectrum::adjustToWavelength( double min, double max )
                        spec->addPeak( p );
        }
 
-       spec->adjustMinMax();
-
        return spec;
 }
 
 void Spectrum::adjustIntensities()
 {
        int maxInt = 0;
-       QList<peak*>::Iterator it = m_peaklist.begin();
-       const QList<peak*>::Iterator itEnd = m_peaklist.end();
-
        //find the highest intensity
-       for ( ; it != itEnd; ++it )
+       foreach ( Spectrum::peak * p, m_peaklist)
        {
-               if ( ( *it )->intensity > maxInt )
-                       maxInt = ( *it )->intensity;
+               if ( p->intensity > maxInt )
+                       maxInt = p->intensity;
        }
 
        //check if an adjustment is needed or not
        if ( maxInt == 1000 ) return;
 
-       double max = ( double ) maxInt;
+       const double max = ( double ) maxInt;
 
        //now adjust the intensities.
-       it = m_peaklist.begin();
-       for ( ; it != itEnd; ++it )
+       foreach ( Spectrum::peak * p, m_peaklist)
        {
-               double curInt = ( ( double )( *it )->intensity );
-               
-               double newInt = max*1000/curInt;
-               ( *it )->intensity = ( int ) round( newInt );
+               double newInt = max*1000/p->intensity;
+
+               p->intensity = ( int ) round( newInt );
        }
 }
 
index a5ecc1f4ef51569fd2560439fd7f577a4e06b7df..cf06565a8f6b667714d495abb653796598be87ef 100644 (file)
@@ -103,35 +103,12 @@ class EDUSCIENCE_EXPORT Spectrum
                 */
                QList<double> wavelengths( double min, double max );
 
-               /**
-                * @return the smallest wavelength
-                */
-               double min() const{
-                       return m_min;
-               }
-               
-               /**
-                * @return the highest wavelength
-                */
-               double max() const{
-                       return m_max;
-               }
-
                /**
                 * @return the list of peaks of the spectrum
                 */
                QList<Spectrum::peak*> peaklist(){
                        return m_peaklist;
                }
-       
-               /**
-                * cache the values of the biggest and
-                * smallest wavelenght
-                */
-               void adjustMinMax(){
-                       m_min = minPeak();
-                       m_max = maxPeak();
-               }
 
                /**
                 * @return the parent element of this spectrum
@@ -140,7 +117,6 @@ class EDUSCIENCE_EXPORT Spectrum
                        return m_parentElement; 
                }
 
-       private:
                /**
                 * @return the smallest wavelength
                 */
@@ -151,16 +127,12 @@ class EDUSCIENCE_EXPORT Spectrum
                 */
                double maxPeak();
 
+       private:
                /**
                 * the internal dataset
                 */
                QList<peak*> m_peaklist;
 
-               /**
-                * the cached values of the highest and lowest wavelength
-                */
-               double m_max, m_min;
-
                Element* m_parentElement;
 };
 #endif // SPECTRUM_H