Element::Element()
{
+ m_radioactive = false;
+ m_artificial = false;
}
QString Element::parsedOrbits( bool canBeEmpty )
v = i18n( "%1 kg/m<sup>3</sup>" ).arg( QString::number( val ) );
break;
case 1://use more common units
- if ( az() == 2 )//gasoline
+ if ( boiling() < 295.0 )//gasoline
{
v = i18n( "%1 g/L" ).arg( QString::number( val ) );
}
p->drawRect( X, Y,ELEMENTSIZE+1,ELEMENTSIZE+1);
}
-QColor Element::currentColor( double temp )
+QColor Element::currentColor( const double temp )
{
QColor color;
+
//take the colours for the given temperature
- const int _az = az();
- if ( _az == 3 || _az == 4 )
- { //check if the element is radioactive or artificial
- if ( _az == 3 ) color=Prefs::color_radioactive();
- if ( _az == 4 ) color=Prefs::color_artificial();
- return color;
- }
-
const double iButton_melting = melting();
const double iButton_boiling = boiling();
+ //If either the mp or bp is not known return
+ //This is to avoid undefined behaviour
+ if ( iButton_boiling <= 0.0 || iButton_melting <= 0.0 )
+ return Qt::lightGray;
+
if ( temp < iButton_melting )
{ //the element is solid
color= Prefs::color_solid();
}
else if ( temp > iButton_melting &&
- temp < iButton_boiling )
+ temp < iButton_boiling )
{ //the element is liquid
color= Prefs::color_liquid();
}
else
color = Qt::lightGray;
-
return color;
}
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();
+ int radioactive = domElement.namedItem( "radioactive" ).toElement().text().toInt();
+ int artificial = domElement.namedItem( "artificial" ).toElement().text().toInt();
int date = domElement.namedItem( "date" ).toElement().text().toInt();
int number = domElement.namedItem( "number" ).toElement().text().toInt();
Element *e = new Element();
e->setDate(date);
e->setBiologicalMeaning(bio);
- e->setAggregation(az);
e->setNumber( number );
+ e->setName(name);
e->setRadius( Element::ATOMIC, atomic_radius );
e->setRadius( Element::IONIC, ionic_radius, ionic_charge );
e->setRadius( Element::COVALENT, covalent_radius );
e->setRadius( Element::VDW, vdw_radius );
+
+ if ( artificial == 1 )
+ e->setArtificial();
+ if ( radioactive == 1 )
+ e->setRadioactive();
e->setScientist(scientist);
e->setCrysatalstructure( crystal );
- e->setName(name);
e->setOrigin(origin);
e->setBlock(block);
e->setGroup(group);
{
ATOMIC = 0,
IONIC,
- VDW, //van der Waals forces
+ VDW, //van der Waals radius
COVALENT
};
return m_number;
}
+ bool radioactive() const{
+ return m_radioactive;
+ }
+
+ bool artificial() const{
+ return m_artificial;
+ }
+
QString nameOrigin() const{
return m_origin;
}
void setDate( int date ) { m_date = date; }
void setBiologicalMeaning( int value ) { m_biological = value; }
- void setAggregation( int value ) { m_az = value; }
void setNumber( int num ){ m_number = num; }
void setScientist( const QString& value ) { m_scientist = value; }
void setAcidicbehaviour( const QString& value ) { m_acidbeh = value; }
void setIsotopes( const QString& value ) { m_isotopes = value; }
+ void setArtificial(){ m_artificial = true; }
+ void setRadioactive(){ m_radioactive = true; }
+
void setIonisationList( doubleList l ){
m_ionenergies = l;
}
return m_date;
}
- ///return the correct color of the element
- QColor currentColor( double temp );
+ /**
+ * return the correct color of the element at the
+ * temperature @p temp
+ */
+ QColor currentColor( const double temp );
- /**
- * mutator for the element's color
- */
+ /**
+ * mutator for the element's color
+ */
void setElementColor( const QColor &c ) { m_Color = c; }
/**
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;
- }
-
/**
* @return the symbol of the element
*/
int m_number,
m_date,
- m_az,
m_biological;
QString m_symbol,
m_crystalstructure,
m_ionvalue;
+ bool m_artificial,
+ m_radioactive;
+
doubleList m_ionenergies;
public: