gcu/atom.h
Go to the documentation of this file.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 #ifndef GCU_ATOM_H
00026 #define GCU_ATOM_H
00027
00028 #include "object.h"
00029 #include <glib.h>
00030 #include <map>
00031 #include <vector>
00032
00034 namespace gcu
00035 {
00036
00037 class Bond;
00038 class Cycle;
00039 class AtomMatchState;
00040 class Vector;
00041
00046 class Atom: public Object
00047 {
00048 public:
00052 Atom ();
00061 Atom (int Z, double x, double y, double z = 0.);
00067 Atom (Atom& a);
00073 Atom& operator= (Atom& a);
00077 virtual ~Atom ();
00078
00079 public :
00084 double Distance (Atom* pAtom);
00090 void zoom (double ZoomFactor);
00099 virtual bool GetCoords (double *x, double *y, double *z = NULL) const;
00107 void SetCoords (double x, double y, double z = 0) {m_x = x; m_y = y; m_z = z;}
00111 int GetZ () const {return m_Z;}
00118 virtual void SetZ (int Z);
00124 virtual void SetCharge (char Charge) {m_Charge = Charge;}
00128 char GetCharge () {return m_Charge;}
00132 virtual const gchar* GetSymbol () const;
00138 virtual void AddBond (Bond* pBond);
00144 virtual void RemoveBond (Bond* pBond);
00148 double x () const {return m_x;}
00152 double y () const {return m_y;}
00156 double z () const {return m_z;}
00160 Vector GetVector () const;
00167 Bond* GetFirstBond (std::map<Atom*, Bond*>::iterator& i);
00174 Bond* GetNextBond (std::map<Atom*, Bond*>::iterator& i);
00179 Bond* GetBond (Atom* pAtom) const;
00183 int GetBondsNumber () const {return m_Bonds.size();}
00188 virtual xmlNodePtr Save (xmlDocPtr xml) const;
00194 virtual bool Load (xmlNodePtr node);
00201 virtual bool LoadNode (xmlNodePtr node);
00209 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00217 virtual void Move (double x, double y, double z = 0.);
00225 virtual void Transform2D (Matrix2D& m, double x, double y);
00226
00234 bool SetProperty (unsigned property, char const *value);
00235
00242 std::string GetProperty (unsigned property) const;
00243
00249 bool IsInCycle (Cycle* pCycle);
00250
00261 virtual bool Match (Atom *atom, AtomMatchState &state);
00262
00266 std::string Name ();
00267
00268 protected:
00272 int m_Z;
00276 double m_x;
00280 double m_y;
00284 double m_z;
00288 char m_Charge;
00292 std::map<Atom*, Bond*> m_Bonds;
00293 };
00294
00300 class AtomPair {
00301 public:
00302
00309 AtomPair (Atom *at1, Atom *at2) {atom1 = at1; atom2 = at2;}
00310
00314 Atom *atom1;
00315
00319 Atom *atom2;
00320 };
00321
00327 class AtomMatchState
00328 {
00329 public:
00330
00334 std::map <Atom*, int> mol1;
00335
00339 std::map <Atom*, int> mol2;
00340
00344 std::vector <AtomPair> atoms;
00345 };
00346
00347 }
00348 #endif // GCU_ATOM_H