molecule.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * GChemPaint library
00005  * molecule.h 
00006  *
00007  * Copyright (C) 2001-2007 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 GCHEMPAINT_MOLECULE_H
00026 #define GCHEMPAINT_MOLECULE_H
00027 
00028 #include "cycle.h"
00029 #include "fragment.h"
00030 #include <list>
00031 #include <openbabel/mol.h>
00032 
00033 namespace gcp {
00034 
00035 class Molecule: public Object
00036 {
00037 public:
00038         Molecule (TypeId Type = MoleculeType);
00039         Molecule (Atom* pAtom);
00040         virtual ~Molecule ();
00041         void Add (GtkWidget* w);
00042         void AddAtom (Atom* pAtom);
00043         void AddFragment (Fragment* pFragment);
00044         void AddBond (Bond* pBond);
00045         void Remove (Object* pObject);
00046         void UpdateCycles (Bond* pBond);
00047         bool Merge (Molecule* pMolecule, bool RemoveDuplicates = false);
00048         void UpdateCycles ();
00049         virtual bool Load (xmlNodePtr);
00050         virtual xmlNodePtr Save (xmlDocPtr xml);
00051         void Clear ();
00052         virtual void SetSelected (GtkWidget* w, int state);
00053         virtual void Transform2D (Matrix2D& m, double x, double y);
00054         virtual Object* GetAtomAt (double x, double y, double z = 0.);
00055         virtual double GetYAlign ();
00056         virtual bool BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y);
00057         virtual bool OnSignal (SignalId Signal, Object *Child);
00058         void ExportToGhemical ();
00059         void SelectAlignmentItem (Object *child);
00060         string GetAlignmentId () {return (m_Alignment)? m_Alignment->GetId (): "";}
00061         void BuildOBMol (OBMol &Mol);
00062         void BuildOBMol2D (OBMol &Mol);
00063         void ShowInChI ();
00064         void BuildInChI ();
00065         void BuildSMILES ();
00066         void ShowWebBase (char const *uri_start, char const *uri_end);
00067         void OpenCalc ();
00068         void CheckCrossings (Bond *pBond);
00069         char const *GetInChI ();
00070         std::string GetRawFormula ();
00071 
00072 private:
00073         list<Cycle*> m_Cycles;
00074         list<Chain*> m_Chains;
00075         list<Atom*> m_Atoms;
00076         list<Fragment*> m_Fragments;
00077         list<Bond*> m_Bonds;
00078         Object *m_Alignment;
00079         string m_InChI;
00080         bool m_Changed;
00081         bool m_IsResidue;
00082 };
00083 
00084 }       //      namespace gcp
00085 
00086 #endif // GCHEMPAINT_MOLECULE_H

Generated on Sun Sep 16 14:21:55 2007 for The Gnome Chemistry Utils by  doxygen 1.5.3