]> Git trees. - libqmvoc.git/commitdiff
As I will add more type of radii I need to add a lot more code
authorCarsten Niehaus <cniehaus@gmx.de>
Fri, 3 Jun 2005 11:24:53 +0000 (11:24 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Fri, 3 Jun 2005 11:24:53 +0000 (11:24 +0000)
to element.h/cpp. This commit removed the now unused stuff and
adds the new stuff (which is currently doing nothing).
This avoids to big conflicts with pino coding

svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=421538

kalzium/src/element.cpp
kalzium/src/element.h

index 64da02c14880a357169c596f0219a715bdab06b5..bd6c0ae257d64279d2351f79d9fb02e2b7a67020 100644 (file)
@@ -146,28 +146,28 @@ const QString Element::adjustUnits( const int type )
                else
                        v = QString::number( val );
        }
-       else if ( type == RADIUS || type == IONICRADIUS ) // its a length
-       {
-               if ( type == RADIUS )
-                       val = radius();
-               else if ( type == IONICRADIUS )
-                       val = ionicValue();
-
-               if ( val <= 0 )
-                       v = i18n( "Value unknown" );
-               else
-               {
-                       switch ( Prefs::units() )
-                       {
-                               case 0://use SI-values (meter for length)
-                                       v = i18n( "%1 10<sup>-12</sup> m" ).arg( QString::number( val ) );
-                                       break;
-                               case 1://use picometer, the most common unit for radii
-                                       v = i18n( "%1 pm" ).arg( QString::number( val ) );
-                                       break;
-                       }
-               }
-       }
+//X    else if ( type == RADIUS || type == IONICRADIUS ) // its a length
+//X    {
+//X            if ( type == RADIUS )
+//X                    val = radius();
+//X            else if ( type == IONICRADIUS )
+//X                    val = ionicValue();
+//X 
+//X            if ( val <= 0 )
+//X                    v = i18n( "Value unknown" );
+//X            else
+//X            {
+//X                    switch ( Prefs::units() )
+//X                    {
+//X                            case 0://use SI-values (meter for length)
+//X                                    v = i18n( "%1 10<sup>-12</sup> m" ).arg( QString::number( val ) );
+//X                                    break;
+//X                            case 1://use picometer, the most common unit for radii
+//X                                    v = i18n( "%1 pm" ).arg( QString::number( val ) );
+//X                                    break;
+//X                    }
+//X            }
+//X    }
        else if ( type == MASS ) // its a mass
        {
                val = mass();
@@ -487,6 +487,11 @@ void Element::setupXY()
  y = posYRegular[m_number-1];
 }
 
+void Element::setRadius( RADIUSTYPE type, double value, const QString& name )
+{
+
+}
+
 KalziumDataObject::KalziumDataObject()
 {
        QDomDocument doc( "datadocument" );
@@ -541,11 +546,9 @@ EList KalziumDataObject::readData(  QDomDocument &dataDocument )
                double mp = domElement.namedItem( "meltingpoint" ).toElement().text().toDouble();
                double bp = domElement.namedItem( "boilingpoint" ).toElement().text().toDouble();
                double density = domElement.namedItem( "density" ).toElement().text().toDouble();
-               double atomic_radius = domElement.namedItem( "radius" ).namedItem( "atomic" ).toElement().text().toDouble();
-               double ionic_radius = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().text().toDouble();
-               QString ionic_charge = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().attributeNode( "charge" ).value();
-               
-               kdDebug() << "Charge: " << ionic_charge << " Value: " << ionic_radius << endl;
+//X            double covalent_radius = domElement.namedItem( "radius" ).namedItem( "covalent" ).toElement().text().toDouble();
+//X            double ionic_radius = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().text().toDouble();
+//X            QString ionic_charge = domElement.namedItem( "radius" ).namedItem( "ionic" ).toElement().attributeNode( "charge" ).value();
                
                int bio = domElement.namedItem( "biologicalmeaning" ).toElement().text().toInt();
                int az = domElement.namedItem( "aggregation" ).toElement().text().toInt();
@@ -580,7 +583,7 @@ EList KalziumDataObject::readData(  QDomDocument &dataDocument )
                e->setBiologicalMeaning(bio);
                e->setAggregation(az);
                e->setNumber( number );
-               e->setIonicValues( ionic_radius, ionic_charge );
+//             e->setIonicValues( ionic_radius, ionic_charge );
                
                e->setScientist(scientist);
                e->setCrysatalstructure( crystal );
@@ -601,7 +604,7 @@ EList KalziumDataObject::readData(  QDomDocument &dataDocument )
                e->setMeltingpoint( mp );
                e->setBoilingpoint( bp );
                e->setDensity( density );
-               e->setAtomicRadius( atomic_radius );
+//             e->setCovalentRadius( covalent_radius );
 
                e->setupXY();
 
index 168418e190465b11bf9b9dda17f7fd233269e98b..beac0bd4de4141e8d73c18993339f1ab64a5e5cc 100644 (file)
@@ -76,6 +76,15 @@ class Element{
                Element();
 
                virtual ~Element();
+               
+               enum RADIUSTYPE
+               {
+                       ATOMIC = 0,
+                       IONIC,
+                       VDW, //van der Waals forces
+                       COVALENT
+               };
+
 
                /**
                 * @return the number of the element
@@ -84,19 +93,6 @@ class Element{
                        return m_number;
                }
 
-               void setIonicValues(double v, const QString& c){
-                       m_ionic_value = v;
-                       m_ionic_charge = c;
-               }
-
-               QString ionicCharge() const{
-                       return m_ionic_charge;
-               }
-
-               double ionicValue() const{
-                       return m_ionic_value;
-               }
-
                QString nameOrigin() const{
                        return m_origin;
                }
@@ -106,7 +102,13 @@ class Element{
                void setMeltingpoint( double value ) { m_MP = value; }
                void setBoilingpoint( double value ) { m_BP = value; }
                void setDensity( double value ) { m_Density = value; }
-               void setAtomicRadius( double value ) { m_AR = value; }
+
+               /**
+                * set the radius of the radiustype @p type to the value @p value.
+                * The ionicradius also has a name @p name. This will store the charge of
+                * the ion (for example, +2 or -3 )
+                */
+               void setRadius( RADIUSTYPE type, double value, const QString& name = 0 );
 
                void setDate( int date ) { m_date = date; }
                void setBiologicalMeaning( int value ) { m_biological = value; }
@@ -281,9 +283,7 @@ class Element{
                /**
                 * @return the radius of the element in picometers
                 */
-               double radius() const {
-                       return m_AR;
-               }
+               double radius( RADIUSTYPE type );
                
                /**
                 * @return the meanmass of the element
@@ -315,7 +315,6 @@ class Element{
                {
                        NOGRADIENT = 0,
                        RADIUS,
-                       IONICRADIUS,
                        MASS,
                        DENSITY,
                        BOILINGPOINT,
@@ -325,7 +324,6 @@ class Element{
                        IE
                };
 
-
                /**
                 * calculate the 4-digit value of the value @p w
                 */
@@ -360,9 +358,7 @@ class Element{
                        m_MP, 
                        m_BP, 
                        m_EN, 
-                       m_Density, 
-                       m_AR,
-                       m_ionic_value;
+                       m_Density;
 
                int     m_number, 
                        m_date,
@@ -380,8 +376,7 @@ class Element{
                        m_orbits,
                        m_isotopes,
                        m_scientist,
-                       m_crystalstructure,
-                       m_ionic_charge;
+                       m_crystalstructure;
 
                doubleList m_ionenergies;