00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef GCU_ATOM_H
00028 #define GCU_ATOM_H
00029
00030 #include <map>
00031 #include <glib.h>
00032 #include "object.h"
00033
00034 using namespace std;
00035
00036 namespace gcu
00037 {
00038
00039 class Bond;
00044 class Atom: public Object
00045 {
00046 public:
00050 Atom ();
00059 Atom (int Z, double x, double y, double z = 0.);
00065 Atom (Atom& a);
00071 Atom& operator= (Atom& a);
00075 virtual ~Atom ();
00076
00077 public :
00082 double Distance (Atom* pAtom);
00088 void zoom (double ZoomFactor);
00097 virtual bool GetCoords (double *x, double *y, double *z = NULL);
00105 void SetCoords (double x, double y, double z = 0) {m_x = x; m_y = y; m_z = z;}
00109 int GetZ () {return m_Z;}
00116 virtual void SetZ (int Z);
00122 void SetCharge (char Charge) {m_Charge = Charge;}
00126 char GetCharge () {return m_Charge;}
00130 const gchar* GetSymbol ();
00136 virtual void AddBond (Bond* pBond);
00142 virtual void RemoveBond (Bond* pBond);
00146 double x () {return m_x;}
00150 double y () {return m_y;}
00154 double z () {return m_z;}
00161 Bond* GetFirstBond (map<Atom*, Bond*>::iterator& i);
00168 Bond* GetNextBond (map<Atom*, Bond*>::iterator& i);
00173 Bond* GetBond (Atom* pAtom);
00177 int GetBondsNumber () {return m_Bonds.size();}
00182 virtual xmlNodePtr Save (xmlDocPtr xml);
00188 virtual bool Load (xmlNodePtr node);
00195 virtual bool LoadNode (xmlNodePtr node);
00203 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
00211 virtual void Move (double x, double y, double z = 0.);
00219 virtual void Transform2D (Matrix2D& m, double x, double y);
00220
00221 protected:
00225 int m_Z;
00229 double m_x;
00233 double m_y;
00237 double m_z;
00241 char m_Charge;
00245 map<Atom*, Bond*> m_Bonds;
00246 };
00247
00248 }
00249 #endif // GCU_ATOM_H