moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kalzium / src / orbitswidget.h
blobe9e3bbc383774bb4508f8fe0168687a9da8bf6d9
1 #ifndef ORBITSWIDGET_H
2 #define ORBITSWIDGET_H
3 /***************************************************************************
5 orbitswidget.h - description
6 -------------------
7 begin : June 2003
8 copyright : (C) 2003, 2004 by Carsten Niehaus
9 email : cniehaus@kde.org
10 ***************************************************************************/
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
22 #include <qwidget.h>
23 #include <math.h>
25 /**
26 * @short the widget which displays the Bohr-orbit of the element
27 * @author Carsten Niehaus
29 class OrbitsWidget : public QWidget
31 Q_OBJECT
33 public:
34 OrbitsWidget( const int Elemno , QWidget *parent=0 , const char *name =0 );
35 OrbitsWidget( QWidget *parent=0 , const char *name =0 );
37 void setElementNumber( const int num );
40 private:
41 /**
42 * the elementnumber we are looking at
44 int Elemno;
46 /**
47 * the number off hulls the atom has
49 int num;
51 typedef QValueList<int> intList;
52 intList numOfElectrons;
54 QStringList hulllist;
56 const QString& getNumber() const;
58 /**
59 * @return the delta of the x-coordinate
60 * @param r is the radius of the circle
61 * @param angle is the n'st circle out of num
62 * @param num is the number of circles
64 inline double translateToDX( const double r , const double angle , const int num )
66 return( r * sin( M_PI * angle / num * 2 ) );
69 /**
70 * @return the delta of the y-coordinate
71 * @param r is the radius of the circle
72 * @param angle is the n'st circle out of num
73 * @param num is the number of circles
75 inline double translateToDY( const double r , const double angle , const int num )
77 return( r * cos( M_PI * angle / num * 2 ) );
80 /**
81 * sets everything up
83 void getNumberOfOrbits();
85 protected slots:
86 virtual void paintEvent( QPaintEvent* );
89 #endif // ORBITSWIDGET_H