The Gnome Chemistry Utils 0.13.3
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * GChemPaint library 00005 * molecule.h 00006 * 00007 * Copyright (C) 2001-2011 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 "fragment.h" 00029 #include <list> 00030 #include <gcu/molecule.h> 00031 00034 namespace gcu { 00035 class UIManager; 00036 } 00037 00038 namespace gcp { 00039 00040 class Bond; 00041 00045 class Molecule: public gcu::Molecule 00046 { 00047 friend class MoleculePrivate; 00048 public: 00052 Molecule (gcu::TypeId Type = gcu::MoleculeType); 00059 Molecule (Atom* pAtom); 00063 virtual ~Molecule (); 00069 void AddChild (gcu::Object* object); 00075 void AddAtom (gcu::Atom* pAtom); 00081 void AddFragment (Fragment* pFragment); 00087 void AddBond (gcu::Bond* pBond); 00093 void Remove (gcu::Object* pObject); 00104 bool Merge (Molecule* pMolecule, bool RemoveDuplicates = false); 00111 bool Load (xmlNodePtr node); 00118 xmlNodePtr Save (xmlDocPtr xml) const; 00122 void Clear (); 00131 void Transform2D (gcu::Matrix2D& m, double x, double y); 00140 Object* GetAtomAt (double x, double y, double z = 0.); 00145 double GetYAlign (); 00155 bool BuildContextualMenu (gcu::UIManager *UIManager, gcu::Object *object, double x, double y); 00164 bool OnSignal (gcu::SignalId Signal, gcu::Object *Child); 00172 void SelectAlignmentItem (gcu::Object *child); 00176 std::string GetAlignmentId () {return (m_Alignment)? m_Alignment->GetId (): "";} 00181 void OpenCalc (); 00188 void CheckCrossings (Bond *pBond); 00193 std::string GetRawFormula () const; 00197 void OnLoaded (); 00202 unsigned GetAtomsNumber () const; 00203 00204 double GetMeanBondLength () const; 00205 void AddChiralAtom (Atom *atom) {m_ChiralAtoms.insert (atom);} 00206 bool AtomIsChiral (Atom *atom) const; 00207 00208 private: 00209 std::list< Fragment * > m_Fragments; 00210 std::set < Atom * > m_ChiralAtoms; 00211 gcu::Object *m_Alignment; 00212 bool m_IsResidue; 00213 }; 00214 00215 } // namespace gcp 00216 00217 #endif // GCHEMPAINT_MOLECULE_H