atom.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * atom.h 
00006  *
00007  * Copyright (C) 2002-2004
00008  *
00009  * Developed by Jean Bréfort <jean.brefort@normalesup.org>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the 
00023  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00024  * Boston, MA  02111-1307, USA.
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 } //namespace gcu
00249 #endif // GCU_ATOM_H

Generated on Sun Nov 27 22:22:36 2005 for The Gnome Chemistry Utils by  doxygen 1.4.5