crystaldoc.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemisty Utils
00005  * crystaldoc.h 
00006  *
00007  * Copyright (C) 2002-2004 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 
00038 namespace gcu
00039 {
00040 
00041 class CrystalView;
00042 
00062 enum gcLattices {cubic=0,
00063                                  body_centered_cubic,
00064                                  face_centered_cubic,
00065                                  hexagonal,
00066                                  tetragonal,
00067                                  body_centered_tetragonal,
00068                                  orthorhombic,
00069                                  base_centered_orthorhombic,
00070                                  body_centered_orthorhombic,
00071                                  face_centered_orthorhombic,
00072                                  rhombohedral,
00073                                  monoclinic,
00074                                  base_centered_monoclinic,
00075                                  triclinic
00076 };
00077 
00081 class CrystalDoc: public GLDocument
00082 {
00083 public:
00087         CrystalDoc (Application *App);
00091         virtual ~CrystalDoc ();
00092 
00103         void ParseXMLTree (xmlNode* xml);
00108         void Update ();
00112         CrystalView* GetView ();
00116         bool IsDirty () {return m_bDirty;}
00120         virtual void SetDirty ();
00124         void Draw ();
00131         virtual CrystalView* CreateNewView ();
00138         virtual CrystalAtom* CreateNewAtom ();
00145         virtual CrystalLine* CreateNewLine ();
00151         virtual CrystalCleavage* CreateNewCleavage ();
00156         xmlDocPtr BuildXMLTree ();
00162         virtual const char* GetProgramId ();
00163         
00164 protected:
00168         void Init ();
00172         void Reinit ();
00178         virtual bool LoadNewView (xmlNodePtr node);
00179 
00180 private:
00181         void Duplicate (CrystalAtom& Atom);
00182         void Duplicate (CrystalLine& Line);
00183 
00184 protected:
00188         gcLattices m_lattice;
00192         gdouble m_a;
00196         gdouble m_b;
00200         gdouble m_c;
00204         gdouble m_alpha;
00208         gdouble m_beta;
00212         gdouble m_gamma;
00216         gdouble m_xmin;
00220         gdouble m_ymin;
00224         gdouble m_zmin;
00228         gdouble m_xmax;
00232         gdouble m_ymax;
00236         gdouble m_zmax;
00240         gboolean m_bFixedSize;  //true if cleavages must not change positions in the view
00244         CrystalAtomList AtomDef;
00248         CrystalAtomList Atoms;
00252         CrystalLineList LineDef;
00256         CrystalLineList Lines;
00260         CrystalCleavageList Cleavages;
00264         list <CrystalView *> m_Views;
00269         bool m_bDirty;
00273         bool m_bEmpty;
00274 };
00275         
00276 } //namespace gcu
00277 
00278 #endif //CRYSTAL_DOC_H

Generated on Sun Nov 26 11:43:07 2006 for The Gnome Chemistry Utils by  doxygen 1.5.1