The Gnome Chemistry Utils: crystaldoc.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# crystaldoc.h

    00001 // -*- C++ -*-
    00002
    00003 /*
    00004  * Gnome Chemisty Utils
    00005  * crystaldoc.h
    00006  *
    00007  * Copyright (C) 2002-2006 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 "crystalline.h"
    00033 #include "crystalcleavage.h"
    00034 #include "document.h"
    00035 #include <gcu/gldocument.h>
    00036
    00037 namespace gcu
    00038 {
    00039
    00040 class CrystalView;
    00041
    00061 enum gcLattices {cubic=0,
    00062                                  body_centered_cubic,
    00063                                  face_centered_cubic,
    00064                                  hexagonal,
    00065                                  tetragonal,
    00066                                  body_centered_tetragonal,
    00067                                  orthorhombic,
    00068                                  base_centered_orthorhombic,
    00069                                  body_centered_orthorhombic,
    00070                                  face_centered_orthorhombic,
    00071                                  rhombohedral,
    00072                                  monoclinic,
    00073                                  base_centered_monoclinic,
    00074                                  triclinic
    00075 };
    00076
    00080 class CrystalDoc: public GLDocument
    00081 {
    00082 public:
    00086         CrystalDoc (Application *App);
    00090         virtual ~CrystalDoc ();
    00091
    00102         void ParseXMLTree (xmlNode* xml);
    00107         void Update ();
    00111         CrystalView* GetView ();
    00115         void Draw ();
    00122         virtual CrystalView* CreateNewView ();
    00129         virtual CrystalAtom* CreateNewAtom ();
    00136         virtual CrystalLine* CreateNewLine ();
    00142         virtual CrystalCleavage* CreateNewCleavage ();
    00147         xmlDocPtr BuildXMLTree ();
    00153         virtual const char* GetProgramId ();
    00154
    00155 protected:
    00159         void Init ();
    00163         void Reinit ();
    00169         virtual bool LoadNewView (xmlNodePtr node);
    00170
    00171 private:
    00172         void Duplicate (CrystalAtom& Atom);
    00173         void Duplicate (CrystalLine& Line);
    00174
    00175 protected:
    00179         gcLattices m_lattice;
    00183         gdouble m_a;
    00187         gdouble m_b;
    00191         gdouble m_c;
    00195         gdouble m_alpha;
    00199         gdouble m_beta;
    00203         gdouble m_gamma;
    00207         gdouble m_xmin;
    00211         gdouble m_ymin;
    00215         gdouble m_zmin;
    00219         gdouble m_xmax;
    00223         gdouble m_ymax;
    00227         gdouble m_zmax;
    00231         gboolean m_bFixedSize;  //true if cleavages must not change positions in the view
    00235         CrystalAtomList AtomDef;
    00239         CrystalAtomList Atoms;
    00243         CrystalLineList LineDef;
    00247         CrystalLineList Lines;
    00251         CrystalCleavageList Cleavages;
    00255         list <CrystalView *> m_Views;
    00256 };
    00257
    00258 extern gchar *LatticeName[];
    00259
    00260 } //namespace gcu
    00261
    00262 #endif //CRYSTAL_DOC_H