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-2009 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 "macros.h"
00037 #include <gcu/gldocument.h>
00038 
00040 namespace gcu
00041 {
00042 
00043 class CrystalView;
00044 class Matrix;
00045 class SpaceGroup;
00046 
00066 enum gcLattices {cubic=0,
00067                                  body_centered_cubic,
00068                                  face_centered_cubic,
00069                                  hexagonal,
00070                                  tetragonal,
00071                                  body_centered_tetragonal,
00072                                  orthorhombic,
00073                                  base_centered_orthorhombic,
00074                                  body_centered_orthorhombic,
00075                                  face_centered_orthorhombic,
00076                                  rhombohedral,
00077                                  monoclinic,
00078                                  base_centered_monoclinic,
00079                                  triclinic
00080 };
00081 
00085 class CrystalDoc: public GLDocument
00086 {
00087 public:
00091         CrystalDoc (Application *App);
00095         virtual ~CrystalDoc ();
00096 
00107         void ParseXMLTree (xmlNode* xml);
00112         void Update ();
00116         CrystalView* GetView ();
00117 
00123         void Draw (Matrix const &m) const;
00124 
00131         virtual CrystalView* CreateNewView ();
00138         virtual CrystalAtom* CreateNewAtom ();
00145         virtual CrystalLine* CreateNewLine ();
00151         virtual CrystalCleavage* CreateNewCleavage ();
00156         xmlDocPtr BuildXMLTree () const;
00162         virtual const char* GetProgramId () const;
00163 
00171         bool SetProperty (unsigned property, char const *value);
00172 
00179         std::string GetProperty (unsigned property) const;
00180 
00185         bool Loaded () throw (LoaderError);
00189         void AddChild (Object* object);
00190 
00191         SpaceGroup const *FindSpaceGroup ();
00192 
00193 protected:
00197         void Init ();
00201         void Reinit ();
00207         virtual bool LoadNewView (xmlNodePtr node);
00208 
00209 private:
00210         void Duplicate (CrystalAtom& Atom);
00211         void Duplicate (CrystalLine& Line);
00212 
00213 protected:
00217         gcLattices m_lattice;
00221         gdouble m_a;
00225         gdouble m_b;
00229         gdouble m_c;
00233         gdouble m_alpha;
00237         gdouble m_beta;
00241         gdouble m_gamma;
00245         gdouble m_xmin;
00249         gdouble m_ymin;
00253         gdouble m_zmin;
00257         gdouble m_xmax;
00261         gdouble m_ymax;
00265         gdouble m_zmax;
00269         gboolean m_bFixedSize;  //true if cleavages must not change positions in the view
00273         CrystalAtomList AtomDef;
00277         CrystalAtomList Atoms;
00281         CrystalLineList LineDef;
00285         CrystalLineList Lines;
00289         CrystalCleavageList Cleavages;
00293         std::list <CrystalView *> m_Views;
00294 
00299 GCU_RO_PROP (std::string, NameCommon);
00300 GCU_RO_PROP (std::string, NameSystematic);
00301 GCU_RO_PROP (std::string, NameMineral);
00302 GCU_RO_PROP (std::string, NameStructure);
00303 GCU_RO_PROP (SpaceGroup const *, SpaceGroup);
00304 };
00305 
00306 extern gchar const *LatticeName[];
00307 
00308 } //namespace gcu
00309 
00310 #endif //CRYSTAL_DOC_H

Generated on Thu Dec 31 11:27:58 2009 for The Gnome Chemistry Utils by  doxygen 1.6.1