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 bool Loaded () throw (LoaderError);
00189 void AddChild (Object* object);
00194 SpaceGroup const *FindSpaceGroup ();
00198 void Reinit ();
00199
00200 protected:
00204 void Init ();
00210 virtual bool LoadNewView (xmlNodePtr node);
00211
00212 private:
00213 void Duplicate (CrystalAtom& Atom);
00214 void Duplicate (CrystalLine& Line);
00215
00216 protected:
00220 gcLattices m_lattice;
00224 gdouble m_a;
00228 gdouble m_b;
00232 gdouble m_c;
00236 gdouble m_alpha;
00240 gdouble m_beta;
00244 gdouble m_gamma;
00248 gdouble m_xmin;
00252 gdouble m_ymin;
00256 gdouble m_zmin;
00260 gdouble m_xmax;
00264 gdouble m_ymax;
00268 gdouble m_zmax;
00272 gboolean m_bFixedSize;
00276 CrystalAtomList AtomDef;
00280 CrystalAtomList Atoms;
00284 CrystalLineList LineDef;
00288 CrystalLineList Lines;
00292 CrystalCleavageList Cleavages;
00296 std::list <CrystalView *> m_Views;
00297
00301 GCU_RO_PROP (std::string, NameCommon)
00305 GCU_RO_PROP (std::string, NameSystematic)
00309 GCU_RO_PROP (std::string, NameMineral)
00313 GCU_RO_PROP (std::string, NameStructure)
00324 GCU_PROP (SpaceGroup const *, SpaceGroup)
00337 GCU_PROP (bool, AutoSpaceGroup)
00338 };
00339
00343 extern gchar const *LatticeName[];
00344
00345 }
00346
00347 #endif //CRYSTAL_DOC_H