crystaldoc.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemisty Utils
00005  * crystaldoc.h 
00006  *
00007  * Copyright (C) 2002-2008 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 CRYSTAL_DOC_H
00026 #define CRYSTAL_DOC_H
00027 
00028 #include <libxml/tree.h>
00029 #include <glib.h>
00030 #include "chemistry.h"
00031 #include "crystalatom.h"
00032 #include "crystalbond.h"
00033 #include "crystalline.h"
00034 #include "crystalcleavage.h"
00035 #include "document.h"
00036 #include <gcu/gldocument.h>
00037 #ifdef HAVE_OPENBABEL_2_2
00038 #       include <openbabel/math/spacegroup.h>
00039 #       include <openbabel/mol.h>
00040 #endif
00041 
00043 namespace gcu
00044 {
00045 
00046 class CrystalView;
00047 class Matrix;
00048 
00068 enum gcLattices {cubic=0,
00069                                  body_centered_cubic,
00070                                  face_centered_cubic,
00071                                  hexagonal,
00072                                  tetragonal,
00073                                  body_centered_tetragonal,
00074                                  orthorhombic,
00075                                  base_centered_orthorhombic,
00076                                  body_centered_orthorhombic,
00077                                  face_centered_orthorhombic,
00078                                  rhombohedral,
00079                                  monoclinic,
00080                                  base_centered_monoclinic,
00081                                  triclinic
00082 };
00083 
00087 class CrystalDoc: public GLDocument
00088 {
00089 public:
00093         CrystalDoc (Application *App);
00097         virtual ~CrystalDoc ();
00098 
00109         void ParseXMLTree (xmlNode* xml);
00114         void Update ();
00118         CrystalView* GetView ();
00119 
00125         void Draw (Matrix const &m) const;
00126 
00133         virtual CrystalView* CreateNewView ();
00140         virtual CrystalAtom* CreateNewAtom ();
00147         virtual CrystalLine* CreateNewLine ();
00153         virtual CrystalCleavage* CreateNewCleavage ();
00158         xmlDocPtr BuildXMLTree () const;
00164         virtual const char* GetProgramId () const;
00165 
00166 #ifdef HAVE_OPENBABEL_2_2
00167         bool ImportOB (OpenBabel::OBMol &mol);
00168 #endif
00169         
00170 protected:
00174         void Init ();
00178         void Reinit ();
00184         virtual bool LoadNewView (xmlNodePtr node);
00185 
00186 private:
00187         void Duplicate (CrystalAtom& Atom);
00188         void Duplicate (CrystalLine& Line);
00189 
00190 protected:
00194         gcLattices m_lattice;
00198         gdouble m_a;
00202         gdouble m_b;
00206         gdouble m_c;
00210         gdouble m_alpha;
00214         gdouble m_beta;
00218         gdouble m_gamma;
00222         gdouble m_xmin;
00226         gdouble m_ymin;
00230         gdouble m_zmin;
00234         gdouble m_xmax;
00238         gdouble m_ymax;
00242         gdouble m_zmax;
00246         gboolean m_bFixedSize;  //true if cleavages must not change positions in the view
00250         CrystalAtomList AtomDef;
00254         CrystalAtomList Atoms;
00258         CrystalLineList LineDef;
00262         CrystalLineList Lines;
00266         CrystalCleavageList Cleavages;
00270         std::list <CrystalView *> m_Views;
00271 
00272 #ifdef HAVE_OPENBABEL_2_2
00273 
00276         OpenBabel::SpaceGroup const *m_SpaceGroup;
00277 #endif
00278 };
00279 
00280 extern gchar const *LatticeName[];
00281 
00282 } //namespace gcu
00283 
00284 #endif //CRYSTAL_DOC_H

Generated on Sun Sep 28 22:21:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6