The Gnome Chemistry Utils  0.14.9
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-2012 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 3 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 <gcugtk/molecule.h>
31 
34 namespace gcu {
35 class UIManager;
36 }
37 
38 namespace gcp {
39 
40 class Bond;
41 
46 {
47 friend class MoleculePrivate;
48 public:
52  Molecule (gcu::TypeId Type = gcu::MoleculeType);
59  Molecule (Atom* pAtom);
63  virtual ~Molecule ();
69  void AddChild (gcu::Object* object);
75  void AddAtom (gcu::Atom* pAtom);
81  void AddFragment (Fragment* pFragment);
87  void AddBond (gcu::Bond* pBond);
93  void Remove (gcu::Object* pObject);
104  bool Merge (Molecule* pMolecule, bool RemoveDuplicates = false);
111  bool Load (xmlNodePtr node);
118  xmlNodePtr Save (xmlDocPtr xml) const;
122  void Clear ();
131  void Transform2D (gcu::Matrix2D& m, double x, double y);
140  Object* GetAtomAt (double x, double y, double z = 0.);
145  double GetYAlign ();
155  bool BuildContextualMenu (gcu::UIManager *UIManager, gcu::Object *object, double x, double y);
164  bool OnSignal (gcu::SignalId Signal, gcu::Object *Child);
172  void SelectAlignmentItem (gcu::Object *child);
176  std::string GetAlignmentId () {return (m_Alignment)? m_Alignment->GetId (): "";}
181  void OpenCalc ();
188  void CheckCrossings (Bond *pBond);
193  std::string GetRawFormula () const;
197  void OnLoaded ();
202  unsigned GetAtomsNumber () const;
203 
207  double GetMeanBondLength () const;
208 
214  void AddChiralAtom (Atom *atom) {m_ChiralAtoms.insert (atom);}
215 
220  bool AtomIsChiral (Atom *atom) const;
221 
222 private:
223  std::list< Fragment * > m_Fragments;
224  std::set < Atom * > m_ChiralAtoms;
225  gcu::Object *m_Alignment;
226  bool m_IsResidue;
227 };
228 
229 } // namespace gcp
230 
231 #endif // GCHEMPAINT_MOLECULE_H
GChemPaint specific C++ classes.
void AddChild(gcu::Object *object)
void AddChiralAtom(Atom *atom)
Definition: gcp/molecule.h:214
void SelectAlignmentItem(gcu::Object *child)
unsigned GetAtomsNumber() const
unsigned TypeId
Definition: object.h:95
void CheckCrossings(Bond *pBond)
bool Load(xmlNodePtr node)
GChemPaint molecule class.
Definition: gcp/molecule.h:45
std::string GetAlignmentId()
Definition: gcp/molecule.h:176
void Remove(gcu::Object *pObject)
Object * GetAtomAt(double x, double y, double z=0.)
Object(TypeId Id=OtherType)
base class for a user interface manager
Definition: ui-manager.h:33
Atoms groups.
Definition: fragment.h:109
double GetYAlign()
bool OnSignal(gcu::SignalId Signal, gcu::Object *Child)
The Gnome Chemistry Utils C++ classes.
char const * GetId() const
Definition: object.h:185
unsigned SignalId
Definition: object.h:151
void AddAtom(gcu::Atom *pAtom)
bool AtomIsChiral(Atom *atom) const
void Transform2D(gcu::Matrix2D &m, double x, double y)
xmlNodePtr Save(xmlDocPtr xml) const
bool Merge(Molecule *pMolecule, bool RemoveDuplicates=false)
std::string GetRawFormula() const
void AddFragment(Fragment *pFragment)
void AddBond(gcu::Bond *pBond)
virtual ~Molecule()
double GetMeanBondLength() const
Molecule(gcu::TypeId Type=gcu::MoleculeType)
bool BuildContextualMenu(gcu::UIManager *UIManager, gcu::Object *object, double x, double y)