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
00045 class Atom: public Object
00046 {
00047 public:
00051 Atom ();
00060 Atom (int Z, double x, double y, double z = 0.);
00066 Atom (Atom& a);
00072 Atom& operator= (Atom& a);
00076 virtual ~Atom ();
00077
00078 public :
00083 double Distance (Atom* pAtom);
00089 void zoom (double ZoomFactor);
00098 virtual bool GetCoords (double *x, double *y, double *z = NULL) const;
00106 void SetCoords (double x, double y, double z = 0) {m_x = x; m_y = y; m_z = z;}
00110 int GetZ () const {return m_Z;}
00117 virtual void SetZ (int Z);
00123 virtual void SetCharge (char Charge) {m_Charge = Charge;}
00127 char GetCharge () {return m_Charge;}
00131 virtual const gchar* GetSymbol () const;
00137 virtual void AddBond (Bond* pBond);
00143 virtual void RemoveBond (Bond* pBond);
00147 double x () const {return m_x;}
00151 double y () const {return m_y;}
00155 double z () const {return m_z;}
00162 Bond* GetFirstBond (std::map<Atom*, Bond*>::iterator& i);
00169 Bond* GetNextBond (std::map<Atom*, Bond*>::iterator& i);
00174 Bond* GetBond (Atom* pAtom) const;
00178 int GetBondsNumber () const {return m_Bonds.size();}
00183 virtual xmlNodePtr Save (xmlDocPtr xml) const;
00189 virtual bool Load (xmlNodePtr node);
00196 virtual bool LoadNode (xmlNodePtr node);
00204 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00212 virtual void Move (double x, double y, double z = 0.);
00220 virtual void Transform2D (Matrix2D& m, double x, double y);
00221
00229 bool SetProperty (unsigned property, char const *value);
00230
00237 std::string GetProperty (unsigned property) const;
00238
00244 bool IsInCycle (Cycle* pCycle);
00245
00256 virtual bool Match (Atom *atom, AtomMatchState &state);
00257
00258 protected:
00262 int m_Z;
00266 double m_x;
00270 double m_y;
00274 double m_z;
00278 char m_Charge;
00282 std::map<Atom*, Bond*> m_Bonds;
00283 };
00284
00290 class AtomPair {
00291 public:
00292
00299 AtomPair (Atom *at1, Atom *at2) {atom1 = at1; atom2 = at2;}
00300
00304 Atom *atom1;
00305
00309 Atom *atom2;
00310 };
00311
00317 class AtomMatchState
00318 {
00319 public:
00320
00324 std::map <Atom*, int> mol1;
00325
00329 std::map <Atom*, int> mol2;
00330
00334 std::vector <AtomPair> atoms;
00335 };
00336
00337 }
00338 #endif // GCU_ATOM_H