gcr/document.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemisty Utils
00005  * gcr/document.h 
00006  *
00007  * Copyright (C) 2002-2010 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
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;  //true if cleavages must not change positions in the view
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 } // namespace gcr
00349 
00350 #endif // GCR_DOCUMENT_H

Generated on Tue Aug 3 10:29:48 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9