From 9203d490b9e414da7920a7f6e7a55b8ca5abd673 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Sat, 22 May 2004 18:30:16 +0000 Subject: [PATCH] * lots of changes in the quiz * a lot doxygenupdates * adding the plotting svn path=/trunk/kdeedu/kalzium/src/element.cpp; revision=313555 --- kalzium/src/element.cpp | 30 ++-------- kalzium/src/element.h | 120 ++++++++++++++++++++++++++++++++-------- 2 files changed, 102 insertions(+), 48 deletions(-) diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index a693e63..59ff5cb 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -84,7 +84,7 @@ const QString Element::adjustUnits( double val, const int type ) { QString v = QString::null; - if ( type == 1 ) // convert an energy + if ( type == ENERGY ) // convert an energy { if ( val == -1 ) v = i18n( "Value unknown" ); @@ -102,7 +102,7 @@ const QString Element::adjustUnits( double val, const int type ) } } } - else if ( type == 0 ) // convert a temperature + else if ( type == TEMPERATURE ) // convert a temperature { if ( Prefs::temperature() == 0 ) { @@ -116,22 +116,22 @@ const QString Element::adjustUnits( double val, const int type ) v.append( "K" ); } } - else if ( type == 2 ) // its a lenght + else if ( type == LENGHT ) // its a lenght { v = QString::number( val ); v.append( " pm" ); } - else if ( type == 3 ) // its a weight + else if ( type == WEIGHT ) // its a weight { v = QString::number( val ); v.append( " u" ); } - else if ( type == 4 ) // its a density + else if ( type == DENSITY ) // its a density { v = QString::number( val ); v.append( " g/m3" ); } - else if ( type == 5 ) //its a date + else if ( type == DATE ) //its a date { if ( val < 1600 ) { @@ -142,24 +142,6 @@ const QString Element::adjustUnits( double val, const int type ) v = i18n( "This element was discovered in the year %1" ).arg( QString::number( val ) ); } } - else if ( type == 6 ) //its a electronegativity - { - if ( Prefs::electronegativity() == 0 ) //EN2 - { - v = QString::number( val ); - kdDebug() << "EN2" << endl; - } - if ( Prefs::electronegativity() == 1 ) //EN3 - { - v = QString::number( val ); - kdDebug() << "EN3" << endl; - } - if ( Prefs::electronegativity() == 2 ) //Pauling - { - v = QString::number( val ); - kdDebug() << "Pauling" << endl; - } - } return v; } diff --git a/kalzium/src/element.h b/kalzium/src/element.h index 39571e9..bffa82c 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -54,11 +54,17 @@ class Element{ /** * @return the number of the element */ - int number() const {return m_number;} + int number() const { + return m_number; + } + /** * @return the date of discovery of the element */ - int date() const { return m_date; } + int date() const { + return m_date; + } + /** * @return the importance of the element for biological * systems. @@ -70,37 +76,58 @@ class Element{ * @li 5: blub * @li 6: blub */ - int biological() const {return m_biological;} + int biological() const { + return m_biological; + } + /** * @return the condition of aggrgation of the element at * room temperature. 0 means solid, 1 means liquid, 2 means vapor */ - int az() const {return m_az;} + int az() const {return m_az; + } /** * @return the symbol of the element */ - QString symbol() const {return m_symbol;} + QString symbol() const { + return m_symbol; + } /** * @return the name of the element */ - QString elname() const {return m_name;} + QString elname() const { + return m_name; + } /** * @return the chemical block (s, p, d, f) of the element */ - QString block() const {return m_block;} + QString block() const { + return m_block; + } + /** * @return the group of the element */ - QString group() const {return m_group;} + QString group() const { + return m_group; + } + /** * @return the acidic behaviour of the element */ - QString acidicbeh() const {return m_acidbeh;} + QString acidicbeh() const { + return m_acidbeh; + } + /** * @return the oxydationstages of the element */ - QString oxstage() const { return m_oxstage; } + + QString oxstage() const { + return m_oxstage; + } + /** * @return the orbits of the element. The QString is already * parsed so that the numbers are superscripts and the first @@ -113,40 +140,62 @@ class Element{ /** * @return the boiling point of the element in Kelvin */ - double boiling() const {return m_BP;} + double boiling() const { + return m_BP; + } + /** * @return the melting point of the element in Kelvin */ - double melting() const {return m_MP;} + double melting() const { + return m_MP; + } + /** * @return the electronegativity of the element in the * Pauling-scale */ - double electroneg() const {return m_EN;} + double electroneg() const { + return m_EN; + } + /** * @return the atomic weight of the element in units */ - double weight() const {return m_weight;} + double weight() const { + return m_weight; + } + /** * @return the density of the element in gramm per mol */ - double density() const {return m_Density;} + double density() const { + return m_Density; + } + /** * @return the radius of the element in picometers */ - double radius() const {return m_AR;} + double radius() const { + return m_AR; + } + /** - * @return the of the element + * @return the first ionizationenergie of the element */ - - //XXX add the rest - double ie() const {return m_IE;} + double ie() const { + return m_IE; + } + /** - * @return the of the element + * @return the first ionizationenergie of the element */ - double ie2() const {return m_IE2;} + double ie2() const { + return m_IE2; + } + /** - * @return the of the element + * @return the meanweight of the element */ double meanweight(); @@ -154,10 +203,33 @@ class Element{ int s_x, s_y; //for the SimplifiedPSE /** - * @return the of the element + * adjusts the units for the data. The user can + * eg define if Fahrenheit, Kelvin or Degrees Celsius + * should be used for the temperature. This method + * takes care of that. + * @param val the value which has to be adjusted + * @parem type the TYPE of the data + * @return the adjusted datastring */ static const QString adjustUnits( double val, const int type ); + /** + * missing + */ + enum TYPE + { + TEMPERATURE = 0, + ENERGY = 1, + LENGHT = 2, + WEIGHT = 3, + DENSITY = 4, + DATE = 5 + }; + + + + + private: void setupXY(); -- 2.47.3