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 "macros.h"
00037 #include <gcu/gldocument.h>
00038
00040 namespace gcu
00041 {
00042
00043 class CrystalView;
00044 class Matrix;
00045 class SpaceGroup;
00046
00066 enum gcLattices {cubic=0,
00067 body_centered_cubic,
00068 face_centered_cubic,
00069 hexagonal,
00070 tetragonal,
00071 body_centered_tetragonal,
00072 orthorhombic,
00073 base_centered_orthorhombic,
00074 body_centered_orthorhombic,
00075 face_centered_orthorhombic,
00076 rhombohedral,
00077 monoclinic,
00078 base_centered_monoclinic,
00079 triclinic
00080 };
00081
00085 class CrystalDoc: public GLDocument
00086 {
00087 public:
00091 CrystalDoc (Application *App);
00095 virtual ~CrystalDoc ();
00096
00107 void ParseXMLTree (xmlNode* xml);
00112 void Update ();
00116 CrystalView* GetView ();
00117
00123 void Draw (Matrix const &m) const;
00124
00131 virtual CrystalView* CreateNewView ();
00138 virtual CrystalAtom* CreateNewAtom ();
00145 virtual CrystalLine* CreateNewLine ();
00151 virtual CrystalCleavage* CreateNewCleavage ();
00156 xmlDocPtr BuildXMLTree () const;
00162 virtual const char* GetProgramId () const;
00163
00171 bool SetProperty (unsigned property, char const *value);
00172
00179 std::string GetProperty (unsigned property) const;
00180
00185 void Loaded ();
00189 void AddChild (Object* object);
00190
00191 SpaceGroup const *FindSpaceGroup ();
00192
00193 protected:
00197 void Init ();
00201 void Reinit ();
00207 virtual bool LoadNewView (xmlNodePtr node);
00208
00209 private:
00210 void Duplicate (CrystalAtom& Atom);
00211 void Duplicate (CrystalLine& Line);
00212
00213 protected:
00217 gcLattices m_lattice;
00221 gdouble m_a;
00225 gdouble m_b;
00229 gdouble m_c;
00233 gdouble m_alpha;
00237 gdouble m_beta;
00241 gdouble m_gamma;
00245 gdouble m_xmin;
00249 gdouble m_ymin;
00253 gdouble m_zmin;
00257 gdouble m_xmax;
00261 gdouble m_ymax;
00265 gdouble m_zmax;
00269 gboolean m_bFixedSize;
00273 CrystalAtomList AtomDef;
00277 CrystalAtomList Atoms;
00281 CrystalLineList LineDef;
00285 CrystalLineList Lines;
00289 CrystalCleavageList Cleavages;
00293 std::list <CrystalView *> m_Views;
00294
00298 SpaceGroup const *m_SpaceGroup;
00299
00300 GCU_RO_PROP (std::string, NameCommon);
00301 GCU_RO_PROP (std::string, NameSystematic);
00302 GCU_RO_PROP (std::string, NameMineral);
00303 GCU_RO_PROP (std::string, NameStructure);
00304 };
00305
00306 extern gchar const *LatticeName[];
00307
00308 }
00309
00310 #endif //CRYSTAL_DOC_H