From b8b4b5d3dc908a6d0a8cd0cc84a7e6884c5dc476 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sun, 3 Feb 2008 15:45:54 +0000 Subject: [PATCH] Adding changes to the Spectrum-class svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=770387 --- libscience/spectrum.cpp | 11 +++++++++++ libscience/spectrum.h | 18 +++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/libscience/spectrum.cpp b/libscience/spectrum.cpp index 928825c..99b1ec9 100644 --- a/libscience/spectrum.cpp +++ b/libscience/spectrum.cpp @@ -98,7 +98,18 @@ QList Spectrum::wavelengths( double min, double max ) return list; } +int Spectrum::parentElementNumber() const +{ + return m_parentElementNumber; +} + Spectrum::~Spectrum() { qDeleteAll( m_peaklist ); } + +Spectrum::Spectrum() +{ + //FIXME this shouldn't be hardcoded + m_parentElementNumber = 16; +} diff --git a/libscience/spectrum.h b/libscience/spectrum.h index 549cc26..bf428be 100644 --- a/libscience/spectrum.h +++ b/libscience/spectrum.h @@ -38,7 +38,7 @@ class SCIENCE_EXPORT Spectrum /** * This spectrum doesn't belong to any element */ - Spectrum(){} + Spectrum(); /** * public destructor @@ -109,12 +109,11 @@ class SCIENCE_EXPORT Spectrum return m_peaklist; } - /** - * @return the parent element of this spectrum + /** + * If the spectrum belongs to Iron, this method will return "26" + * @return the number of the element the spectrum belongs to */ - Element* parentElement() { - return m_parentElement; - } + int parentElementNumber() const; /** * @return the smallest wavelength @@ -126,12 +125,17 @@ class SCIENCE_EXPORT Spectrum */ double maxPeak(); + void setParentElementNumber( int num ) + { + m_parentElementNumber = num; + } + private: /** * the internal dataset */ QList m_peaklist; - Element* m_parentElement; + int m_parentElementNumber; }; #endif // SPECTRUM_H -- 2.47.3