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 "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;
00245 gboolean m_bFixedSize;
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 }
00282
00283 #endif //CRYSTAL_DOC_H