The Gnome Chemistry Utils 0.12.10
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemisty Utils 00005 * crystaldoc.h 00006 * 00007 * Copyright (C) 2002-2009 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 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; //true if cleavages must not change positions in the view 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 } //namespace gcu 00346 00347 #endif //CRYSTAL_DOC_H