From: Carsten Niehaus Date: Wed, 20 Jul 2005 08:17:16 +0000 (+0000) Subject: add html-export to the spectrum-class X-Git-Tag: v3.80.2~300^2~40 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=cd08456932bfea35cd8fa82562ab1508af07fbe5;p=libqmvoc.git add html-export to the spectrum-class svn path=/trunk/KDE/kdeedu/kalzium/src/spectrum.h; revision=436757 --- diff --git a/kalzium/src/spectrum.cpp b/kalzium/src/spectrum.cpp index 2f97f37..5224400 100644 --- a/kalzium/src/spectrum.cpp +++ b/kalzium/src/spectrum.cpp @@ -37,7 +37,6 @@ double Spectrum::minBand() const QValueList::const_iterator itEnd = m_bandlist.end(); for (;it!=itEnd;++it) { - kdDebug() << "value: " << ( *it ).wavelength << " Current min-value: " << value << endl; if ( value > ( *it ).wavelength ) value = ( *it ).wavelength; } @@ -133,6 +132,37 @@ QValueList Spectrum::wavelengths( double min, double max ) return list; } +QString Spectrum::BandsAsHtml() +{ + QString html = "Chemical datai"; + + html.append( "" ); + + QValueList::const_iterator it = m_bandlist.begin(); + const QValueList::const_iterator itEnd = m_bandlist.end(); + for (;it!=itEnd;++it) + { + html.append( "" ); + html.append( i18n( "" ).arg( ( *it ).wavelength ) ); + html.append( i18n( "" ).arg( ( *it ).intensity ) ); + html.append( i18n( "" ).arg( ( *it ).aki ) ); + html.append( i18n( "" ).arg( ( *it ).energy1 ) ); + html.append( i18n( "" ).arg( ( *it ).energy2 ) ); + html.append( i18n( "" ).arg( ( *it ).electronconfig1 ) ); + html.append( i18n( "" ).arg( ( *it ).electronconfig2 ) ); + html.append( i18n( "" ).arg( ( *it ).term1 ) ); + html.append( i18n( "" ).arg( ( *it ).term2 ) ); + html.append( i18n( "" ).arg( ( *it ).J1 ) ); + html.append( i18n( "" ).arg( ( *it ).J2 ) ); + html.append( "\n"); + } + + html.append( "
Wavelength: %1 nmIntensity: %1Probability: %1 108s-1Energy 1: %1Energy 2: %1Electronconfiguration 1: %1Electronconfiguration 2: %1Term 1: %1Term 2: %1J 1: %1J 2: %1
" ); + + html.append( "" ); + return html; +} + SpectrumView::SpectrumView( Spectrum *spec, QWidget *parent, const char* name ) : QWidget( parent, name ) { @@ -143,9 +173,8 @@ SpectrumView::SpectrumView( Spectrum *spec, QWidget *parent, const char* name ) m_spectrumWidget = new SpectrumWidget( this, "spectrum" ); m_spectrumWidget->setSpectrum( m_spectrum ); + kdDebug() << m_spectrum->BandsAsHtml() << endl; - kdDebug() << "minumum: " << m_spectrum->min() << " maximum: " << m_spectrum->max() << endl; - //m_spectrumWidget->setBorders( m_spectrum->min(), m_spectrum->max() ); spectrumLayout->addWidget( m_spectrumWidget ); diff --git a/kalzium/src/spectrum.h b/kalzium/src/spectrum.h index c9ee477..0731bdb 100644 --- a/kalzium/src/spectrum.h +++ b/kalzium/src/spectrum.h @@ -144,6 +144,11 @@ class Spectrum m_max = maxBand(); } + /** + * @return the data of a spectrum as html-code + */ + QString BandsAsHtml(); + private: /** * @return the smallest wavelength