const QValueList<band>::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;
}
return value;
}
+double Spectrum::maxBand()
+{
+ kdDebug() << "Spectrum::maxBand()" << endl;
+
+ double value = ( *m_bandlist.begin() ).wavelength;
+ QValueList<band>::Iterator it = m_bandlist.begin();
+ const QValueList<band>::Iterator itEnd = m_bandlist.end();
+ for (;it!=itEnd;++it)
+ {
+ kdDebug() << "value: " << ( *it ).wavelength << " Current max-value: " << value << endl;
+ if ( value < ( *it ).wavelength )
+ value = ( *it ).wavelength;
+ }
+ return value;
+}
+
+
Spectrum* Spectrum::adjustToWavelength( double min, double max )
{
Spectrum *spec = new Spectrum();
for ( ; it != itEnd; ++it )
{
+ kdDebug( ) << "WL: " << ( *it ).wavelength << endl;
if ( ( *it ).wavelength < min || ( *it ).wavelength > max )
continue;
}
}
-double Spectrum::maxBand()
+QValueList<double> Spectrum::wavelengths( double min, double max )
{
- kdDebug() << "Spectrum::maxBand()" << endl;
-
- double value = ( *m_bandlist.begin() ).wavelength;
+ QValueList<double> list;
+
QValueList<band>::Iterator it = m_bandlist.begin();
const QValueList<band>::Iterator itEnd = m_bandlist.end();
- for (;it!=itEnd;++it)
+
+ for ( ; it != itEnd; ++it )
{
- if ( value < ( *it ).wavelength )
- value = ( *it ).wavelength;
+ if ( ( *it ).wavelength < min || ( *it ).wavelength > max )
+ continue;
+
+ list.append( ( *it ).wavelength );
}
- return value;
+
+ return list;
}
SpectrumView::SpectrumView( Spectrum *spec, QWidget *parent, const char* name )
{
kdDebug()<<"SpectrumView::SpectrumView()" << endl;
- m_spectrum = spec;
+ //make sure only visible light will be plotted
+ m_spectrum = spec->adjustToWavelength( 380.0, 780.0 );
+ m_spectrum->adjustMinMax();
QVBoxLayout *spectrumLayout = new QVBoxLayout( this, 0, -1, "spectrumLayout" );
m_spectrumWidget = new SpectrumWidget( this, "spectrum" );
m_spectrumWidget->setSpectrum( m_spectrum );
+ kdDebug() << spec->min() << " max: " << spec->max() << endl;
m_spectrumWidget->setBorders( spec->min(), spec->max() );
spectrumLayout->addWidget( m_spectrumWidget );
* public ctor
*/
Spectrum(){
- m_min = 400;
- m_max = 700;
};
/**
*/
struct band
{
- ///in Angstrom (1/10 nm)
+ ///in nm)
double wavelength;
///Transition Probabilities
}
/**
- * @param min the lowest allowed wavalength
- * @param max the highest allowed wavalength
+ * @param min the lowest allowed wavalength in nanometer
+ * @param max the highest allowed wavalength in nanometer
*
* @returns a spectrum with the wavelength in the range
* of @p min to @p max. The intensities are readjusted
*/
void adjustIntensities();
+ /**
+ * @param min the lowest allowed wavalength in nanometer
+ * @param max the highest allowed wavalength in nanometer
+ *
+ * @return the wavelength in a QValueList<double>
+ */
+ QValueList<double> wavelengths( double min, double max );
+
/**
* @return the smallest wavelength
*/
QValueList<band>* bandlist(){
return &m_bandlist;
}
+
+ /**
+ * cache the values of the biggest and
+ * smallest wavelenght
+ */
+ void adjustMinMax(){
+ m_min = minBand();
+ kdDebug() << "adjustMinMax::m_min: " << m_min << endl;
+ m_max = maxBand();
+ kdDebug() << "adjustMinMax::m_max: " << m_max << endl;
+ }
private:
/**
* @return the biggest wavelength
*/
double maxBand();
-
- /**
- * cache the values of the biggest and
- * smallest wavelenght
- */
- void adjustMinMax(){
- m_min = minBand();
- m_max = maxBand();
- }
/**
* the internal dataset