The Gnome Chemistry Utils: atom.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# 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 using namespace std;
    00033
    00034 namespace gcu
    00035 {
    00036
    00037 class Bond;
    00042 class Atom: public Object
    00043 {
    00044 public:
    00048         Atom ();
    00057         Atom (int Z, double x, double y, double z = 0.);
    00063         Atom (Atom& a);
    00069         Atom& operator= (Atom& a);
    00073         virtual ~Atom ();
    00074
    00075 public :
    00080         double Distance (Atom* pAtom);
    00086         void zoom (double ZoomFactor);
    00095         virtual bool GetCoords (double *x, double *y, double *z = NULL);
    00103         void SetCoords (double x, double y, double z = 0) {m_x = x; m_y = y; m_z = z;}
    00107         int GetZ () {return m_Z;}
    00114         virtual void SetZ (int Z);
    00120         void SetCharge (char Charge) {m_Charge = Charge;}
    00124         char GetCharge () {return m_Charge;}
    00128         const gchar* GetSymbol ();
    00134         virtual void AddBond (Bond* pBond);
    00140         virtual void RemoveBond (Bond* pBond);
    00144         double x () {return m_x;}
    00148         double y () {return m_y;}
    00152         double z () {return m_z;}
    00159         Bond* GetFirstBond (map<Atom*, Bond*>::iterator& i);
    00166         Bond* GetNextBond (map<Atom*, Bond*>::iterator& i);
    00171         Bond* GetBond (Atom* pAtom);
    00175         int GetBondsNumber () {return m_Bonds.size();}
    00180         virtual xmlNodePtr Save (xmlDocPtr xml);
    00186         virtual bool Load (xmlNodePtr node);
    00193         virtual bool LoadNode (xmlNodePtr node);
    00201         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
    00209         virtual void Move (double x, double y, double z = 0.);
    00217         virtual void Transform2D (Matrix2D& m, double x, double y);
    00218
    00219 protected:
    00223         int m_Z;
    00227         double m_x;
    00231         double m_y;
    00235         double m_z;
    00239         char m_Charge;
    00243         map<Atom*, Bond*> m_Bonds;
    00244 };
    00245
    00246 } //namespace gcu
    00247 #endif // GCU_ATOM_H