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
00026
00027 #ifndef CRYSTAL_DOC_H
00028 #define CRYSTAL_DOC_H
00029
00030 #include <libxml/tree.h>
00031 #include <glib.h>
00032 #include "chemistry/chemistry.h"
00033 #include "crystalatom.h"
00034 #include "crystalbond.h"
00035 #include "crystalline.h"
00036 #include "crystalcleavage.h"
00037
00038 namespace gcu
00039 {
00040
00041 class CrystalView;
00042
00062 enum gcLattices {cubic=0,
00063 body_centered_cubic,
00064 face_centered_cubic,
00065 hexagonal,
00066 tetragonal,
00067 body_centered_tetragonal,
00068 orthorhombic,
00069 base_centered_orthorhombic,
00070 body_centered_orthorhombic,
00071 face_centered_orthorhombic,
00072 rhombohedral,
00073 monoclinic,
00074 base_centered_monoclinic,
00075 triclinic};
00076
00080 class CrystalDoc
00081 {
00082 public:
00086 CrystalDoc();
00090 virtual ~CrystalDoc();
00091
00102 void ParseXMLTree(xmlNode* xml);
00107 void Update();
00111 CrystalView* GetView();
00115 bool IsDirty() {return m_bDirty;}
00119 virtual void SetDirty();
00123 void Draw();
00127 gdouble GetMaxDist() {return m_dDist;}
00134 virtual CrystalView* CreateNewView();
00141 virtual CrystalAtom* CreateNewAtom();
00148 virtual CrystalLine* CreateNewLine();
00154 virtual CrystalCleavage* CreateNewCleavage();
00159 xmlDocPtr BuildXMLTree();
00165 virtual const char* GetProgramId();
00166
00167 protected:
00171 void Init();
00175 void Reinit();
00181 virtual bool LoadNewView(xmlNodePtr node);
00182
00183 private:
00184 void Duplicate(CrystalAtom& Atom);
00185 void Duplicate(CrystalLine& Line);
00186
00187 protected:
00191 gcLattices m_lattice;
00195 gdouble m_a;
00199 gdouble m_b;
00203 gdouble m_c;
00207 gdouble m_alpha;
00211 gdouble m_beta;
00215 gdouble m_gamma;
00219 gdouble m_xmin;
00223 gdouble m_ymin;
00227 gdouble m_zmin;
00231 gdouble m_xmax;
00235 gdouble m_ymax;
00239 gdouble m_zmax;
00243 gdouble m_dDist;
00247 gboolean m_bFixedSize;
00251 CrystalAtomList AtomDef;
00255 CrystalAtomList Atoms;
00259 CrystalLineList LineDef;
00263 CrystalLineList Lines;
00267 CrystalCleavageList Cleavages;
00271 list <CrystalView *> m_Views;
00276 bool m_bDirty;
00280 bool m_bEmpty;
00281 };
00282
00283 }
00284
00285 #endif //CRYSTAL_DOC_H