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 "crystalline.h"
00035 #include "crystalcleavage.h"
00036
00037 namespace gcu
00038 {
00039
00040 class CrystalView;
00041
00061 enum gcLattices {cubic=0,
00062 body_centered_cubic,
00063 face_centered_cubic,
00064 hexagonal,
00065 tetragonal,
00066 body_centered_tetragonal,
00067 orthorhombic,
00068 base_centered_orthorhombic,
00069 body_centered_orthorhombic,
00070 face_centered_orthorhombic,
00071 rhombohedral,
00072 monoclinic,
00073 base_centered_monoclinic,
00074 triclinic};
00075
00079 class CrystalDoc
00080 {
00081 public:
00085 CrystalDoc();
00089 virtual ~CrystalDoc();
00090
00101 void ParseXMLTree(xmlNode* xml);
00106 void Update();
00110 CrystalView* GetView();
00114 bool IsDirty() {return m_bDirty;}
00118 virtual void SetDirty();
00122 void Draw();
00126 gdouble GetMaxDist() {return m_dDist;}
00133 virtual CrystalView* CreateNewView();
00140 virtual CrystalAtom* CreateNewAtom();
00147 virtual CrystalLine* CreateNewLine();
00153 virtual CrystalCleavage* CreateNewCleavage();
00158 xmlDocPtr BuildXMLTree();
00164 virtual const char* GetProgramId();
00165
00166 protected:
00170 void Init();
00174 void Reinit();
00180 virtual bool LoadNewView(xmlNodePtr node);
00181
00182 private:
00183 void Duplicate(CrystalAtom& Atom);
00184 void Duplicate(CrystalLine& Line);
00185
00186 protected:
00190 gcLattices m_lattice;
00194 gdouble m_a;
00198 gdouble m_b;
00202 gdouble m_c;
00206 gdouble m_alpha;
00210 gdouble m_beta;
00214 gdouble m_gamma;
00218 gdouble m_xmin;
00222 gdouble m_ymin;
00226 gdouble m_zmin;
00230 gdouble m_xmax;
00234 gdouble m_ymax;
00238 gdouble m_zmax;
00242 gdouble m_dDist;
00246 gboolean m_bFixedSize;
00250 CrystalAtomList AtomDef;
00254 CrystalAtomList Atoms;
00258 CrystalLineList LineDef;
00262 CrystalLineList Lines;
00266 CrystalCleavageList Cleavages;
00270 list <CrystalView *> m_Views;
00275 bool m_bDirty;
00279 bool m_bEmpty;
00280 };
00281
00282 }
00283
00284 #endif //CRYSTAL_DOC_H