00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00042 namespace gcu
00043 {
00044
00045 class CrystalView;
00046 class Matrix;
00047
00067 enum gcLattices {cubic=0,
00068 body_centered_cubic,
00069 face_centered_cubic,
00070 hexagonal,
00071 tetragonal,
00072 body_centered_tetragonal,
00073 orthorhombic,
00074 base_centered_orthorhombic,
00075 body_centered_orthorhombic,
00076 face_centered_orthorhombic,
00077 rhombohedral,
00078 monoclinic,
00079 base_centered_monoclinic,
00080 triclinic
00081 };
00082
00086 class CrystalDoc: public GLDocument
00087 {
00088 public:
00092 CrystalDoc (Application *App);
00096 virtual ~CrystalDoc ();
00097
00108 void ParseXMLTree (xmlNode* xml);
00113 void Update ();
00117 CrystalView* GetView ();
00118
00124 void Draw (Matrix &m);
00125
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 #ifdef HAVE_OPENBABEL_2_2
00166 bool ImportOB (OpenBabel::OBMol &mol);
00167 #endif
00168
00169 protected:
00173 void Init ();
00177 void Reinit ();
00183 virtual bool LoadNewView (xmlNodePtr node);
00184
00185 private:
00186 void Duplicate (CrystalAtom& Atom);
00187 void Duplicate (CrystalLine& Line);
00188
00189 protected:
00193 gcLattices m_lattice;
00197 gdouble m_a;
00201 gdouble m_b;
00205 gdouble m_c;
00209 gdouble m_alpha;
00213 gdouble m_beta;
00217 gdouble m_gamma;
00221 gdouble m_xmin;
00225 gdouble m_ymin;
00229 gdouble m_zmin;
00233 gdouble m_xmax;
00237 gdouble m_ymax;
00241 gdouble m_zmax;
00245 gboolean m_bFixedSize;
00249 CrystalAtomList AtomDef;
00253 CrystalAtomList Atoms;
00257 CrystalLineList LineDef;
00261 CrystalLineList Lines;
00265 CrystalCleavageList Cleavages;
00269 std::list <CrystalView *> m_Views;
00270
00271 #ifdef HAVE_OPENBABEL_2_2
00272
00275 OpenBabel::SpaceGroup const *m_SpaceGroup;
00276 #endif
00277 };
00278
00279 extern gchar const *LatticeName[];
00280
00281 }
00282
00283 #endif //CRYSTAL_DOC_H