The Gnome Chemistry Utils  0.12.13
crystaldoc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemisty Utils
5  * crystaldoc.h
6  *
7  * Copyright (C) 2002-2009 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef CRYSTAL_DOC_H
26 #define CRYSTAL_DOC_H
27 
28 #include <libxml/tree.h>
29 #include <glib.h>
30 #include "chemistry.h"
31 #include "crystalatom.h"
32 #include "crystalbond.h"
33 #include "crystalline.h"
34 #include "crystalcleavage.h"
35 #include "document.h"
36 #include "macros.h"
37 #include <gcu/gldocument.h>
38 
40 namespace gcu
41 {
42 
43 class CrystalView;
44 class Matrix;
45 class SpaceGroup;
46 
66 enum gcLattices {cubic=0,
67  body_centered_cubic,
68  face_centered_cubic,
69  hexagonal,
70  tetragonal,
71  body_centered_tetragonal,
72  orthorhombic,
73  base_centered_orthorhombic,
74  body_centered_orthorhombic,
75  face_centered_orthorhombic,
76  rhombohedral,
77  monoclinic,
78  base_centered_monoclinic,
79  triclinic
80 };
81 
85 class CrystalDoc: public GLDocument
86 {
87 public:
91  CrystalDoc (Application *App);
95  virtual ~CrystalDoc ();
96 
107  void ParseXMLTree (xmlNode* xml);
112  void Update ();
116  CrystalView* GetView ();
117 
123  void Draw (Matrix const &m) const;
124 
131  virtual CrystalView* CreateNewView ();
138  virtual CrystalAtom* CreateNewAtom ();
145  virtual CrystalLine* CreateNewLine ();
156  xmlDocPtr BuildXMLTree () const;
162  virtual const char* GetProgramId () const;
163 
171  bool SetProperty (unsigned property, char const *value);
172 
179  std::string GetProperty (unsigned property) const;
180 
185  bool Loaded () throw (LoaderError);
189  void AddChild (Object* object);
194  SpaceGroup const *FindSpaceGroup ();
198  void Reinit ();
199 
200 protected:
204  void Init ();
210  virtual bool LoadNewView (xmlNodePtr node);
211 
212 private:
213  void Duplicate (CrystalAtom& Atom);
214  void Duplicate (CrystalLine& Line);
215 
216 protected:
224  gdouble m_a;
228  gdouble m_b;
232  gdouble m_c;
236  gdouble m_alpha;
240  gdouble m_beta;
244  gdouble m_gamma;
248  gdouble m_xmin;
252  gdouble m_ymin;
256  gdouble m_zmin;
260  gdouble m_xmax;
264  gdouble m_ymax;
268  gdouble m_zmax;
272  gboolean m_bFixedSize; //true if cleavages must not change positions in the view
296  std::list <CrystalView *> m_Views;
297 
301 GCU_RO_PROP (std::string, NameCommon)
305 GCU_RO_PROP (std::string, NameSystematic)
309 GCU_RO_PROP (std::string, NameMineral)
313 GCU_RO_PROP (std::string, NameStructure)
337 GCU_PROP (bool, AutoSpaceGroup)
338 };
339 
343 extern gchar const *LatticeName[];
344 
345 } //namespace gcu
346 
347 #endif //CRYSTAL_DOC_H