crystaldoc.h
Go to the documentation of this file.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
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;
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 }
00283
00284 #endif //CRYSTAL_DOC_H