The Gnome Chemistry Utils  0.14.0
chem3ddoc.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * gcu/chem3ddoc.h
6  *
7  * Copyright (C) 2006-2012 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 3 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 GCU_CHEM3D_DOCUMENT_H
26 #define GCU_CHEM3D_DOCUMENT_H
27 
28 #include <gcu/macros.h>
29 #include <gcu/gldocument.h>
30 #include <gcu/molecule.h>
31 
33 namespace gcu {
34 
45 typedef enum
46 {
47  BALL_AND_STICK,
48  SPACEFILL,
49  CYLINDERS,
50  WIREFRAME
52 
53 class Application;
54 class Matrix;
55 
61 class Chem3dDoc: public GLDocument
62 {
63 public:
67  Chem3dDoc ();
72  Chem3dDoc (Application *App, GLView *View);
76  virtual ~Chem3dDoc ();
77 
83  void Draw (Matrix const &m) const;
84 
88  bool IsEmpty () {return !m_Mol || m_Mol->GetAtomsNumber () == 0;}
89 
96  void Load (char const *uri, char const *mime_type);
97 
106  ContentType LoadData (char const *data, char const *mime_type, size_t size = 0);
107 
113  void OnExportVRML (std::string const &filename);
114 
118  void Clear ();
119 
125  virtual GLView *CreateView () = 0;
126 
135  static Display3DMode Display3DModeFromString (char const *name);
136 
142  static char const *Display3DModeAsString (Display3DMode mode);
143 
151  bool SetProperty (unsigned property, char const *value);
152 
166 
167 private:
168  /* cell parameters to support molecule loaded from a crystal structure */
169  gdouble m_a, m_b, m_c, m_alpha, m_beta, m_gamma;
170 };
171 
172 } // namespace gcu
173 
174 #endif // GCU_CHEM3D_DOCUMENT_H