The Gnome Chemistry Utils  0.12.11
gcp/molecule.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * GChemPaint library
5  * molecule.h
6  *
7  * Copyright (C) 2001-2008 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCHEMPAINT_MOLECULE_H
26 #define GCHEMPAINT_MOLECULE_H
27 
28 #include "fragment.h"
29 #include <list>
30 #include <gcu/molecule.h>
31 #include <openbabel/mol.h>
32 
34 namespace gcp {
35 
36 class Bond;
37 
41 class Molecule: public gcu::Molecule
42 {
43 public:
47  Molecule (gcu::TypeId Type = gcu::MoleculeType);
54  Molecule (Atom* pAtom);
58  virtual ~Molecule ();
64  void AddChild (gcu::Object* object);
70  void AddAtom (gcu::Atom* pAtom);
76  void AddFragment (Fragment* pFragment);
82  void AddBond (gcu::Bond* pBond);
88  void Remove (gcu::Object* pObject);
99  bool Merge (Molecule* pMolecule, bool RemoveDuplicates = false);
106  bool Load (xmlNodePtr node);
113  xmlNodePtr Save (xmlDocPtr xml) const;
117  void Clear ();
126  void Transform2D (gcu::Matrix2D& m, double x, double y);
135  Object* GetAtomAt (double x, double y, double z = 0.);
140  double GetYAlign ();
150  bool BuildContextualMenu (GtkUIManager *UIManager, gcu::Object *object, double x, double y);
159  bool OnSignal (gcu::SignalId Signal, gcu::Object *Child);
164  void ExportToGhemical ();
172  void SelectAlignmentItem (gcu::Object *child);
176  std::string GetAlignmentId () {return (m_Alignment)? m_Alignment->GetId (): "";}
184  void BuildOBMol (OpenBabel::OBMol &Mol);
191  void BuildOBMol2D (OpenBabel::OBMol &Mol);
196  void ShowInChI ();
200  void BuildInChI ();
205  void BuildSMILES ();
213  void ShowWebBase (char const *uri_start, char const *uri_end);
218  void OpenCalc ();
225  void CheckCrossings (Bond *pBond);
230  char const *GetInChI ();
235  std::string GetRawFormula () const;
239  void OnLoaded ();
244  unsigned GetAtomsNumber () const;
245 
246 private:
247  std::list<Fragment*> m_Fragments;
248  gcu::Object *m_Alignment;
249  std::string m_InChI;
250  bool m_Changed;
251  bool m_IsResidue;
252 };
253 
254 } // namespace gcp
255 
256 #endif // GCHEMPAINT_MOLECULE_H