kalzium
bsdyengine.h
Go to the documentation of this file.00001 /********************************************************************** 00002 BSDYEngine - Dynamic detail engine for "balls and sticks" display 00003 00004 Copyright (C) 2007 Donald Ephraim Curtis <donald-curtis@uiowa.edu> 00005 00006 This file is part of the Avogadro molecular editor project. 00007 For more information, see <http://avogadro.sourceforge.net/> 00008 00009 Avogadro is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 Avogadro 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 Street, Fifth Floor, Boston, MA 00022 02110-1301, USA. 00023 **********************************************************************/ 00024 00025 #ifndef __BSDYENGINE_H 00026 #define __BSDYENGINE_H 00027 00028 #include <avogadro/global.h> 00029 #include <avogadro/engine.h> 00030 00031 #include <openbabel/mol.h> 00032 00033 #include <QGLWidget> 00034 #include <QObject> 00035 #include <QImage> 00036 00037 #include "ui_bsdysettingswidget.h" 00038 00039 namespace Avogadro { 00040 00042 class BSDYSettingsWidget; 00043 class BSDYEngine : public Engine 00044 { 00045 Q_OBJECT 00046 00047 public: 00049 BSDYEngine(QObject *parent=0); 00051 ~BSDYEngine(); 00052 00054 00055 00056 QString name() { return(QString(tr("Dynamic Ball and Stick"))); } 00058 QString description() { return(QString(tr("Renders primitives using Balls (atoms) and Sticks (bonds). Includes demonstration of dynamic rendering based on distance from camera"))); } 00060 00062 00063 00064 bool render(const Atom *a); 00066 bool render(const Bond *b); 00068 bool render(const Molecule *m); 00069 00070 bool render(GLWidget *gl); 00071 00072 double radius(const Primitive *p = 0); 00074 00075 void addPrimitive(Primitive *); 00076 void updatePrimitive(Primitive *); 00077 void removePrimitive(Primitive *); 00078 00080 QWidget *settingsWidget(); 00081 00082 private: 00083 double radius(const Atom *atom); 00084 00085 GLWidget *m_glwidget; 00086 bool m_update; 00087 BSDYSettingsWidget *m_settingsWidget; 00088 Ui::BSDYSettingsWidget *m_ui; 00089 00090 double m_atomRadiusPercentage; 00091 double m_bondRadius; 00092 00093 private Q_SLOTS: 00094 void settingsWidgetDestroyed(); 00095 00099 void setAtomRadiusPercentage(int percent); 00100 00104 void setBondRadius(int value); 00105 00106 }; 00107 00108 class BSDYSettingsWidget : public QWidget, public Ui::BSDYSettingsWidget 00109 { 00110 public: 00111 BSDYSettingsWidget(QWidget *parent=0) : QWidget(parent) { 00112 setupUi(this); 00113 } 00114 }; 00115 00117 class BSDYEngineFactory : public QObject, public EngineFactory 00118 { 00119 Q_OBJECT 00120 Q_INTERFACES(Avogadro::EngineFactory) 00121 00122 public: 00123 Engine *createInstance(QObject *parent = 0) { return new BSDYEngine(parent); } 00124 }; 00125 00126 } // end namespace Avogadro 00127 00128 #endif
KDE 4.0 API Reference