gcr/document.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 GCR_DOCUMENT_H
00026 #define GCR_DOCUMENT_H
00027
00028 #include <libxml/tree.h>
00029 #include <glib.h>
00030 #include "atom.h"
00031 #include "bond.h"
00032 #include "line.h"
00033 #include "cleavage.h"
00034 #include <gcu/chemistry.h>
00035 #include <gcu/macros.h>
00036 #include <gcu/gldocument.h>
00037
00038 namespace gcu {
00039 class Application;
00040 class Matrix;
00041 class SpaceGroup;
00042 }
00043
00045 namespace gcr {
00046
00047 class View;
00048
00068 enum Lattice {
00069 cubic=0,
00070 body_centered_cubic,
00071 face_centered_cubic,
00072 hexagonal,
00073 tetragonal,
00074 body_centered_tetragonal,
00075 orthorhombic,
00076 base_centered_orthorhombic,
00077 body_centered_orthorhombic,
00078 face_centered_orthorhombic,
00079 rhombohedral,
00080 monoclinic,
00081 base_centered_monoclinic,
00082 triclinic
00083 };
00084
00088 class Document: public gcu::GLDocument
00089 {
00090 public:
00094 Document (gcu::Application *App);
00098 virtual ~Document ();
00099
00110 void ParseXMLTree (xmlNode* xml);
00115 void Update ();
00119 View* GetView ();
00120
00126 void Draw (gcu::Matrix const &m) const;
00127
00134 virtual View* CreateNewView ();
00141 virtual Atom* CreateNewAtom ();
00148 virtual Line* CreateNewLine ();
00154 virtual Cleavage* CreateNewCleavage ();
00159 xmlDocPtr BuildXMLTree () const;
00165 virtual const char* GetProgramId () const;
00166
00174 bool SetProperty (unsigned property, char const *value);
00175
00182 std::string GetProperty (unsigned property) const;
00183
00188 bool Loaded () throw (gcu::LoaderError);
00192 void AddChild (Object* object);
00197 gcu::SpaceGroup const *FindSpaceGroup ();
00201 void Reinit ();
00202
00203 protected:
00207 void Init ();
00213 virtual bool LoadNewView (xmlNodePtr node);
00214
00215 private:
00216 void Duplicate (Atom& Atom);
00217 void Duplicate (Line& Line);
00218
00219 protected:
00223 Lattice m_lattice;
00227 gdouble m_a;
00231 gdouble m_b;
00235 gdouble m_c;
00239 gdouble m_alpha;
00243 gdouble m_beta;
00247 gdouble m_gamma;
00251 gdouble m_xmin;
00255 gdouble m_ymin;
00259 gdouble m_zmin;
00263 gdouble m_xmax;
00267 gdouble m_ymax;
00271 gdouble m_zmax;
00275 gboolean m_bFixedSize;
00279 AtomList AtomDef;
00283 AtomList Atoms;
00287 LineList LineDef;
00291 LineList Lines;
00295 CleavageList Cleavages;
00299 std::list <View *> m_Views;
00300
00304 GCU_RO_PROP (std::string, NameCommon)
00308 GCU_RO_PROP (std::string, NameSystematic)
00312 GCU_RO_PROP (std::string, NameMineral)
00316 GCU_RO_PROP (std::string, NameStructure)
00327 GCU_PROP (gcu::SpaceGroup const *, SpaceGroup)
00340 GCU_PROP (bool, AutoSpaceGroup)
00341 };
00342
00346 extern gchar const *LatticeName[];
00347
00348 }
00349
00350 #endif // GCR_DOCUMENT_H