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 "crystalline.h"
00033 #include "crystalcleavage.h"
00034 
00035 namespace gcu
00036 {
00037 
00038 class CrystalView;
00039 
00059 enum gcLattices {cubic=0,
00060                                  body_centered_cubic,
00061                                  face_centered_cubic,
00062                                  hexagonal,
00063                                  tetragonal,
00064                                  body_centered_tetragonal,
00065                                  orthorhombic,
00066                                  base_centered_orthorhombic,
00067                                  body_centered_orthorhombic,
00068                                  face_centered_orthorhombic,
00069                                  rhombohedral,
00070                                  monoclinic,
00071                                  base_centered_monoclinic,
00072                                  triclinic
00073 };
00074 
00078 class CrystalDoc
00079 {
00080 public:
00084         CrystalDoc ();
00088         virtual ~CrystalDoc ();
00089 
00100         void ParseXMLTree (xmlNode* xml);
00105         void Update ();
00109         CrystalView* GetView ();
00113         bool IsDirty () {return m_bDirty;}
00117         virtual void SetDirty ();
00121         void Draw ();
00125         gdouble GetMaxDist () {return m_dDist;}
00132         virtual CrystalView* CreateNewView ();
00139         virtual CrystalAtom* CreateNewAtom ();
00146         virtual CrystalLine* CreateNewLine ();
00152         virtual CrystalCleavage* CreateNewCleavage ();
00157         xmlDocPtr BuildXMLTree ();
00163         virtual const char* GetProgramId ();
00164         
00165 protected:
00169         void Init ();
00173         void Reinit ();
00179         virtual bool LoadNewView (xmlNodePtr node);
00180 
00181 private:
00182         void Duplicate (CrystalAtom& Atom);
00183         void Duplicate (CrystalLine& Line);
00184 
00185 protected:
00189         gcLattices m_lattice;
00193         gdouble m_a;
00197         gdouble m_b;
00201         gdouble m_c;
00205         gdouble m_alpha;
00209         gdouble m_beta;
00213         gdouble m_gamma;
00217         gdouble m_xmin;
00221         gdouble m_ymin;
00225         gdouble m_zmin;
00229         gdouble m_xmax;
00233         gdouble m_ymax;
00237         gdouble m_zmax;
00241         gdouble m_dDist; //maximum distance between an object and the center
00245         gboolean m_bFixedSize;  //true if cleavages must not change positions in the view
00249         CrystalAtomList AtomDef;
00253         CrystalAtomList Atoms;
00257         CrystalLineList LineDef;
00261         CrystalLineList Lines;
00265         CrystalCleavageList Cleavages;
00269         list <CrystalView *> m_Views;
00274         bool m_bDirty;
00278         bool m_bEmpty;
00279 };
00280         
00281 } //namespace gcu
00282 
00283 #endif //CRYSTAL_DOC_H

Generated on Mon May 7 15:00:16 2007 for The Gnome Chemistry Utils by  doxygen 1.5.2