gcu/atom.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * atom.h 
00006  *
00007  * Copyright (C) 2002-2004 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef GCU_ATOM_H
00026 #define GCU_ATOM_H
00027 
00028 #include <map>
00029 #include <glib.h>
00030 #include "object.h"
00031 
00032 namespace gcu
00033 {
00034         
00035 class Bond;
00040 class Atom: public Object
00041 {
00042 public:
00046         Atom ();
00055         Atom (int Z, double x, double y, double z = 0.);
00061         Atom (Atom& a);
00067         Atom& operator= (Atom& a);
00071         virtual ~Atom ();
00072 
00073 public :
00078         double Distance (Atom* pAtom);
00084         void zoom (double ZoomFactor);
00093         virtual bool GetCoords (double *x, double *y, double *z = NULL);
00101         void SetCoords (double x, double y, double z = 0) {m_x = x; m_y = y; m_z = z;}
00105         int GetZ () {return m_Z;}
00112         virtual void SetZ (int Z);
00118         void SetCharge (char Charge) {m_Charge = Charge;}
00122         char GetCharge () {return m_Charge;}
00126         const gchar* GetSymbol ();
00132         virtual void AddBond (Bond* pBond);
00138         virtual void RemoveBond (Bond* pBond);
00142         double x () {return m_x;}
00146         double y () {return m_y;}
00150         double z () {return m_z;}
00157         Bond* GetFirstBond (std::map<Atom*, Bond*>::iterator& i);
00164         Bond* GetNextBond (std::map<Atom*, Bond*>::iterator& i);
00169         Bond* GetBond (Atom* pAtom);
00173         int GetBondsNumber () {return m_Bonds.size();}
00178         virtual xmlNodePtr Save (xmlDocPtr xml);
00184         virtual bool Load (xmlNodePtr node);
00191         virtual bool LoadNode (xmlNodePtr node);
00199         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
00207         virtual void Move (double x, double y, double z = 0.);
00215         virtual void Transform2D (Matrix2D& m, double x, double y);
00216 
00217 protected:
00221         int m_Z;
00225         double m_x;
00229         double m_y;
00233         double m_z;
00237         char m_Charge;
00241         std::map<Atom*, Bond*> m_Bonds;
00242 };
00243 
00244 } //namespace gcu
00245 #endif // GCU_ATOM_H

Generated on Thu Dec 20 11:20:45 2007 for The Gnome Chemistry Utils by  doxygen 1.5.4